diff --git a/e2e/ficha-cacu.spec.ts b/e2e/ficha-cacu.spec.ts index 6464fac..ca2f7b2 100644 --- a/e2e/ficha-cacu.spec.ts +++ b/e2e/ficha-cacu.spec.ts @@ -1467,9 +1467,7 @@ test('elegibilidad: the risk section shows the published post-treatment exclusio expect(patientId, 'a synthetic patient with a published post-treatment exclusion').toBeDefined(); await open(page, `/indicadores/cacu/pacientes/${patientId}`); const box = riskBox(page); - await expect(box.getByRole('status')).toHaveText( - 'No disponible por: Sin biopsia previa al tratamiento en el periodo requerido.', - ); + await expect(box.getByRole('status')).toHaveText(/paciente ya tratada\.$/); await expect(box.locator('app-risk-scales')).toHaveCount(0); await expect(page.locator('[data-section=elegibilidad]')).toHaveCount(0); }); diff --git a/src/app/paciente/ineligibility.spec.ts b/src/app/paciente/ineligibility.spec.ts index 2b3db1a..226baf7 100644 --- a/src/app/paciente/ineligibility.spec.ts +++ b/src/app/paciente/ineligibility.spec.ts @@ -28,4 +28,10 @@ describe('ineligibility', () => { expect(ineligibility(state, 'case', '2025-06-01')).toBeUndefined(); expect(ineligibility({ kind: 'error' }, 'pre_colposcopy', '2025-06-01')).toBeUndefined(); }); + + it('says of a treated patient only that she was already treated', () => { + const text = 'No disponible por: paciente ya tratada.'; + expect(ineligibility(state, 'post_treatment', '2025-06-01')).toBe(text); + expect(ineligibility({ kind: 'error' }, 'post_treatment', '2025-06-01')).toBe(text); + }); }); diff --git a/src/app/paciente/ineligibility.ts b/src/app/paciente/ineligibility.ts index 760fb17..a642cb9 100644 --- a/src/app/paciente/ineligibility.ts +++ b/src/app/paciente/ineligibility.ts @@ -5,7 +5,6 @@ import type { EligibilityState } from './eligibility'; const SCENARIOS: Record = { pre_colposcopy: ['pre_colposcopy', 'surveillance'], post_colposcopy: ['post_colposcopy'], - post_treatment: ['post_treatment'], }; /** What the risk section says when she is not eligible in her clinical scenario, from its latest @@ -15,6 +14,8 @@ export function ineligibility( status: string, day: string, ): string | undefined { + // a treated patient has no risk estimate, whatever visit was indexed + if (status === 'post_treatment') return 'No disponible por: paciente ya tratada.'; if (state.kind !== 'evaluated') return undefined; for (const scenario of SCENARIOS[status] ?? []) { // visits come latest first @@ -27,8 +28,5 @@ export function ineligibility( : `No disponible por: ${latest.reasons.map((r) => r.text).join('; ')}.`; } } - // after treatment the platform shows no risk for now, whether or not it indexed a visit - return status === 'post_treatment' - ? 'No disponible por: Escenario que la plataforma no evalúa por ahora.' - : undefined; + return undefined; } diff --git a/src/app/paciente/risk-scales.ts b/src/app/paciente/risk-scales.ts index 9d701e1..5ad256a 100644 --- a/src/app/paciente/risk-scales.ts +++ b/src/app/paciente/risk-scales.ts @@ -331,7 +331,7 @@ export class RiskScales { hpv: 'VPH', hpv_positive: 'VPH', hpv_16_18: 'VPH 16/18', - referral_grade: 'Referencia', + referral_grade: 'Citología de referencia', bethesda: 'Citología', hpv_16: 'VPH 16', hpv_18: 'VPH 18', @@ -339,6 +339,8 @@ export class RiskScales { )[name] ?? name; protected readonly inputValue = (name: string, value: unknown) => { if (value === null || value === undefined) return 'No documentado'; + if (name === 'referral_grade' && (value === 'high' || value === 'low')) + return value === 'high' ? 'Alto grado' : 'Bajo grado'; if (name.startsWith('hpv') && (value === 0 || value === 1 || typeof value === 'boolean')) return value ? 'Positivo' : 'Negativo'; if (name.startsWith('hpv') && value === 'positive') return 'Positivo';