From 92cb1ff1978978ca08b2b56f0f4982ec7f8566a8 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Thu, 3 Dec 2026 01:10:38 -0500 Subject: [PATCH 01/12] OpenConceptLab/ocl_online#841 | A new project starts with OCL Semantic when the release supports it, and clinical headers are suggested as Name - Choosing a release with semantic search selects OCL Semantic in a new project, until someone adds or removes an algorithm. Saved and copied projects keep their own. - The change applies to the algorithms as they are when the releases have loaded, so a pick made while they load is no longer lost. - A header that ends in Diagnosis, Condition, Procedure, Drug or Medication is suggested as Name. - The form says when no column is mapped to Name. Saving still works. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/ConfigurationForm.jsx | 7 +++ src/components/map-projects/MapProject.jsx | 37 ++++++++----- .../map-projects/MultiAlgoSelector.jsx | 11 +--- .../__tests__/columnSuggestions.test.js | 29 +++++++++- .../__tests__/selectedAlgos.test.js | 54 ++++++++++++++++++- .../map-projects/columnSuggestions.js | 17 +++++- src/components/map-projects/selectedAlgos.js | 29 ++++++++++ src/i18n/locales/en/translations.json | 1 + src/i18n/locales/es/translations.json | 1 + src/i18n/locales/pt-BR/translations.json | 1 + src/i18n/locales/zh/translations.json | 1 + 11 files changed, 162 insertions(+), 26 deletions(-) diff --git a/src/components/map-projects/ConfigurationForm.jsx b/src/components/map-projects/ConfigurationForm.jsx index 7c0fd0e7..c7b4d56e 100644 --- a/src/components/map-projects/ConfigurationForm.jsx +++ b/src/components/map-projects/ConfigurationForm.jsx @@ -38,6 +38,7 @@ import RepoSearchAutocomplete from '../repos/RepoSearchAutocomplete' import RepoVersionSearchAutocomplete from '../repos/RepoVersionSearchAutocomplete' import CloseIconButton from '../common/CloseIconButton'; import ColumnMapTable from './ColumnMapTable' +import { hasNameColumn } from './columnSuggestions' import ScoreConfiguration from './ScoreConfiguration' import { SCORES_COLOR } from './constants' import FilterTable from './FilterTable' @@ -553,6 +554,12 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n disabled={locked} /> + { + !hasNameColumn(columns) && + + {t('map_project.no_name_column')} + + } } { diff --git a/src/components/map-projects/MapProject.jsx b/src/components/map-projects/MapProject.jsx index 5db29a09..cb8aedb0 100644 --- a/src/components/map-projects/MapProject.jsx +++ b/src/components/map-projects/MapProject.jsx @@ -49,7 +49,6 @@ import chunk from 'lodash/chunk' import get from 'lodash/get' import omit from 'lodash/omit' import omitBy from 'lodash/omitBy' -import reject from 'lodash/reject' import uniq from 'lodash/uniq' import compact from 'lodash/compact' import keyBy from 'lodash/keyBy' @@ -95,6 +94,7 @@ import { aiOnByDefault, getMaxRunRows, getMapperSettings } from '@openconceptlab import { createAutosaveScheduler, createLatestSender, isToldOnLeave, recordReadOnlyRefusal, saveOnLeave, sendAfter, trackSave, whenSaved, installUnloadGuard, SAVE_SKIPPED } from './autosave' import { blockLeaving, continueLeaving, createEditTracker, createRunClosers, getRunLeaveMessageKey, isUnsavedNewProject, shouldAskBeforeLeaving, shouldWarnBeforeUnload } from './leaveGuard' import { editProposed, getColumnsSnapshot } from './unsavedEdits' +import { getAlgosForRelease, toSelectedAlgo } from './selectedAlgos' import MatchSummaryCard from './MatchSummaryCard' import MappingDecisionResult from './MappingDecisionResult' import DecisionSelector from './DecisionSelector' @@ -233,6 +233,9 @@ const MapProject = () => { const [appliedFacets, setAppliedFacets] = React.useState({}); const [searchResponse, setSearchResponse] = React.useState({}); const [algosSelected, setAlgosSelected] = React.useState([]) + // Once the algorithms are someone's choice, OCL Semantic is no longer selected by + // default (OpenConceptLab/ocl_online#841). A saved or copied project's already are. + const algosChosenRef = React.useRef(Boolean(params.projectId || templateFromProjectURL)) const [notes, setNotes] = React.useState({}) const [mapTypes, setMapTypes] = React.useState({}) const [proposed, setProposed] = React.useState({}) @@ -2325,7 +2328,7 @@ const MapProject = () => { }) } - const onRepoVersionChange = version => { + const onRepoVersionChange = (version, isRestored=false) => { setRepoVersion(version || false) setShowTargetRepoVersionError(false) // A slower read of an earlier version doesn't overwrite this one's list. @@ -2334,21 +2337,26 @@ const MapProject = () => { if(version?.version_url) { setLocales(getDeclaredLocales(version)) stopTargetMappedSourcesRef.current = readMappedSources(version.version_url, setMappedSources) - updateAlgosByRepoVersion(version) + updateAlgosByRepoVersion(version, isRestored) } else { setMappedSources([]) setLocales([]) } } - const updateAlgosByRepoVersion = version => { - const isLLMAlgoAllowed = version?.match_algorithms?.includes('llm') - const index = algos.findIndex(algo => algo.type === 'ocl-semantic') - if(index > -1) { - if(find(algosSelected, {type: 'ocl-semantic'}) && !isLLMAlgoAllowed) { - setAlgosSelected(reject(algosSelected, {type: 'ocl-semantic'})) - } - } + // The versions can load after the algorithms change, so this works on the + // list as it is then. + const updateAlgosByRepoVersion = (version, isRestored) => { + const defaultAlgo = algosChosenRef.current || projectIdRef.current ? null : + toSelectedAlgo(find(algos, {type: 'ocl-semantic'}), requestLimits) + setAlgosSelected(prev => getAlgosForRelease(prev, version, {defaultAlgo, isRestored})) + } + + // The form's changes: only adding or removing an algorithm changes how many there are. + const onAlgosSelectedChange = next => { + if(Array.isArray(next) && next.length !== algosSelected.length) + algosChosenRef.current = true + setAlgosSelected(next) } const getFilters = () => { @@ -3225,7 +3233,10 @@ const MapProject = () => { setVersions(fetchedVersions || []) setVersionsStatus(fetchedVersions ? null : 'failed') noteTargetReadThrottle(response) - onRepoVersionChange(savedVersion === undefined ? getDefaultTargetRepoVersion(fetchedVersions) : getSavedTargetRepoVersion(fetchedVersions, savedVersion)) + if(savedVersion === undefined) + onRepoVersionChange(getDefaultTargetRepoVersion(fetchedVersions)) + else + onRepoVersionChange(getSavedTargetRepoVersion(fetchedVersions, savedVersion), true) }) } @@ -6506,7 +6517,7 @@ const MapProject = () => { versions={versions} algos={algos} algosSelected={algosSelected} - setAlgosSelected={setAlgosSelected} + setAlgosSelected={onAlgosSelectedChange} validColumns={headers} columns={columns} isValidColumnValue={isValidColumnValue} diff --git a/src/components/map-projects/MultiAlgoSelector.jsx b/src/components/map-projects/MultiAlgoSelector.jsx index 4ccd009f..80fa940f 100644 --- a/src/components/map-projects/MultiAlgoSelector.jsx +++ b/src/components/map-projects/MultiAlgoSelector.jsx @@ -41,7 +41,7 @@ import { needsSessionToken, getTokenFlag, tokenInputValue, removeSavedToken } fr import { getRequestLimits, getRequestSettings } from './requestLimits' import { dropVersion } from '../../common/utils' import { LockedFields, useEditLock } from '../common/NoticeLock' -import { patchSelected, customCheckReply } from './selectedAlgos' +import { patchSelected, customCheckReply, toSelectedAlgo } from './selectedAlgos' import { applyBridgeCanonical, getDefaultBridgeRepoVersion, @@ -357,14 +357,7 @@ export default function MultiAlgoSelector({ id = `${id}-1` name = `${name}-1` } - const defaults = { - ...omit(algo, ['getIcon', 'disabled', 'description', 'url']), - id: id, - name: name, - batch_size: getRequestSettings(algo, requestLimits).batchSize, - concurrent_requests: getRequestSettings(algo, requestLimits).concurrentRequests, - __key: Math.random(100).toString() - }; + const defaults = {...toSelectedAlgo(algo, requestLimits), id, name}; commitValue([...(latestValueRef.current || []), defaults]); setExpanded((prev) => { diff --git a/src/components/map-projects/__tests__/columnSuggestions.test.js b/src/components/map-projects/__tests__/columnSuggestions.test.js index 6b23610c..9761b70f 100644 --- a/src/components/map-projects/__tests__/columnSuggestions.test.js +++ b/src/components/map-projects/__tests__/columnSuggestions.test.js @@ -7,7 +7,7 @@ import test from 'node:test' import assert from 'node:assert/strict' -import { suggestColumnLabels, isCodeLikeHeader, updateColumnState, resuggestColumns, applyTemplateColumns } from '../columnSuggestions.js' +import { suggestColumnLabels, isCodeLikeHeader, updateColumnState, resuggestColumns, applyTemplateColumns, hasNameColumn } from '../columnSuggestions.js' const BASE = [ {label: 'ID'}, @@ -35,6 +35,22 @@ test('suggestColumnLabels: Name goes to the strongest header, not the first', () ) }) +test('suggestColumnLabels: clinical headers suggest Name (OpenConceptLab/ocl_online#841)', () => { + const headers = ['Diagnosis', 'Diagnoses', 'Procedure', 'Drug', 'Medication', 'Condition', 'Primary diagnosis', 'generic_drug'] + headers.forEach(header => assert.deepEqual(suggestColumnLabels([header], BASE), ['Name'], header)) + assert.deepEqual(suggestColumnLabels(['Local Code', 'Diagnosis', 'Group'], BASE), [null, 'Name', null]) +}) + +test('suggestColumnLabels: a clinical word that only describes another one suggests nothing', () => { + const headers = ['Diagnosis Date', 'Drug Dose', 'Procedure Code', 'Medication Route', 'Drug class', 'Conditional'] + headers.forEach(header => assert.deepEqual(suggestColumnLabels([header], BASE), [null], header)) +}) + +test('suggestColumnLabels: a name column wins over a clinical one, which wins over a description', () => { + assert.deepEqual(suggestColumnLabels(['Drug', 'Drug Name'], BASE), [null, 'Name']) + assert.deepEqual(suggestColumnLabels(['Diagnosis Description', 'Diagnosis'], BASE), [null, 'Name']) +}) + test('suggestColumnLabels: exact matches are left alone', () => { assert.deepEqual(suggestColumnLabels(['Name', 'Description'], BASE), [null, null]) }) @@ -182,3 +198,14 @@ test('applyTemplateColumns leaves unmatched columns as suggestions and ignores a assert.equal(applyTemplateColumns(uploaded, []), uploaded) assert.deepEqual(applyTemplateColumns(uploaded, [{label: 'Name', original: 'Component'}]), uploaded) }) + +test('hasNameColumn: only a column whose mapped field is Name counts', () => { + const names = headers => hasNameColumn(upload(headers)) + assert.equal(names(['Local Code', 'Diagnosis']), true) + assert.equal(names(['Name']), true) + assert.equal(names(['name']), true) + assert.equal(names(['Local Code', 'Synonyms']), false) + assert.equal(hasNameColumn(updateColumnState(upload(['Diagnosis']), 0, null)), false) + assert.equal(hasNameColumn([]), false) + assert.equal(hasNameColumn([{label: undefined}]), false) +}) diff --git a/src/components/map-projects/__tests__/selectedAlgos.test.js b/src/components/map-projects/__tests__/selectedAlgos.test.js index 1b277b2e..7212fdfb 100644 --- a/src/components/map-projects/__tests__/selectedAlgos.test.js +++ b/src/components/map-projects/__tests__/selectedAlgos.test.js @@ -8,7 +8,7 @@ import test from 'node:test' import assert from 'node:assert/strict' -import { patchSelected, isStaleReply, customCheckReply } from '../selectedAlgos.js' +import { patchSelected, isStaleReply, customCheckReply, toSelectedAlgo, getAlgosForRelease } from '../selectedAlgos.js' const custom = { __key: 'a', type: 'custom', url: 'https://algo.example/a', id: '', name: '' } const search = { __key: 'b', type: 'ocl-search', id: 'ocl-search', name: 'Search' } @@ -72,3 +72,55 @@ test('customCheckReply: the URL or token changed while pending only stops loadin assert.equal(customCheckReply({ list: [{ ...custom, url: 'https://algo.example/b' }], key: 'a', sent, checkId: 1, latestCheckId: 1 }), 'clear') assert.equal(customCheckReply({ list: [{ ...custom, token: 'new' }], key: 'a', sent, checkId: 1, latestCheckId: 1 }), 'clear') }) + +// OCL Semantic by default in a new project (OpenConceptLab/ocl_online#841) + +const SEMANTIC_RELEASE = {version_url: '/orgs/Org/sources/Source/2/', match_algorithms: ['es', 'llm']} +const KEYWORD_RELEASE = {version_url: '/orgs/Org/sources/Source/1/', match_algorithms: ['es']} +const semantic = { __key: 'c', type: 'ocl-semantic', id: 'ocl-semantic', name: 'OCL Semantic' } + +test('getAlgosForRelease: a release with semantic search starts with the default algorithm', () => { + assert.deepEqual(getAlgosForRelease([], SEMANTIC_RELEASE, {defaultAlgo: semantic}), [semantic]) +}) + +test('getAlgosForRelease: a release without semantic search selects nothing', () => { + const none = [] + assert.equal(getAlgosForRelease(none, KEYWORD_RELEASE, {defaultAlgo: semantic}), none) +}) + +test('getAlgosForRelease: without a default (chosen, removed, saved or copied), nothing is added', () => { + const none = [] + assert.equal(getAlgosForRelease(none, SEMANTIC_RELEASE), none) + const chosen = [search] + assert.equal(getAlgosForRelease(chosen, SEMANTIC_RELEASE), chosen) +}) + +test('getAlgosForRelease: a list that already has an algorithm is kept, whatever the default', () => { + const chosen = [search] + assert.equal(getAlgosForRelease(chosen, SEMANTIC_RELEASE, {defaultAlgo: semantic}), chosen) + const selected = [semantic] + assert.equal(getAlgosForRelease(selected, SEMANTIC_RELEASE, {defaultAlgo: {...semantic, __key: 'd'}}), selected) +}) + +test('getAlgosForRelease: choosing a release without semantic search takes OCL Semantic out and keeps the rest', () => { + assert.deepEqual(getAlgosForRelease([semantic, custom], KEYWORD_RELEASE), [custom]) +}) + +test('getAlgosForRelease: a project loading its own release keeps OCL Semantic, so the form can warn', () => { + const saved = [semantic] + assert.equal(getAlgosForRelease(saved, KEYWORD_RELEASE, {isRestored: true}), saved) +}) + +test('toSelectedAlgo: keeps what a project saves, with the settings within the limits', () => { + const algo = { + id: 'ocl-semantic', type: 'ocl-semantic', name: 'OCL Semantic', provider: 'ocl', batch_size: 50, concurrent_requests: 4, + query_params: {semantic: true}, getIcon: () => null, disabled: true, description: 'Example', url: '/example/', + } + const selected = toSelectedAlgo(algo, {batchSize: 10, concurrentRequests: 2, capped: true}) + assert.ok(selected.__key) + assert.deepEqual({...selected, __key: 'k'}, { + __key: 'k', id: 'ocl-semantic', type: 'ocl-semantic', name: 'OCL Semantic', provider: 'ocl', batch_size: 10, concurrent_requests: 2, + query_params: {semantic: true}, + }) + assert.notEqual(toSelectedAlgo(algo).__key, selected.__key) +}) diff --git a/src/components/map-projects/columnSuggestions.js b/src/components/map-projects/columnSuggestions.js index 415020f6..f5abce2a 100644 --- a/src/components/map-projects/columnSuggestions.js +++ b/src/components/map-projects/columnSuggestions.js @@ -16,14 +16,24 @@ const CODE_TOKENS = ['code', 'codes', 'id', 'ids', 'uuid', 'identifier'] +// These say what the row is only as the header's last word: "Primary +// diagnosis" holds names, "Diagnosis Date" doesn't +// (OpenConceptLab/ocl_online#841). +const CLINICAL_TOKENS = [ + 'diagnosis', 'diagnoses', 'condition', 'conditions', 'procedure', 'procedures', + 'drug', 'drugs', 'medication', 'medications' +] + const SUGGESTION_RULES = [ - {label: 'Name', tokens: ['name', 'term', 'test', 'description']}, + {label: 'Name', tokens: ['name', 'term', 'test', ...CLINICAL_TOKENS, 'description']}, {label: 'Synonyms', tokens: ['synonym', 'synonyms']}, {label: 'Property: SYSTEM', tokens: ['specimen', 'system', 'sample']}, ] const tokenize = header => String(header || '').toLowerCase().split(/[\s_-]+/).filter(Boolean) +const dropDescribingWords = tokens => tokens.filter((token, idx) => idx === tokens.length - 1 || !CLINICAL_TOKENS.includes(token)) + export const isCodeLikeHeader = header => tokenize(header).some(token => CODE_TOKENS.includes(token)) /** @@ -51,7 +61,7 @@ export const suggestColumnLabels = (headers, validColumns, reserved = []) => { if(isExact(header) || alreadyRecognised || isCodeLikeHeader(header)) return null - const tokens = tokenize(header) + const tokens = dropDescribingWords(tokenize(header)) const rule = SUGGESTION_RULES.find(rule => tokens.some(token => rule.tokens.includes(token))) return rule ? {idx, rule, rank: rule.tokens.findIndex(token => tokens.includes(token))} : null }) @@ -69,6 +79,9 @@ export const suggestColumnLabels = (headers, validColumns, reserved = []) => { return suggestions } +// AutoMatch compares names, so the form says when no column holds them. +export const hasNameColumn = columns => columns.some(column => column.label?.toLowerCase() === 'name') + /** * Returns a new columns array with one column's mapping changed. A change * without a key is a mapping choice: it ends any suggestion, and clearing it diff --git a/src/components/map-projects/selectedAlgos.js b/src/components/map-projects/selectedAlgos.js index 8b335848..67f116c9 100644 --- a/src/components/map-projects/selectedAlgos.js +++ b/src/components/map-projects/selectedAlgos.js @@ -1,3 +1,7 @@ +import omit from 'lodash/omit.js' +import { getRequestSettings } from './requestLimits.js' +import { isLLMBridgeRepoVersion } from './projectTargetRepo.js' + // Edits to the selected algorithm list (ocl_online#786). // // A reply that arrives after a request (a custom algorithm check, a bridge @@ -25,3 +29,28 @@ export const customCheckReply = ({ list, key, sent, checkId, latestCheckId }) => return 'ignore' return isStaleReply(list, key, sent) ? 'clear' : 'apply' } + +// An algorithm as a project keeps it once selected, with the request settings +// it starts with. +export const toSelectedAlgo = (algo, requestLimits) => { + const { batchSize, concurrentRequests } = getRequestSettings(algo, requestLimits) + return { + ...omit(algo, ['getIcon', 'disabled', 'description', 'url']), + batch_size: batchSize, + concurrent_requests: concurrentRequests, + __key: Math.random().toString() + } +} + +// The selected algorithms once the target release is `version`. `defaultAlgo` +// (OCL Semantic) is passed only while a new project's algorithms are still +// nobody's choice. A release chosen without semantic search takes OCL Semantic +// out; a project loading its own release (isRestored) keeps what it saved, and +// the form warns (OpenConceptLab/ocl_online#841). +export const getAlgosForRelease = (list, version, { defaultAlgo, isRestored } = {}) => { + if(isLLMBridgeRepoVersion(version)) + return defaultAlgo && !list.length ? [defaultAlgo] : list + if(isRestored || !list.some(algo => algo.type === 'ocl-semantic')) + return list + return list.filter(algo => algo.type !== 'ocl-semantic') +} diff --git a/src/i18n/locales/en/translations.json b/src/i18n/locales/en/translations.json index d2d86ef1..1a12e579 100644 --- a/src/i18n/locales/en/translations.json +++ b/src/i18n/locales/en/translations.json @@ -277,6 +277,7 @@ "field_configuration": "Field Configuration", "field_configuration_description": "Associate fields in the input data to fields that the matching algorithms are able to understand. Assign input fields that contain concept codes or mappings to specific repositories. <0>Learn more", "column_suggested": "Suggested from column name. Change it if it's wrong.", + "no_name_column": "No column is mapped to Name. AutoMatch compares names, so choose Name for the column that has them.", "input_column": "Input Column", "mapped_field": "Mapped Field", "field": "Field", diff --git a/src/i18n/locales/es/translations.json b/src/i18n/locales/es/translations.json index 74768eec..0487d559 100644 --- a/src/i18n/locales/es/translations.json +++ b/src/i18n/locales/es/translations.json @@ -258,6 +258,7 @@ "field_configuration": "Configuración de Campo", "field_configuration_description": "Asocie campos en los datos de entrada con campos que los algoritmos de coincidencia puedan entender. Asigne campos de entrada que contengan códigos de concepto o mapeos a repositorios específicos. <0>Aprenda más", "column_suggested": "Sugerido a partir del nombre de la columna. Cámbielo si es incorrecto.", + "no_name_column": "Ninguna columna está asociada a Name. AutoMatch compara nombres, así que elija Name para la columna que los contiene.", "input_column": "Columna de Entrada", "mapped_field": "Campo Mapeado", "field": "Campo", diff --git a/src/i18n/locales/pt-BR/translations.json b/src/i18n/locales/pt-BR/translations.json index 72362fee..96b64850 100644 --- a/src/i18n/locales/pt-BR/translations.json +++ b/src/i18n/locales/pt-BR/translations.json @@ -277,6 +277,7 @@ "field_configuration": "Configuração de Campo", "field_configuration_description": "Associe campos nos dados de entrada a campos que os algoritmos de mapeamento são capazes de entender. Atribua campos de entrada que contenham códigos de conceito ou mapeamentos a repositórios específicos. <0>Saiba mais", "column_suggested": "Sugerido pelo nome da coluna. Altere se estiver errado.", + "no_name_column": "Nenhuma coluna está associada a Name. O AutoMatch compara nomes, então escolha Name para a coluna que os contém.", "input_column": "Coluna de Entrada", "mapped_field": "Campo Mapeado", "field": "Campo", diff --git a/src/i18n/locales/zh/translations.json b/src/i18n/locales/zh/translations.json index 1ca75730..c34760c9 100644 --- a/src/i18n/locales/zh/translations.json +++ b/src/i18n/locales/zh/translations.json @@ -270,6 +270,7 @@ "field_configuration": "字段配置", "field_configuration_description": "将输入数据中的字段与匹配算法能够理解的字段关联。将包含概念代码或映射的输入字段分配给特定存储库。<0>了解更多", "column_suggested": "根据列名建议。如有误请更改。", + "no_name_column": "没有列映射到 Name。AutoMatch 按名称进行比较,请为包含名称的列选择 Name。", "input_column": "输入列", "mapped_field": "映射字段", "field": "字段", From 238cdd46fef94c4765f73a36fee8d8023a10661b Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Thu, 3 Dec 2026 01:16:14 -0500 Subject: [PATCH 02/12] OpenConceptLab/ocl_online#841 | A date column, or "Age at diagnosis", is never suggested as Name A header such as Test Date took the Name suggestion from the Diagnosis column beside it, and Date of Diagnosis ended in a clinical word. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../__tests__/columnSuggestions.test.js | 11 +++++++++++ .../map-projects/columnSuggestions.js | 17 +++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/map-projects/__tests__/columnSuggestions.test.js b/src/components/map-projects/__tests__/columnSuggestions.test.js index 9761b70f..e4f63968 100644 --- a/src/components/map-projects/__tests__/columnSuggestions.test.js +++ b/src/components/map-projects/__tests__/columnSuggestions.test.js @@ -46,6 +46,17 @@ test('suggestColumnLabels: a clinical word that only describes another one sugge headers.forEach(header => assert.deepEqual(suggestColumnLabels([header], BASE), [null], header)) }) +test('suggestColumnLabels: a clinical word after of, at or for suggests nothing', () => { + const headers = ['Year of diagnosis', 'Age at Diagnosis', 'Reason for procedure', 'Number of drugs'] + assert.deepEqual(suggestColumnLabels(headers, BASE), headers.map(() => null)) + assert.deepEqual(suggestColumnLabels(['Description of diagnosis'], BASE), ['Name']) +}) + +test('suggestColumnLabels: a date column never takes Name from the column that holds names', () => { + assert.deepEqual(suggestColumnLabels(['Test Date', 'Date of Diagnosis', 'Diagnosis'], BASE), [null, null, 'Name']) + assert.deepEqual(suggestColumnLabels(['Test Date', 'Diagnosis_Date'], BASE), [null, null]) +}) + test('suggestColumnLabels: a name column wins over a clinical one, which wins over a description', () => { assert.deepEqual(suggestColumnLabels(['Drug', 'Drug Name'], BASE), [null, 'Name']) assert.deepEqual(suggestColumnLabels(['Diagnosis Description', 'Diagnosis'], BASE), [null, 'Name']) diff --git a/src/components/map-projects/columnSuggestions.js b/src/components/map-projects/columnSuggestions.js index f5abce2a..639ec218 100644 --- a/src/components/map-projects/columnSuggestions.js +++ b/src/components/map-projects/columnSuggestions.js @@ -15,10 +15,11 @@ */ const CODE_TOKENS = ['code', 'codes', 'id', 'ids', 'uuid', 'identifier'] +const DATE_TOKENS = ['date', 'dates', 'datetime'] -// These say what the row is only as the header's last word: "Primary -// diagnosis" holds names, "Diagnosis Date" doesn't -// (OpenConceptLab/ocl_online#841). +// These say what the row is only as the header's last word, and not after "of", +// "at" or "for": "Primary diagnosis" holds names, "Diagnosis code" and "Age at +// diagnosis" don't (OpenConceptLab/ocl_online#841). const CLINICAL_TOKENS = [ 'diagnosis', 'diagnoses', 'condition', 'conditions', 'procedure', 'procedures', 'drug', 'drugs', 'medication', 'medications' @@ -32,9 +33,13 @@ const SUGGESTION_RULES = [ const tokenize = header => String(header || '').toLowerCase().split(/[\s_-]+/).filter(Boolean) -const dropDescribingWords = tokens => tokens.filter((token, idx) => idx === tokens.length - 1 || !CLINICAL_TOKENS.includes(token)) +const dropDescribingWords = tokens => { + const namesRow = !tokens.some(token => ['of', 'at', 'for'].includes(token)) + return tokens.filter((token, idx) => !CLINICAL_TOKENS.includes(token) || (namesRow && idx === tokens.length - 1)) +} export const isCodeLikeHeader = header => tokenize(header).some(token => CODE_TOKENS.includes(token)) +const isDateHeader = header => tokenize(header).some(token => DATE_TOKENS.includes(token)) /** * Returns one suggested label per header, aligned with `headers`, or null @@ -58,7 +63,7 @@ export const suggestColumnLabels = (headers, validColumns, reserved = []) => { const matches = headers.map((header, idx) => { const alreadyRecognised = String(header || '').toLowerCase().includes('class') - if(isExact(header) || alreadyRecognised || isCodeLikeHeader(header)) + if(isExact(header) || alreadyRecognised || isCodeLikeHeader(header) || isDateHeader(header)) return null const tokens = dropDescribingWords(tokenize(header)) @@ -67,7 +72,7 @@ export const suggestColumnLabels = (headers, validColumns, reserved = []) => { }) // A field goes to the column with its strongest word ("name" before "test"), - // then the first such column, so "Test Name" wins over an earlier "Test Date". + // then the first such column, so "Test Name" wins over an earlier "Test". const suggestions = headers.map(() => null) matches.filter(Boolean).sort((a, b) => a.rank - b.rank || a.idx - b.idx).forEach(({idx, rule}) => { const target = findValid(rule.label) From 6470cb1d6319a1ec60b1daaf6e7f200ca691f056 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Thu, 3 Dec 2026 01:22:45 -0500 Subject: [PATCH 03/12] OpenConceptLab/ocl_online#841 | A sheet that got a Name suggestion keeps the same one The clinical words only fill the gap: Diagnosis Description still wins over Diagnosis. Date/Time counts as a date header too. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/__tests__/columnSuggestions.test.js | 5 +++-- src/components/map-projects/columnSuggestions.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/map-projects/__tests__/columnSuggestions.test.js b/src/components/map-projects/__tests__/columnSuggestions.test.js index e4f63968..f7b71938 100644 --- a/src/components/map-projects/__tests__/columnSuggestions.test.js +++ b/src/components/map-projects/__tests__/columnSuggestions.test.js @@ -54,12 +54,13 @@ test('suggestColumnLabels: a clinical word after of, at or for suggests nothing' test('suggestColumnLabels: a date column never takes Name from the column that holds names', () => { assert.deepEqual(suggestColumnLabels(['Test Date', 'Date of Diagnosis', 'Diagnosis'], BASE), [null, null, 'Name']) + assert.deepEqual(suggestColumnLabels(['Test Date/Time', 'Diagnosis'], BASE), [null, 'Name']) assert.deepEqual(suggestColumnLabels(['Test Date', 'Diagnosis_Date'], BASE), [null, null]) }) -test('suggestColumnLabels: a name column wins over a clinical one, which wins over a description', () => { +test('suggestColumnLabels: a clinical word only takes Name when no other header has one of the general words', () => { assert.deepEqual(suggestColumnLabels(['Drug', 'Drug Name'], BASE), [null, 'Name']) - assert.deepEqual(suggestColumnLabels(['Diagnosis Description', 'Diagnosis'], BASE), [null, 'Name']) + assert.deepEqual(suggestColumnLabels(['Diagnosis', 'Diagnosis Description'], BASE), [null, 'Name']) }) test('suggestColumnLabels: exact matches are left alone', () => { diff --git a/src/components/map-projects/columnSuggestions.js b/src/components/map-projects/columnSuggestions.js index 639ec218..6787e9e2 100644 --- a/src/components/map-projects/columnSuggestions.js +++ b/src/components/map-projects/columnSuggestions.js @@ -26,12 +26,12 @@ const CLINICAL_TOKENS = [ ] const SUGGESTION_RULES = [ - {label: 'Name', tokens: ['name', 'term', 'test', ...CLINICAL_TOKENS, 'description']}, + {label: 'Name', tokens: ['name', 'term', 'test', 'description', ...CLINICAL_TOKENS]}, {label: 'Synonyms', tokens: ['synonym', 'synonyms']}, {label: 'Property: SYSTEM', tokens: ['specimen', 'system', 'sample']}, ] -const tokenize = header => String(header || '').toLowerCase().split(/[\s_-]+/).filter(Boolean) +const tokenize = header => String(header || '').toLowerCase().split(/[\s_/-]+/).filter(Boolean) const dropDescribingWords = tokens => { const namesRow = !tokens.some(token => ['of', 'at', 'for'].includes(token)) From 7566e25d4a7f990b5ec1abb19ed128f59cdeeefe Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Thu, 3 Dec 2026 01:27:43 -0500 Subject: [PATCH 04/12] OpenConceptLab/ocl_online#841 | A date word counts next to punctuation, and other headers split as before Test (Date/Time) is a date header. Drug Name/Strength no longer takes Name from Generic Drug Name. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/__tests__/columnSuggestions.test.js | 5 ++++- src/components/map-projects/columnSuggestions.js | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/map-projects/__tests__/columnSuggestions.test.js b/src/components/map-projects/__tests__/columnSuggestions.test.js index f7b71938..eb80b094 100644 --- a/src/components/map-projects/__tests__/columnSuggestions.test.js +++ b/src/components/map-projects/__tests__/columnSuggestions.test.js @@ -54,13 +54,16 @@ test('suggestColumnLabels: a clinical word after of, at or for suggests nothing' test('suggestColumnLabels: a date column never takes Name from the column that holds names', () => { assert.deepEqual(suggestColumnLabels(['Test Date', 'Date of Diagnosis', 'Diagnosis'], BASE), [null, null, 'Name']) - assert.deepEqual(suggestColumnLabels(['Test Date/Time', 'Diagnosis'], BASE), [null, 'Name']) + const dates = ['Test Date/Time', 'Test (Date/Time)', 'Test (date)', 'Test datetime'] + dates.forEach(header => assert.deepEqual(suggestColumnLabels([header, 'Diagnosis'], BASE), [null, 'Name'], header)) + assert.deepEqual(suggestColumnLabels(['Test update'], BASE), ['Name']) assert.deepEqual(suggestColumnLabels(['Test Date', 'Diagnosis_Date'], BASE), [null, null]) }) test('suggestColumnLabels: a clinical word only takes Name when no other header has one of the general words', () => { assert.deepEqual(suggestColumnLabels(['Drug', 'Drug Name'], BASE), [null, 'Name']) assert.deepEqual(suggestColumnLabels(['Diagnosis', 'Diagnosis Description'], BASE), [null, 'Name']) + assert.deepEqual(suggestColumnLabels(['Drug Name/Strength', 'Generic Drug Name'], BASE), [null, 'Name']) }) test('suggestColumnLabels: exact matches are left alone', () => { diff --git a/src/components/map-projects/columnSuggestions.js b/src/components/map-projects/columnSuggestions.js index 6787e9e2..9f33f073 100644 --- a/src/components/map-projects/columnSuggestions.js +++ b/src/components/map-projects/columnSuggestions.js @@ -15,7 +15,6 @@ */ const CODE_TOKENS = ['code', 'codes', 'id', 'ids', 'uuid', 'identifier'] -const DATE_TOKENS = ['date', 'dates', 'datetime'] // These say what the row is only as the header's last word, and not after "of", // "at" or "for": "Primary diagnosis" holds names, "Diagnosis code" and "Age at @@ -31,7 +30,7 @@ const SUGGESTION_RULES = [ {label: 'Property: SYSTEM', tokens: ['specimen', 'system', 'sample']}, ] -const tokenize = header => String(header || '').toLowerCase().split(/[\s_/-]+/).filter(Boolean) +const tokenize = header => String(header || '').toLowerCase().split(/[\s_-]+/).filter(Boolean) const dropDescribingWords = tokens => { const namesRow = !tokens.some(token => ['of', 'at', 'for'].includes(token)) @@ -39,7 +38,7 @@ const dropDescribingWords = tokens => { } export const isCodeLikeHeader = header => tokenize(header).some(token => CODE_TOKENS.includes(token)) -const isDateHeader = header => tokenize(header).some(token => DATE_TOKENS.includes(token)) +const isDateHeader = header => /(^|[^a-z])date(s|time)?([^a-z]|$)/i.test(header || '') /** * Returns one suggested label per header, aligned with `headers`, or null From cd64a3153a80a90fc844e61e98fe9ecb748770dd Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Thu, 3 Dec 2026 01:34:35 -0500 Subject: [PATCH 05/12] OpenConceptLab/ocl_online#841 | Two tests that repeated others are merged into them Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/__tests__/columnSuggestions.test.js | 10 ++++------ .../map-projects/__tests__/selectedAlgos.test.js | 2 -- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/map-projects/__tests__/columnSuggestions.test.js b/src/components/map-projects/__tests__/columnSuggestions.test.js index eb80b094..33f38726 100644 --- a/src/components/map-projects/__tests__/columnSuggestions.test.js +++ b/src/components/map-projects/__tests__/columnSuggestions.test.js @@ -42,13 +42,11 @@ test('suggestColumnLabels: clinical headers suggest Name (OpenConceptLab/ocl_onl }) test('suggestColumnLabels: a clinical word that only describes another one suggests nothing', () => { - const headers = ['Diagnosis Date', 'Drug Dose', 'Procedure Code', 'Medication Route', 'Drug class', 'Conditional'] + const headers = [ + 'Diagnosis Date', 'Drug Dose', 'Procedure Code', 'Medication Route', 'Drug class', 'Conditional', + 'Year of diagnosis', 'Age at Diagnosis', 'Reason for procedure', 'Number of drugs' + ] headers.forEach(header => assert.deepEqual(suggestColumnLabels([header], BASE), [null], header)) -}) - -test('suggestColumnLabels: a clinical word after of, at or for suggests nothing', () => { - const headers = ['Year of diagnosis', 'Age at Diagnosis', 'Reason for procedure', 'Number of drugs'] - assert.deepEqual(suggestColumnLabels(headers, BASE), headers.map(() => null)) assert.deepEqual(suggestColumnLabels(['Description of diagnosis'], BASE), ['Name']) }) diff --git a/src/components/map-projects/__tests__/selectedAlgos.test.js b/src/components/map-projects/__tests__/selectedAlgos.test.js index 7212fdfb..36258adc 100644 --- a/src/components/map-projects/__tests__/selectedAlgos.test.js +++ b/src/components/map-projects/__tests__/selectedAlgos.test.js @@ -91,8 +91,6 @@ test('getAlgosForRelease: a release without semantic search selects nothing', () test('getAlgosForRelease: without a default (chosen, removed, saved or copied), nothing is added', () => { const none = [] assert.equal(getAlgosForRelease(none, SEMANTIC_RELEASE), none) - const chosen = [search] - assert.equal(getAlgosForRelease(chosen, SEMANTIC_RELEASE), chosen) }) test('getAlgosForRelease: a list that already has an algorithm is kept, whatever the default', () => { From cda51bd1fd15e3c73d8fa03f36f725ed2d4a65bb Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Thu, 3 Dec 2026 01:37:55 -0500 Subject: [PATCH 06/12] OpenConceptLab/ocl_online#841 | A clinical word beside a code word joined by a slash isn't a name either Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/__tests__/columnSuggestions.test.js | 2 +- .../map-projects/__tests__/selectedAlgos.test.js | 1 + src/components/map-projects/columnSuggestions.js | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/map-projects/__tests__/columnSuggestions.test.js b/src/components/map-projects/__tests__/columnSuggestions.test.js index 33f38726..435a9564 100644 --- a/src/components/map-projects/__tests__/columnSuggestions.test.js +++ b/src/components/map-projects/__tests__/columnSuggestions.test.js @@ -44,7 +44,7 @@ test('suggestColumnLabels: clinical headers suggest Name (OpenConceptLab/ocl_onl test('suggestColumnLabels: a clinical word that only describes another one suggests nothing', () => { const headers = [ 'Diagnosis Date', 'Drug Dose', 'Procedure Code', 'Medication Route', 'Drug class', 'Conditional', - 'Year of diagnosis', 'Age at Diagnosis', 'Reason for procedure', 'Number of drugs' + 'Year of diagnosis', 'Age at Diagnosis', 'Reason for procedure', 'Number of drugs', 'Code/ID - Diagnosis' ] headers.forEach(header => assert.deepEqual(suggestColumnLabels([header], BASE), [null], header)) assert.deepEqual(suggestColumnLabels(['Description of diagnosis'], BASE), ['Name']) diff --git a/src/components/map-projects/__tests__/selectedAlgos.test.js b/src/components/map-projects/__tests__/selectedAlgos.test.js index 36258adc..75d9f1ae 100644 --- a/src/components/map-projects/__tests__/selectedAlgos.test.js +++ b/src/components/map-projects/__tests__/selectedAlgos.test.js @@ -95,6 +95,7 @@ test('getAlgosForRelease: without a default (chosen, removed, saved or copied), test('getAlgosForRelease: a list that already has an algorithm is kept, whatever the default', () => { const chosen = [search] + assert.equal(getAlgosForRelease(chosen, SEMANTIC_RELEASE), chosen) assert.equal(getAlgosForRelease(chosen, SEMANTIC_RELEASE, {defaultAlgo: semantic}), chosen) const selected = [semantic] assert.equal(getAlgosForRelease(selected, SEMANTIC_RELEASE, {defaultAlgo: {...semantic, __key: 'd'}}), selected) diff --git a/src/components/map-projects/columnSuggestions.js b/src/components/map-projects/columnSuggestions.js index 9f33f073..25bc129e 100644 --- a/src/components/map-projects/columnSuggestions.js +++ b/src/components/map-projects/columnSuggestions.js @@ -16,9 +16,9 @@ const CODE_TOKENS = ['code', 'codes', 'id', 'ids', 'uuid', 'identifier'] -// These say what the row is only as the header's last word, and not after "of", -// "at" or "for": "Primary diagnosis" holds names, "Diagnosis code" and "Age at -// diagnosis" don't (OpenConceptLab/ocl_online#841). +// These say what the row is only as the header's last word, and not beside "of", +// "at", "for" or a code word: "Primary diagnosis" holds names, "Diagnosis code" +// and "Age at diagnosis" don't (OpenConceptLab/ocl_online#841). const CLINICAL_TOKENS = [ 'diagnosis', 'diagnoses', 'condition', 'conditions', 'procedure', 'procedures', 'drug', 'drugs', 'medication', 'medications' @@ -33,7 +33,7 @@ const SUGGESTION_RULES = [ const tokenize = header => String(header || '').toLowerCase().split(/[\s_-]+/).filter(Boolean) const dropDescribingWords = tokens => { - const namesRow = !tokens.some(token => ['of', 'at', 'for'].includes(token)) + const namesRow = !tokens.join('/').split('/').some(word => ['of', 'at', 'for', ...CODE_TOKENS].includes(word)) return tokens.filter((token, idx) => !CLINICAL_TOKENS.includes(token) || (namesRow && idx === tokens.length - 1)) } From ec78bc2b5c6b2693cb5fc70157f92d2cba76cf00 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Fri, 4 Dec 2026 21:43:14 -0500 Subject: [PATCH 07/12] OpenConceptLab/ocl_online#841 | Saving says which required field or column mapping is missing The line under the column table is gone. A save by hand without a column mapped to Name is refused with "Missing required column mapping: Name.", and one without an owner, a name or a file with "Missing required field: ...". Save & Close stays on, so it can say so, and Upload file has a star. Autosave isn't held to it: a saved project keeps its work, and a refused save leaves a pending autosave to run. The page's message shows before a file is uploaded too. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/ConfigurationForm.jsx | 12 +-- src/components/map-projects/MapProject.jsx | 89 +++++++++++-------- .../__tests__/columnSuggestions.test.js | 25 +++--- .../map-projects/columnSuggestions.js | 8 +- src/i18n/locales/en/translations.json | 3 +- src/i18n/locales/es/translations.json | 3 +- src/i18n/locales/pt-BR/translations.json | 3 +- src/i18n/locales/zh/translations.json | 3 +- 8 files changed, 84 insertions(+), 62 deletions(-) diff --git a/src/components/map-projects/ConfigurationForm.jsx b/src/components/map-projects/ConfigurationForm.jsx index c7b4d56e..de534a8c 100644 --- a/src/components/map-projects/ConfigurationForm.jsx +++ b/src/components/map-projects/ConfigurationForm.jsx @@ -38,7 +38,6 @@ import RepoSearchAutocomplete from '../repos/RepoSearchAutocomplete' import RepoVersionSearchAutocomplete from '../repos/RepoVersionSearchAutocomplete' import CloseIconButton from '../common/CloseIconButton'; import ColumnMapTable from './ColumnMapTable' -import { hasNameColumn } from './columnSuggestions' import ScoreConfiguration from './ScoreConfiguration' import { SCORES_COLOR } from './constants' import FilterTable from './FilterTable' @@ -222,10 +221,11 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n disabled={locked || Boolean(project?.id && project.input_file_name)} > { - file?.name ? file.name : t('map_project.upload_file') + file?.name ? file.name : <>{t('map_project.upload_file')} } @@ -554,12 +554,6 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n disabled={locked} /> - { - !hasNameColumn(columns) && - - {t('map_project.no_name_column')} - - } } { @@ -611,7 +605,7 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n sx={{textTransform: 'none', margin: '20px 5px 5px 0px'}} startIcon={lock ? : } onClick={onSave} - disabled={locked || !name || !file?.name || !owner || hasConfigErrors || hasAccessErrors} + disabled={locked || hasConfigErrors || hasAccessErrors} loading={isSaving} loadingPosition="start" > diff --git a/src/components/map-projects/MapProject.jsx b/src/components/map-projects/MapProject.jsx index cb8aedb0..5e180f09 100644 --- a/src/components/map-projects/MapProject.jsx +++ b/src/components/map-projects/MapProject.jsx @@ -84,7 +84,7 @@ import { buildPanelPayload } from './openConceptPanel' import LoaderDialog from '../common/LoaderDialog' import Error403 from '../errors/Error403' import { HEADERS, SEMANTIC_SEARCH_HEADERS, ROW_STATES, VIEWS, DECISION_TABS, ROW_STAGES, PROMPTS_KEY_DEFAULT, PROMPTS_ACTION_TYPE_DEFAULT, SCORES_COLOR } from './constants' -import { updateColumnState, resuggestColumns, applyTemplateColumns } from './columnSuggestions' +import { updateColumnState, resuggestColumns, applyTemplateColumns, getMissingColumns } from './columnSuggestions' import MapProjectDeleteConfirmDialog from './MapProjectDeleteConfirmDialog'; import ConfigurationForm from './ConfigurationForm' import Controls from './Controls' @@ -1776,25 +1776,40 @@ const MapProject = () => { }) } + // What a save by hand is refused for. Autosave isn't: a saved project keeps + // its work whatever its settings lack (OpenConceptLab/ocl_online#841). + const getMissingRequired = () => { + const fields = compact([ + !owner && t('map_project.project_owner'), + !name && t('common.name'), + !file?.name && t('map_project.upload_file') + ]) + const missingColumns = file?.name ? getMissingColumns(columns) : [] + return compact([ + fields.length && t('map_project.missing_required_field', {names: fields.join(', ')}), + missingColumns.length && t('map_project.missing_required_column_mapping', {names: missingColumns.join(', ')}) + ]) + } + const onSave = (options = {}) => { const isAutoSave = options.source === 'auto' if(isAutoSave && (!project?.id || readOnlyRef.current)) return - if(!isAutoSave) - autosaveSchedulerRef.current.cancel() - if(!repoVersion?.version_url || !selectedTargetRepoVersion) { + const isVersionMissing = !repoVersion?.version_url || !selectedTargetRepoVersion + const errors = isAutoSave ? [] : getMissingRequired() + if(isVersionMissing) + errors.push(t('map_project.target_repo_version_required', 'Select a target repository version before saving.')) + if(errors.length) { setConfigure(true) - setShowTargetRepoVersionError(true) - setAlert({ - message: t( - 'map_project.target_repo_version_required', - 'Select a target repository version before saving.' - ), - severity: 'error', - duration: 8 - }) + setShowTargetRepoVersionError(isVersionMissing) + setAlert({message: errors.join(' '), severity: 'error', duration: 8, isRefusedSave: true}) return } + // After the checks, so a refused save leaves a pending autosave to run. + if(!isAutoSave) { + autosaveSchedulerRef.current.cancel() + setAlert(prev => prev?.isRefusedSave ? false : prev) + } const rowLogsForSave = options.logs || logsRef.current const projectLogsForSave = options.projectLogs || projectLogsRef.current const editsInSave = editTrackerRef.current.saving() @@ -6622,6 +6637,30 @@ const MapProject = () => { loadingProject && } + + setAlert(false)} + > + + + } + sx={{ width: '100%' }} + > + {alert?.message} + + { onSearchTextChange={setSearchText} searchValue={headerRowSearch} /> - - setAlert(false)} - > - - - } - sx={{ width: '100%' }} - > - {alert?.message} - -
{ - const names = headers => hasNameColumn(upload(headers)) - assert.equal(names(['Local Code', 'Diagnosis']), true) - assert.equal(names(['Name']), true) - assert.equal(names(['name']), true) - assert.equal(names(['Local Code', 'Synonyms']), false) - assert.equal(hasNameColumn(updateColumnState(upload(['Diagnosis']), 0, null)), false) - assert.equal(hasNameColumn([]), false) - assert.equal(hasNameColumn([{label: undefined}]), false) +test('getMissingColumns: a save needs a column mapped to Name', () => { + const missing = headers => getMissingColumns(upload(headers)) + assert.deepEqual(missing(['Local Code', 'Diagnosis']), []) + assert.deepEqual(missing(['Name']), []) + assert.deepEqual(missing(['name']), []) + assert.deepEqual(missing(['Local Code', 'Synonyms']), ['Name']) + assert.deepEqual(getMissingColumns(updateColumnState(upload(['Diagnosis']), 0, null)), ['Name']) + assert.deepEqual(getMissingColumns([]), ['Name']) + assert.deepEqual(getMissingColumns([{label: undefined}]), ['Name']) +}) + +test('getMissingColumns: any other column can be required too', () => { + const columns = upload(['Local Code', 'Diagnosis']) + assert.deepEqual(getMissingColumns(columns, ['Name', 'Synonyms', 'Property: SYSTEM']), ['Synonyms', 'Property: SYSTEM']) }) diff --git a/src/components/map-projects/columnSuggestions.js b/src/components/map-projects/columnSuggestions.js index 25bc129e..2964b2d1 100644 --- a/src/components/map-projects/columnSuggestions.js +++ b/src/components/map-projects/columnSuggestions.js @@ -83,8 +83,12 @@ export const suggestColumnLabels = (headers, validColumns, reserved = []) => { return suggestions } -// AutoMatch compares names, so the form says when no column holds them. -export const hasNameColumn = columns => columns.some(column => column.label?.toLowerCase() === 'name') +// The fields that need a column before someone can save a project's settings: +// AutoMatch compares names (OpenConceptLab/ocl_online#841). +const REQUIRED_COLUMNS = ['Name'] + +export const getMissingColumns = (columns, required = REQUIRED_COLUMNS) => + required.filter(label => !columns.some(column => column.label?.toLowerCase() === label.toLowerCase())) /** * Returns a new columns array with one column's mapping changed. A change diff --git a/src/i18n/locales/en/translations.json b/src/i18n/locales/en/translations.json index 1a12e579..fe4e96c6 100644 --- a/src/i18n/locales/en/translations.json +++ b/src/i18n/locales/en/translations.json @@ -277,7 +277,8 @@ "field_configuration": "Field Configuration", "field_configuration_description": "Associate fields in the input data to fields that the matching algorithms are able to understand. Assign input fields that contain concept codes or mappings to specific repositories. <0>Learn more", "column_suggested": "Suggested from column name. Change it if it's wrong.", - "no_name_column": "No column is mapped to Name. AutoMatch compares names, so choose Name for the column that has them.", + "missing_required_field": "Missing required field: {{names}}.", + "missing_required_column_mapping": "Missing required column mapping: {{names}}.", "input_column": "Input Column", "mapped_field": "Mapped Field", "field": "Field", diff --git a/src/i18n/locales/es/translations.json b/src/i18n/locales/es/translations.json index 0487d559..2458a844 100644 --- a/src/i18n/locales/es/translations.json +++ b/src/i18n/locales/es/translations.json @@ -258,7 +258,8 @@ "field_configuration": "Configuración de Campo", "field_configuration_description": "Asocie campos en los datos de entrada con campos que los algoritmos de coincidencia puedan entender. Asigne campos de entrada que contengan códigos de concepto o mapeos a repositorios específicos. <0>Aprenda más", "column_suggested": "Sugerido a partir del nombre de la columna. Cámbielo si es incorrecto.", - "no_name_column": "Ninguna columna está asociada a Name. AutoMatch compara nombres, así que elija Name para la columna que los contiene.", + "missing_required_field": "Falta un campo obligatorio: {{names}}.", + "missing_required_column_mapping": "Falta una asignación de columna obligatoria: {{names}}.", "input_column": "Columna de Entrada", "mapped_field": "Campo Mapeado", "field": "Campo", diff --git a/src/i18n/locales/pt-BR/translations.json b/src/i18n/locales/pt-BR/translations.json index 96b64850..adca4089 100644 --- a/src/i18n/locales/pt-BR/translations.json +++ b/src/i18n/locales/pt-BR/translations.json @@ -277,7 +277,8 @@ "field_configuration": "Configuração de Campo", "field_configuration_description": "Associe campos nos dados de entrada a campos que os algoritmos de mapeamento são capazes de entender. Atribua campos de entrada que contenham códigos de conceito ou mapeamentos a repositórios específicos. <0>Saiba mais", "column_suggested": "Sugerido pelo nome da coluna. Altere se estiver errado.", - "no_name_column": "Nenhuma coluna está associada a Name. O AutoMatch compara nomes, então escolha Name para a coluna que os contém.", + "missing_required_field": "Falta um campo obrigatório: {{names}}.", + "missing_required_column_mapping": "Falta um mapeamento de coluna obrigatório: {{names}}.", "input_column": "Coluna de Entrada", "mapped_field": "Campo Mapeado", "field": "Campo", diff --git a/src/i18n/locales/zh/translations.json b/src/i18n/locales/zh/translations.json index c34760c9..29893a99 100644 --- a/src/i18n/locales/zh/translations.json +++ b/src/i18n/locales/zh/translations.json @@ -270,7 +270,8 @@ "field_configuration": "字段配置", "field_configuration_description": "将输入数据中的字段与匹配算法能够理解的字段关联。将包含概念代码或映射的输入字段分配给特定存储库。<0>了解更多", "column_suggested": "根据列名建议。如有误请更改。", - "no_name_column": "没有列映射到 Name。AutoMatch 按名称进行比较,请为包含名称的列选择 Name。", + "missing_required_field": "缺少必填字段:{{names}}。", + "missing_required_column_mapping": "缺少必需的列映射:{{names}}。", "input_column": "输入列", "mapped_field": "映射字段", "field": "字段", From b827b4d89a1bb43cf891e4521c5762b4abcd2914 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Fri, 4 Dec 2026 21:43:14 -0500 Subject: [PATCH 08/12] OpenConceptLab/ocl_online#841 | The AutoMatch dialog's OCL AI Assistant box takes its default when the project's history arrives Opened before the history had loaded, the box stayed off. It now takes the project's default then, unless the user has already changed it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- src/components/map-projects/MapProject.jsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/map-projects/MapProject.jsx b/src/components/map-projects/MapProject.jsx index 5e180f09..1a1f6748 100644 --- a/src/components/map-projects/MapProject.jsx +++ b/src/components/map-projects/MapProject.jsx @@ -3364,6 +3364,11 @@ const MapProject = () => { event.stopPropagation() event.preventDefault() setAutoMatchScope(getSelectedRowIndexes().length ? 'selected' : (rowStatuses.unmapped.length ? 'unmapped' : 'all')) + applyAutoMatchAIDefault() + setMatchDialog(true) + } + + const applyAutoMatchAIDefault = () => { if(inAIAssistantGroup) { const { runAI, applied } = getAutoMatchAIOnOpen({ current: autoRunAIAnalysis, @@ -3375,7 +3380,18 @@ const MapProject = () => { autoMatchAIDefaultAppliedRef.current = applied setAutoRunAIAnalysis(runAI) } - setMatchDialog(true) + } + + // The project's logs can load after the dialog opened, and the box takes its + // default then, unless the user has already changed it. + React.useEffect(() => { + if(matchDialog && !autoMatchAIDefaultAppliedRef.current) + applyAutoMatchAIDefault() + }, [projectLogs]) + + const onAutoRunAIAnalysisChange = runAI => { + autoMatchAIDefaultAppliedRef.current = true + setAutoRunAIAnalysis(runAI) } const onAutoMatchConfigure = () => { @@ -7039,7 +7055,7 @@ const MapProject = () => { setAutoMatchScope, selectedRowCount: selectedRowsCount, autoRunAIAnalysis, - setAutoRunAIAnalysis, + setAutoRunAIAnalysis: onAutoRunAIAnalysisChange, AIModels, AIModel, setAIModel, From 4bd367b4d96179ae0c3bfd1c62f043beadccc9e7 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Fri, 4 Dec 2026 22:00:27 -0500 Subject: [PATCH 09/12] OpenConceptLab/ocl_online#841 | A refused save keeps its fuller message, a name of spaces is missing, and the AI box takes its default when access arrives late An autosave refused for a missing version no longer replaces the message a save by hand just showed. A project name of only spaces counts as missing. The AutoMatch dialog's box also takes its default when the user's access to the OCL AI Assistant arrives while it's open. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- src/components/map-projects/MapProject.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/map-projects/MapProject.jsx b/src/components/map-projects/MapProject.jsx index 1a1f6748..3825fbc5 100644 --- a/src/components/map-projects/MapProject.jsx +++ b/src/components/map-projects/MapProject.jsx @@ -1781,7 +1781,7 @@ const MapProject = () => { const getMissingRequired = () => { const fields = compact([ !owner && t('map_project.project_owner'), - !name && t('common.name'), + !name?.trim() && t('common.name'), !file?.name && t('map_project.upload_file') ]) const missingColumns = file?.name ? getMissingColumns(columns) : [] @@ -1802,7 +1802,8 @@ const MapProject = () => { if(errors.length) { setConfigure(true) setShowTargetRepoVersionError(isVersionMissing) - setAlert({message: errors.join(' '), severity: 'error', duration: 8, isRefusedSave: true}) + // An autosave refused for the version keeps a save by hand's fuller message. + setAlert(prev => isAutoSave && prev?.isRefusedSave ? prev : {message: errors.join(' '), severity: 'error', duration: 8, isRefusedSave: true}) return } // After the checks, so a refused save leaves a pending autosave to run. @@ -3382,12 +3383,13 @@ const MapProject = () => { } } - // The project's logs can load after the dialog opened, and the box takes its - // default then, unless the user has already changed it. + // The project's logs, and the user's access to the OCL AI Assistant, can load + // after the dialog opened. The box takes its default then, unless the user + // has already changed it. React.useEffect(() => { if(matchDialog && !autoMatchAIDefaultAppliedRef.current) applyAutoMatchAIDefault() - }, [projectLogs]) + }, [projectLogs, inAIAssistantGroup]) const onAutoRunAIAnalysisChange = runAI => { autoMatchAIDefaultAppliedRef.current = true From 7458b29f8c690098b94699ecdc831d3004a69bc7 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Fri, 4 Dec 2026 22:07:36 -0500 Subject: [PATCH 10/12] OpenConceptLab/ocl_online#841 | A refused autosave names all that's missing now, not an older message An autosave is still refused only for a missing version, but its message now lists everything missing at that moment, as a save by hand's does. It no longer keeps an earlier message that may have gone out of date. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- src/components/map-projects/MapProject.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/map-projects/MapProject.jsx b/src/components/map-projects/MapProject.jsx index 3825fbc5..b3c74df5 100644 --- a/src/components/map-projects/MapProject.jsx +++ b/src/components/map-projects/MapProject.jsx @@ -1776,8 +1776,9 @@ const MapProject = () => { }) } - // What a save by hand is refused for. Autosave isn't: a saved project keeps - // its work whatever its settings lack (OpenConceptLab/ocl_online#841). + // What a save by hand is refused for. Autosave isn't refused for these: a + // saved project keeps its work whatever its settings lack + // (OpenConceptLab/ocl_online#841). const getMissingRequired = () => { const fields = compact([ !owner && t('map_project.project_owner'), @@ -1795,15 +1796,15 @@ const MapProject = () => { const isAutoSave = options.source === 'auto' if(isAutoSave && (!project?.id || readOnlyRef.current)) return + // Only a missing version refuses an autosave; a refusal names all that's missing. const isVersionMissing = !repoVersion?.version_url || !selectedTargetRepoVersion - const errors = isAutoSave ? [] : getMissingRequired() + const errors = getMissingRequired() if(isVersionMissing) errors.push(t('map_project.target_repo_version_required', 'Select a target repository version before saving.')) - if(errors.length) { + if(isVersionMissing || (!isAutoSave && errors.length)) { setConfigure(true) setShowTargetRepoVersionError(isVersionMissing) - // An autosave refused for the version keeps a save by hand's fuller message. - setAlert(prev => isAutoSave && prev?.isRefusedSave ? prev : {message: errors.join(' '), severity: 'error', duration: 8, isRefusedSave: true}) + setAlert({message: errors.join(' '), severity: 'error', duration: 8, isRefusedSave: true}) return } // After the checks, so a refused save leaves a pending autosave to run. From 0a52a372e678196a1e63c39ed7a10723fe5d2c44 Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Fri, 4 Dec 2026 22:15:17 -0500 Subject: [PATCH 11/12] OpenConceptLab/ocl_online#841 | One message names every missing field in the form's order, and the empty fields show their error "Missing required field: Upload file." for one, and "Missing required fields: Name, Upload file, Repository, Version." for several, in the form's order. A missing version is named there too, not in a sentence of its own, and Repository is named only when the version is missing as well: a save needs only the version. After a refused save, Name, Repository and Version show their error while they're empty, until a save goes through. Upload file keeps its star. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- .../map-projects/ConfigurationForm.jsx | 7 ++-- src/components/map-projects/MapProject.jsx | 33 ++++++++++--------- .../repos/RepoSearchAutocomplete.jsx | 3 +- src/i18n/locales/en/translations.json | 3 +- src/i18n/locales/es/translations.json | 3 +- src/i18n/locales/pt-BR/translations.json | 3 +- src/i18n/locales/zh/translations.json | 2 +- 7 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/components/map-projects/ConfigurationForm.jsx b/src/components/map-projects/ConfigurationForm.jsx index de534a8c..72794e3d 100644 --- a/src/components/map-projects/ConfigurationForm.jsx +++ b/src/components/map-projects/ConfigurationForm.jsx @@ -75,7 +75,7 @@ const getSuggestedRepos = () => (window.REPO_SUGGESTIONS || process.env.REPO_SUG .filter(([owner, id]) => owner && id) .map(([owner, id]) => ({id, short_code: id, name: id, owner, ownerType: 'Organization', type: 'Source', url: `/orgs/${owner}/sources/${id}/`})) -const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, name, setName, description, setDescription, repo, onRepoChange, repoVersion, setRepoVersion, showTargetRepoVersionError, versions, mappedSources, targetSourcesFromRows, algosSelected, setAlgosSelected, sx, algos, validColumns, columns, isValidColumnValue, updateColumn, configure, setConfigure, columnVisibilityModel, setColumnVisibilityModel, onSave, isSaving, candidatesScore, onScoreChange, includeDefaultFilter, setIncludeDefaultFilter, filters, setFilters, locales, setAIAssistantColumns, AIAssistantColumns, inAIAssistantGroup, lookupConfig, setLookupConfig, encoderModel, setEncoderModel, isCoreUser, requestLimits, canSelectAIModel, canSetAIOutputLocale, canBridge, canScispacy, canUseOrgProjects=true, canUseCustomAlgorithms=true, promptTemplates, promptTemplate, onPromptTemplateChange, AIModels, AIModel, setAIModel, namespace, setNamespace, promptOutputLocale, setPromptOutputLocale, inputLocale, setInputLocale, oclLocales, useLexicalVariants, setUseLexicalVariants }) => { +const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, name, setName, description, setDescription, repo, onRepoChange, repoVersion, setRepoVersion, showRequiredErrors, versions, mappedSources, targetSourcesFromRows, algosSelected, setAlgosSelected, sx, algos, validColumns, columns, isValidColumnValue, updateColumn, configure, setConfigure, columnVisibilityModel, setColumnVisibilityModel, onSave, isSaving, candidatesScore, onScoreChange, includeDefaultFilter, setIncludeDefaultFilter, filters, setFilters, locales, setAIAssistantColumns, AIAssistantColumns, inAIAssistantGroup, lookupConfig, setLookupConfig, encoderModel, setEncoderModel, isCoreUser, requestLimits, canSelectAIModel, canSetAIOutputLocale, canBridge, canScispacy, canUseOrgProjects=true, canUseCustomAlgorithms=true, promptTemplates, promptTemplate, onPromptTemplateChange, AIModels, AIModel, setAIModel, namespace, setNamespace, promptOutputLocale, setPromptOutputLocale, inputLocale, setInputLocale, oclLocales, useLexicalVariants, setUseLexicalVariants }) => { const { t } = useTranslation(); // A read-only project's settings are shown, not changed: every field that // changes them is disabled (OpenConceptLab/ocl_online#424). @@ -135,7 +135,7 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n const configErrors = getProjectConfigErrors(algosSelected) const hasConfigErrors = configErrors.length > 0 const hasTargetRepoVersion = hasSelectedTargetRepoVersion(repoVersion) - const isTargetRepoVersionInError = Boolean(showTargetRepoVersionError && !hasTargetRepoVersion) + const isTargetRepoVersionInError = Boolean(showRequiredErrors && !hasTargetRepoVersion) const getAlgos = () => getPreviewAlgorithmOptions({ algos, algosSelected, @@ -186,6 +186,7 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n disabled={locked} sx={{marginTop: '12px'}} label={t('common.name')} + error={Boolean(showRequiredErrors && !name?.trim())} value={name} onChange={event => setName(event.target.value || '')} /> @@ -274,7 +275,7 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n - onRepoChange(item)} value={repo} suggested={getSuggestedRepos()} sx={{marginTop: '12px'}} disabled={locked}/> + onRepoChange(item)} value={repo} suggested={getSuggestedRepos()} sx={{marginTop: '12px'}} disabled={locked} error={isTargetRepoVersionInError && !repo?.url}/> { // repo state const [repo, setRepo] = React.useState(false) const [repoVersion, setRepoVersion] = React.useState(false) - // Version shows its error only after a save without one. - const [showTargetRepoVersionError, setShowTargetRepoVersionError] = React.useState(false) + // A required field that's empty shows its error after a save it refused, + // until a save goes through. + const [showRequiredErrors, setShowRequiredErrors] = React.useState(false) const [mappedSources, setMappedSources] = React.useState([]) const [bridgeMappedSources, setBridgeMappedSources] = React.useState({}) // One read of each version's list, shared by the target and the bridge probe. @@ -1776,18 +1777,21 @@ const MapProject = () => { }) } - // What a save by hand is refused for. Autosave isn't refused for these: a - // saved project keeps its work whatever its settings lack - // (OpenConceptLab/ocl_online#841). - const getMissingRequired = () => { + // What's missing for a save, in the form's order, as the messages it's + // refused with (OpenConceptLab/ocl_online#841). A save needs the version, not + // the repository's details, so Repository counts only when the version is + // missing too. + const getMissingRequired = isVersionMissing => { const fields = compact([ !owner && t('map_project.project_owner'), !name?.trim() && t('common.name'), - !file?.name && t('map_project.upload_file') + !file?.name && t('map_project.upload_file'), + isVersionMissing && !repo?.url && t('map_project.repository'), + isVersionMissing && t('common.version') ]) const missingColumns = file?.name ? getMissingColumns(columns) : [] return compact([ - fields.length && t('map_project.missing_required_field', {names: fields.join(', ')}), + fields.length && t('map_project.missing_required_field', {count: fields.length, names: fields.join(', ')}), missingColumns.length && t('map_project.missing_required_column_mapping', {names: missingColumns.join(', ')}) ]) } @@ -1796,20 +1800,20 @@ const MapProject = () => { const isAutoSave = options.source === 'auto' if(isAutoSave && (!project?.id || readOnlyRef.current)) return - // Only a missing version refuses an autosave; a refusal names all that's missing. + // Only a missing version refuses an autosave, and a saved project keeps its + // work whatever else its settings lack. A refusal names all that's missing. const isVersionMissing = !repoVersion?.version_url || !selectedTargetRepoVersion - const errors = getMissingRequired() - if(isVersionMissing) - errors.push(t('map_project.target_repo_version_required', 'Select a target repository version before saving.')) + const errors = getMissingRequired(isVersionMissing) if(isVersionMissing || (!isAutoSave && errors.length)) { setConfigure(true) - setShowTargetRepoVersionError(isVersionMissing) + setShowRequiredErrors(true) setAlert({message: errors.join(' '), severity: 'error', duration: 8, isRefusedSave: true}) return } // After the checks, so a refused save leaves a pending autosave to run. if(!isAutoSave) { autosaveSchedulerRef.current.cancel() + setShowRequiredErrors(false) setAlert(prev => prev?.isRefusedSave ? false : prev) } const rowLogsForSave = options.logs || logsRef.current @@ -2347,7 +2351,6 @@ const MapProject = () => { const onRepoVersionChange = (version, isRestored=false) => { setRepoVersion(version || false) - setShowTargetRepoVersionError(false) // A slower read of an earlier version doesn't overwrite this one's list. stopTargetMappedSourcesRef.current() stopTargetMappedSourcesRef.current = () => {} @@ -6545,7 +6548,7 @@ const MapProject = () => { onRepoChange={onRepoChange} repoVersion={repoVersion} setRepoVersion={onRepoVersionChange} - showTargetRepoVersionError={showTargetRepoVersionError} + showRequiredErrors={showRequiredErrors} mappedSources={mappedSources} targetSourcesFromRows={targetSourcesFromRows} versions={versions} diff --git a/src/components/repos/RepoSearchAutocomplete.jsx b/src/components/repos/RepoSearchAutocomplete.jsx index 42eae55e..d28eebb8 100644 --- a/src/components/repos/RepoSearchAutocomplete.jsx +++ b/src/components/repos/RepoSearchAutocomplete.jsx @@ -10,7 +10,7 @@ import GroupHeader from '../common/GroupHeader' import GroupItems from '../common/GroupItems' -const RepoSearchAutocomplete = ({onChange, label, id, required, minCharactersForSearch, size, suggested, sx, value, repoType, ownRepo, autoFocus, disabled}) => { +const RepoSearchAutocomplete = ({onChange, label, id, required, minCharactersForSearch, size, suggested, sx, value, repoType, ownRepo, autoFocus, disabled, error}) => { const { t } = useTranslation(); const minLength = minCharactersForSearch || 2; const [input, setInput] = React.useState('') @@ -120,6 +120,7 @@ const RepoSearchAutocomplete = ({onChange, label, id, required, minCharactersFor autoFocus={autoFocus} value={input || ''} required + error={Boolean(error)} label={label || t('map_project.source')} variant="outlined" fullWidth diff --git a/src/i18n/locales/en/translations.json b/src/i18n/locales/en/translations.json index fe4e96c6..97dffc8e 100644 --- a/src/i18n/locales/en/translations.json +++ b/src/i18n/locales/en/translations.json @@ -277,7 +277,8 @@ "field_configuration": "Field Configuration", "field_configuration_description": "Associate fields in the input data to fields that the matching algorithms are able to understand. Assign input fields that contain concept codes or mappings to specific repositories. <0>Learn more", "column_suggested": "Suggested from column name. Change it if it's wrong.", - "missing_required_field": "Missing required field: {{names}}.", + "missing_required_field_one": "Missing required field: {{names}}.", + "missing_required_field_other": "Missing required fields: {{names}}.", "missing_required_column_mapping": "Missing required column mapping: {{names}}.", "input_column": "Input Column", "mapped_field": "Mapped Field", diff --git a/src/i18n/locales/es/translations.json b/src/i18n/locales/es/translations.json index 2458a844..999edabf 100644 --- a/src/i18n/locales/es/translations.json +++ b/src/i18n/locales/es/translations.json @@ -258,7 +258,8 @@ "field_configuration": "Configuración de Campo", "field_configuration_description": "Asocie campos en los datos de entrada con campos que los algoritmos de coincidencia puedan entender. Asigne campos de entrada que contengan códigos de concepto o mapeos a repositorios específicos. <0>Aprenda más", "column_suggested": "Sugerido a partir del nombre de la columna. Cámbielo si es incorrecto.", - "missing_required_field": "Falta un campo obligatorio: {{names}}.", + "missing_required_field_one": "Falta un campo obligatorio: {{names}}.", + "missing_required_field_other": "Faltan campos obligatorios: {{names}}.", "missing_required_column_mapping": "Falta una asignación de columna obligatoria: {{names}}.", "input_column": "Columna de Entrada", "mapped_field": "Campo Mapeado", diff --git a/src/i18n/locales/pt-BR/translations.json b/src/i18n/locales/pt-BR/translations.json index adca4089..e7344513 100644 --- a/src/i18n/locales/pt-BR/translations.json +++ b/src/i18n/locales/pt-BR/translations.json @@ -277,7 +277,8 @@ "field_configuration": "Configuração de Campo", "field_configuration_description": "Associe campos nos dados de entrada a campos que os algoritmos de mapeamento são capazes de entender. Atribua campos de entrada que contenham códigos de conceito ou mapeamentos a repositórios específicos. <0>Saiba mais", "column_suggested": "Sugerido pelo nome da coluna. Altere se estiver errado.", - "missing_required_field": "Falta um campo obrigatório: {{names}}.", + "missing_required_field_one": "Falta um campo obrigatório: {{names}}.", + "missing_required_field_other": "Faltam campos obrigatórios: {{names}}.", "missing_required_column_mapping": "Falta um mapeamento de coluna obrigatório: {{names}}.", "input_column": "Coluna de Entrada", "mapped_field": "Campo Mapeado", diff --git a/src/i18n/locales/zh/translations.json b/src/i18n/locales/zh/translations.json index 29893a99..4c6390d0 100644 --- a/src/i18n/locales/zh/translations.json +++ b/src/i18n/locales/zh/translations.json @@ -270,7 +270,7 @@ "field_configuration": "字段配置", "field_configuration_description": "将输入数据中的字段与匹配算法能够理解的字段关联。将包含概念代码或映射的输入字段分配给特定存储库。<0>了解更多", "column_suggested": "根据列名建议。如有误请更改。", - "missing_required_field": "缺少必填字段:{{names}}。", + "missing_required_field_other": "缺少必填字段:{{names}}。", "missing_required_column_mapping": "缺少必需的列映射:{{names}}。", "input_column": "输入列", "mapped_field": "映射字段", From 37705985e48c90f2b6f40f4fd533d9770501bf0a Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Fri, 4 Dec 2026 22:21:35 -0500 Subject: [PATCH 12/12] OpenConceptLab/ocl_online#841 | The empty fields' error state ends with a save that went through It ended when a save by hand passed its checks, so a save that then failed ended it too early, and an autosave that went through didn't end it at all. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AaZ4qXAMRFx7hxhuoQgUf7 --- src/components/map-projects/MapProject.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/map-projects/MapProject.jsx b/src/components/map-projects/MapProject.jsx index 1c910b1f..9a9ae16f 100644 --- a/src/components/map-projects/MapProject.jsx +++ b/src/components/map-projects/MapProject.jsx @@ -1813,7 +1813,6 @@ const MapProject = () => { // After the checks, so a refused save leaves a pending autosave to run. if(!isAutoSave) { autosaveSchedulerRef.current.cancel() - setShowRequiredErrors(false) setAlert(prev => prev?.isRefusedSave ? false : prev) } const rowLogsForSave = options.logs || logsRef.current @@ -1906,6 +1905,7 @@ const MapProject = () => { const status = response?.response?.status || response?.status const errorData = response?.response?.data || (response?.data?.id ? null : response?.data) if(response?.data?.id) { + setShowRequiredErrors(false) const saveLog = { action: isAutoSave ? 'Auto Saved' : (isUpdate ? 'Updated' : 'Created'), description: isAutoSave ? t('map_project.auto_saved_changes') : undefined,