CaMa record: the recurrence analysis only for patients after treatment
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
<mat-card class="prognosis-card" appearance="outlined" aria-labelledby="pronostico-title">
|
<mat-card class="prognosis-card" appearance="outlined" aria-labelledby="pronostico-title">
|
||||||
<mat-card-header><h3 id="pronostico-title">Pronóstico y recomendaciones</h3></mat-card-header>
|
<mat-card-header><h3 id="pronostico-title">Pronóstico y recomendaciones</h3></mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
@if (p.idField === 'pac_id') { <app-cama-analisis-recurrencia [pacId]="p.patientId" /> }
|
@if (p.idField === 'pac_id' && p.clinicalScenario === postTreatment) { <app-cama-analisis-recurrencia [pacId]="p.patientId" /> }
|
||||||
<section aria-labelledby="recomendaciones-pronostico-title">
|
<section aria-labelledby="recomendaciones-pronostico-title">
|
||||||
<h5 id="recomendaciones-pronostico-title">Recomendaciones</h5>
|
<h5 id="recomendaciones-pronostico-title">Recomendaciones</h5>
|
||||||
<p class="availability">{{ recommendationsUnavailable }}</p>
|
<p class="availability">{{ recommendationsUnavailable }}</p>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { CamaPatientSummary, RECOMMENDATIONS_UNAVAILABLE, toCamaPatientSummary }
|
|||||||
const rows = () => seguimientoTablaResponse(structuredClone(fixtureData)).items;
|
const rows = () => seguimientoTablaResponse(structuredClone(fixtureData)).items;
|
||||||
const complete = () => rows().find(r => r['biopsia'] !== null && r['dias_mastografia_diagnostico'] !== null)!;
|
const complete = () => rows().find(r => r['biopsia'] !== null && r['dias_mastografia_diagnostico'] !== null)!;
|
||||||
const incomplete = () => rows().find(r => r['biopsia'] === 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', () => {
|
describe('Ficha CaMa: resumen', () => {
|
||||||
// Fails if a field of the row is mapped to another one or lost on the way to the card.
|
// 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
|
// 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.
|
// 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)', () => {
|
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 card = (selector: string) => root().querySelector(selector) as HTMLElement;
|
||||||
const subsections = (selector: string) => [...card(selector).querySelectorAll('h5')].map(h => h.textContent!.trim());
|
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/);
|
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.
|
// 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', () => {
|
it('moves focus to its title when it opens', () => {
|
||||||
montar(toCamaPatientSummary(complete(), '2026-10-20')!);
|
montar(toCamaPatientSummary(complete(), '2026-10-20')!);
|
||||||
|
|||||||
@@ -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
|
* 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
|
* 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({
|
@Component({
|
||||||
selector: 'app-cama-patient-card',
|
selector: 'app-cama-patient-card',
|
||||||
@@ -24,6 +24,8 @@ export class CamaPatientCard implements AfterViewInit {
|
|||||||
readonly summary = input.required<CamaPatientSummary>();
|
readonly summary = input.required<CamaPatientSummary>();
|
||||||
readonly back = output<void>();
|
readonly back = output<void>();
|
||||||
readonly notAvailable = NOT_AVAILABLE;
|
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;
|
readonly recommendationsUnavailable = RECOMMENDATIONS_UNAVAILABLE;
|
||||||
private readonly title = viewChild<ElementRef<HTMLElement>>('title');
|
private readonly title = viewChild<ElementRef<HTMLElement>>('title');
|
||||||
readonly generating = signal(false);
|
readonly generating = signal(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user