Mostrar el motivo de exclusión en la ficha CaCu
This commit is contained in:
@@ -117,6 +117,37 @@ async function open(page: Page, url: string) {
|
|||||||
await expect(historial(page)).toBeVisible({ timeout: 120_000 });
|
await expect(historial(page)).toBeVisible({ timeout: 120_000 });
|
||||||
await expect(page.locator('app-loading')).toHaveCount(0, { timeout: 60_000 });
|
await expect(page.locator('app-loading')).toHaveCount(0, { timeout: 60_000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test('ficha (simulado): states why a hysterectomy makes this risk assessment unavailable', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const { url, sample } = await firstRecord(page);
|
||||||
|
const previousDay = plus(sample, -1);
|
||||||
|
await page.route('**/api/cacu/fhir/Patient/*', async (route) => {
|
||||||
|
const response = await route.fetch();
|
||||||
|
const patient = await response.json();
|
||||||
|
patient.extension = [
|
||||||
|
...(patient.extension ?? []),
|
||||||
|
{ url: EXT + 'first-hysterectomy-recorded', valueDate: sample },
|
||||||
|
];
|
||||||
|
await route.fulfill({ response, json: patient });
|
||||||
|
});
|
||||||
|
await withRisks(page, [risk('past', 'Modelo v1', 'cacu.cin2_pim', previousDay, [[5, 0.2]])]);
|
||||||
|
|
||||||
|
await open(page, url);
|
||||||
|
await expect(
|
||||||
|
page.getByText('Sin estimación de riesgo por antecedente de histerectomía', {
|
||||||
|
exact: false,
|
||||||
|
}),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(page.locator('app-risk-scales')).toHaveCount(0);
|
||||||
|
|
||||||
|
const historical = new URL(url, 'http://example.test');
|
||||||
|
historical.searchParams.set('citologia', previousDay);
|
||||||
|
await open(page, historical.pathname + historical.search);
|
||||||
|
await expect(page.locator('app-risk-scales')).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
/** Where a scale draws its marker, in % of the bar, and the figure it prints. */
|
/** Where a scale draws its marker, in % of the bar, and the figure it prints. */
|
||||||
async function drawn(scaleBox: Locator) {
|
async function drawn(scaleBox: Locator) {
|
||||||
const marker = scaleBox.locator('.risk-marker');
|
const marker = scaleBox.locator('.risk-marker');
|
||||||
|
|||||||
@@ -258,9 +258,13 @@
|
|||||||
><mat-card-title>Riesgos y recomendaciones</mat-card-title></mat-card-header
|
><mat-card-title>Riesgos y recomendaciones</mat-card-title></mat-card-header
|
||||||
>
|
>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<app-risk-scales [groups]="groups()" />
|
@if (riskExclusion(); as reason) {
|
||||||
@if (reference.value(); as ref) {
|
<p role="status">{{ reason }}</p>
|
||||||
<app-reference-risk [view]="ref" />
|
} @else {
|
||||||
|
<app-risk-scales [groups]="groups()" />
|
||||||
|
@if (reference.value(); as ref) {
|
||||||
|
<app-reference-risk [view]="ref" />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@if (models().length) {
|
@if (models().length) {
|
||||||
<table class="plain">
|
<table class="plain">
|
||||||
@@ -303,7 +307,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<app-plot [figure]="curve()" [height]="300" />
|
<app-plot [figure]="curve()" [height]="300" />
|
||||||
</details>
|
</details>
|
||||||
} @else {
|
} @else if (!riskExclusion()) {
|
||||||
<p class="muted">Sin evaluación de un modelo en producción.</p>
|
<p class="muted">Sin evaluación de un modelo en producción.</p>
|
||||||
}
|
}
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|||||||
@@ -148,6 +148,16 @@ export class Paciente {
|
|||||||
});
|
});
|
||||||
protected readonly cutoff = computed(() => this.corte() ?? new Date().toLocaleDateString('sv'));
|
protected readonly cutoff = computed(() => this.corte() ?? new Date().toLocaleDateString('sv'));
|
||||||
protected readonly age = computed(() => ageAt(this.patient()?.birthDate, this.cutoff()));
|
protected readonly age = computed(() => ageAt(this.patient()?.birthDate, this.cutoff()));
|
||||||
|
protected readonly riskExclusion = computed(() => {
|
||||||
|
if (this.domain() !== 'cacu') return undefined;
|
||||||
|
const patient = this.patient();
|
||||||
|
const recorded = patient && ext(patient, 'first-hysterectomy-recorded')?.valueDate;
|
||||||
|
const sample = this.citologia()?.slice(0, 10);
|
||||||
|
const index = sample && sample < this.cutoff() ? sample : this.cutoff();
|
||||||
|
return recorded && recorded <= index
|
||||||
|
? `Sin estimación de riesgo por antecedente de histerectomía registrado el ${recorded}.`
|
||||||
|
: undefined;
|
||||||
|
});
|
||||||
/** CaCu: the route of the cytology she was opened at, else of her latest, by the cut-off. */
|
/** CaCu: the route of the cytology she was opened at, else of her latest, by the cut-off. */
|
||||||
protected readonly stages = computed(() => {
|
protected readonly stages = computed(() => {
|
||||||
const cytologies = (this.data.value()?.reports ?? []).filter(
|
const cytologies = (this.data.value()?.reports ?? []).filter(
|
||||||
@@ -207,6 +217,7 @@ export class Paciente {
|
|||||||
['Estatus de seguimiento', this.status()],
|
['Estatus de seguimiento', this.status()],
|
||||||
['Fecha de corte', this.cutoff()],
|
['Fecha de corte', this.cutoff()],
|
||||||
];
|
];
|
||||||
|
if (this.riskExclusion()) facts.push(['Evaluación de riesgo', this.riskExclusion()]);
|
||||||
const sheets = recordSheets(
|
const sheets = recordSheets(
|
||||||
facts,
|
facts,
|
||||||
this.stages() ?? [],
|
this.stages() ?? [],
|
||||||
@@ -270,6 +281,7 @@ export class Paciente {
|
|||||||
protected readonly antecedents = ANTECEDENTS;
|
protected readonly antecedents = ANTECEDENTS;
|
||||||
/** One model's latest risk assessment per model. */
|
/** One model's latest risk assessment per model. */
|
||||||
protected readonly models = computed(() => {
|
protected readonly models = computed(() => {
|
||||||
|
if (this.riskExclusion()) return [];
|
||||||
const latest = new Map<string, RiskAssessment>();
|
const latest = new Map<string, RiskAssessment>();
|
||||||
for (const r of this.data.value()?.risks ?? []) {
|
for (const r of this.data.value()?.risks ?? []) {
|
||||||
const key = code(r.method) ?? '';
|
const key = code(r.method) ?? '';
|
||||||
|
|||||||
Reference in New Issue
Block a user