integrating latest dashboard changes

This commit is contained in:
Roberto Treviño Cervantes
2026-10-26 01:42:32 -06:00
parent d9245fe9b7
commit 51517ddf61
85 changed files with 7754 additions and 320 deletions
@@ -1,7 +1,7 @@
import { TargetMeta } from '../api/api.types';
import { suggestTarget, words } from './target-suggester';
const targets = ['Paciente', 'OrdenesEstudio', 'NotaMedica', 'BiopsiaCervical', 'BiometriaHematica'].map(
const targets = ['Paciente', 'OrdenesEstudio', 'CitologiaCervical', 'NotaMedica', 'BiopsiaCervical', 'BiometriaHematica'].map(
(table) => ({ key: `cacu.${table}`, domain: 'cacu', table, conflict_fields: null, fields: [] }) as TargetMeta,
);
@@ -19,6 +19,10 @@ describe('suggestTarget', () => {
// Nothing in the table's own name — fall back to the connection's.
['Tabla 1 · pág. 1', 'cacu_biopsias_reporte.pdf', 'BiopsiaCervical'],
['Regiones 1', 'pacientes_escaneados.pdf', 'Paciente'],
// Hospital tables named without separators.
['citologiacervical', 'hospital_cacu', 'CitologiaCervical'],
['biopsiacervical', 'hospital_cacu', 'BiopsiaCervical'],
['notamedica', 'hospital_cacu', 'NotaMedica'],
])('%s (%s) → %s', (table, connection, expected) => {
expect(suggestTarget(table, targets, connection)?.table).toBe(expected);
});
+6 -2
View File
@@ -25,9 +25,13 @@ function forms(word: string): string[] {
return result;
}
/** Run-together names ("citologiacervical") count a target word found inside them. */
function overlap(sourceText: string, targetText: string): number {
const source = new Set(words(sourceText).flatMap(forms));
return words(targetText).filter((word) => forms(word).some((form) => source.has(form))).length;
const sourceWords = words(sourceText);
const source = new Set(sourceWords.flatMap(forms));
const matches = (form: string) =>
source.has(form) || (form.length > 3 && sourceWords.some((word) => word.includes(form)));
return words(targetText).filter((word) => forms(word).some(matches)).length;
}
/**