Risk record: the evaluation instant reads as a day and minute in UTC
The index date is a calendar day and the evaluation time was the raw ISO instant, so the two looked inconsistent. The
instant now shows as 'YYYY-MM-DD HH:MM UTC' (the full value stays in the <time> element's datetime).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit ea2664f324)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<div><dt>Versión del modelo</dt><dd>{{ riesgo.modelo_version }}</dd></div>
|
||||
<div><dt>Fecha índice</dt><dd>{{ riesgo.fecha_indice }}</dd></div>
|
||||
<div><dt>Desenlace</dt><dd>{{ riesgo.desenlace_texto ?? riesgo.desenlace }}</dd></div>
|
||||
<div><dt>Evaluado en (UTC)</dt><dd>{{ riesgo.evaluado_en }}</dd></div>
|
||||
<div><dt>Evaluado en</dt><dd><time [attr.datetime]="riesgo.evaluado_en">{{ instante(riesgo.evaluado_en) }}</time></dd></div>
|
||||
<div><dt>Estado del lote</dt><dd>{{ riesgo.estado_lote === 'final' ? 'Final (final)' : 'Preliminar (preliminary)' }}</dd></div>
|
||||
</dl>
|
||||
@if (riesgo.horizontes.length) {
|
||||
|
||||
@@ -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()); });
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user