From 72e5f9bf93363c92bda723cfffcc265da49708b5 Mon Sep 17 00:00:00 2001 From: rockdrigo Date: Sat, 21 Nov 2026 14:57:30 -0600 Subject: [PATCH] CaMa record: the recurrence analysis only for patients after treatment --- .../paciente-detalle/cama/cama-patient-card.html | 2 +- .../cama/cama-patient-card.spec.ts | 14 ++++++++++++-- .../paciente-detalle/cama/cama-patient-card.ts | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.html b/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.html index 949fd51..eb4fcfc 100644 --- a/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.html +++ b/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.html @@ -37,7 +37,7 @@

Pronóstico y recomendaciones

- @if (p.idField === 'pac_id') { } + @if (p.idField === 'pac_id' && p.clinicalScenario === postTreatment) { }
Recomendaciones

{{ recommendationsUnavailable }}

diff --git a/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.spec.ts b/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.spec.ts index 34d00ad..d3dd5fe 100644 --- a/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.spec.ts +++ b/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.spec.ts @@ -14,7 +14,7 @@ import { CamaPatientSummary, RECOMMENDATIONS_UNAVAILABLE, toCamaPatientSummary } const rows = () => seguimientoTablaResponse(structuredClone(fixtureData)).items; const complete = () => rows().find(r => r['biopsia'] !== null && r['dias_mastografia_diagnostico'] !== null)!; const incomplete = () => rows().find(r => r['biopsia'] === null)!; -const withPacId = () => ({ ...complete(), pac_id: '7', id_seudonimo: null }); +const withPacId = (escenario: string | null = null) => ({ ...complete(), pac_id: '7', id_seudonimo: null, escenario_clinico: escenario }); describe('Ficha CaMa: resumen', () => { // Fails if a field of the row is mapped to another one or lost on the way to the card. @@ -84,7 +84,7 @@ describe('Ficha CaMa: componente', () => { // Fails if the cards or their subsections leave the order and the names of the specification: recurrence first, then death, each with // its risk factors, and the recommendations unchanged (not available) in both. it('has "Pronóstico y recomendaciones" (recurrence, risk factors, recommendations) before "Riesgo de muerte" (survival, risk factors, recommendations)', () => { - montar(toCamaPatientSummary(withPacId(), '2026-10-20')!); + montar(toCamaPatientSummary(withPacId('Post-tratamiento'), '2026-10-20')!); const card = (selector: string) => root().querySelector(selector) as HTMLElement; const subsections = (selector: string) => [...card(selector).querySelectorAll('h5')].map(h => h.textContent!.trim()); @@ -95,6 +95,16 @@ describe('Ficha CaMa: componente', () => { expect(root().textContent).not.toMatch(/Información simulada|Entorno DEV|Riesgo individual CaMa|Probabilidad de recurrencia|Factores pronóstico/); }); + // Fails if a patient who has not been treated is shown the recurrence analysis (and its factors), which only makes sense after treatment. + it('shows the recurrence analysis only to a patient after treatment', () => { + montar(toCamaPatientSummary(withPacId('En observación'), '2026-10-20')!); + const subsections = (selector: string) => [...(root().querySelector(selector) as HTMLElement).querySelectorAll('h5')].map(h => h.textContent!.trim()); + + expect(subsections('.prognosis-card')).toEqual(['Recomendaciones']); + expect(subsections('.risk-card')).toEqual(['Análisis de supervivencia', 'Factores de riesgo', 'Recomendaciones']); + expect(root().textContent).not.toContain('Análisis de recurrencia'); + }); + // Fails if the record opens without moving focus to its title, which strands keyboard and screen-reader users. it('moves focus to its title when it opens', () => { montar(toCamaPatientSummary(complete(), '2026-10-20')!); diff --git a/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.ts b/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.ts index eb09566..04c8d89 100644 --- a/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.ts +++ b/src/app/features/indicadores/paciente-detalle/cama/cama-patient-card.ts @@ -12,7 +12,7 @@ import { /** * Individual record of a CaMa follow-up patient. It shows what the follow-up list carries, the recurrence analysis with its risk * factors ("Pronóstico y recomendaciones") and the survival analysis with its risk factors ("Riesgo de muerte"), one clinical - * scenario at a time; the recommendations are not available yet. + * scenario at a time (the recurrence analysis only for patients after treatment); the recommendations are not available yet. */ @Component({ selector: 'app-cama-patient-card', @@ -24,6 +24,8 @@ export class CamaPatientCard implements AfterViewInit { readonly summary = input.required(); readonly back = output(); readonly notAvailable = NOT_AVAILABLE; + /** The recurrence analysis is for patients who have been treated: it is shown only in this clinical scenario. */ + readonly postTreatment = 'Post-tratamiento'; readonly recommendationsUnavailable = RECOMMENDATIONS_UNAVAILABLE; private readonly title = viewChild>('title'); readonly generating = signal(false);