Repository navigation
OpenConceptLab/ocl_issues#2907 | suggesting field mapping for column headers - #106
Conversation
snyaggarwal
left a comment
There was a problem hiding this comment.
Issue complete: no.
The suggestion rules and localization are covered and the current checks pass, but the new re-suggestion effect introduces a configuration-screen crash after a manual column edit when the available headers subsequently change. I left the reproduction and fix direction inline.
Verification: npm test (515 passed) and npm run eslint -- --quiet passed.
…array after edits updateColumn copied the columns array into a plain object, so the target re-suggestion effect threw 'prev.some is not a function' after a manual edit when the target's mapped fields loaded. Move the column updates into pure helpers that keep the array shape, and add regression tests for the edit-then-target-update sequence. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
snyaggarwal
left a comment
There was a problem hiding this comment.
Issue complete: no.
The previous prev.some crash is fixed and now has good regression coverage. One remaining blocking data-correctness issue surfaced in the whole-PR pass: suggestions can duplicate a field that an exact header already maps, causing the exact input value to be overwritten when rows are prepared. I left the reproduction inline.
Verification: npm test (519 passed), npm run eslint -- --quiet passed, and CI/Snyk are green.
… no two columns map to one field Exact header matches and labels the user already chose now hold their field before any suggestion is made, so a pattern column like 'Test Name' can no longer take Name from an exact 'Name' column, wherever it sits in the file. Upload uses the same resuggestColumns path as target changes, so the logic lives in one place. Adds regression tests for the mixed exact-plus-pattern case, the reversed order, and a manual choice that collides with a suggestion. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
snyaggarwal
left a comment
There was a problem hiding this comment.
Verdict: approved / no findings.
Issue complete: yes. The previous runtime-shape regression and exact-mapping collision are both fixed. Exact and manually selected fields are now reserved before suggestions are assigned, regardless of column order, and upload/re-suggestion share the same covered path.
Security blockers: none.
Verification: npm test (525 passed), npm run eslint -- --quiet passed, and CI/Snyk are green.
GitHub does not permit formally approving one's own PR, so this is posted as a COMMENT review.
Codex review, pass 1 (codex-cli 0.163.0, commit 14e174c)Verdict: findings. One P1 confirmed as a regression; one P1 reads as P2; one P1 disagreed with; one P2 confirmed. Fixes are one-click suggestions in the review that follows.
findings.json{
"reviewer": "codex-cli 0.163.0",
"perspective": "defects",
"mode": "full",
"commit": "14e174c7ce973d6dfb6dec2102f43e0a1709e11a",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 1323,
"claim": "Batched automatic source selections overwrite one another.",
"scenario": "Assign a column containing LOINC and SNOMED mappings to Mapping: List while both sources are available. Both source selectors run their mount effects against the same captured columns. The new immutable replacement retains only the last targetSource selection, dropping the other from matching configuration. The base commit preserves both.",
"action": "Use functional state updates and merge each source selection into the latest targetSource state inside the updater. Add coverage for multiple selectors mounting together.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.2",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 1323,
"claim": "A manual mapping can remain overridden by an automatic suggestion.",
"scenario": "Upload Notes,Test Name, then select Name for Notes. Test Name remains automatically mapped to Name because editing a column does not rerun suggestion reconciliation. prepareRow processes the later Test Name column last and silently overwrites the manually selected Notes value in the matching payload.",
"action": "Reconcile remaining automatic suggestions whenever a manual mapping changes, giving manual selections precedence. Test the actual edit path without requiring a subsequent target reload.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.3",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/columnSuggestions.js",
"line": 51,
"claim": "A literal Description header never receives the required Name suggestion.",
"scenario": "Upload Code,Description with concept names in Description. Since Description is already a valid field, the exact-match guard skips the description-to-Name rule. The column remains Description without a suggestion indicator, and prepareRow emits description rather than name, contrary to acceptance criterion 1.",
"action": "Apply the required description-to-Name suggestion for new uploads before the exact-match exemption, while preserving saved user mappings. Test Description independently of other Name candidates.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.4",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/columnSuggestions.js",
"line": 89,
"claim": "Manually edited columns consume suggestions that are then discarded.",
"scenario": "Upload Specimen,Sample before target properties load, clear Specimen deliberately, then load a target supporting SYSTEM. suggestColumnLabels still processes Specimen's original header and reserves SYSTEM for it. That result is discarded because Specimen is no longer automatic, while Sample receives no suggestion despite the field being available.",
"action": "Generate suggestions only for automatic columns, preserving their indexes, and reserve only the current mapped labels of manually edited columns.",
"lines_delta": null,
"confidence": "high"
}
]
} |
There was a problem hiding this comment.
Reviewed at 14e174c against OpenConceptLab/ocl_issues#2907. The rules, the neutral icon and the four locales look right. On the sample sheet (Code,Name,Specimen, LOINC target), Code gets the neutral icon, Name matches exactly and Specimen is suggested as Property: SYSTEM, so the red ✗ is gone.
Before merge
- P1, "Learn more" returns 404.
.../en/latest/oclmap/has no index page, so AC 4 isn't met. Suggestion onconstants.js. - P1, regression: a multi-source
Mapping: Listkeeps only one target source. Codex F1.1, confirmed. Suggestion onupdateColumn, which also fixes F1.2 (a manual choice should take its field back from a suggestion).
Smaller fixes
3. P2, Name goes to the first matching column, not the best one. "Test Date" or "Test Description" before "Test Name" takes Name.
4. P2, a cleared column still holds the field it would have been suggested. Codex F1.4.
5. P3, "External Name" is treated as a code column. Also P3: the "Suggested from column name" note comes back when a saved project is reopened.
With all the suggestions applied, CI's lint (eslint src --ext .jsx,.js) and npm run test:all pass: 528 unit and 6 integration tests. The two new tests for items 3 and 4 fail at 14e174c. Item 2 has no unit test, because the bug is in React state batching.
Timing: no need to hold this for the Oct 19 cut. Once these fixes are in, it's approved to go ahead.
Co-authored-by: Jonathan Payne <paynejd@gmail.com>
Linked Issue
Closes OpenConceptLab/ocl_issues#2907