Decir que la paciente ya fue tratada y nombrar el grado de la citología de referencia

This commit is contained in:
2026-12-04 16:47:40 -06:00
parent c28cf31e2a
commit c128448317
4 changed files with 13 additions and 9 deletions
+1 -3
View File
@@ -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(); expect(patientId, 'a synthetic patient with a published post-treatment exclusion').toBeDefined();
await open(page, `/indicadores/cacu/pacientes/${patientId}`); await open(page, `/indicadores/cacu/pacientes/${patientId}`);
const box = riskBox(page); const box = riskBox(page);
await expect(box.getByRole('status')).toHaveText( await expect(box.getByRole('status')).toHaveText(/paciente ya tratada\.$/);
'No disponible por: Sin biopsia previa al tratamiento en el periodo requerido.',
);
await expect(box.locator('app-risk-scales')).toHaveCount(0); await expect(box.locator('app-risk-scales')).toHaveCount(0);
await expect(page.locator('[data-section=elegibilidad]')).toHaveCount(0); await expect(page.locator('[data-section=elegibilidad]')).toHaveCount(0);
}); });
+6
View File
@@ -28,4 +28,10 @@ describe('ineligibility', () => {
expect(ineligibility(state, 'case', '2025-06-01')).toBeUndefined(); expect(ineligibility(state, 'case', '2025-06-01')).toBeUndefined();
expect(ineligibility({ kind: 'error' }, 'pre_colposcopy', '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);
});
}); });
+3 -5
View File
@@ -5,7 +5,6 @@ import type { EligibilityState } from './eligibility';
const SCENARIOS: Record<string, string[]> = { const SCENARIOS: Record<string, string[]> = {
pre_colposcopy: ['pre_colposcopy', 'surveillance'], pre_colposcopy: ['pre_colposcopy', 'surveillance'],
post_colposcopy: ['post_colposcopy'], 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 /** 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, status: string,
day: string, day: string,
): string | undefined { ): 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; if (state.kind !== 'evaluated') return undefined;
for (const scenario of SCENARIOS[status] ?? []) { for (const scenario of SCENARIOS[status] ?? []) {
// visits come latest first // visits come latest first
@@ -27,8 +28,5 @@ export function ineligibility(
: `No disponible por: ${latest.reasons.map((r) => r.text).join('; ')}.`; : `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 undefined;
return status === 'post_treatment'
? 'No disponible por: Escenario que la plataforma no evalúa por ahora.'
: undefined;
} }
+3 -1
View File
@@ -331,7 +331,7 @@ export class RiskScales {
hpv: 'VPH', hpv: 'VPH',
hpv_positive: 'VPH', hpv_positive: 'VPH',
hpv_16_18: 'VPH 16/18', hpv_16_18: 'VPH 16/18',
referral_grade: 'Referencia', referral_grade: 'Citología de referencia',
bethesda: 'Citología', bethesda: 'Citología',
hpv_16: 'VPH 16', hpv_16: 'VPH 16',
hpv_18: 'VPH 18', hpv_18: 'VPH 18',
@@ -339,6 +339,8 @@ export class RiskScales {
)[name] ?? name; )[name] ?? name;
protected readonly inputValue = (name: string, value: unknown) => { protected readonly inputValue = (name: string, value: unknown) => {
if (value === null || value === undefined) return 'No documentado'; 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')) if (name.startsWith('hpv') && (value === 0 || value === 1 || typeof value === 'boolean'))
return value ? 'Positivo' : 'Negativo'; return value ? 'Positivo' : 'Negativo';
if (name.startsWith('hpv') && value === 'positive') return 'Positivo'; if (name.startsWith('hpv') && value === 'positive') return 'Positivo';