Merge parity/F2b-web

This commit is contained in:
2026-12-03 13:52:27 -06:00
8 changed files with 161 additions and 74 deletions
+15 -16
View File
@@ -11,6 +11,7 @@ type Block = {
fields?: string[][];
table?: Table;
chart?: Chart;
charts?: Chart[];
text?: string;
};
export type Section = { title: string; blocks: Block[] };
@@ -64,21 +65,19 @@ export function recordSections(patient: TeaPatient, norms: ReadonlyMap<string, C
{
title: 'Alteraciones',
blocks: patient.studies.flatMap((eeg) =>
eeg.metrics.flatMap((m) => {
eeg.metrics.map((m) => {
const norm = norms.get(`${eeg.id}|${m.key}`);
return [
{
title: `${eeg.date} · ${m.title}`,
fields: [
['z', shown(m.z)],
['Resultado', alteration(m.outside)],
],
chart: m.sites.length
? { title: 'Mapa de la cabeza', figure: headMap(m.sites) }
: undefined,
},
...(norm ? [{ chart: norm }] : []),
];
return {
title: `${eeg.date} · ${m.title}`,
fields: [
['z', shown(m.z)],
['Resultado', alteration(m.outside)],
],
charts: [
...(m.sites.length ? [{ title: 'Mapa de la cabeza', figure: headMap(m.sites) }] : []),
...(norm ? [norm] : []),
],
};
}),
),
},
@@ -191,9 +190,9 @@ export function teaPdfContent(
: '—',
);
}
if (block.chart) {
for (const chart of [...(block.chart ? [block.chart] : []), ...(block.charts ?? [])]) {
const image = charts.next().value;
content.push({ text: block.chart.title, bold: true });
content.push({ text: chart.title, bold: true });
if (image) content.push({ image, fit: [510, 620] });
}
}