diff --git a/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.html b/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.html index 30a796b..f04c835 100644 --- a/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.html +++ b/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.html @@ -14,7 +14,7 @@
Versión del modelo
{{ riesgo.modelo_version }}
Fecha índice
{{ riesgo.fecha_indice }}
Desenlace
{{ riesgo.desenlace_texto ?? riesgo.desenlace }}
-
Evaluado en (UTC)
{{ riesgo.evaluado_en }}
+
Evaluado en
Estado del lote
{{ riesgo.estado_lote === 'final' ? 'Final (final)' : 'Preliminar (preliminary)' }}
@if (riesgo.horizontes.length) { diff --git a/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.ts b/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.ts index cd4626e..4342680 100644 --- a/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.ts +++ b/src/app/features/indicadores/paciente-detalle/paciente-riesgo-tabla.ts @@ -4,6 +4,12 @@ import { DominioRiesgo } from './paciente-riesgo.models'; import { PacienteRiesgoState } from './paciente-riesgo.state'; import { tieneIntervalo } from './paciente-riesgo.validation'; +/** A UTC instant as the day and the minute it happened, so it reads next to the index date (a calendar day, not an instant). */ +export const instanteUtc = (iso: string) => { + const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(iso); + return m ? `${m[1]} ${m[2]} UTC` : iso; +}; + @Component({ selector: 'app-paciente-riesgo-tabla', imports: [DecimalPipe], @@ -20,6 +26,7 @@ export class PacienteRiesgoTabla { private readonly state = inject(PacienteRiesgoState); readonly estado = this.state.estado; readonly tieneIntervalo = tieneIntervalo; + readonly instante = instanteUtc; constructor() { effect(() => { this.state.dominio.set(this.dominio()); this.state.pacId.set(this.pacId()); }); } diff --git a/src/app/features/indicadores/paciente-detalle/paciente-riesgo.spec.ts b/src/app/features/indicadores/paciente-detalle/paciente-riesgo.spec.ts index 51c685d..2b13303 100644 --- a/src/app/features/indicadores/paciente-detalle/paciente-riesgo.spec.ts +++ b/src/app/features/indicadores/paciente-detalle/paciente-riesgo.spec.ts @@ -5,7 +5,7 @@ import { of, Subject, throwError } from 'rxjs'; import { PacienteRiesgoProvider } from './paciente-riesgo.models'; import { PACIENTE_RIESGO_PROVIDER } from './paciente-riesgo.provider'; import { prediccion, riesgoCacuEjemplo } from './paciente-riesgo.testing'; -import { PacienteRiesgoTabla } from './paciente-riesgo-tabla'; +import { instanteUtc, PacienteRiesgoTabla } from './paciente-riesgo-tabla'; describe('RIESGO-CACU-02: presentación y aislamiento', () => { function setup(provider?: PacienteRiesgoProvider) { @@ -50,7 +50,7 @@ describe('RIESGO-CACU-02: presentación y aislamiento', () => { expect([...root.querySelectorAll('.percentage')].map(c => c.textContent!.trim())).toEqual(['8 %', '21 %', '34 %']); expect(root.querySelector('.interval')!.textContent).toContain('5 % – 12 %'); expect(root.textContent).toContain('Final (final)'); - for (const value of ['modelo-cacu', '2.1.0', '2026-10-01T00:00:00Z', '2026-06-01', 'CIN2+ por biopsia']) { + for (const value of ['modelo-cacu', '2.1.0', '2026-10-01 00:00 UTC', '2026-06-01', 'CIN2+ por biopsia']) { expect(root.textContent).toContain(value); } // The record no longer shows the cohort's internals (its definition, version or model variables). @@ -135,3 +135,10 @@ describe('RIESGO-CACU-02: presentación y aislamiento', () => { expect(f.nativeElement.textContent).toContain('Recomendaciones no disponibles'); }); }); + +describe('instanteUtc', () => { + it('shows the day and the minute of a UTC instant, and leaves anything else as it came', () => { + expect(instanteUtc('2026-11-21T23:17:45.120Z')).toBe('2026-11-21 23:17 UTC'); + expect(instanteUtc('no es una fecha')).toBe('no es una fecha'); + }); +});