F2b: TEA record after the 3 Dec review

Add a label above each completed timeline diamond and a baseline tick at
each completed step date, retaining the dotted line and day annotations.
Group each study and metric into one alterations block with its fields,
head map and age norm. Name the centile bands, shorten the norm title,
explain the head-map z scale and use Puntas paroxísticas consistently in
the shared biomarker labels. Update the logic and page expectations.

Choices left open by the spec:
- Use label annotations shifted upward by 26 pixels and a 40-pixel top
  margin; retain the existing categorical axis and pending annotations.
  Use the completed dates as explicit date-axis ticks.
- Add an optional charts array for the grouped row while retaining chart
  for standalone plots. Put the map first and norm second, omit absent
  figures, and keep a block even when neither figure is available.
- Use two equal grid columns with the existing space-4 gap, stacking at
  800 pixels. Separate adjacent blocks with the existing border color,
  space-6 margin and space-4 padding.
- Keep grouped figures in the PDF export's existing sequential image
  order, consuming one image for each figure.
- Make bandFill's final name parameter optional and show its legend only
  when a name is supplied, preserving unnamed governance bands.
- Keep the existing lighter outer/darker inner band drawing order.
- Keep tea-data.ts unchanged: its spike title already matches the required
  Puntas paroxísticas. Preserve the existing spike exclusion in loadNorms.

Verification: git diff --check passed. Prettier skipped because this
worktree has no WebApp/node_modules/.bin/prettier. Angular tests/build and
browser page tests were not run on the saturated lab server, as specified.
No API signatures, schemas or endpoints changed.
This commit is contained in:
2026-12-03 13:51:40 -06:00
parent 98eda5bc28
commit 2add96e38a
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] : []),
],
};
}),
),
},
@@ -188,9 +187,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] });
}
}