Gobernanza: Analizar EEG leads to Estudios EEG, which hosts the single-study evaluation; the timeline is only a dotted line; the probability curve and the age-norm bands are drawn from the model and the centiles

This commit is contained in:
2026-12-01 18:25:08 -06:00
parent f7eb170e15
commit 98eda5bc28
14 changed files with 187 additions and 141 deletions
+28 -12
View File
@@ -10,6 +10,31 @@ interface Band {
high?: (number | null)[];
}
export function bandFill(
x: number[],
low: (number | null)[],
high: (number | null)[],
colour: string,
alpha: string,
): Partial<Plotly.Data> {
const rows = x.flatMap((age, i) =>
low[i] != null && high[i] != null
? [{ age, low: low[i] as number, high: high[i] as number }]
: [],
);
return {
type: 'scatter',
mode: 'lines',
x: [...rows.map((r) => r.age), ...rows.map((r) => r.age).reverse()],
y: [...rows.map((r) => r.high), ...rows.map((r) => r.low).reverse()],
fill: 'toself',
fillcolor: `${colour}${alpha}`,
line: { width: 0 },
hoverinfo: 'skip',
showlegend: false,
};
}
export function banded(
name: string,
b: Band,
@@ -17,18 +42,7 @@ export function banded(
dash?: 'dot',
): Partial<Plotly.Data>[] {
const lines: Partial<Plotly.Data>[] = [];
if (b.low && b.high) {
lines.push({
x: [...b.x, ...[...b.x].reverse()],
y: [...b.high, ...[...b.low].reverse()] as number[],
fill: 'toself',
fillcolor: `${colour}33`,
line: { width: 0 },
hoverinfo: 'skip',
showlegend: false,
type: 'scatter',
});
}
if (b.low && b.high) lines.push(bandFill(b.x, b.low, b.high, colour, '33'));
lines.push({
x: b.x,
y: b.y,
@@ -43,7 +57,9 @@ export function banded(
export interface Centile {
age_months: number;
p5: number | null;
p25?: number | null;
median: number | null;
p75?: number | null;
p95: number | null;
}