Merge feature/tea-eeg-analysis into dev (TEA candidate composition)
This commit is contained in:
@@ -30,9 +30,9 @@ export function code(concept: Concept | undefined): string | undefined {
|
||||
export function display(concept: Concept | undefined): string | undefined {
|
||||
return concept?.coding?.[0]?.display ?? concept?.text;
|
||||
}
|
||||
// The code of a concept from `system` (a name under the project's CodeSystem base, or a full URL).
|
||||
// The code of a concept from `system` (a name under the project's CodeSystem base, or a full URI such as a URN).
|
||||
export function codeIn(concept: Concept | undefined, system: string): string | undefined {
|
||||
const url = system.includes('://') ? system : CODE_SYSTEM + system;
|
||||
const url = system.includes(':') ? system : CODE_SYSTEM + system;
|
||||
return concept?.coding?.find(c => c.system === url)?.code;
|
||||
}
|
||||
// The extensions named `name` (the last segment of their URL).
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -173,14 +173,15 @@ describe('Seguimiento de TEA sobre FHIR', () => {
|
||||
expect(response.paginacion).toEqual({ page: 1, page_size: 5, total_items: 6, total_pages: 2 });
|
||||
expect(response.items[0]).toMatchObject({ id_seudonimo: 'P-4A59E9D8B4', grupo_edad: '16-23 meses', ultimo_eeg: '2025-05-20', mchat: 12,
|
||||
css_ados2: 7, modulo_ados2: '1', estado_caso: 'completo', alteraciones_eeg: 'anormal', alteraciones: ['ritmo_posterior'], pendientes: [] });
|
||||
expect(response.resumen_eeg).toMatchObject({ normales: 2, anormales: 1, sin_eeg: 3 });
|
||||
expect(response.resumen_eeg).toMatchObject({ validadas: true, con_eeg_valido: 3, normales: 2, anormales: 1, sin_eeg: 3 });
|
||||
expect(response.tipos_alteracion.map(t => t.codigo)).toContain('ritmo_posterior');
|
||||
});
|
||||
|
||||
it('el resumen del paciente arma el ADOS-2, la calidad, las alteraciones y su mapa', async () => {
|
||||
// Pins down: ADOS-2 domains whose totals add up (the page checks it), quality criteria in channels or dB, each
|
||||
// metric's state and effects from the code system, and one map per evaluable metric from its electrodes. Fails if
|
||||
// the summary stops passing the page's checks or a map appears for a metric without electrodes.
|
||||
// Pins down: the age group from the summary's episode, ADOS-2 domains whose totals add up (the page checks it),
|
||||
// the EEG analysis's checks as its report writes them (value or text, A/N, decisive), each metric's state, effects
|
||||
// and median from the code system and its observation, and one map per evaluable metric from its electrodes'
|
||||
// z-scores. Fails if the summary stops passing the page's checks or a map appears for a metric without electrodes.
|
||||
const answer = firstValueFrom(service.detalle('P-4A59E9D8B4'));
|
||||
http.expectOne('/tea/fhir/Patient/P-4A59E9D8B4/$resumen-tea').flush(fx.resumenPaciente);
|
||||
http.expectOne('/tea/fhir/CodeSystem/tea-eeg-metrica').flush(fx.metricasEeg);
|
||||
@@ -188,9 +189,11 @@ describe('Seguimiento de TEA sobre FHIR', () => {
|
||||
expect(detalle.grupo_edad).toBe('16-23 meses');
|
||||
expect(detalle.ados2).toMatchObject({ modulo: '1', css: 7, clasificacion: 'autismo', nivel_css: 'moderado' });
|
||||
expect(detalle.eeg!.calidad).toBe('bueno');
|
||||
expect(detalle.eeg!.criterios_calidad.find(c => c.codigo === 'linea')).toMatchObject({ valor: 3.5, unidad: 'dB' });
|
||||
expect(detalle.eeg!.criterios_calidad.find(c => c.codigo === 'line-noise')).toMatchObject({ valor: 3.5, unidad: 'dB', nivel: 'bueno', decisivo: false, electrodo: null });
|
||||
expect(detalle.eeg!.criterios_calidad.find(c => c.codigo === 'clean-windows')).toMatchObject({ valor: 95, decisivo: true });
|
||||
expect(detalle.eeg!.criterios_calidad.find(c => c.codigo === 'triage-level')?.valor).toBe('completo');
|
||||
const ritmo = detalle.eeg!.alteraciones.find(a => a.codigo === 'ritmo_posterior')!;
|
||||
expect(ritmo).toMatchObject({ estado: 'disminuido', valor_z: -4.08 });
|
||||
expect(ritmo).toMatchObject({ estado: 'disminuido', valor_z: -4.08, referencia: { min: 4.5, max: 7, mediana: 5.75 }, sin_evaluar: null });
|
||||
expect(ritmo.efectos).toContain('Ritmo más lento de lo esperado para la edad.');
|
||||
expect(detalle.eeg!.mapas.map(m => m.codigo)).toEqual(['ritmo_posterior']);
|
||||
});
|
||||
|
||||
@@ -61,15 +61,23 @@
|
||||
@if (teaData; as response) {
|
||||
<section class="resumen-eeg" aria-labelledby="resumen-eeg-titulo">
|
||||
<h3 id="resumen-eeg-titulo">EEG de los pacientes filtrados</h3>
|
||||
<dl>
|
||||
<div><dt>Normales</dt><dd>{{ response.resumen_eeg.normales }}</dd></div>
|
||||
<div><dt>Anormales</dt><dd>{{ response.resumen_eeg.anormales }}</dd></div>
|
||||
<div><dt>Sin EEG</dt><dd>{{ response.resumen_eeg.sin_eeg }}</dd></div>
|
||||
@for (a of response.resumen_eeg.por_alteracion; track a.codigo) {
|
||||
<div class="tipo"><dt>{{ a.etiqueta }}</dt><dd>{{ a.n }}</dd></div>
|
||||
}
|
||||
</dl>
|
||||
<p>Un paciente con dos alteraciones cuenta en ambas, así que los tipos pueden sumar más que los anormales.</p>
|
||||
@if (response.resumen_eeg.validadas) {
|
||||
<dl>
|
||||
<div><dt>Normales</dt><dd>{{ response.resumen_eeg.normales }}</dd></div>
|
||||
<div><dt>Anormales</dt><dd>{{ response.resumen_eeg.anormales }}</dd></div>
|
||||
<div><dt>Sin EEG</dt><dd>{{ response.resumen_eeg.sin_eeg }}</dd></div>
|
||||
@for (a of response.resumen_eeg.por_alteracion; track a.codigo) {
|
||||
<div class="tipo"><dt>{{ a.etiqueta }}</dt><dd>{{ a.n }}</dd></div>
|
||||
}
|
||||
</dl>
|
||||
<p>Un paciente con dos alteraciones cuenta en ambas, así que los tipos pueden sumar más que los anormales.</p>
|
||||
} @else {
|
||||
<dl>
|
||||
<div><dt>Con EEG válido</dt><dd>{{ response.resumen_eeg.con_eeg_valido }}</dd></div>
|
||||
<div><dt>Sin EEG válido</dt><dd>{{ response.resumen_eeg.sin_eeg }}</dd></div>
|
||||
</dl>
|
||||
<p>Las alteraciones del EEG se muestran cuando se validen sus curvas de referencia.</p>
|
||||
}
|
||||
</section>
|
||||
<div class="tracking-table" role="region" aria-label="Lista de seguimiento" tabindex="0">
|
||||
<table>
|
||||
|
||||
@@ -12,7 +12,7 @@ import { PacienteDetalleState } from './paciente-detalle/paciente-detalle.state'
|
||||
import { Dominio } from './indicadores.models';
|
||||
import { ETIQUETA_IDENTIDAD, IdentidadPaciente, identidadDe } from './paciente-identidad';
|
||||
import { IndicadoresService } from './indicadores.service';
|
||||
import { ALTERACIONES_EEG, ESTADOS_CASO, GRUPOS_EDAD_TEA, RANGOS_CSS, RANGOS_MCHAT, TeaSeguimientoPaciente, TeaSeguimientoResponse, TeaSeguimientoService } from './tea-seguimiento.service';
|
||||
import { ALTERACIONES_EEG, EEG_VALIDO, ESTADOS_CASO, GRUPOS_EDAD_TEA, RANGOS_CSS, RANGOS_MCHAT, TeaSeguimientoPaciente, TeaSeguimientoResponse, TeaSeguimientoService } from './tea-seguimiento.service';
|
||||
import { TeaPacienteResumen } from './tea-paciente-resumen';
|
||||
|
||||
@Component({
|
||||
@@ -98,6 +98,8 @@ export class IndicadoresTracking implements OnChanges {
|
||||
if (result.data) {
|
||||
const data = result.data;
|
||||
this.tiposAlteracion = data.tipos_alteracion;
|
||||
// Until the alterations are validated, the EEG filter can only tell a valid EEG from none.
|
||||
this.statuses = data.resumen_eeg.validadas ? ALTERACIONES_EEG : EEG_VALIDO;
|
||||
this.applied = { ...this.applied, corte: data.corte, meses: data.ventana.meses, estatus: data.filtros.alteraciones_eeg ?? undefined, page: data.paginacion.page, page_size: data.paginacion.page_size };
|
||||
this.draft = { ...this.applied };
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<p class="meta">Módulo {{ a.modulo }} · {{ a.algoritmo }} · {{ a.fecha }}</p>
|
||||
<div class="headline">
|
||||
<span class="css" [attr.data-nivel]="a.nivel_css">CSS {{ a.css }}<small>de 10</small></span>
|
||||
<span><strong>{{ nivelCss[a.nivel_css] }}</strong><small>Clasificación: {{ clasificacion[a.clasificacion] }}</small><small>Total del algoritmo: {{ a.total }} / {{ a.total_maximo }}</small></span>
|
||||
<span><strong>{{ nivelCss[a.nivel_css] }}</strong><small>Clasificación: {{ clasificacionDe(a) }}</small><small>Total del algoritmo: {{ a.total }} / {{ a.total_maximo }}</small></span>
|
||||
</div>
|
||||
@for (dom of a.dominios; track dom.codigo) {
|
||||
<div class="dominio">
|
||||
@@ -37,18 +37,24 @@
|
||||
</section>
|
||||
|
||||
<section class="panel calidad" aria-label="Calidad del EEG">
|
||||
<h3>Calidad del EEG @if (d.eeg) { <span class="mock">Datos de ejemplo</span> }</h3>
|
||||
<h3>Calidad del EEG</h3>
|
||||
@if (d.eeg; as e) {
|
||||
<p class="meta">{{ e.fecha }} · {{ e.duracion_min }} min · {{ e.canales }} canales</p>
|
||||
<p class="meta">{{ e.fecha }}@if (e.duracion_min !== null) { · {{ e.duracion_min }} min }@if (e.canales !== null) { · {{ e.canales }} canales }</p>
|
||||
<div class="headline">
|
||||
<span class="css" [attr.data-calidad]="e.calidad"><strong>{{ calidad[e.calidad] }}</strong></span>
|
||||
<small>La calificación general es la peor de sus criterios.</small>
|
||||
<small>{{ e.calidad === 'sin_analizar' ? 'El análisis del EEG aún no lo revisa.' : 'Veredicto del análisis del EEG, según las reglas siguientes.' }}</small>
|
||||
</div>
|
||||
<dl>
|
||||
@for (c of e.criterios_calidad; track c.codigo) {
|
||||
<dt>{{ c.etiqueta }}</dt><dd [attr.data-calidad]="c.nivel">{{ c.valor }} {{ c.unidad === 'canales' ? 'de ' + e.canales : c.unidad }}</dd>
|
||||
@for (c of delEstudio(e); track c.codigo) {
|
||||
<dt>{{ c.etiqueta }}@if (c.decisivo) {<small> (decisiva)</small>}</dt><dd [attr.data-calidad]="c.nivel">{{ valorDe(c) }}</dd>
|
||||
}
|
||||
</dl>
|
||||
@if (canalesMalos(e).length) {
|
||||
<p class="efectos-titulo">Canales descartados</p>
|
||||
<ul class="canales-malos">
|
||||
@for (c of canalesMalos(e); track $index) { <li><strong>{{ c.electrodo }}</strong> · {{ c.etiqueta }}</li> }
|
||||
</ul>
|
||||
}
|
||||
} @else { <p>Sin EEG registrado.</p> }
|
||||
</section>
|
||||
|
||||
@@ -56,7 +62,7 @@
|
||||
<div class="alteraciones-zona" [class.abierta]="mapaActual(e)">
|
||||
<section class="panel alteraciones" aria-label="Alteraciones del EEG">
|
||||
<h3>Alteraciones del EEG <span class="mock">Datos de ejemplo</span></h3>
|
||||
<p class="meta">Referencia neurotípica para {{ d.grupo_edad }} y efectos asociados de ejemplo, pendientes de validación médica. Elige una alteración para ver sus zonas más afectadas.</p>
|
||||
<p class="meta">Curvas de referencia por edad ({{ d.grupo_edad || 'edad sin dato' }}) y efectos asociados de ejemplo, pendientes de validación médica. Elige una alteración para ver sus zonas más afectadas.</p>
|
||||
@if (!alteradas(e).length) { <p class="sin-alteraciones">Sin alteraciones en las métricas evaluadas.</p> }
|
||||
<ul class="metricas">
|
||||
@for (m of e.alteraciones; track m.codigo) {
|
||||
@@ -66,10 +72,10 @@
|
||||
[attr.aria-controls]="'zonas-' + d.id_seudonimo" (click)="elegirMapa(e, m.codigo)">{{ m.etiqueta }}</button>
|
||||
<span class="estado">{{ estado[m.estado] }}</span>
|
||||
</div>
|
||||
@if (m.valor !== null) {
|
||||
<p class="valor">{{ m.valor }}{{ m.unidad ? ' ' + m.unidad : '' }} · referencia {{ m.referencia.min }}–{{ m.referencia.max }} · z = {{ m.valor_z }}</p>
|
||||
@if (m.referencia; as r) {
|
||||
<p class="valor">{{ m.valor }}{{ m.unidad ? ' ' + m.unidad : '' }} · referencia {{ r.min }}–{{ r.max }}@if (r.mediana !== null) { (mediana {{ r.mediana }}) } · z = {{ m.valor_z }}</p>
|
||||
} @else {
|
||||
<p class="valor">Sin registro de sueño en el estudio.</p>
|
||||
<p class="valor">@if (m.valor !== null) { {{ m.valor }}{{ m.unidad ? ' ' + m.unidad : '' }} · }{{ sinEvaluar(m) }}</p>
|
||||
}
|
||||
@if (m.efectos.length) {
|
||||
<p class="efectos-titulo">Posibles efectos asociados</p>
|
||||
|
||||
@@ -9,7 +9,7 @@ h3 { margin: 0 0 .15rem; font-size: 1rem; }
|
||||
border: 2px solid var(--issste-border); border-radius: var(--issste-radius); font-size: 1.1rem; font-weight: 700; }
|
||||
.css small { margin: 0; font-size: .7rem; font-weight: 400; }
|
||||
.css[data-nivel=alto], .css[data-calidad=malo] { border-color: #B3261E; color: #B3261E; }
|
||||
.css[data-nivel=moderado], .css[data-calidad=aceptable] { border-color: #B26A00; color: #B26A00; }
|
||||
.css[data-nivel=moderado], .css[data-calidad=sin_analizar] { border-color: #B26A00; color: #B26A00; }
|
||||
.css[data-nivel=bajo], .css[data-nivel=minimo], .css[data-calidad=bueno] { border-color: var(--issste-accent); }
|
||||
.css[data-calidad] { flex: none; white-space: nowrap; }
|
||||
dd[data-calidad=malo] { color: #B3261E; }
|
||||
@@ -23,7 +23,6 @@ button.nombre:focus-visible::after { outline: 2px solid var(--issste-text); outl
|
||||
.leyenda-mapa span { width: .8rem; height: .8rem; border-radius: 2px; }
|
||||
.leyenda-mapa .azul { background: #2166AC; }
|
||||
.leyenda-mapa .rojo { margin-inline-start: .5rem; background: #B2182B; }
|
||||
dd[data-calidad=aceptable] { color: #B26A00; }
|
||||
.dominio { display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; margin-bottom: .4rem; font-size: .85rem; }
|
||||
.bar { grid-column: 1 / -1; height: .375rem; border-radius: 999px; background: var(--issste-border); overflow: hidden; }
|
||||
.bar span { display: block; height: 100%; background: var(--issste-text); }
|
||||
@@ -72,3 +71,5 @@ li[data-estado=no_evaluable] .estado { color: var(--issste-text-secondary); font
|
||||
.efectos-titulo { margin: .3rem 0 .1rem; font-size: .8rem; font-weight: 600; }
|
||||
.efectos { padding-inline-start: 1.1rem; list-style: disc; font-size: .8rem; }
|
||||
button { min-height: 44px; padding: .6rem; border: 1px solid var(--issste-border); border-radius: 4px; background: var(--issste-surface); color: inherit; font: inherit; cursor: pointer; }
|
||||
|
||||
.canales-malos { margin: .25rem 0 0; padding-inline-start: 1.1rem; font-size: .85rem; }
|
||||
|
||||
@@ -2,12 +2,14 @@ import { Component, DestroyRef, ElementRef, inject, Input, OnInit, signal } from
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
|
||||
import { PlotlyFigure } from './indicadores.models';
|
||||
import { TeaAdos2, TeaAlteracionEstado, TeaEeg, TeaEegMapa, TeaPacienteDetalle, TeaSeguimientoService } from './tea-seguimiento.service';
|
||||
import {
|
||||
CLASIFICACIONES_ADOS2, TeaAlteracionEstado, TeaCriterioCalidad, TeaEeg, TeaEegAlteracion, TeaEegMapa, TeaPacienteDetalle,
|
||||
TeaSeguimientoService, TeaAdos2,
|
||||
} from './tea-seguimiento.service';
|
||||
|
||||
const CLASIFICACION: Record<TeaAdos2['clasificacion'], string> = { autismo: 'Autismo', espectro_autista: 'Espectro autista', no_espectro: 'No espectro' };
|
||||
// ADOS-2 calibrated severity score ranges.
|
||||
const NIVEL_CSS: Record<TeaAdos2['nivel_css'], string> = { minimo: 'Evidencia mínima o nula', bajo: 'Nivel bajo', moderado: 'Nivel moderado', alto: 'Nivel alto' };
|
||||
const CALIDAD: Record<TeaEeg['calidad'], string> = { bueno: 'Bueno', aceptable: 'Aceptable', malo: 'Malo' };
|
||||
const CALIDAD: Record<TeaEeg['calidad'], string> = { bueno: 'Válido', malo: 'No válido', sin_analizar: 'Sin analizar' };
|
||||
const ESTADO: Record<TeaAlteracionEstado, string> = { normal: 'Dentro de referencia', aumentado: 'Aumentado', disminuido: 'Disminuido', no_evaluable: 'No evaluable' };
|
||||
const INK = '#081839';
|
||||
|
||||
@@ -73,7 +75,7 @@ export class TeaPacienteResumen implements OnInit {
|
||||
this.mapaElegido = mapa?.codigo;
|
||||
this.figura = mapa && mapaFigure(eeg, mapa, this.fondo());
|
||||
}
|
||||
readonly clasificacion = CLASIFICACION;
|
||||
readonly clasificacion = CLASIFICACIONES_ADOS2;
|
||||
readonly nivelCss = NIVEL_CSS;
|
||||
readonly calidad = CALIDAD;
|
||||
readonly estado = ESTADO;
|
||||
@@ -91,6 +93,17 @@ export class TeaPacienteResumen implements OnInit {
|
||||
error: () => this.status.set('error'),
|
||||
});
|
||||
}
|
||||
// The study-wide checks, then each bad channel.
|
||||
delEstudio(eeg: TeaEeg) { return eeg.criterios_calidad.filter(c => c.electrodo === null); }
|
||||
canalesMalos(eeg: TeaEeg) { return eeg.criterios_calidad.filter(c => c.electrodo !== null); }
|
||||
valorDe(c: TeaCriterioCalidad) {
|
||||
return c.valor === null ? '' : typeof c.valor === 'number' ? `${Math.round(c.valor * 100) / 100}${c.unidad ? ' ' + c.unidad : ''}` : c.valor;
|
||||
}
|
||||
// Why a metric couldn't be evaluated, in the reader's terms.
|
||||
sinEvaluar(m: TeaEegAlteracion) {
|
||||
return m.sin_evaluar === 'sin_valor' ? 'No se pudo medir en el estudio.' : 'Sin referencia para la edad del niño.';
|
||||
}
|
||||
clasificacionDe(a: TeaAdos2) { return a.clasificacion ? this.clasificacion[a.clasificacion] : 'Sin clasificación'; }
|
||||
alteradas(eeg: TeaEeg) { return eeg.alteraciones.filter(m => m.estado === 'aumentado' || m.estado === 'disminuido'); }
|
||||
pct(value: number, max: number) { return max > 0 ? Math.round(100 * value / max) : 0; }
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ import { estratoValor } from './indicadores-fhir';
|
||||
import { SeguimientoQuery } from './cacu-seguimiento.models';
|
||||
import { validSeguimientoQuery } from './cacu-seguimiento.service';
|
||||
import {
|
||||
RANGOS_CSS, RANGOS_MCHAT, TeaAdos2, TeaAdosDominio, TeaAlteracionEstado, TeaEeg, TeaEegAlteracion, TeaEegMapa, TeaNivelCalidad,
|
||||
teaPacienteDetalle, TeaSeguimientoPaciente, teaSeguimientoResponse, TeaSeguimientoService,
|
||||
CLASIFICACIONES_ADOS2, RANGOS_CSS, RANGOS_MCHAT, TeaAdos2, TeaAdosDominio, TeaAlteracionEstado, TeaCriterioCalidad, TeaEeg,
|
||||
TeaEegAlteracion, TeaEegMapa, TeaNivelCalidad, teaPacienteDetalle, TeaSeguimientoPaciente, teaSeguimientoResponse,
|
||||
TeaSeguimientoService,
|
||||
} from './tea-seguimiento.service';
|
||||
|
||||
// TEA's follow-up list and patient summary over the WebApi's FHIR endpoint: each child's screening is an
|
||||
@@ -19,7 +20,7 @@ interface Observation extends Resource {
|
||||
valueInteger?: number; valueQuantity?: Quantity; valueString?: string; valueCodeableConcept?: Concept;
|
||||
interpretation?: Concept[]; dataAbsentReason?: Concept;
|
||||
referenceRange?: { low?: Quantity; high?: Quantity; text?: string }[];
|
||||
component?: { code?: Concept; valueInteger?: number; valueQuantity?: Quantity; valueString?: string; valueCodeableConcept?: Concept; extension?: Resource['extension'] }[];
|
||||
component?: { code?: Concept; valueInteger?: number; valueQuantity?: Quantity; valueString?: string; valueBoolean?: boolean; valueCodeableConcept?: Concept; extension?: Resource['extension'] }[];
|
||||
}
|
||||
interface Report extends Resource {
|
||||
effectiveDateTime?: string; subject?: { reference?: string }; result?: { reference?: string }[]; conclusionCode?: Concept[];
|
||||
@@ -28,6 +29,9 @@ interface Metric { code?: string; display?: string; property?: { code: string; v
|
||||
|
||||
const MAX_COUNT = 200;
|
||||
const METRICAS = 'tea-eeg-metrica';
|
||||
// The EEG analysis's quality checks, under the code system of its own validation report.
|
||||
const CRITERIOS = 'urn:tea:validation';
|
||||
const FILTRO_EEG: Record<string, string> = { sin_eeg_valido: 'sin-eeg-valido' };
|
||||
const INTERPRETACION: Record<string, TeaAlteracionEstado> = { H: 'aumentado', L: 'disminuido', N: 'normal' };
|
||||
|
||||
// The 10-20 electrodes on the page's head (x left to right, y back to front, radius 1) and the regions they average.
|
||||
@@ -77,10 +81,16 @@ export function mapaDeElectrodos(codigo: string, etiqueta: string, valores: Reco
|
||||
return { codigo, metrica: `${etiqueta} (puntuación z)`, z, regiones };
|
||||
}
|
||||
|
||||
// The module as the page writes it: `MODULO_1` is 1, the toddler module is T.
|
||||
function moduloAdos2(codigo: string | undefined): string | undefined {
|
||||
const modulo = codigo?.replace(/^ados2\.modulo\./, '');
|
||||
return modulo === 'TODDLER' ? 'T' : modulo?.replace(/^MODULO_/, '');
|
||||
}
|
||||
|
||||
export function ados2DeObservacion(o: Observation | undefined): TeaAdos2 | null {
|
||||
const css = component(o, 'ados2.css')?.valueInteger;
|
||||
if (!o?.effectiveDateTime || typeof css !== 'number') return null;
|
||||
const modulo = code(component(o, 'ados2.modulo')?.valueCodeableConcept)?.replace(/^ados2\.modulo\.(MODULO_)?/, '') ?? '';
|
||||
const modulo = moduloAdos2(code(component(o, 'ados2.modulo')?.valueCodeableConcept)) ?? '';
|
||||
const clasificacion = code(component(o, 'ados2.clasificacion')?.valueCodeableConcept)?.replace('ados2.clasificacion.', '').toLowerCase();
|
||||
const items = (o.component ?? []).filter(c => extension(c, 'dominio'));
|
||||
const dominios: TeaAdosDominio[] = (o.component ?? []).filter(c => codeIn(c.code, 'ados2-dominio')).map(c => {
|
||||
@@ -96,34 +106,52 @@ export function ados2DeObservacion(o: Observation | undefined): TeaAdos2 | null
|
||||
return {
|
||||
fecha: o.effectiveDateTime.slice(0, 10), modulo, algoritmo: component(o, 'ados2.algoritmo')?.valueString ?? '',
|
||||
dominios, total: dominios.reduce((t, d) => t + d.puntaje, 0), total_maximo: dominios.reduce((t, d) => t + d.maximo, 0),
|
||||
clasificacion: (clasificacion ?? 'no_espectro') as TeaAdos2['clasificacion'], css,
|
||||
clasificacion: clasificacion && Object.hasOwn(CLASIFICACIONES_ADOS2, clasificacion) ? clasificacion as TeaAdos2['clasificacion'] : null, css,
|
||||
nivel_css: (RANGOS_CSS.find(r => css >= r.min && css <= r.max)?.codigo ?? 'minimo') as TeaAdos2['nivel_css'],
|
||||
};
|
||||
}
|
||||
|
||||
// A metric against its age baseline. Without a value nothing was measured; with a value but no z, the baseline doesn't
|
||||
// cover the child's age (or none is in production yet).
|
||||
function alteracion(o: Observation, metricas: Metric[]): TeaEegAlteracion {
|
||||
const codigo = code(o.code) ?? '';
|
||||
const metrica = metricas.find(m => m.code === codigo);
|
||||
const evaluable = !o.dataAbsentReason && typeof o.valueQuantity?.value === 'number';
|
||||
const valor = o.valueQuantity?.value ?? null;
|
||||
const z = component(o, 'z')?.valueQuantity?.value;
|
||||
const evaluable = valor !== null && typeof z === 'number';
|
||||
const estado = evaluable ? INTERPRETACION[code(o.interpretation?.[0]) ?? ''] ?? 'normal' : 'no_evaluable';
|
||||
const range = o.referenceRange?.[0];
|
||||
const low = o.referenceRange?.[0]?.low?.value, high = o.referenceRange?.[0]?.high?.value;
|
||||
const referencia = typeof low === 'number' && typeof high === 'number'
|
||||
? { min: low, max: high, mediana: component(o, 'mediana')?.valueQuantity?.value ?? null } : null;
|
||||
return {
|
||||
codigo, etiqueta: display(o.code) ?? metrica?.display ?? codigo,
|
||||
unidad: o.valueQuantity?.unit ?? metrica?.property?.find(p => p.code === 'unidad')?.valueString ?? '',
|
||||
referencia: { min: range?.low?.value ?? 0, max: range?.high?.value ?? 0 },
|
||||
valor: evaluable ? o.valueQuantity!.value! : null,
|
||||
valor_z: evaluable ? component(o, 'z')?.valueQuantity?.value ?? null : null,
|
||||
estado,
|
||||
referencia: evaluable ? referencia : null,
|
||||
valor, valor_z: evaluable && typeof z === 'number' ? z : null, estado,
|
||||
sin_evaluar: evaluable ? null : valor === null ? 'sin_valor' : 'sin_referencia',
|
||||
efectos: (metrica?.property ?? []).filter(p => p.code === `efecto-${estado}`).map(p => p.valueString!).filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
// One quality check as the EEG analysis reports it: its value or reason, A/N, the bad channel's electrode, whether it
|
||||
// alone invalidates the EEG.
|
||||
function criterio(o: Observation): TeaCriterioCalidad {
|
||||
const parte = (nombre: string) => o.component?.find(c => c.code?.text === nombre);
|
||||
return {
|
||||
codigo: codeIn(o.code, CRITERIOS)!, etiqueta: display(o.code) ?? codeIn(o.code, CRITERIOS)!,
|
||||
valor: o.valueQuantity?.value ?? o.valueString ?? null, unidad: o.valueQuantity?.unit ?? '',
|
||||
nivel: code(o.interpretation?.[0]) === 'A' ? 'malo' : 'bueno',
|
||||
electrodo: parte('electrode')?.valueString ?? null, decisivo: parte('decisive')?.valueBoolean === true,
|
||||
};
|
||||
}
|
||||
|
||||
// The study EEG of `report`, with the observations it lists and the electrode maps of its metrics.
|
||||
export function eegDeReporte(report: Report | undefined, observations: Observation[], metricas: Metric[]): TeaEeg | null {
|
||||
if (!report?.effectiveDateTime) return null;
|
||||
const ids = new Set((report.result ?? []).map(r => referenceId(r)));
|
||||
const listed = observations.filter(o => ids.has(o.id));
|
||||
const calidad = (concept: Concept | undefined) => (code(concept) ?? 'MALO').toLowerCase() as TeaNivelCalidad;
|
||||
const calidad = (concept: Concept | undefined) => (code(concept) ?? 'SIN_ANALIZAR').toLowerCase() as TeaNivelCalidad;
|
||||
const duracion = extension(report, 'duracion-min')?.valueDecimal;
|
||||
const alteraciones = listed.filter(o => codeIn(o.code, METRICAS)).map(o => alteracion(o, metricas));
|
||||
// A metric's electrode values are `electrodos-<the metric observation's id>`.
|
||||
const mapas = observations.filter(o => o.id?.startsWith('electrodos-') && ids.has(o.id.slice('electrodos-'.length)))
|
||||
@@ -135,14 +163,10 @@ export function eegDeReporte(report: Report | undefined, observations: Observati
|
||||
.filter(m => alteraciones.some(a => a.codigo === m.codigo && a.estado !== 'no_evaluable'));
|
||||
return {
|
||||
fecha: report.effectiveDateTime.slice(0, 10),
|
||||
duracion_min: Math.round(extension(report, 'duracion-min')?.valueDecimal ?? 0),
|
||||
canales: extension(report, 'canales')?.valueInteger ?? 0,
|
||||
duracion_min: duracion === undefined ? null : Math.round(duracion),
|
||||
canales: extension(report, 'canales')?.valueInteger ?? null,
|
||||
calidad: calidad(report.conclusionCode?.[0]),
|
||||
criterios_calidad: listed.filter(o => code(o.code)?.startsWith('eeg.calidad_')).map(o => ({
|
||||
codigo: code(o.code)!.replace('eeg.calidad_', ''), etiqueta: display(o.code) ?? '',
|
||||
valor: o.valueInteger ?? o.valueQuantity?.value ?? 0, unidad: typeof o.valueInteger === 'number' ? 'canales' : o.valueQuantity?.unit ?? '',
|
||||
nivel: calidad(o.interpretation?.[0]),
|
||||
})),
|
||||
criterios_calidad: listed.filter(o => codeIn(o.code, CRITERIOS)).map(criterio),
|
||||
alteraciones, mapas,
|
||||
ejes_mapa: { x: EJE, y: EJE, electrodos: Object.entries(ELECTRODOS).map(([nombre, [x, y]]) => ({ nombre, x, y })) },
|
||||
};
|
||||
@@ -166,7 +190,7 @@ export function pacienteDeEpisodio(episode: Resource, included: Resource[], vali
|
||||
const report = own.find(r => r.resourceType === 'DiagnosticReport') as Report | undefined;
|
||||
const ados2 = byCode(observations, 'ados2');
|
||||
const plan = own.find(r => r.resourceType === 'CarePlan') as { activity?: { detail?: { code?: Concept; status?: string } }[] } | undefined;
|
||||
const modulo = code(component(ados2, 'ados2.modulo')?.valueCodeableConcept)?.replace(/^ados2\.modulo\.(MODULO_)?/, '');
|
||||
const modulo = moduloAdos2(code(component(ados2, 'ados2.modulo')?.valueCodeableConcept));
|
||||
return {
|
||||
id_seudonimo: id,
|
||||
grupo_edad: grupoEdad(extension(episode, 'grupo-edad')?.valueCoding?.code),
|
||||
@@ -221,7 +245,7 @@ export class FhirTeaSeguimientoService extends TeaSeguimientoService {
|
||||
const corte = query.corte ?? isoDay(this.today());
|
||||
const { desde, hasta } = ventana(corte, query.meses);
|
||||
let params = new HttpParams().append('date', 'ge' + desde).append('date', 'le' + hasta);
|
||||
if (query.estatus) params = params.set('resultado-eeg', query.estatus);
|
||||
if (query.estatus) params = params.set('resultado-eeg', FILTRO_EEG[query.estatus] ?? query.estatus);
|
||||
if (query.grupo_edad) params = params.set('grupo-edad', grupoCodigo(query.grupo_edad));
|
||||
const mchat = RANGOS_MCHAT.find(r => r.codigo === query.mchat), css = RANGOS_CSS.find(r => r.codigo === query.css);
|
||||
if (mchat) params = params.append('mchat', 'ge' + mchat.min).append('mchat', 'le' + mchat.max);
|
||||
@@ -248,6 +272,7 @@ export class FhirTeaSeguimientoService extends TeaSeguimientoService {
|
||||
items: episodes.map(e => pacienteDeEpisodio(e, included, validadas)),
|
||||
tipos_alteracion: validadas ? metricas.map(m => ({ codigo: m.code ?? '', etiqueta: m.display ?? m.code ?? '' })) : [],
|
||||
resumen_eeg: {
|
||||
validadas, con_eeg_valido: validadas ? parameter(resumen, 'normales') + parameter(resumen, 'anormales') : parameter(resumen, 'con_eeg_valido'),
|
||||
normales: parameter(resumen, 'normales'), anormales: parameter(resumen, 'anormales'), sin_eeg: parameter(resumen, 'sin_eeg_valido'),
|
||||
por_alteracion: porAlteracion(resumen, metricas),
|
||||
},
|
||||
@@ -261,12 +286,11 @@ export class FhirTeaSeguimientoService extends TeaSeguimientoService {
|
||||
}).pipe(map(({ bundle, metricas }) => {
|
||||
const all = resources(bundle);
|
||||
const observations = all.filter(r => r.resourceType === 'Observation') as Observation[];
|
||||
const metric = observations.find(o => codeIn(o.code, METRICAS) && o.referenceRange?.[0]?.text);
|
||||
const edad = metric?.referenceRange?.[0]?.text?.split(': ').pop();
|
||||
const episode = resources(bundle, 'EpisodeOfCare')[0];
|
||||
return teaPacienteDetalle({
|
||||
simulado: all.length > 0 && all.every(isSimulated),
|
||||
id_seudonimo: id,
|
||||
grupo_edad: grupoEdad(edad),
|
||||
grupo_edad: grupoEdad(episode && extension(episode, 'grupo-edad')?.valueCoding?.code),
|
||||
ados2: ados2DeObservacion(byCode(observations, 'ados2')),
|
||||
eeg: eegDeReporte(resources(bundle, 'DiagnosticReport')[0] as Report | undefined, observations, metricas),
|
||||
}, id);
|
||||
|
||||
@@ -4,7 +4,8 @@ import { map } from 'rxjs';
|
||||
import { isoDate, SeguimientoQuery, SeguimientoResponse, SeguimientoStatus } from './cacu-seguimiento.models';
|
||||
import { validSeguimientoQuery } from './cacu-seguimiento.service';
|
||||
|
||||
export type AlteracionesEeg = 'normal' | 'anormal';
|
||||
// The EEG filter: by alteration once the domain expert has validated them, otherwise only by a valid EEG or none.
|
||||
export type AlteracionesEeg = 'normal' | 'anormal' | 'valido' | 'sin_eeg_valido';
|
||||
export type EstadoCaso = 'completo' | 'en_proceso' | 'fuera_protocolo';
|
||||
export interface TeaSeguimientoPaciente {
|
||||
id_seudonimo: string;
|
||||
@@ -12,7 +13,7 @@ export interface TeaSeguimientoPaciente {
|
||||
ultimo_eeg: string | null;
|
||||
mchat: number | null;
|
||||
css_ados2: number | null;
|
||||
alteraciones_eeg: AlteracionesEeg | null;
|
||||
alteraciones_eeg: 'normal' | 'anormal' | null;
|
||||
modulo_ados2: string | null;
|
||||
estado_caso: EstadoCaso;
|
||||
// What a case in process still lacks.
|
||||
@@ -21,6 +22,9 @@ export interface TeaSeguimientoPaciente {
|
||||
alteraciones: string[];
|
||||
}
|
||||
export interface TeaResumenEeg {
|
||||
// Without validated alterations only the split by a valid EEG is known: `normales`, `anormales` and `por_alteracion`
|
||||
// stay empty.
|
||||
validadas: boolean; con_eeg_valido: number;
|
||||
normales: number; anormales: number; sin_eeg: number;
|
||||
por_alteracion: { codigo: string; etiqueta: string; n: number }[];
|
||||
}
|
||||
@@ -35,21 +39,29 @@ export interface TeaAdosReactivo { codigo: string; etiqueta: string; puntaje: nu
|
||||
export interface TeaAdosDominio { codigo: string; etiqueta: string; puntaje: number; maximo: number; reactivos: TeaAdosReactivo[] }
|
||||
export interface TeaAdos2 {
|
||||
fecha: string; modulo: string; algoritmo: string; dominios: TeaAdosDominio[]; total: number; total_maximo: number;
|
||||
clasificacion: 'autismo' | 'espectro_autista' | 'no_espectro'; css: number; nivel_css: 'minimo' | 'bajo' | 'moderado' | 'alto';
|
||||
clasificacion: ClasificacionAdos2 | null; css: number; nivel_css: 'minimo' | 'bajo' | 'moderado' | 'alto';
|
||||
}
|
||||
export type ClasificacionAdos2 = 'autismo' | 'espectro_autista' | 'no_espectro' | 'preocupacion_leve_moderada' | 'preocupacion_severa';
|
||||
export interface TeaEegRegion { codigo: string; etiqueta: string; valor_z: number }
|
||||
// Mock: EEG metrics with placeholder reference ranges and associated effects, pending medical review.
|
||||
export type TeaNivelCalidad = 'bueno' | 'aceptable' | 'malo';
|
||||
// EEG metrics against age baselines and their associated effects, both pending medical validation.
|
||||
export type TeaNivelCalidad = 'bueno' | 'malo' | 'sin_analizar';
|
||||
// One quality check of the EEG analysis: a study-wide rule, or a bad channel with its electrode and reason.
|
||||
export interface TeaCriterioCalidad {
|
||||
codigo: string; etiqueta: string; valor: number | string | null; unidad: string; nivel: 'bueno' | 'malo';
|
||||
electrodo: string | null; decisivo: boolean;
|
||||
}
|
||||
export type TeaAlteracionEstado = 'normal' | 'aumentado' | 'disminuido' | 'no_evaluable';
|
||||
export interface TeaEegAlteracion {
|
||||
codigo: string; etiqueta: string; unidad: string; referencia: { min: number; max: number };
|
||||
codigo: string; etiqueta: string; unidad: string; referencia: { min: number; max: number; mediana: number | null } | null;
|
||||
valor: number | null; valor_z: number | null; estado: TeaAlteracionEstado; efectos: string[];
|
||||
// Why it could not be evaluated: nothing measured (spindles without sleep), or no reference for the child's age.
|
||||
sin_evaluar: 'sin_valor' | 'sin_referencia' | null;
|
||||
}
|
||||
export interface TeaEegMapa { codigo: string; metrica: string; z: (number | null)[][]; regiones: TeaEegRegion[] }
|
||||
export interface TeaEeg {
|
||||
fecha: string; duracion_min: number; canales: number;
|
||||
// The overall rating is in words, like Automagic, and is the worst of its criteria, which report numbers.
|
||||
calidad: TeaNivelCalidad; criterios_calidad: { codigo: string; etiqueta: string; valor: number; unidad: string; nivel: TeaNivelCalidad }[];
|
||||
fecha: string; duracion_min: number | null; canales: number | null;
|
||||
// The overall rating is the EEG analysis's verdict; its checks say why.
|
||||
calidad: TeaNivelCalidad; criterios_calidad: TeaCriterioCalidad[];
|
||||
alteraciones: TeaEegAlteracion[];
|
||||
// One map per alteration that could be evaluated, on shared axes.
|
||||
mapas: TeaEegMapa[];
|
||||
@@ -57,6 +69,10 @@ export interface TeaEeg {
|
||||
}
|
||||
export interface TeaPacienteDetalle { simulado: true; id_seudonimo: string; grupo_edad: string; ados2: TeaAdos2 | null; eeg: TeaEeg | null }
|
||||
// TEA has no follow-up status; its third filter is the EEG result, using the CaCu status shape.
|
||||
export const CLASIFICACIONES_ADOS2: Record<ClasificacionAdos2, string> = {
|
||||
autismo: 'Autismo', espectro_autista: 'Espectro autista', no_espectro: 'No espectro',
|
||||
preocupacion_leve_moderada: 'Preocupación leve a moderada', preocupacion_severa: 'Preocupación de moderada a severa',
|
||||
};
|
||||
export const ESTADOS_CASO: Record<EstadoCaso, string> = { completo: 'Completo', en_proceso: 'En proceso', fuera_protocolo: 'Fuera del protocolo' };
|
||||
export const GRUPOS_EDAD_TEA = ['16-23 meses', '24-29 meses', '30-36 meses'];
|
||||
// M-CHAT-R/F risk bands, and the ADOS-2 calibrated severity levels used in the patient summary.
|
||||
@@ -71,15 +87,22 @@ export const RANGOS_CSS = [
|
||||
{ codigo: 'moderado', etiqueta: 'Nivel moderado (5–7)', min: 5, max: 7 },
|
||||
{ codigo: 'alto', etiqueta: 'Nivel alto (8–10)', min: 8, max: 10 },
|
||||
];
|
||||
export const ALTERACIONES_EEG: SeguimientoStatus[] = [{ codigo: 'normal', etiqueta: 'Normal' }, { codigo: 'anormal', etiqueta: 'Anormal' }];
|
||||
export const ALTERACIONES_EEG: SeguimientoStatus[] = [
|
||||
{ codigo: 'normal', etiqueta: 'Normal' }, { codigo: 'anormal', etiqueta: 'Anormal' }, { codigo: 'sin_eeg_valido', etiqueta: 'Sin EEG válido' },
|
||||
];
|
||||
export const EEG_VALIDO: SeguimientoStatus[] = [{ codigo: 'valido', etiqueta: 'Con EEG válido' }, { codigo: 'sin_eeg_valido', etiqueta: 'Sin EEG válido' }];
|
||||
|
||||
const record = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v);
|
||||
const integer = (v: unknown, min = 0) => typeof v === 'number' && Number.isSafeInteger(v) && v >= min;
|
||||
const eeg = (v: unknown) => v === null || v === 'normal' || v === 'anormal';
|
||||
const filtroEeg = (v: unknown) => v === null || ['normal', 'anormal', 'valido', 'sin_eeg_valido'].includes(v as string);
|
||||
const score = (v: unknown, min: number, max: number) => v === null || typeof v === 'number' && Number.isSafeInteger(v) && v >= min && v <= max;
|
||||
// ADOS-2 item codes: 0 to 3, and 7 to 9 for an item that doesn't apply or wasn't scored.
|
||||
const CODIGOS_REACTIVO = [0, 1, 2, 3, 7, 8, 9];
|
||||
const textos = (v: unknown) => Array.isArray(v) && v.every(t => typeof t === 'string');
|
||||
function validResumenEeg(r: unknown): boolean {
|
||||
return record(r) && integer(r['normales']) && integer(r['anormales']) && integer(r['sin_eeg']) && Array.isArray(r['por_alteracion'])
|
||||
return record(r) && typeof r['validadas'] === 'boolean' && integer(r['con_eeg_valido'])
|
||||
&& integer(r['normales']) && integer(r['anormales']) && integer(r['sin_eeg']) && Array.isArray(r['por_alteracion'])
|
||||
&& r['por_alteracion'].every(a => record(a) && typeof a['codigo'] === 'string' && typeof a['etiqueta'] === 'string' && integer(a['n']));
|
||||
}
|
||||
export function teaSeguimientoResponse(v: unknown): TeaSeguimientoResponse {
|
||||
@@ -88,7 +111,7 @@ export function teaSeguimientoResponse(v: unknown): TeaSeguimientoResponse {
|
||||
const p = v['paginacion'], window = v['ventana'], filters = v['filtros'];
|
||||
// M-CHAT-R/F totals range 0–20; ADOS-2 calibrated severity scores range 1–10.
|
||||
if (!isoDate(v['corte']) || !record(window) || ![1,3,6,12].includes(window['meses'] as number) || !isoDate(window['desde']) || !isoDate(window['hasta'])
|
||||
|| !record(filters) || !eeg(filters['alteraciones_eeg'])
|
||||
|| !record(filters) || !filtroEeg(filters['alteraciones_eeg'])
|
||||
|| !record(p) || !integer(p['page'], 1) || !integer(p['page_size'], 1) || (p['page_size'] as number) > 200 || !integer(p['total_items']) || !integer(p['total_pages'])
|
||||
|| !Array.isArray(v['items']) || v['items'].length > (p['page_size'] as number) || !v['items'].every(item => record(item)
|
||||
&& typeof item['id_seudonimo'] === 'string' && typeof item['grupo_edad'] === 'string'
|
||||
@@ -106,33 +129,39 @@ const finite = (v: unknown) => typeof v === 'number' && Number.isFinite(v);
|
||||
const text = (v: unknown) => typeof v === 'string' && v.length > 0;
|
||||
function validAdos(a: unknown): boolean {
|
||||
if (a === null) return true;
|
||||
if (!record(a) || !isoDate(a['fecha']) || !text(a['modulo']) || !text(a['algoritmo']) || !score(a['css'], 1, 10)
|
||||
|| !['autismo', 'espectro_autista', 'no_espectro'].includes(a['clasificacion'] as string)
|
||||
if (!record(a) || !isoDate(a['fecha']) || !text(a['modulo']) || typeof a['algoritmo'] !== 'string' || !score(a['css'], 1, 10)
|
||||
|| !(a['clasificacion'] === null || Object.hasOwn(CLASIFICACIONES_ADOS2, a['clasificacion'] as string))
|
||||
|| !['minimo', 'bajo', 'moderado', 'alto'].includes(a['nivel_css'] as string) || !Array.isArray(a['dominios'])) return false;
|
||||
// Items score 0–3 (algorithm 0–2); each domain and the total must be the sum of their parts.
|
||||
// Items carry an ADOS-2 code (algorithm 0–2); each domain and the total must be the sum of their parts.
|
||||
const dominios = a['dominios'] as unknown[];
|
||||
const ok = dominios.every(d => record(d) && text(d['codigo']) && text(d['etiqueta']) && Array.isArray(d['reactivos'])
|
||||
&& d['reactivos'].every(r => record(r) && text(r['codigo']) && text(r['etiqueta']) && score(r['puntaje'], 0, 3) && score(r['puntaje_algoritmo'], 0, 2))
|
||||
&& d['reactivos'].every(r => record(r) && text(r['codigo']) && text(r['etiqueta']) && CODIGOS_REACTIVO.includes(r['puntaje'] as number) && score(r['puntaje_algoritmo'], 0, 2))
|
||||
&& d['puntaje'] === (d['reactivos'] as TeaAdosReactivo[]).reduce((t, r) => t + r.puntaje_algoritmo, 0)
|
||||
&& d['maximo'] === 2 * (d['reactivos'] as unknown[]).length);
|
||||
return ok && a['total'] === (dominios as TeaAdosDominio[]).reduce((t, d) => t + d.puntaje, 0)
|
||||
&& a['total_maximo'] === (dominios as TeaAdosDominio[]).reduce((t, d) => t + d.maximo, 0);
|
||||
}
|
||||
// A metric without a value cannot be evaluated; one with a value is out of range exactly when it is altered.
|
||||
// A metric that can't be evaluated says why and has no z; one that can has its value, z and reference.
|
||||
function validAlteracion(a: unknown): boolean {
|
||||
if (!record(a) || !text(a['codigo']) || !text(a['etiqueta']) || typeof a['unidad'] !== 'string' || !record(a['referencia'])
|
||||
|| !finite(a['referencia']['min']) || !finite(a['referencia']['max']) || (a['referencia']['min'] as number) > (a['referencia']['max'] as number)
|
||||
const ref = a !== null && record(a) ? a['referencia'] : undefined;
|
||||
if (!record(a) || !text(a['codigo']) || !text(a['etiqueta']) || typeof a['unidad'] !== 'string'
|
||||
|| !(ref === null || record(ref) && finite(ref['min']) && finite(ref['max']) && (ref['min'] as number) <= (ref['max'] as number)
|
||||
&& (ref['mediana'] === null || finite(ref['mediana'])))
|
||||
|| !Array.isArray(a['efectos']) || !a['efectos'].every(text)) return false;
|
||||
const estado = a['estado'];
|
||||
if (estado === 'no_evaluable') return a['valor'] === null && a['valor_z'] === null;
|
||||
return finite(a['valor']) && finite(a['valor_z']) && ['normal', 'aumentado', 'disminuido'].includes(estado as string);
|
||||
if (estado === 'no_evaluable') return a['valor_z'] === null && ['sin_valor', 'sin_referencia'].includes(a['sin_evaluar'] as string)
|
||||
&& (a['sin_evaluar'] === 'sin_valor') === (a['valor'] === null);
|
||||
return finite(a['valor']) && finite(a['valor_z']) && ref !== null && a['sin_evaluar'] === null
|
||||
&& ['normal', 'aumentado', 'disminuido'].includes(estado as string);
|
||||
}
|
||||
function validEeg(e: unknown): boolean {
|
||||
if (e === null) return true;
|
||||
const nivel = (v: unknown) => ['bueno', 'aceptable', 'malo'].includes(v as string);
|
||||
if (!record(e) || !isoDate(e['fecha']) || !integer(e['duracion_min'], 1) || !integer(e['canales'], 1) || !nivel(e['calidad'])
|
||||
|| !Array.isArray(e['criterios_calidad']) || !e['criterios_calidad'].every(c => record(c) && text(c['codigo']) && text(c['etiqueta']) && nivel(c['nivel']) && text(c['unidad'])
|
||||
&& (c['unidad'] === 'canales' ? integer(c['valor']) && (c['valor'] as number) <= (e['canales'] as number) : finite(c['valor']) && (c['valor'] as number) >= 0))) return false;
|
||||
const optional = (v: unknown) => v === null || integer(v);
|
||||
if (!record(e) || !isoDate(e['fecha']) || !optional(e['duracion_min']) || !optional(e['canales'])
|
||||
|| !['bueno', 'malo', 'sin_analizar'].includes(e['calidad'] as string)
|
||||
|| !Array.isArray(e['criterios_calidad']) || !e['criterios_calidad'].every(c => record(c) && text(c['codigo']) && text(c['etiqueta'])
|
||||
&& ['bueno', 'malo'].includes(c['nivel'] as string) && typeof c['unidad'] === 'string' && typeof c['decisivo'] === 'boolean'
|
||||
&& (c['electrodo'] === null || text(c['electrodo'])) && (c['valor'] === null || finite(c['valor']) || text(c['valor'])))) return false;
|
||||
if (!Array.isArray(e['alteraciones']) || !e['alteraciones'].every(validAlteracion)) return false;
|
||||
const ejes = e['ejes_mapa'];
|
||||
if (!record(ejes) || !Array.isArray(ejes['x']) || !Array.isArray(ejes['y']) || !Array.isArray(e['mapas'])) return false;
|
||||
|
||||
@@ -13,13 +13,14 @@ const data = {
|
||||
paginacion: { page: 1, page_size: 50, total_items: 2, total_pages: 1 },
|
||||
items: [item, { ...item, id_seudonimo: 'T-0002', ultimo_eeg: null, mchat: null, css_ados2: null, alteraciones_eeg: null, modulo_ados2: null, estado_caso: 'fuera_protocolo', pendientes: [], alteraciones: [] }],
|
||||
tipos_alteracion: [{ codigo: 'ritmo_posterior', etiqueta: 'Ritmo posterior' }, { codigo: 'picos_paroxisticos', etiqueta: 'Picos paroxísticos' }],
|
||||
resumen_eeg: { normales: 3, anormales: 1, sin_eeg: 1, por_alteracion: [{ codigo: 'ritmo_posterior', etiqueta: 'Ritmo posterior', n: 1 }, { codigo: 'picos_paroxisticos', etiqueta: 'Picos paroxísticos', n: 0 }] },
|
||||
resumen_eeg: { validadas: true, con_eeg_valido: 4, normales: 3, anormales: 1, sin_eeg: 1, por_alteracion: [{ codigo: 'ritmo_posterior', etiqueta: 'Ritmo posterior', n: 1 }, { codigo: 'picos_paroxisticos', etiqueta: 'Picos paroxísticos', n: 0 }] },
|
||||
};
|
||||
const reactivo = (codigo: string, puntaje: number) => ({ codigo, etiqueta: 'Reactivo ' + codigo, puntaje, puntaje_algoritmo: Math.min(puntaje, 2) });
|
||||
const metrica = (codigo: string, etiqueta: string, extra: object) => ({ codigo, etiqueta, unidad: '', referencia: { min: 1, max: 2 }, efectos: [], ...extra });
|
||||
const metrica = (codigo: string, etiqueta: string, extra: object) => ({
|
||||
codigo, etiqueta, unidad: '', referencia: { min: 1, max: 2, mediana: 1.5 }, efectos: [], sin_evaluar: null, ...extra });
|
||||
const alteraciones = [
|
||||
metrica('ritmo_posterior', 'Ritmo posterior', { valor: 0.9, valor_z: -2.4, estado: 'disminuido', efectos: ['Ritmo más lento de lo esperado para la edad.'] }),
|
||||
metrica('husos_sueno_n2', 'Husos de sueño N2', { valor: null, valor_z: null, estado: 'no_evaluable' }),
|
||||
metrica('husos_sueno_n2', 'Husos de sueño N2', { valor: null, valor_z: null, estado: 'no_evaluable', referencia: null, sin_evaluar: 'sin_valor' }),
|
||||
metrica('husos_sueno_n3', 'Husos de sueño N3', { valor: 1.4, valor_z: 0.2, estado: 'normal' }),
|
||||
metrica('picos_paroxisticos', 'Picos paroxísticos', { valor: 1.5, valor_z: 0.3, estado: 'normal' }),
|
||||
metrica('gradiente_anteroposterior', 'Gradiente anteroposterior', { valor: 1.2, valor_z: -0.4, estado: 'normal' }),
|
||||
@@ -30,8 +31,12 @@ const detalle = {
|
||||
ados2: { fecha: '2026-08-23', modulo: '1', algoritmo: 'Pocas o ninguna palabra', total: 5, total_maximo: 8, clasificacion: 'no_espectro', css: 3, nivel_css: 'bajo',
|
||||
dominios: [{ codigo: 'AS', etiqueta: 'Afecto social', puntaje: 4, maximo: 4, reactivos: [reactivo('A2', 3), reactivo('B1', 2)] },
|
||||
{ codigo: 'CRR', etiqueta: 'Comportamiento restringido y repetitivo', puntaje: 1, maximo: 4, reactivos: [reactivo('D1', 1), reactivo('D2', 0)] }] },
|
||||
eeg: { fecha: '2026-09-12', duracion_min: 20, canales: 19, calidad: 'aceptable',
|
||||
criterios_calidad: [{ codigo: 'amplitud', etiqueta: 'Canales con amplitud extrema', valor: 1, unidad: 'canales', nivel: 'bueno' }, { codigo: 'linea', etiqueta: 'Ruido de la línea eléctrica', valor: 8, unidad: 'dB', nivel: 'aceptable' }],
|
||||
eeg: { fecha: '2026-09-12', duracion_min: 20, canales: 19, calidad: 'bueno',
|
||||
criterios_calidad: [
|
||||
{ codigo: 'clean-windows', etiqueta: 'Ventanas limpias', valor: 95, unidad: '%', nivel: 'bueno', electrodo: null, decisivo: true },
|
||||
{ codigo: 'line-noise', etiqueta: 'Ruido de la línea eléctrica', valor: 48, unidad: 'dB', nivel: 'malo', electrodo: null, decisivo: false },
|
||||
{ codigo: 'dead-channel', etiqueta: 'Canal muerto', valor: 'dead channel', unidad: '', nivel: 'malo', electrodo: 'T3', decisivo: false },
|
||||
],
|
||||
alteraciones,
|
||||
mapas: [mapa('ritmo_posterior', 'Ritmo posterior (puntuación z)', 'Central'), mapa('picos_paroxisticos', 'Picos paroxísticos (puntuación z)', 'Occipital')],
|
||||
ejes_mapa: { x: [-1, 0, 1], y: [-1, 0, 1], electrodos: [{ nombre: 'Cz', x: 0, y: 0 }] } },
|
||||
@@ -75,7 +80,7 @@ describe('Seguimiento TEA', () => {
|
||||
expect(root.querySelector('input[type=date]')).not.toBeNull();
|
||||
const select = root.querySelector<HTMLSelectElement>('select[name=estatus]')!;
|
||||
expect(select.closest('label')?.textContent).toContain('Alteraciones EEG');
|
||||
expect(Array.from(select.options).map(o => o.textContent?.trim())).toEqual(['Todas', 'Normal', 'Anormal']);
|
||||
expect(Array.from(select.options).map(o => o.textContent?.trim())).toEqual(['Todas', 'Normal', 'Anormal', 'Sin EEG válido']);
|
||||
fixture.componentInstance.draft = { ...fixture.componentInstance.draft, estatus: 'anormal', corte: '2026-08-31', meses: 6, page_size: 20 };
|
||||
fixture.componentInstance.apply();
|
||||
const filtered = request();
|
||||
@@ -218,7 +223,7 @@ describe('Seguimiento TEA', () => {
|
||||
const panel = root.querySelector('#tea-detalle-T-0002')!;
|
||||
expect(panel.textContent).toContain('CSS 3');
|
||||
expect(panel.textContent).toContain('Afecto social (AS)');
|
||||
expect(panel.textContent).toContain('Aceptable');
|
||||
expect(panel.textContent).toContain('Válido');
|
||||
// Opens with the map of the first altered metric.
|
||||
expect(panel.querySelector('app-plotly-chart')).not.toBeNull();
|
||||
// Item scores start collapsed.
|
||||
@@ -228,7 +233,7 @@ describe('Seguimiento TEA', () => {
|
||||
expect(metricas.textContent).toContain('Disminuido');
|
||||
expect(metricas.textContent).toContain('Posibles efectos asociados');
|
||||
expect(metricas.textContent).toContain('Ritmo más lento de lo esperado para la edad.');
|
||||
expect(metricas.textContent).toContain('Sin registro de sueño en el estudio.');
|
||||
expect(metricas.textContent).toContain('No se pudo medir en el estudio.');
|
||||
expect(Array.from(metricas.querySelectorAll('.nombre')).map(n => n.textContent)).toEqual(
|
||||
['Ritmo posterior', 'Husos de sueño N2', 'Husos de sueño N3', 'Picos paroxísticos', 'Gradiente anteroposterior']);
|
||||
expect(metricas.textContent).not.toContain('Sin alteraciones en las métricas evaluadas.');
|
||||
@@ -269,6 +274,29 @@ describe('Seguimiento TEA', () => {
|
||||
expect(root.querySelector('#tea-detalle-T-0002')?.textContent).toContain('No se pudo cargar el resumen del paciente.');
|
||||
http.verify();
|
||||
});
|
||||
it('admite las clasificaciones del módulo T, una sin clasificar y los códigos de reactivo que no aplican', () => {
|
||||
const ados2 = detalle.ados2;
|
||||
for (const clasificacion of ['preocupacion_leve_moderada', 'preocupacion_severa', null]) {
|
||||
expect(() => teaPacienteDetalle({ ...detalle, ados2: { ...ados2, clasificacion } }, 'T-0001')).not.toThrow();
|
||||
}
|
||||
expect(() => teaPacienteDetalle({ ...detalle, ados2: { ...ados2, clasificacion: 'dudoso' } }, 'T-0001')).toThrow();
|
||||
const [as, crr] = ados2.dominios;
|
||||
const noAplica = { ...ados2, dominios: [{ ...as, reactivos: [{ ...as.reactivos[0], puntaje: 8, puntaje_algoritmo: 2 }, as.reactivos[1]] }, crr] };
|
||||
expect(() => teaPacienteDetalle({ ...detalle, ados2: noAplica }, 'T-0001')).not.toThrow();
|
||||
});
|
||||
it('sin alteraciones validadas resume y filtra solo por EEG válido', () => {
|
||||
const fixture = open();
|
||||
const sinValidar = { ...data, resumen_eeg: { validadas: false, con_eeg_valido: 2, normales: 0, anormales: 0, sin_eeg: 1, por_alteracion: [] } };
|
||||
request().flush(sinValidar); fixture.detectChanges();
|
||||
const root: HTMLElement = fixture.nativeElement;
|
||||
const resumen = root.querySelector('.resumen-eeg')!;
|
||||
expect(Array.from(resumen.querySelectorAll('dt')).map(d => d.textContent)).toEqual(['Con EEG válido', 'Sin EEG válido']);
|
||||
expect(Array.from(resumen.querySelectorAll('dd')).map(d => d.textContent)).toEqual(['2', '1']);
|
||||
const opciones = Array.from(root.querySelectorAll<HTMLOptionElement>('select[name="estatus"] option')).map(o => o.textContent!.trim());
|
||||
expect(opciones).toContain('Con EEG válido');
|
||||
expect(opciones).not.toContain('Anormal');
|
||||
http.verify();
|
||||
});
|
||||
it('valida que los puntajes ADOS-2 sumen y que el mapa sea rectangular', () => {
|
||||
expect(() => teaPacienteDetalle(detalle, 'T-0001')).not.toThrow();
|
||||
expect(() => teaPacienteDetalle({ ...detalle, simulado: false }, 'T-0001')).toThrow();
|
||||
@@ -279,25 +307,27 @@ describe('Seguimiento TEA', () => {
|
||||
expect(() => teaPacienteDetalle({ ...detalle, eeg: { ...detalle.eeg, mapas: [{ ...detalle.eeg.mapas[0], z: [[0, 0]] }] } }, 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle({ ...detalle, eeg: { ...detalle.eeg, calidad: 'regular' } }, 'T-0001')).toThrow();
|
||||
});
|
||||
it('la calidad general es una palabra, sus criterios son números y se validan', () => {
|
||||
it('la calidad es el veredicto del análisis, con sus reglas y los canales descartados, y se valida', () => {
|
||||
const fixture = open();
|
||||
request().flush(tres); fixture.detectChanges();
|
||||
const root: HTMLElement = fixture.nativeElement;
|
||||
root.querySelectorAll<HTMLButtonElement>('button.row-toggle')[0].click(); fixture.detectChanges();
|
||||
http.expectOne('/tea/seguimiento/T-0001').flush(detalle); fixture.detectChanges();
|
||||
const panel = root.querySelector('section.calidad')!;
|
||||
expect(panel.querySelector('.css')!.textContent!.trim()).toBe('Aceptable');
|
||||
expect(Array.from(panel.querySelectorAll('dt, dd')).map(n => n.textContent)).toEqual(['Canales con amplitud extrema', '1 de 19', 'Ruido de la línea eléctrica', '8 dB']);
|
||||
expect(panel.querySelectorAll('dd')[1].getAttribute('data-calidad')).toBe('aceptable');
|
||||
expect(panel.textContent).not.toMatch(/Impedancia|Artefactos|de 100/);
|
||||
const texto = (n: Element) => n.textContent!.replace(/\s+/g, ' ').trim();
|
||||
expect(texto(panel.querySelector('.css')!)).toBe('Válido');
|
||||
expect(Array.from(panel.querySelectorAll('dt, dd')).map(texto)).toEqual(['Ventanas limpias (decisiva)', '95 %', 'Ruido de la línea eléctrica', '48 dB']);
|
||||
expect(panel.querySelectorAll('dd')[1].getAttribute('data-calidad')).toBe('malo');
|
||||
expect(Array.from(panel.querySelectorAll('.canales-malos li')).map(texto)).toEqual(['T3 · Canal muerto']);
|
||||
const conCriterios = (criterios_calidad: unknown) => ({ ...detalle, eeg: { ...detalle.eeg, criterios_calidad } });
|
||||
expect(() => teaPacienteDetalle(conCriterios(undefined), 'T-0001')).toThrow();
|
||||
const criterio = { codigo: 'a', etiqueta: 'A', valor: 2, unidad: 'canales', nivel: 'bueno' };
|
||||
expect(() => teaPacienteDetalle(conCriterios([criterio]), 'T-0001')).not.toThrow();
|
||||
const criterio = { codigo: 'a', etiqueta: 'A', valor: 2, unidad: '', nivel: 'bueno', electrodo: null, decisivo: false };
|
||||
expect(() => teaPacienteDetalle(conCriterios([criterio, { ...criterio, valor: 'completo' }, { ...criterio, valor: null }]), 'T-0001')).not.toThrow();
|
||||
expect(() => teaPacienteDetalle(conCriterios([{ ...criterio, nivel: 'regular' }]), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(conCriterios([{ ...criterio, valor: null }]), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(conCriterios([{ ...criterio, valor: 20 }]), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(conCriterios([{ ...criterio, decisivo: 'si' }]), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(conCriterios([{ ...criterio, electrodo: '' }]), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle({ ...detalle, eeg: { ...detalle.eeg, calidad: 'buena' } }, 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle({ ...detalle, eeg: { ...detalle.eeg, calidad: 'sin_analizar', duracion_min: null, canales: null } }, 'T-0001')).not.toThrow();
|
||||
http.verify();
|
||||
});
|
||||
it('valida las alteraciones del EEG', () => {
|
||||
@@ -306,6 +336,8 @@ describe('Seguimiento TEA', () => {
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[0], estado: 'alto' }), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[0], valor: null }), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[1], valor: 3 }), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[1], valor: 3, sin_evaluar: 'sin_referencia' }), 'T-0001')).not.toThrow();
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[0], sin_evaluar: 'sin_valor' }), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[0], referencia: { min: 3, max: 1 } }), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(con({ ...alteraciones[0], efectos: [''] }), 'T-0001')).toThrow();
|
||||
expect(() => teaPacienteDetalle(con(alteraciones[3]), 'T-0001')).not.toThrow();
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
@if (patientState() === 'error') { <p role="alert">{{ patientError() }}</p> }
|
||||
@if (patientState() === 'listo') {
|
||||
<article class="card"><h3>ADOS-2</h3>@if (ados(); as ados) { <p>Fecha: {{ ados.effectiveDateTime }}</p><dl>@for (c of ados.component; track $index) { <div><dt>{{ c.code.coding?.[0]?.display || c.code.coding?.[0]?.code }}</dt><dd>{{ componentValue(c) }}</dd></div> }</dl> } @else { <p>Sin información de ADOS-2.</p> }</article>
|
||||
<article class="card"><h3>EEG del estudio</h3>@if (eeg(); as eeg) { <p>Fecha: {{ eeg.effectiveDateTime }}</p><p>Calidad: {{ eegQuality() }}</p><p>Duración: {{ eegExtension('duracion-min') }} minutos. Canales: {{ eegExtension('canales') }}.</p>@if (eeg.conclusion) { <p>{{ eeg.conclusion }}</p> }<dl>@for (o of quality(); track o.id) { <div><dt>{{ o.code.coding?.[0]?.display }}</dt><dd>{{ observationValue(o) }} ({{ qualityStatus(o) }})</dd></div> }</dl> } @else { <p>Sin información de EEG.</p> }</article>
|
||||
<article class="card"><h3>EEG del estudio</h3>@if (eeg(); as eeg) { <p>Fecha: {{ eeg.effectiveDateTime }}</p><p>Calidad: {{ eegQuality() }}</p><p>Duración: {{ eegExtension('duracion-min') }} minutos. Canales: {{ eegExtension('canales') }}.</p>@if (eeg.conclusion) { <p>{{ eeg.conclusion }}</p> }<dl>@for (o of quality(); track o.id) { <div><dt>{{ o.code.coding?.[0]?.display }}@if (electrode(o); as e) { · {{ e }} }</dt><dd>{{ observationValue(o) }} ({{ qualityStatus(o) }})</dd></div> }</dl> } @else { <p>Sin información de EEG.</p> }</article>
|
||||
@if (alterationsAvailable() && alterations().length) { <article class="card"><h3>Métricas del EEG</h3><dl>@for (o of alterations(); track o.id) { <div><dt>{{ o.code.coding?.[0]?.display }}</dt><dd>{{ observationValue(o) }}</dd></div> }</dl></article> }
|
||||
}
|
||||
</section>
|
||||
|
||||
@@ -174,12 +174,14 @@ export class TeaStatusPage implements OnDestroy {
|
||||
}
|
||||
ados() { return this.patientResources().find(r => r.resourceType === 'Observation' && code(r.code) === 'ados2'); }
|
||||
eeg() { return this.patientResources().find(r => r.resourceType === 'DiagnosticReport' && code(r.code) === 'eeg'); }
|
||||
eegQuality() { const quality = code(this.eeg()?.conclusionCode?.[0]); return quality === 'BUENO' ? 'Buena' : quality === 'MALO' ? 'Mala' : 'Sin dato'; }
|
||||
eegQuality() { const quality = code(this.eeg()?.conclusionCode?.[0]); return quality === 'BUENO' ? 'Buena' : quality === 'MALO' ? 'Mala' : quality === 'SIN_ANALIZAR' ? 'Sin analizar' : 'Sin dato'; }
|
||||
eegExtension(name: string) { const e = this.eeg()?.extension?.find((x: Resource) => x.url.endsWith(`/${name}`)); return e?.valueDecimal ?? e?.valueInteger ?? 'Sin dato'; }
|
||||
qualityStatus(observation: Resource) { const value = code(observation.interpretation?.[0]); return value === 'BUENO' ? 'buena' : value === 'MALO' ? 'mala' : 'sin dato'; }
|
||||
quality() { const ids = new Set((this.eeg()?.result ?? []).map((r: Resource) => r.reference)); return this.patientResources().filter(r => r.resourceType === 'Observation' && ids.has(`Observation/${r.id}`) && code(r.code).startsWith('eeg.calidad_')); }
|
||||
// The EEG analysis's checks: A is out of range, N within.
|
||||
qualityStatus(observation: Resource) { const value = code(observation.interpretation?.[0]); return value === 'N' ? 'dentro de rango' : value === 'A' ? 'fuera de rango' : 'sin dato'; }
|
||||
quality() { const ids = new Set((this.eeg()?.result ?? []).map((r: Resource) => r.reference)); return this.patientResources().filter(r => r.resourceType === 'Observation' && ids.has(`Observation/${r.id}`) && r.code?.coding?.[0]?.system === 'urn:tea:validation'); }
|
||||
electrode(o: Resource): string | undefined { return o.component?.find((c: Resource) => c.code?.text === 'electrode')?.valueString; }
|
||||
alterationsAvailable() { return this.measures().some(m => m.id.startsWith('M30-')); }
|
||||
alterations() { return this.patientResources().filter(r => r.resourceType === 'Observation' && r.code?.coding?.[0]?.system?.endsWith('/tea-eeg-metrica') && !r.id?.startsWith('electrodos-')); }
|
||||
componentValue(c: Resource) { return c.valueInteger ?? c.valueString ?? (text(c.valueCodeableConcept) || 'Sin dato'); }
|
||||
observationValue(o: Resource) { return o.valueInteger ?? (o.valueQuantity ? `${o.valueQuantity.value} ${o.valueQuantity.unit ?? ''}` : 'Sin dato'); }
|
||||
observationValue(o: Resource) { return o.valueInteger ?? (o.valueQuantity ? `${o.valueQuantity.value} ${o.valueQuantity.unit ?? ''}`.trim() : o.valueString ?? 'Sin dato'); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user