Decir que la paciente ya fue tratada y nombrar el grado de la citología de referencia
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { EligibilityState } from './eligibility';
|
||||
const SCENARIOS: Record<string, string[]> = {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user