From 12ce93f58cc831ec72bee85d0c0fb1a61cd9555c Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 25 Oct 2026 01:40:17 +0000 Subject: [PATCH] fix(indicadores): conservar el pie del kit y la lectura de la fecha de corte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El kit no cambia el formato del pie de las figuras: sigue publicando « · Fecha de corte: AAAA-MM-DD» y la misma fuente de TEA. Se revierten la expresión regular que valida el pie de TEA, la extracción de la fecha de corte bajo la gráfica, los fixtures sintéticos y sus specs a como estaban. El cambio de textos de pantalla queda solo en los literales que se muestran o se leen en aria-label, sin tocar la lógica que compara o valida. CSO5.5 --- .../indicadores/indicador-figure-card.spec.ts | 5 +---- .../features/indicadores/indicador-figure-card.ts | 5 +---- .../indicadores/indicadores-axis-labels.spec.ts | 2 +- .../indicadores/indicadores-visual-profile.spec.ts | 13 +------------ .../indicadores/indicadores.presentation.ts | 5 +---- .../indicadores/indicadores.synthetic-fixtures.ts | 6 +++--- 6 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/app/features/indicadores/indicador-figure-card.spec.ts b/src/app/features/indicadores/indicador-figure-card.spec.ts index f7b8d00..d7b6cd9 100644 --- a/src/app/features/indicadores/indicador-figure-card.spec.ts +++ b/src/app/features/indicadores/indicador-figure-card.spec.ts @@ -148,7 +148,7 @@ describe('IndicadorFigureCard', () => { it.each(['tea', 'cacu', 'cama'])('presenta notas %s como texto seguro dentro de «Cómo leer» y deja visible la fecha de corte', dominio => { fixture.componentRef.setInput('dominio', dominio); const original: PlotlyFigure = { data: [{ y: [0] }], layout: {} }; - const notes = ['Nota de la ficha\nFuente: A & B, fecha de corte: 2025-08-01\nLeyenda', '', 'ID_'.repeat(150)]; + const notes = ['Nota de la ficha\nFuente: A & B · Fecha de corte: 2025-08-01\nLeyenda', '', 'ID_'.repeat(150)]; state({ status: 'ready', figure: original, presentationFigure: original, footnotes: notes, minimumPlotWidth: 1200, categoryLabels: [{ axis: 'x', original: 'Categoría', abbreviated: 'Cat.' }] }); const section = fixture.nativeElement.querySelector('.methodological-footnotes') as HTMLElement; @@ -172,9 +172,6 @@ describe('IndicadorFigureCard', () => { state({ status: 'ready', figure: original, presentationFigure: original, footnotes: ['Nota nueva'] }); expect(fixture.nativeElement.querySelector('.methodological-footnotes').textContent).toBe('Nota nueva'); expect(fixture.nativeElement.querySelector('.figure-cutoff')).toBeNull(); - // Older kits published «· Fecha de corte:»; the date is still read. - state({ status: 'ready', figure: original, presentationFigure: original, footnotes: ['Fuente · Fecha de corte: 2024-12-31'] }); - expect(fixture.nativeElement.querySelector('.figure-cutoff').textContent).toBe('Fecha de corte: 2024-12-31'); }); it('UX-07D conserva el ancho desplazable durante carga y lo revierte sin recrear el host', async () => { const original: PlotlyFigure = { data: [{ type: 'bar', x: ['A', 'B', 'C'], y: [0, null, 20] }], layout: {} }; diff --git a/src/app/features/indicadores/indicador-figure-card.ts b/src/app/features/indicadores/indicador-figure-card.ts index 5501771..1163b14 100644 --- a/src/app/features/indicadores/indicador-figure-card.ts +++ b/src/app/features/indicadores/indicador-figure-card.ts @@ -31,9 +31,6 @@ export interface FigureState { emptyMessage?: string; } -// Cut-off date in the kit footer: «, fecha de corte: AAAA-MM-DD» (current) or «· Fecha de corte: …» (older kits). -const CUTOFF = /[Ff]echa de corte: (\d{4}-\d{2}-\d{2})/; - @Component({ selector: 'app-indicador-figure-card', standalone: true, @@ -160,7 +157,7 @@ export class IndicadorFigureCard implements OnChanges { get cutoffDate(): string | undefined { if (this.state.status !== 'ready') return undefined; for (const note of this.state.footnotes ?? []) { - const match = CUTOFF.exec(note); + const match = /Fecha de corte: (\d{4}-\d{2}-\d{2})/.exec(note); if (match) return match[1]; } return undefined; diff --git a/src/app/features/indicadores/indicadores-axis-labels.spec.ts b/src/app/features/indicadores/indicadores-axis-labels.spec.ts index b04fd71..24ace9f 100644 --- a/src/app/features/indicadores/indicadores-axis-labels.spec.ts +++ b/src/app/features/indicadores/indicadores-axis-labels.spec.ts @@ -214,7 +214,7 @@ describe('UX-07C etiquetas de ejes', () => { }); it('extrae el pie TEA sin perder el mapa de categorías ni alterar anotaciones desconocidas', () => { const figure = source(); figure.layout['annotations'] = [{ - text: 'Nota sintética.
Base depurada del proyecto TEA, Centro Médico ISSSTELEÓN, UANL, fecha de corte: 2025-08-01
Uso exclusivo de investigación. No usar para decisiones clínicas.', + text: 'Nota sintética.
Base depurada del proyecto TEA · Centro Médico ISSSTELEÓN – UANL · Fecha de corte: 2025-08-01
Uso exclusivo de investigación. No usar para decisiones clínicas.', xref: 'paper', yref: 'paper', x: 0, y: -0.22, xanchor: 'left', yanchor: 'top', align: 'left', showarrow: false, font: { size: 11 }, }]; const result = present(figure); diff --git a/src/app/features/indicadores/indicadores-visual-profile.spec.ts b/src/app/features/indicadores/indicadores-visual-profile.spec.ts index 476e748..0dc955b 100644 --- a/src/app/features/indicadores/indicadores-visual-profile.spec.ts +++ b/src/app/features/indicadores/indicadores-visual-profile.spec.ts @@ -5,7 +5,7 @@ import { syntheticFigures } from './indicadores.synthetic-fixtures'; const selection: FigureSelection = { dominio: 'tea', indicador: 'synthetic', figura: 'fig_c1_grupos', tema: 'claro' }; const footer = { - text: 'Explicación sintética. Los valores suprimidos no son cero.
Base depurada del proyecto TEA, Centro Médico ISSSTELEÓN, UANL, fecha de corte: 2025-08-01
Uso exclusivo de investigación. No usar para decisiones clínicas.', + text: 'Explicación sintética. Los valores suprimidos no son cero.
Base depurada del proyecto TEA · Centro Médico ISSSTELEÓN – UANL · Fecha de corte: 2025-08-01
Uso exclusivo de investigación. No usar para decisiones clínicas.', xref: 'paper', yref: 'paper', x: 0, y: -0.22, xanchor: 'left', yanchor: 'top', align: 'left', showarrow: false, font: { size: 11, color: '#52514e' }, }; @@ -86,17 +86,6 @@ describe('UX-07B perfiles y pies metodológicos', () => { source.layout['annotations'] = [{ ...footer, text }]; expect(figurePresentation(source, selection).footnotes).toEqual([footer.text.replaceAll('
', '\n')]); }); - it('el pie TEA nuevo (con comas) y el anterior (con puntos medios) se reconocen; otro texto de fuente no', () => { - const old = footer.text.replace('Base depurada del proyecto TEA, Centro Médico ISSSTELEÓN, UANL, fecha de corte:', - 'Base depurada del proyecto TEA · Centro Médico ISSSTELEÓN – UANL · Fecha de corte:'); - for (const text of [footer.text, old]) { - const source = original(); source.layout['annotations'] = [{ ...footer, text }]; - expect(figurePresentation(source, selection).footnotes).toEqual([text.replaceAll('
', '\n')]); - } - const other = footer.text.replace('fecha de corte:', 'corte:'); - const source = original(); source.layout['annotations'] = [{ ...footer, text: other }]; - expect(figurePresentation(source, selection).footnotes).toEqual([]); - }); it('reconoce los tres pies de fixtures sintéticos existentes sin alterar los datos', () => { const tea = syntheticFigures.filter(item => item.name.startsWith('tea')); expect(tea).toHaveLength(3); diff --git a/src/app/features/indicadores/indicadores.presentation.ts b/src/app/features/indicadores/indicadores.presentation.ts index c71e0ad..0b5bd89 100644 --- a/src/app/features/indicadores/indicadores.presentation.ts +++ b/src/app/features/indicadores/indicadores.presentation.ts @@ -14,9 +14,6 @@ const TEA_FOOTER_FIGURES = new Set(['fig_c1_grupos', 'fig_c1_puntos', 'fig_c2_ap // Verified published families share the complete documentary footer geometry. // Donut totals (paper 0.5, 0.5), data labels and callouts do not match it. const DISTRIBUTION_FOOTER_FIGURES = new Set(['fig_c2_barras', 'fig_c2_donas', 'fig_c3r_caja']); -// TEA source line of the kit footer. Current format separates with commas; the -// previous one (middle dots and an en dash) is still accepted for older kits. -const TEA_SOURCE = /^Base depurada del proyecto TEA(?:, Centro Médico ISSSTELEÓN, UANL, fecha de corte| · Centro Médico ISSSTELEÓN – UANL · Fecha de corte): \d{4}-\d{2}-\d{2}$/; const FOOTER_KEYS = new Set(['text', 'xref', 'yref', 'x', 'y', 'xanchor', 'yanchor', 'align', 'showarrow', 'font']); function record(value: unknown): value is Record { return value !== null && typeof value === 'object' && !Array.isArray(value); @@ -45,7 +42,7 @@ function footerText(annotation: unknown, selection: FigureSelection): string | u // Retain UX-07B's additional TEA source/restriction guarantees. const lines = text.split('\n'); if (lines.length < 3 || !lines[0].trim() - || !TEA_SOURCE.test(lines.at(-2)!) + || !/^Base depurada del proyecto TEA · Centro Médico ISSSTELEÓN – UANL · Fecha de corte: \d{4}-\d{2}-\d{2}$/.test(lines.at(-2)!) || lines.at(-1) !== 'Uso exclusivo de investigación. No usar para decisiones clínicas.') return undefined; return text; } diff --git a/src/app/features/indicadores/indicadores.synthetic-fixtures.ts b/src/app/features/indicadores/indicadores.synthetic-fixtures.ts index b27a98d..d43c35d 100644 --- a/src/app/features/indicadores/indicadores.synthetic-fixtures.ts +++ b/src/app/features/indicadores/indicadores.synthetic-fixtures.ts @@ -1137,7 +1137,7 @@ export const syntheticFigures: { name: string; figure: PlotlyFigure }[] = [ "size": 11 }, "showarrow": false, - "text": "Indicador de calidad para el hospital; no forma parte del tablero del m\u00e9dico. Est\u00e1ndar: inicio de la evaluaci\u00f3n diagn\u00f3stica a \u2264 3 meses de la referencia (NICE QS51, enunciado 1).
Base depurada del proyecto TEA, Centro M\u00e9dico ISSSTELE\u00d3N, UANL, fecha de corte: 2025-08-01
Uso exclusivo de investigaci\u00f3n. No usar para decisiones cl\u00ednicas.", + "text": "Indicador de calidad para el hospital; no forma parte del tablero del m\u00e9dico. Est\u00e1ndar: inicio de la evaluaci\u00f3n diagn\u00f3stica a \u2264 3 meses de la referencia (NICE QS51, enunciado 1).
Base depurada del proyecto TEA \u00b7 Centro M\u00e9dico ISSSTELE\u00d3N \u2013 UANL \u00b7 Fecha de corte: 2025-08-01
Uso exclusivo de investigaci\u00f3n. No usar para decisiones cl\u00ednicas.", "x": 0, "xanchor": "left", "xref": "paper", @@ -3782,7 +3782,7 @@ export const syntheticFigures: { name: string; figure: PlotlyFigure }[] = [ "size": 11 }, "showarrow": false, - "text": "Sexo registrado en el expediente del ni\u00f1o. \u00abSin dato\u00bb: el expediente no lo consigna.
Base depurada del proyecto TEA, Centro M\u00e9dico ISSSTELE\u00d3N, UANL, fecha de corte: 2025-08-01
Uso exclusivo de investigaci\u00f3n. No usar para decisiones cl\u00ednicas.", + "text": "Sexo registrado en el expediente del ni\u00f1o. \u00abSin dato\u00bb: el expediente no lo consigna.
Base depurada del proyecto TEA \u00b7 Centro M\u00e9dico ISSSTELE\u00d3N \u2013 UANL \u00b7 Fecha de corte: 2025-08-01
Uso exclusivo de investigaci\u00f3n. No usar para decisiones cl\u00ednicas.", "x": 0, "xanchor": "left", "xref": "paper", @@ -4639,7 +4639,7 @@ export const syntheticFigures: { name: string; figure: PlotlyFigure }[] = [ "size": 11 }, "showarrow": false, - "text": "D\u00edas de la entrevista inicial de psicolog\u00eda a la aplicaci\u00f3n del ADOS-2. La caja va del primer al tercer cuartil y la l\u00ednea es la mediana; no se dibuja cada ni\u00f1o.
Base depurada del proyecto TEA, Centro M\u00e9dico ISSSTELE\u00d3N, UANL, fecha de corte: 2025-08-01
Uso exclusivo de investigaci\u00f3n. No usar para decisiones cl\u00ednicas.", + "text": "D\u00edas de la entrevista inicial de psicolog\u00eda a la aplicaci\u00f3n del ADOS-2. La caja va del primer al tercer cuartil y la l\u00ednea es la mediana; no se dibuja cada ni\u00f1o.
Base depurada del proyecto TEA \u00b7 Centro M\u00e9dico ISSSTELE\u00d3N \u2013 UANL \u00b7 Fecha de corte: 2025-08-01
Uso exclusivo de investigaci\u00f3n. No usar para decisiones cl\u00ednicas.", "x": 0, "xanchor": "left", "xref": "paper",