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
+14 -8
View File
@@ -4,6 +4,8 @@ import { code, ext, resources } from '../fhir';
/** One row of the follow-up list: what the list shows of a patient at the cut-off. */
export interface Row {
patient: Patient;
name?: string;
curp?: string;
status: string;
ageGroup: string;
cytology?: { date: string; result?: string; adequacy?: string };
@@ -13,6 +15,8 @@ export interface Row {
risk: Record<'cin2' | 'cancer', number | undefined>;
}
export const CURP = 'https://isssteleon.org/fhir/sid/curp';
const AGE_GROUPS: [number, number][] = [
[25, 34],
[35, 44],
@@ -72,17 +76,17 @@ export function rows(page: Bundle, start: string, cutoff: string, horizon: numbe
return resources<Patient>(page, 'Patient', 'match').map((patient) => {
const mine = reports.filter((r) => r.subject?.reference === `Patient/${patient.id}`);
const by = (kind: string) => mine.filter((r) => code(r.code) === kind);
const cytologies = by('cervical-cytology')
const cytologies = by('cervical_cytology')
.filter((r) => start <= r.effectiveDateTime! && r.effectiveDateTime! <= cutoff)
.sort((a, b) => a.effectiveDateTime!.localeCompare(b.effectiveDateTime!));
const last = cytologies.at(-1);
const lastResults = last ? results(last) : new Map();
const hpv = cytologies.filter((r) => results(r).has('hpv')).at(-1);
const hpv = cytologies.filter((r) => results(r).has('cervical_cytology.hpv')).at(-1);
const hpvResults = hpv ? results(hpv) : new Map();
const types = ['hpv-16', 'hpv-18']
const types = ['cervical_cytology.hpv_16', 'cervical_cytology.hpv_18']
.filter((k) => hpvResults.has(k))
.map((k) => hpvResults.get(k)!.valueBoolean);
const biopsy = by('cervical-biopsy')
const biopsy = by('cervical_biopsy')
.filter((r) => ext(r, 'report-date'))
.sort((a, b) =>
ext(a, 'report-date')!.valueDate!.localeCompare(ext(b, 'report-date')!.valueDate!),
@@ -91,22 +95,24 @@ export function rows(page: Bundle, start: string, cutoff: string, horizon: numbe
const theirs = risks.filter((r) => r.subject?.reference === `Patient/${patient.id}`);
return {
patient,
name: patient.name?.[0]?.text,
curp: patient.identifier?.find((i) => i.system === CURP)?.value,
status: ext(patient, 'follow-up-status')?.valueCoding?.code ?? '',
ageGroup: ageGroup(patient.birthDate, cutoff),
cytology: last && {
date: last.effectiveDateTime!,
result: code(lastResults.get('cytology-result')?.valueCodeableConcept),
adequacy: code(lastResults.get('cytology-adequacy')?.valueCodeableConcept),
result: code(lastResults.get('cervical_cytology.result')?.valueCodeableConcept),
adequacy: code(lastResults.get('cervical_cytology.adequacy')?.valueCodeableConcept),
},
hpv: hpv && {
date: hpv.effectiveDateTime!,
positive: !!hpvResults.get('hpv')?.valueBoolean,
positive: !!hpvResults.get('cervical_cytology.hpv')?.valueBoolean,
types1618: types.length ? types.some((t) => t) : undefined,
},
daysToDiagnosis: last ? ext(last, 'days-to-diagnosis')?.valueInteger : undefined,
biopsy: biopsy && {
date: ext(biopsy, 'report-date')!.valueDate!,
histology: code(biopsy.conclusionCode?.[0]),
histology: code(results(biopsy).get('cervical_biopsy.histology')?.valueCodeableConcept),
},
risk: {
cin2: currentRisk(theirs, 'cin2', horizon),
+5 -2
View File
@@ -75,9 +75,12 @@
@for (row of rows(); track row.patient.id) {
<tr>
<td>
<a [routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]" class="id">{{
row.patient.id!.slice(0, 10)
<a [routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]">{{
row.name ?? row.patient.id!.slice(0, 10)
}}</a>
@if (row.curp) {
<div class="muted curp">{{ row.curp }}</div>
}
</td>
<td>{{ row.ageGroup }}</td>
<td>{{ name(row.status) }}</td>
+5 -1
View File
@@ -20,9 +20,13 @@
white-space: nowrap;
}
.id {
a {
color: var(--color-action);
}
.curp {
font-family: monospace;
font-size: 12px;
}
.pager {