|
|
|
@@ -12,6 +12,7 @@ import { CamaAnalisisSupervivencia } from './cama-analisis-supervivencia.compone
|
|
|
|
|
import { CamaCurvasService, respuestaCurvas } from './cama-curvas.service';
|
|
|
|
|
import { CamaFactoresRiesgo, entradasDe } from './cama-factores-riesgo.component';
|
|
|
|
|
import { CamaRecurrenciaService, respuestaRecurrencia } from './cama-recurrencia.service';
|
|
|
|
|
import { figuraRecurrencia } from './cama-recurrencia-figura';
|
|
|
|
|
|
|
|
|
|
const meses = Array.from({ length: 25 }, (_, i) => i);
|
|
|
|
|
const decreciente = (fin: number) => meses.map(m => 1 - (1 - fin) * (m / 24));
|
|
|
|
@@ -112,6 +113,14 @@ describe('Análisis de supervivencia', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('Análisis de recurrencia', () => {
|
|
|
|
|
// Fails if the y axis is scaled by follow-up the axis does not show: a curve that stays above 0.8 in the 72 months drawn must not start its axis at 0.2.
|
|
|
|
|
it('scales the y axis to the months it draws', () => {
|
|
|
|
|
const largo = { ...figura('metabric', 'Largo'), observado_hasta: 300, months_max: 72,
|
|
|
|
|
km: { months: Array.from({ length: 301 }, (_, i) => i), S: Array.from({ length: 301 }, (_, i) => 1 - i / 400), low: Array.from({ length: 301 }, (_, i) => (i <= 72 ? 0.85 : 0.2)), high: Array.from({ length: 301 }, () => 1) } };
|
|
|
|
|
|
|
|
|
|
expect((figuraRecurrencia(respuestaRecurrencia({ modelo: { nombre: 'cama-recurrence', version: '1' }, horizontes: [12, 36, 60], escenarios: [largo], resumen: [], predeterminado: null }).escenarios[0]).layout as any).yaxis.range[0]).toBeGreaterThan(0.5);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const figura = (cohorte: string, escenario: string) => ({ cohorte, cohorte_nombre: cohorte === 'scanb' ? 'SCAN-B' : 'METABRIC', escenario, n: 300, recaidas: 180,
|
|
|
|
|
horizons_months: [12, 36, 60], observado_hasta: 60, months_max: 72,
|
|
|
|
|
km: { months: Array.from({ length: 61 }, (_, i) => i), S: Array.from({ length: 61 }, (_, i) => 1 - i / 200), low: Array.from({ length: 61 }, (_, i) => 1 - i / 190), high: Array.from({ length: 61 }, () => 1) },
|
|
|
|
|