Skip to content

fix(editor): separate plate grids from their metadata and retire covered suggestions - #11

Merged
iamgp merged 2 commits into
mainfrom
fix/scan-table-suggestions
Sep 17, 2026
Merged

iamgp merged 2 commits into
mainfrom
fix/scan-table-suggestions

Conversation

@iamgp

@iamgp iamgp commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Why the change

The scan proposed one table spanning a plate map and the sample metadata columns beside it, stretched through rows of N/A filler, and a field saved over a suggested range left its suggestion card in the sidebar.

Special things to note

  • A plate grid is now proposed as a transposed table: the records are the plate columns (1..12) and the row letters (A..H) name the values. One row per well would need a different field shape.
  • Table suggestions stay open-ended, so the tighter block end only changes ranking and the preview bounds, not the saved range.
  • A card is retired only when the saved field covers the whole suggestion; mapping part of a suggested range keeps it.

Change outline

The scan builds candidates per sheet, then dedupes, suppresses overlaps and ranks them. Three new guards sit inside that pipeline, and one sits where a field is saved.

 findTableSuggestions
+  if (!hasInformativeHeaders(headers)) continue      # a header row of placeholders names nothing
   assessHeaderRow
   measureTableBlock
+    a row of placeholders counts as a spacer row     # N/A filler no longer extends the block
 findTransposedTableSuggestions
-  isRecordName(value)   # strings only, so 1..12 was rejected and the grid was lost
+  isRecordName(value)   # numbers count, so the plate reads as one matrix table
 coalesceHeaderRuns
   shouldMergeHeaderRuns
+    runsAreSeparateBlocks                           # grid columns repeat / numbered axis beside labels

The two shape rules, as pseudocode:

runsAreSeparateBlocks(leftRun, rightRun)
  if three or more columns repeat the column before them
    return true          # a grid copies whole columns, a record table does not
  if the left run is a numbered axis (1, 2, 3, ..) and the right run is labels
    return true          # 1..12 belongs to the grid, not to the table beside it
  return false

measureTableBlock(rowsBelowHeader)
  if a row is sparse, or holds only placeholders (N/A, -, none)
    treat it as a spacer row    # it pads a block without describing it

Saving a field now prunes the list, so drawing a selection and pressing Accept end in the same state:

 handleSaveField(field)
   schema.addField(field) / replaceField
+  setSuggestions(current =>
+    dropSuggestionsCoveredBy(current, [...fields, field], defaultSheet))
   if pendingSuggestionId
     drop that card
 editor/src/
 ├── App.tsx                     # retires suggestions a saved field covers
 └── lib/
     ├── suggestions.ts          # grid, placeholder and axis guards, plus dropSuggestionsCoveredBy
     └── suggestions.test.ts     # 9 new cases, including the reported plate-layout workbook

The scan merged a 96-well plate map with the sample metadata columns beside it
into one seventeen-column table, stretched tables through rows of N/A filler, and
read the A..H row labels as list fields.

- A header run split by a spacer column now stays apart when the columns repeat
  (a grid copies whole columns, a record table does not) or when a numbered axis
  such as 1..12 sits beside labelled columns.
- Rows of placeholder filler no longer extend a table block, and a header row of
  placeholders is not a table at all.
- Numeric record names count for a transposed table, so a plate grid reads as one
  matrix table whose records are the plate columns.
- A single letter heading a run of single letters is a grid axis, not a list
  field.
- `dropSuggestionsCoveredBy` retires the suggestions a field already answers.
Saving a field by drawing a selection left the suggestion card that proposed the
same region in the sidebar, so the list disagreed with the schema. Saving now
drops every suggestion the new field covers, which is what pressing Accept
already did.
@iamgp
iamgp merged commit 11de916 into main Sep 17, 2026
6 checks passed
@iamgp
iamgp deleted the fix/scan-table-suggestions branch September 17, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant