Merge origin/rebuild into parity/T1-merge (WebApp)
rebuild's shell, auth and non-TEA pages; tea/parity's TEA pages on tea/parity's API. - Routes: rebuild's signed-in tree; the TEA risk page joins it (domainAllowed reads the route's data domain when the path has no :domain). - Indicadores: rebuild's header and its generic Resumen/Trazabilidad/Definiciones tabs (TEA as the reference page, fed by tea/parity's measures); TEA Seguimiento and Análisis de riesgo render tea/parity's tea-list inside rebuild's tab-seguimiento/tab-riesgos, which keep rebuild's CaCu/CaMa lists and patient search. rebuild's tab-riesgos-tea read rebuild's TEA Patient extensions, which are gone with its backend; tea-list already shows that list from tea/parity's FHIR search, so it is deleted rather than ported (its look is the base for T8/T9). - Paciente: rebuild's record for CaCu/CaMa; TEA delegates to tea/parity's TeaRecord. rebuild's inline TEA sections read its EEG detail endpoint and are removed. - Gobernanza: tea/parity's page (execution, models with checks/lineage, bundles, training, studies, preview) until T13; model headings use rebuild's model titles. figures.ts: rebuild's scenarios (drawn in the record) plus tea/parity's association forest. - plot.ts: rebuild's layout helpers on tea/parity's partial Plotly bundle. - Conectar: rebuild's KINDS/HELP with an entry for tea/parity's edf node. - Dead code removed: measures boxes/sankey (tea/parity's old TEA tab), eeg-labels headMap/byDeviation/LEVEL_NAMES/METRIC_NAMES (rebuild's TEA record), e2e/layout.ts. - e2e: tea/parity's TEA cases, signed in; rebuild's CaCu/CaMa/site cases need their hospitals loaded and come back with the page suite (T16). - openapi.json and src/app/api: regenerated in the next commit.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Analysis } from '../api/models/analysis';
|
||||
import type { Figure } from '../plot';
|
||||
import { PALETTE } from '../plot';
|
||||
import { BIOMARKER_NAMES, OUTCOME_NAMES, ZONE_NAMES } from '../eeg-labels';
|
||||
|
||||
interface Band {
|
||||
x: number[];
|
||||
@@ -124,14 +125,6 @@ export function interpretabilityFigures(
|
||||
},
|
||||
},
|
||||
},
|
||||
...((report['escenarios'] ?? []) as any[]).map((e) =>
|
||||
scenarioFigure(
|
||||
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, fallecidos = ${e.fallecidos.toLocaleString('es-MX')})`,
|
||||
e,
|
||||
e.horizons_months,
|
||||
'Supervivencia S(t)',
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
case 'subgroups':
|
||||
@@ -201,16 +194,7 @@ export function interpretabilityFigures(
|
||||
];
|
||||
}
|
||||
case 'scenarios':
|
||||
return (report['recurrencia']['escenarios'] as any[])
|
||||
.slice(0, 6)
|
||||
.map((e) =>
|
||||
scenarioFigure(
|
||||
`${e.cohorte_nombre} · ${e.escenario} (n = ${e.n}, ${e.recaidas} recaídas)`,
|
||||
e,
|
||||
report['recurrencia']['horizons_months'],
|
||||
'Supervivencia libre de recaída',
|
||||
),
|
||||
);
|
||||
return [];
|
||||
case 'forest':
|
||||
return [
|
||||
{
|
||||
@@ -317,12 +301,68 @@ export function interpretabilityFigures(
|
||||
},
|
||||
];
|
||||
}
|
||||
case 'associations': {
|
||||
// Each estimated pair's odds ratio with its 95 % interval, clearest first.
|
||||
const rows = (report['rows'] as any[])
|
||||
.filter((r) => r.odds_ratio !== null)
|
||||
.sort((a, b) => (a.q ?? 1) - (b.q ?? 1));
|
||||
const label = (r: any) =>
|
||||
`${BIOMARKER_NAMES[r.biomarker] ?? r.biomarker} · ${ZONE_NAMES[r.zone] ?? r.zone} → ${
|
||||
OUTCOME_NAMES[r.outcome_code] ?? r.outcome_code
|
||||
}`;
|
||||
return [
|
||||
{
|
||||
title: `Asociaciones con el ADOS-2 (${report['children']} niños, nivel ${
|
||||
report['level'] === 'item' ? 'reactivo' : 'dominio'
|
||||
})`,
|
||||
figure: {
|
||||
data: [
|
||||
{
|
||||
type: 'scatter',
|
||||
mode: 'markers',
|
||||
x: rows.map((r) => r.odds_ratio),
|
||||
y: rows.map(label),
|
||||
error_x: {
|
||||
type: 'data',
|
||||
symmetric: false,
|
||||
array: rows.map((r) => (r.ci_high ?? r.odds_ratio) - r.odds_ratio),
|
||||
arrayminus: rows.map((r) => r.odds_ratio - (r.ci_low ?? r.odds_ratio)),
|
||||
},
|
||||
marker: {
|
||||
color: rows.map((r) => ((r.q ?? 1) < 0.05 ? PALETTE[2] : '#9aa0a6')),
|
||||
size: 9,
|
||||
},
|
||||
customdata: rows.map((r) => r.q),
|
||||
hovertemplate: 'OR %{x:.2f} · q %{customdata:.3f}<extra>%{y}</extra>',
|
||||
showlegend: false,
|
||||
},
|
||||
],
|
||||
layout: {
|
||||
xaxis: { title: { text: 'Razón de momios (escala log)' }, type: 'log' },
|
||||
yaxis: { automargin: true, autorange: 'reversed' },
|
||||
shapes: [
|
||||
{
|
||||
type: 'line',
|
||||
x0: 1,
|
||||
x1: 1,
|
||||
yref: 'paper',
|
||||
y0: 0,
|
||||
y1: 1,
|
||||
line: { color: '#9aa0a6', dash: 'dot' },
|
||||
},
|
||||
],
|
||||
height: Math.max(320, 22 * rows.length + 80),
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function scenarioFigure(
|
||||
export function scenarioFigure(
|
||||
title: string,
|
||||
e: any,
|
||||
horizons: number[],
|
||||
@@ -356,8 +396,10 @@ function scenarioFigure(
|
||||
points('LR + HBN combinado (IC 95 % bootstrap)', horizons, e.points.COMB),
|
||||
],
|
||||
layout: {
|
||||
xaxis: { title: { text: 'Meses desde el diagnóstico' } },
|
||||
yaxis: { title: { text: yTitle } },
|
||||
// One label per month with every curve's survival there, as percentages.
|
||||
hovermode: 'x unified',
|
||||
xaxis: { title: { text: 'Meses desde el diagnóstico' }, hoverformat: '.0f' },
|
||||
yaxis: { title: { text: yTitle }, tickformat: '.1~%', hoverformat: '.1%' },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user