Compare commits

...

5 Commits

3 changed files with 6 additions and 5 deletions
@@ -36,7 +36,8 @@ describe('Seguimiento de CaMa: ficha del paciente', () => {
// Fails if the export buttons leave the title row or come back under the table. // Fails if the export buttons leave the title row or come back under the table.
it('has the export buttons in the row of the section title, and nothing after the pagination', () => { it('has the export buttons in the row of the section title, and nothing after the pagination', () => {
const row = root().querySelector('.title-row')!; const row = root().querySelector('.title-row')!;
expect(row.querySelector('h2')!.textContent).toContain('Seguimiento de'); // Fails if the section heading goes back to «Seguimiento de …» instead of the name of the section tab.
expect(row.querySelector('h2')!.textContent).toBe('Análisis de riesgos');
expect([...row.querySelectorAll('button')].map(b => b.textContent!.trim())).toEqual(['Exportar Excel (.xlsx)', 'Exportar PDF']); expect([...row.querySelectorAll('button')].map(b => b.textContent!.trim())).toEqual(['Exportar Excel (.xlsx)', 'Exportar PDF']);
expect(root().querySelector('nav')!.nextElementSibling).toBeNull(); expect(root().querySelector('nav')!.nextElementSibling).toBeNull();
expect(root().textContent).not.toContain('Exportar resultados'); expect(root().textContent).not.toContain('Exportar resultados');
@@ -48,7 +48,7 @@ const mismosFiltros = (a: Record<string, string | undefined>, b: Record<string,
} }
<div [hidden]="!!ficha()"> <div [hidden]="!!ficha()">
<div class="title-row"> <div class="title-row">
<h2>Seguimiento de {{ domainLabel }}</h2> <h2>Análisis de riesgos</h2>
@if (data(); as respuesta) { @if (data(); as respuesta) {
<app-seguimiento-exportar [dominio]="dominio" [respuesta]="respuesta" [habilitado]="estado() === 'ready' && !diferencia()" [seleccion]="etiquetaDatos()" /> <app-seguimiento-exportar [dominio]="dominio" [respuesta]="respuesta" [habilitado]="estado() === 'ready' && !diferencia()" [seleccion]="etiquetaDatos()" />
} }
@@ -11,7 +11,7 @@ export interface CurvasSupervivencia {
n: number; events: number; median_follow_up_months: number; n: number; events: number; median_follow_up_months: number;
horizons_months: number[]; months_max: number; bootstrap_replicas: number; horizons_months: number[]; months_max: number; bootstrap_replicas: number;
km: { months: number[]; S: number[]; low: number[]; high: number[] }; km: { months: number[]; S: number[]; low: number[]; high: number[] };
km_adjusted: { months: number[]; S: number[] }; km_adjusted?: { months: number[]; S: number[] };
weibull: { t: number[]; S: number[] }; weibull: { t: number[]; S: number[] };
weibull_fractional: { t: number[]; S: number[] }; weibull_fractional: { t: number[]; S: number[] };
points: { LR: SerieDeSupervivencia; HBN: SerieDeSupervivencia; COMB: SerieDeSupervivencia }; points: { LR: SerieDeSupervivencia; HBN: SerieDeSupervivencia; COMB: SerieDeSupervivencia };
@@ -50,7 +50,7 @@ export function respuestaCurvas(v: unknown): RespuestaCurvas {
const km = c['km'], adjusted = c['km_adjusted'], weibull = c['weibull'], fractional = c['weibull_fractional'], points = c['points']; const km = c['km'], adjusted = c['km_adjusted'], weibull = c['weibull'], fractional = c['weibull_fractional'], points = c['points'];
if (!record(km) || !numbers(km['months']) || !probabilities(km['S'], (km['months'] as number[]).length) if (!record(km) || !numbers(km['months']) || !probabilities(km['S'], (km['months'] as number[]).length)
|| !probabilities(km['low'], (km['months'] as number[]).length) || !probabilities(km['high'], (km['months'] as number[]).length)) invalid(); || !probabilities(km['low'], (km['months'] as number[]).length) || !probabilities(km['high'], (km['months'] as number[]).length)) invalid();
if (!record(adjusted) || !numbers(adjusted['months']) || !probabilities(adjusted['S'], (adjusted['months'] as number[]).length)) invalid(); if (adjusted !== undefined && (!record(adjusted) || !numbers(adjusted['months']) || !probabilities(adjusted['S'], (adjusted['months'] as number[]).length))) invalid();
for (const curve of [weibull, fractional]) { for (const curve of [weibull, fractional]) {
if (!record(curve) || !numbers(curve['t']) || !probabilities(curve['S'], (curve['t'] as number[]).length)) invalid(); if (!record(curve) || !numbers(curve['t']) || !probabilities(curve['S'], (curve['t'] as number[]).length)) invalid();
} }
@@ -63,7 +63,7 @@ export function respuestaCurvas(v: unknown): RespuestaCurvas {
escenario: typeof c['escenario'] === 'string' ? c['escenario'] : undefined, escenario: typeof c['escenario'] === 'string' ? c['escenario'] : undefined,
n: c['n'] as number, events: c['events'] as number, median_follow_up_months: c['median_follow_up_months'] as number, n: c['n'] as number, events: c['events'] as number, median_follow_up_months: c['median_follow_up_months'] as number,
horizons_months: horizons as number[], months_max: c['months_max'] as number, bootstrap_replicas: c['bootstrap_replicas'] as number, horizons_months: horizons as number[], months_max: c['months_max'] as number, bootstrap_replicas: c['bootstrap_replicas'] as number,
km: km as CurvasSupervivencia['km'], km_adjusted: adjusted as CurvasSupervivencia['km_adjusted'], km: km as CurvasSupervivencia['km'], ...(adjusted !== undefined ? { km_adjusted: adjusted as CurvasSupervivencia['km_adjusted'] } : {}),
weibull: weibull as CurvasSupervivencia['weibull'], weibull_fractional: fractional as CurvasSupervivencia['weibull_fractional'], weibull: weibull as CurvasSupervivencia['weibull'], weibull_fractional: fractional as CurvasSupervivencia['weibull_fractional'],
points: { LR: serie(p['LR'], h), HBN: serie(p['HBN'], h), COMB: serie(p['COMB'], h) }, etiquetas, points: { LR: serie(p['LR'], h), HBN: serie(p['HBN'], h), COMB: serie(p['COMB'], h) }, etiquetas,
}, },