ConceptMap editor, names and CURP shown, catalog codes read

This commit is contained in:
Roberto Treviño
2026-11-25 16:17:23 -06:00
parent 9fc0666d66
commit 9b02641804
27 changed files with 901 additions and 87 deletions
+9 -1
View File
@@ -6,9 +6,17 @@
<p class="muted" role="alert">No se encontró la paciente.</p>
} @else if (patient(); as p) {
<h1>
Paciente <code>{{ p.id!.slice(0, 10) }}</code>
{{ identity().name ?? 'Paciente' }} <code class="muted">{{ p.id!.slice(0, 10) }}</code>
</h1>
<dl class="summary">
<div>
<dt>CURP</dt>
<dd>{{ identity().curp ?? 'Sin dato' }}</dd>
</div>
<div>
<dt>Expedientes</dt>
<dd>{{ identity().numbers.join(', ') || 'Sin dato' }}</dd>
</div>
<div>
<dt>Fecha de nacimiento</dt>
<dd>{{ p.birthDate ?? 'Sin dato' }}</dd>
+19 -7
View File
@@ -13,9 +13,19 @@ import type {
RiskAssessment,
} from 'fhir/r4';
import { code, ext, Fhir, label, resources } from '../fhir';
import { CURP } from '../indicadores/follow-up';
import { name } from '../indicadores/measures';
import { Figure, PALETTE, Plot } from '../plot';
/** 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)
return name(code(o.valueCodeableConcept) ?? '') || label(o.valueCodeableConcept);
if (o.valueQuantity) return `${o.valueQuantity.value} ${o.valueQuantity.unit ?? ''}`.trim();
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({
@@ -86,13 +96,7 @@ export class Paciente {
reported: ext(r, 'report-date')?.valueDate,
kind: label(r.code),
status: r.status,
results: [
...results.map(
(o) =>
`${label(o.code)}: ${o.valueBoolean !== undefined ? (o.valueBoolean ? 'positivo' : 'negativo') : name(code(o.valueCodeableConcept) ?? '')}`,
),
...(r.conclusionCode ?? []).map((c) => `Histología: ${name(code(c) ?? '')}`),
],
results: [...results.map((o) => `${label(o.code)}: ${shown(o)}`)],
};
});
});
@@ -169,6 +173,14 @@ 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 identity = computed(() => {
const p = this.patient();
return {
name: p?.name?.[0]?.text,
curp: p?.identifier?.find((i) => i.system === CURP)?.value,
numbers: (p?.identifier ?? []).filter((i) => i.system !== CURP).map((i) => i.value),
};
});
protected readonly status = computed(() => {
const p = this.patient();
return p ? name(ext(p, 'follow-up-status')?.valueCoding?.code ?? '') : '';