T17: sweep of the WebApp after the feature-parity work
Removed the legacy indicator layout, unused chart helpers, styles and exports, the card-actions component, fetch-all and explanatory comments; one pager shared by the four worklists, shared filter-row styles, one FHIR name and CURP reader, downloads through export/, the concept-map editor on Material controls.
This commit is contained in:
@@ -19,9 +19,19 @@ import { Api } from '../api/api';
|
||||
import { curve } from '../api/fn/models/curve';
|
||||
import { readReport$Json } from '../api/fn/models/read-report-json';
|
||||
import type { Domain } from '../api/models/domain';
|
||||
import { code, EXT, ext, Fhir, label, resources } from '../fhir';
|
||||
import {
|
||||
code,
|
||||
CURP,
|
||||
ext,
|
||||
extensions,
|
||||
Fhir,
|
||||
label,
|
||||
patientCurp,
|
||||
patientName,
|
||||
resources,
|
||||
} from '../fhir';
|
||||
import { scenarioFigure } from '../gobernanza/figures';
|
||||
import { ageGroup, CAMA_AGE_GROUPS, camaRows, CURP } from '../indicadores/follow-up';
|
||||
import { ageGroup, CAMA_AGE_GROUPS, camaRows } from '../indicadores/follow-up';
|
||||
import { LABELS, name, PRIORITY } from '../indicadores/measures';
|
||||
import { Figure, PALETTE, Plot } from '../plot';
|
||||
import { Loading } from '../loading';
|
||||
@@ -38,11 +48,9 @@ import {
|
||||
Section,
|
||||
} from './tea-sections';
|
||||
|
||||
/** An Observation's value as the screens say it, whatever its type. */
|
||||
function shown(o: Observation): string {
|
||||
if (o.valueBoolean !== undefined) return o.valueBoolean ? 'positivo' : 'negativo';
|
||||
if (o.valueCodeableConcept) {
|
||||
// The screens' own name for the code (BI-RADS 4C), else the server's display.
|
||||
const c = code(o.valueCodeableConcept) ?? '';
|
||||
return (c in LABELS ? name(c) : '') || label(o.valueCodeableConcept);
|
||||
}
|
||||
@@ -50,8 +58,6 @@ function shown(o: Observation): string {
|
||||
return o.valueString ?? o.valueDateTime ?? '';
|
||||
}
|
||||
|
||||
/** One patient: her history (conditions, procedures), her tests and results, and the
|
||||
* champion models' risks with their curves. Everything read from the FHIR API. */
|
||||
@Component({
|
||||
selector: 'app-paciente',
|
||||
imports: [
|
||||
@@ -77,7 +83,6 @@ export class Paciente {
|
||||
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);
|
||||
readonly domain = input.required<string>();
|
||||
readonly id = input.required<string>();
|
||||
/** The follow-up list she was opened from: its window (months) and cut-off. */
|
||||
readonly ventana = input<string>();
|
||||
readonly corte = input<string>();
|
||||
readonly risk = input(false);
|
||||
@@ -117,7 +122,6 @@ export class Paciente {
|
||||
date: c.recordedDate ?? '',
|
||||
kind: 'Diagnóstico',
|
||||
text: label(c.code),
|
||||
// the ICD-10 code a note diagnosed by (the platform's own codes stay unsaid)
|
||||
code: c.code?.coding?.find((x) => x.system?.includes('icd-10'))?.code,
|
||||
})),
|
||||
...d.procedures.map((p) => ({
|
||||
@@ -140,7 +144,6 @@ export class Paciente {
|
||||
reported: ext(r, 'report-date')?.valueDate,
|
||||
kind: label(r.code),
|
||||
status: r.status,
|
||||
// "BI-RADS 4C", not "BI-RADS: BI-RADS 4C"
|
||||
results: results.map((o) => {
|
||||
const [name, value] = [label(o.code), shown(o)];
|
||||
return value.startsWith(name) ? value : `${name}: ${value}`;
|
||||
@@ -148,7 +151,6 @@ export class Paciente {
|
||||
};
|
||||
});
|
||||
});
|
||||
/** One model's latest risk assessment per model. */
|
||||
protected readonly models = computed(() => {
|
||||
const latest = new Map<string, RiskAssessment>();
|
||||
for (const r of this.data.value()?.risks ?? []) {
|
||||
@@ -164,10 +166,7 @@ export class Paciente {
|
||||
text: r.method?.text ?? '',
|
||||
version: Number(/v(\d+)$/.exec(r.method?.text ?? '')?.[1] ?? 0),
|
||||
index: r.occurrenceDateTime ?? '',
|
||||
// the clinical scenarios of the model's report she falls in
|
||||
scenarios: (r.extension ?? [])
|
||||
.filter((e) => e.url === EXT + 'escenario-clinico')
|
||||
.map((e) => e.valueString ?? ''),
|
||||
scenarios: extensions(r, 'escenario-clinico').map((e) => e.valueString ?? ''),
|
||||
predictions: (r.prediction ?? []).map((p) => ({
|
||||
years: p.whenRange?.high?.value ?? 0,
|
||||
p: p.probabilityDecimal ?? 0,
|
||||
@@ -176,8 +175,6 @@ export class Paciente {
|
||||
})),
|
||||
}));
|
||||
});
|
||||
/** "Análisis de supervivencia" and "Análisis de recurrencia": the curves of her clinical
|
||||
* scenarios, from the report of the model version that scored her. */
|
||||
protected readonly survival = this.analysis('survival');
|
||||
protected readonly recurrence = this.analysis('recurrence');
|
||||
protected readonly recurrenceModel = computed(() =>
|
||||
@@ -202,7 +199,6 @@ export class Paciente {
|
||||
const mine = (all: any[]) => all.filter((e) => m.scenarios.includes(e.escenario));
|
||||
if (name === 'recurrence') {
|
||||
const r = (report?.['recurrencia'] ?? {}) as any;
|
||||
// The risk factors of her scenarios, by horizon (the development tables).
|
||||
const technical = (await this.api.invoke(readReport$Json, {
|
||||
domain: domain as Domain,
|
||||
name,
|
||||
@@ -274,7 +270,6 @@ export class Paciente {
|
||||
}),
|
||||
layout: {
|
||||
xaxis: { title: { text: 'Años desde la fecha índice' }, dtick: 1 },
|
||||
// At least 0–5 %: a near-zero risk reads as near zero, not as a full axis.
|
||||
yaxis: {
|
||||
title: { text: 'Probabilidad (%)' },
|
||||
range: [0, Math.max(5, this.top() * 110)],
|
||||
@@ -287,12 +282,12 @@ export class Paciente {
|
||||
return Math.max(0, ...this.models().flatMap((m) => m.predictions.map((p) => p.high ?? p.p)));
|
||||
}
|
||||
protected readonly name = name;
|
||||
protected readonly patientName = patientName;
|
||||
protected readonly identity = computed(() => {
|
||||
const p = this.patient();
|
||||
return {
|
||||
name: p?.name?.[0]?.text,
|
||||
curp: p?.identifier?.find((i) => i.system === CURP)?.value,
|
||||
// each record number once (several sources may carry the same one)
|
||||
name: patientName(p),
|
||||
curp: patientCurp(p),
|
||||
numbers: [
|
||||
...new Set(
|
||||
(p?.identifier ?? []).filter((i) => i.system !== CURP).map((i) => i.value ?? ''),
|
||||
@@ -300,8 +295,6 @@ export class Paciente {
|
||||
].filter(Boolean),
|
||||
};
|
||||
});
|
||||
/** CaMa: her row on the follow-up list (window and cut-off as opened, else the widest
|
||||
* window up to the last day with data), as the list shows it: the old record's card. */
|
||||
private readonly listed = resource({
|
||||
params: () =>
|
||||
this.domain() === 'cama'
|
||||
@@ -329,7 +322,6 @@ export class Paciente {
|
||||
const found = this.listed.value();
|
||||
const d = this.data.value();
|
||||
if (!found || !d) return undefined;
|
||||
// Her own latest mammogram and biopsy, on the list or not.
|
||||
const latest = (study: string) =>
|
||||
d.reports
|
||||
.filter((r) => code(r.code) === study)
|
||||
|
||||
Reference in New Issue
Block a user