feat(tea): cambios de la reunión del 5 de noviembre
Resumen - Estado del caso (completo, en proceso, fuera del protocolo) al cierre del periodo, en una figura y en el párrafo, separado de diagnóstico confirmado. - Tiempos por paso: M-CHAT a ADOS-2, ADOS-2 a diagnóstico y total. - Un solo formato: barras. M24 son barras apiladas por grupo de edad. - «Descargar reporte» abre la impresión con el periodo y los indicadores seleccionados. Histórico - Porcentaje de casos en proceso, tiempos por paso en la misma escala y calidad de los EEG (indicador solo de esta pestaña, con `vistas`). - Ejes con unidades y fechas como «mar 2025». Seguimiento - Columna y filtro de estado del caso, con lo que falta. - Filtro por tipo de alteración y resumen de EEG que sigue los filtros. - Módulo de ADOS-2 junto al puntaje. - Tarjetas de alteraciones: al elegir una se apartan y aparece su mapa, sin caja, con leyenda de colores. Referencia por grupo de edad. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { Component, DestroyRef, inject, Input, OnInit, signal } from '@angular/core';
|
||||
import { Component, DestroyRef, ElementRef, inject, Input, OnInit, signal } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
|
||||
import { PlotlyFigure } from './indicadores.models';
|
||||
import { TeaAdos2, TeaAlteracionEstado, TeaEeg, TeaPacienteDetalle, TeaSeguimientoService } from './tea-seguimiento.service';
|
||||
import { TeaAdos2, TeaAlteracionEstado, TeaEeg, TeaEegMapa, TeaPacienteDetalle, TeaSeguimientoService } 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.
|
||||
@@ -14,17 +14,17 @@ const INK = '#081839';
|
||||
// Shape paths have no arcs: the hole is a polygon, wound against the frame so it stays empty under either fill rule.
|
||||
const HOLE = Array.from({ length: 96 }, (_, i) => -2 * Math.PI * i / 96)
|
||||
.map((a, i) => `${i ? 'L' : 'M'} ${Math.cos(a).toFixed(4)} ${Math.sin(a).toFixed(4)}`).join(' ');
|
||||
// A white frame with a round hole hides the map outside the head; then the head outline, nose and ears.
|
||||
const HEAD_SHAPES = [
|
||||
{ type: 'path', path: `M -2 -2 L 2 -2 L 2 2 L -2 2 Z ${HOLE} Z`, fillrule: 'evenodd', fillcolor: '#FFFFFF', line: { width: 0 } },
|
||||
// A frame with a round hole hides the map outside the head, in the colour behind the map; then the head outline, nose and ears.
|
||||
const headShapes = (fondo: string) => [
|
||||
{ type: 'path', path: `M -2 -2 L 2 -2 L 2 2 L -2 2 Z ${HOLE} Z`, fillrule: 'evenodd', fillcolor: fondo, line: { width: 0 } },
|
||||
{ type: 'circle', xref: 'x', yref: 'y', x0: -1, y0: -1, x1: 1, y1: 1, line: { color: INK, width: 2 } },
|
||||
{ type: 'path', path: 'M -0.13 0.99 L 0 1.13 L 0.13 0.99', line: { color: INK, width: 2 } },
|
||||
{ type: 'path', path: 'M -0.99 0.14 Q -1.1 0.12 -1.08 0 Q -1.1 -0.12 -0.99 -0.14', line: { color: INK, width: 2 } },
|
||||
{ type: 'path', path: 'M 0.99 0.14 Q 1.1 0.12 1.08 0 Q 1.1 -0.12 0.99 -0.14', line: { color: INK, width: 2 } },
|
||||
];
|
||||
|
||||
export function mapaFigure(eeg: TeaEeg): PlotlyFigure {
|
||||
const m = eeg.mapa;
|
||||
export function mapaFigure(eeg: TeaEeg, mapa: TeaEegMapa, fondo = '#FFFFFF'): PlotlyFigure {
|
||||
const m = { ...eeg.ejes_mapa, z: mapa.z };
|
||||
return {
|
||||
data: [
|
||||
{ type: 'contour', x: m.x, y: m.y, z: m.z, zmin: -3, zmax: 3, zmid: 0, colorscale: 'RdBu', connectgaps: false,
|
||||
@@ -34,7 +34,7 @@ export function mapaFigure(eeg: TeaEeg): PlotlyFigure {
|
||||
textposition: 'top center', textfont: { size: 9, color: INK }, marker: { size: 5, color: INK }, hoverinfo: 'text', showlegend: false },
|
||||
],
|
||||
layout: {
|
||||
margin: { l: 8, r: 8, t: 8, b: 8 }, showlegend: false, shapes: HEAD_SHAPES,
|
||||
margin: { l: 8, r: 8, t: 8, b: 8 }, showlegend: false, shapes: headShapes(fondo),
|
||||
paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)',
|
||||
xaxis: { visible: false, range: [-1.2, 1.2], fixedrange: true },
|
||||
yaxis: { visible: false, range: [-1.15, 1.2], scaleanchor: 'x', fixedrange: true },
|
||||
@@ -51,12 +51,28 @@ export function mapaFigure(eeg: TeaEeg): PlotlyFigure {
|
||||
})
|
||||
export class TeaPacienteResumen implements OnInit {
|
||||
@Input({ required: true }) id = '';
|
||||
// In its own window there is room for two wide columns instead of four narrow ones.
|
||||
private readonly service = inject(TeaSeguimientoService);
|
||||
private readonly destroy = inject(DestroyRef);
|
||||
readonly status = signal<'loading' | 'ready' | 'error'>('loading');
|
||||
readonly detalle = signal<TeaPacienteDetalle | undefined>(undefined);
|
||||
figura?: PlotlyFigure;
|
||||
private mapaElegido?: string;
|
||||
private readonly elemento = inject<ElementRef<HTMLElement>>(ElementRef);
|
||||
// The first solid background around this component: the map has no box of its own.
|
||||
private fondo() {
|
||||
for (let e: HTMLElement | null = this.elemento.nativeElement; e; e = e.parentElement) {
|
||||
const color = getComputedStyle(e).backgroundColor;
|
||||
if (/^rgb\(/.test(color)) return color;
|
||||
}
|
||||
return '#FFFFFF';
|
||||
}
|
||||
mapaActual(eeg: TeaEeg) { return eeg.mapas.find(m => m.codigo === this.mapaElegido); }
|
||||
elegirMapa(eeg: TeaEeg, codigo: string) {
|
||||
// The chosen card closes the map again, and the cards take the whole space back.
|
||||
const mapa = codigo === this.mapaElegido ? undefined : eeg.mapas.find(m => m.codigo === codigo);
|
||||
this.mapaElegido = mapa?.codigo;
|
||||
this.figura = mapa && mapaFigure(eeg, mapa, this.fondo());
|
||||
}
|
||||
readonly clasificacion = CLASIFICACION;
|
||||
readonly nivelCss = NIVEL_CSS;
|
||||
readonly calidad = CALIDAD;
|
||||
@@ -65,7 +81,7 @@ export class TeaPacienteResumen implements OnInit {
|
||||
load() {
|
||||
this.status.set('loading');
|
||||
this.service.detalle(this.id).pipe(takeUntilDestroyed(this.destroy)).subscribe({
|
||||
next: d => { this.figura = d.eeg ? mapaFigure(d.eeg) : undefined; this.detalle.set(d); this.status.set('ready'); },
|
||||
next: d => { this.mapaElegido = undefined; this.figura = undefined; this.detalle.set(d); this.status.set('ready'); },
|
||||
error: () => this.status.set('error'),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user