Commit Graph

147 Commits

Author SHA1 Message Date
alberto 38f633c2da Record test finds the unmeasured metric's lines wherever the ADOS-2 section follows 2026-12-03 21:13:24 -06:00
alberto e345d45c60 F7c: one spindle metric over all NREM sleep
Spindles are measured once, over every window the state classifier labels
sleep, and each child's detection thresholds come from all NREM sleep
samples. The 75 uV slow-wave rule labelled 89 % of the epochs after N2
onset in Helsinki toddlers (16-36 months) as N3 and was never validated
against technician-scored stages (biomarcadores-tea E13, usar_n3 = false).

spindles_n2 and spindles_n3 become spindles; the four N2/N3 age scenarios
become eeg-spindles and eeg-spindle-topography. The director's flag for a
posterior rhythm near the sigma band is kept as the rhythm_near_sigma
feature. Reasons: no-sleep under one minute of sleep, else no-spindles.
2026-12-03 20:47:28 -06:00
alberto 7a22e433f4 History axes keep the period order whatever trace comes first 2026-12-03 17:41:48 -06:00
alberto 2da269a6a8 History band is one filled shape per run of periods with both bounds, so gaps no longer split it into triangles 2026-12-03 17:40:54 -06:00
alberto 599e239cd0 Indicator grids use shrinkable columns, so cards never push past the screen 2026-12-03 17:35:02 -06:00
alberto e93e807325 Box charts hover only Q3, Mediana and Q1, through an invisible marker; the box itself takes no hover 2026-12-03 17:32:41 -06:00
alberto ebb8db0017 Headroom reads bar traces through a local shape; Plotly types export no PlotData here 2026-12-03 17:12:54 -06:00
alberto 0c2e05d077 F6: bar labels fit inside the plot; clinical chart heights as before
- Cause: the percent axis range of 0-110 was only reached by the three percent bar builders (ageStack, ageShare, teaAlterations); every other bar chart with outside labels (count bars, sex bars) ran on autorange, where Plotly reserves no room for outside text, and the labels were only kept visible by cliponaxis false, so they spilled over the plot edge into the legend area. The headroom lived in each builder instead of in the shared plot code.
- Headroom is now computed once in the shared plot builder (plot-headroom.ts, used by layoutOf): for bar traces with outside labels, the value axis (y for vertical, x for horizontal bars) gets a range of 15 % over the maximum (and under the minimum if negative) unless the figure sets its own range. Percent axes keep their explicit 0-110 range with ticks every 20, ending at 100.
- cliponaxis false for bars is removed: with the headroom the labels are inside the plot area.
- Indicadores clinicos: route chart 300, grid figures 320, figure-row figures 360 again; the clinicalHeight constant is gone.
- Logic spec on the produced axis ranges: plot-headroom.spec.ts.
2026-12-03 17:12:06 -06:00
alberto bbd31f1307 Record blocks draw the charts grid only when there are charts 2026-12-03 17:04:01 -06:00
alberto f3d7b20a8b Merge parity/F5-hide-empty 2026-12-03 17:03:46 -06:00
alberto 7ba9927176 F5: No evaluable alterations draw no plots
- tea-data: evaluable(metric) is the single rule (a metric with no
  outside result is not evaluable)
- tea-sections: the Alteraciones block takes its head map and age norm
  from metricCharts, which yields none for a not evaluable metric; the
  block keeps title, z and Resultado with the reason
- paciente: loadNorms skips not evaluable metrics instead of fetching
  their curves
- tea-patient.spec: a not evaluable metric yields no charts and no
  chart entries in the PDF content

The risk page needs no change: zBars already drops rows without z, so
a not evaluable metric adds no empty plot.
2026-12-03 17:03:21 -06:00
alberto 996a5fed88 Percent axis range is a tuple; the alterations chart takes the shared percent range 2026-12-03 17:03:08 -06:00
alberto 3154ba92df F4: TEA indicators display after review
- Prevalencia registrada (M31): the sex selector, its signal and the bar outline highlight are gone; the headline always shows the total rate and the bars keep one bar per sex
- Indicadores de oportunidad: the box charts show Q3, Mediana and Q1 in the hover, formatted with the shared one-decimal hover format, instead of annotations
- Porcentaje de confirmacion diagnostica (M24): the stacked bars, axis title, ticks, bar text and hover are in percent of the patients of each sex and age group
- Porcentaje de pacientes con / sin EEG (M21, M22): bar text shows the percentage only
- Headroom: the shared percent axis now ends at 110 with ticks every 20, and the shared plot builder never clips bar labels (cliponaxis false for every bar trace), so a 100 % bar keeps its label; the per-trace cliponaxis on the bar builders was removed
- Indicadores clinicos: route, grid and figure-row charts all use one height (430 px, was 300/320/360)

Choices: percent axis headroom lives in percentAxis, with rate dots keeping their own 0-100 range; the clinical height is a single component constant.
2026-12-03 17:02:21 -06:00
alberto dca39203d2 F3: Trazabilidad chooses which periods to show
Added a "Periodos a mostrar" selector to the Trazabilidad filters, as in the
reference history tab.

- period-selection.ts: pure functions for the initial window, the periods
  shown for a choice, the select options, the year grouping and the labels.
- periods-dialog.ts: Material dialog with the periods of the interval by year,
  checkboxes, choose all and clear all, and a count of what is chosen.
- tab-trazabilidad.ts: the select offers the latest periods in steps of five,
  all, and a custom choice that opens the dialog; the choice is kept per
  interval. Every panel draws the same chosen periods.

Choices: the periods offered are those with data in any panel. The default is
the domain's declared window (the last 5 months for CaCu, months only) when
there are more periods than it, otherwise all. Cancelling the dialog leaves the
selection untouched. period-selection.spec.ts covers the selection functions.
2026-12-03 16:25:44 -06:00
alberto 5cedcb91e0 Page cases follow the dotted timeline and the single-study evaluation hosted in Estudios EEG 2026-12-03 15:06:02 -06:00
alberto 9bd9e71bf9 Patient spec follows the triaje label 2026-12-03 14:03:33 -06:00
alberto c3e9d8a99f Reason label: triaje, as in the quality table 2026-12-03 14:03:29 -06:00
alberto 7fb7302537 TEA definitions name the No evaluable reasons through the shared reason labels 2026-12-03 14:03:23 -06:00
alberto fd3f7f2537 Merge parity/F2d 2026-12-03 14:03:05 -06:00
alberto 0e4bde9c62 TEA section in Datos y definiciones
The definitions tab renders a TEA section from indicadores/tea-definitions.ts, shown only
for the TEA domain through definitionGroups(domain). Five groups: EEG alterations and the
16-36 month range, how to read z, the head map colors and the norm bands (P25-P75 = 50 %,
P5-P95 = 90 %), the "No evaluable" reasons, the risk analysis (odds ratio reading and what the
probability means), and the indicators (prevalence per 10,000 and the data it needs, medians
that do not add up, M23 groups).

Choices left open by the spec:
- The text is plain data (group id, title, term/text entries) rendered as definition lists,
  above the indicator catalog.
- The "No evaluable" reasons cover every code in eeg-labels.ts, merging sin N2 / sin N3,
  sin edad / edad fuera de la curva, with the spec's seven reasons all present.
- The range text says 16 to 36 months for every alteration, spikes included.
- The only test covers the domain filter and the shape of the data, not the text.
2026-12-03 14:02:51 -06:00
alberto 06239e726d Box figure spec reading carries its strata 2026-12-03 13:58:25 -06:00
alberto 477c4a07d8 Merge parity/F2b-reason 2026-12-03 13:57:26 -06:00
alberto cc3f6b3e0d F2b: No evaluable carries the reason ported from the tea library
eeg-labels.ts maps each reason code to its Spanish label: the metric
reasons, the study reasons and one label per window reason. The metric
shows "No evaluable · <label>" in Resultado where it showed a dash, and
only when it has no result; a metric with a result keeps it. The
study's reasons show as a Motivos row in the EEG quality summary.
Unknown codes show as the code. The patient spec covers the mapping and
the reading of both extensions from FHIR.
2026-12-03 13:56:48 -06:00
alberto 581eb64457 Merge parity/F2a 2026-12-03 13:55:41 -06:00
alberto 72d5d07d67 F2a: TEA indicators after the 3 Dec review
Changed:
- Summary: the time sentences say "La mediana de..." and the footnote is gone (nothing else used it); "se evaluaron" is now "se registraron en el tamizaje".
- boxFigure: the median, Q3 and Q1 are text annotations to the right of the box; the hover is off so nothing else is labelled.
- M23 is titled "Pacientes en tamizaje por resultado diagnostico" on the page and in Trazabilidad.
- M21/M22 ageShare: the bar text is "p % (n/N)" from numerator and denominator of strata.age_sex, and the hover reuses it.
- M28 Sankey: every node label ends with its count ("M-CHAT · 18"), the "Se quedo en..." nodes included; link labels stay without it.
- M31: the bars plot the rate per 10,000 for the selected period, one bar per sex, with the rate as bar text and confirmed of total children in the hover. The card shows a headline number that follows the sex toggle (total when both sexes). Trazabilidad plots the rate as a line per sex plus the total (new 'rate' panel kind replaces the stacked counts).
- reading() carries the per-stratum measureScore as Reading.rates; the group measureScore is the total rate.

Choices the spec left open:
- Q3, median and Q1 sit at a fixed 56 px right of the box, anchored top/middle/bottom so they do not overlap when the three values are equal.
- Headline detail line: "por 10 000 niños · n confirmados de N niños".
- The selected-sex outline on the M31 bars is black, since the bars are one trace now.
- e2e pages.spec.ts:23 already expects no toggle on the M23 card, which is what the page renders, so it stays; it now also asserts the new M23 heading.
2026-12-03 13:55:14 -06:00
alberto 4eed732ca4 Merge parity/F2b-web 2026-12-03 13:52:27 -06:00
alberto 08c280fbd0 Merge parity/F2c 2026-12-03 13:51:56 -06:00
alberto 2add96e38a 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.
2026-12-03 13:51:40 -06:00
alberto d8b9452870 F2c: risk page after the 3 Dec review
Replace the risk introduction with the reviewed text, name severe ADOS-2
probabilities in the risk section and record table, and place the TEA
clarification below the risk probability table through section content.
Use one shared decimal log-axis builder in the patient forest and both
governance OR charts. Add builder and patient logic coverage and update
the page case for the section, column headers and clarification.

Choices left open by the spec:
- Name the builder logAxis and mirror valueAxis's iterable input signature;
  put its logic spec in indicadores/figures.spec.ts beside the builder.
- Generate the 1-2-3-5-7 sequence from the floor of the minimum log10 to
  the ceiling of the maximum log10, including only 1 in the last decade.
  Whole-decade bounds retain labels for narrow and single-value ranges.
- Ignore missing, nonfinite and nonpositive input; return empty tick
  arrays when no positive finite data remain. Discard generated zero or
  nonfinite ticks at floating-point limits.
- Construct tick values from decimal exponent strings to avoid binary
  multiplication artifacts; use explicit array ticks and SHORT hovers.
- Let the existing private decimal formatter accept optional Intl options,
  retaining its existing defaults. For log labels use its es-MX locale,
  one significant digit and no grouping, preserving small decimals and
  avoiding scientific notation and trailing zeros.
- Include estimates and confidence bounds in each chart's input, plus 1
  in the two charts that draw the reference line.
- Represent the risk table note as a following text block so the existing
  page and PDF renderers both place it below the table.
- Cover decimal sequences, whole-decade bounds, singleton and iterable
  input, invalid input, small and large labels, patient confidence bounds,
  probability labels and the clarification's PDF inclusion in logic tests.
  Add page assertions for the probability headers and clarification.

Validation: ruff check . passed; ruff format --check . passed (144 files);
git diff --check passed. A Node smoke check of the source logAxis function
passed nine assertions. Prettier was skipped because this worktree has no
WebApp/node_modules/.bin/prettier. Angular tests/build and Playwright page
tests were not run here, as the spec reserves them for milkpc/the VM.
Python imports and the API did not change; lint-imports and API generation
were not needed.
2026-12-03 13:50:53 -06:00
alberto 98eda5bc28 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 2026-12-01 18:35:42 -06:00
alberto f7eb170e15 One-step ticks only when the axis spans five or less, counted from zero 2026-12-01 17:29:05 -06:00
alberto b6e9acd3ba OpenAPI document with the training source titles 2026-12-01 17:26:09 -06:00
alberto 8ebf870f41 Plot axes are built fresh for every chart
The module-level axis defaults were shared by every chart, and Plotly writes its detected axis type, range and autorange back into the layout it is given, so one chart's category axis and range leaked into the others (count axes typed as categories, percent ranges ignored). Each layout now gets its own axis objects.
2026-12-01 17:23:53 -06:00
alberto ef407ce0a7 Every chart uses the shared short number format: axes, hover and bar/value text
Counts print as integers and other values with at most one decimal, in tick labels (valueAxis, percentAxis), hover templates and bar and pie text.
2026-12-01 17:20:28 -06:00
alberto 5cd601651c Count axes are linear with whole-number or one-decimal tick labels from one shared builder
The EEG quality chart's count axis was typed as a category axis, which put 0 on the right; every count and value axis now takes its type and tick format from valueAxis: linear, whole numbers for counts (one step when the range is narrow), one decimal otherwise, with Plotly choosing the number of ticks.
2026-12-01 17:15:35 -06:00
alberto 8ca3b053bd C1a: code only, no comments, no Markdown
Remove 125 JavaScript, TypeScript, and stylesheet comments and nine configuration comments. The submodule had zero tracked Markdown files. Remove the Markdown-only EditorConfig section.

Keep the generated client headers and tool directives. Delete other comments in place without regenerating the client or changing OpenAPI data.
2026-12-01 16:55:32 -06:00
alberto c2d4747d69 F1e: the baseline exports from the page 2026-12-01 15:56:31 -06:00
alberto 08c447006c F1e: complete-child case finds the child by search and reads hidden marks as attached 2026-12-01 15:28:54 -06:00
alberto a4bf48b60d F1e: complete-child case reads the semester with the EEGs; export refusal is expected 2026-12-01 15:09:10 -06:00
alberto 13146fdca4 F1e: page cases tolerate collapsed box plots and read the bundle guard's refusal 2026-12-01 14:53:29 -06:00
alberto 4118b050b8 F1: Sankey laid out by Plotly's own columns, with no hand-set x/y
Root cause of the crossing bands and overlap: with explicit node x/y Plotly keeps the nodes where they are set but orders the links leaving a node on its own, so a stopped band could leave the top of a node while its target sat at the bottom (bands crossed), zero-flow nodes stayed in the figure and tiny nodes landed on one another, and long one-line labels ran into the next column's labels. Now the stopped nodes are plain sinks that Plotly justifies to the right column, ordered neuropediátrica, psicológica, M-CHAT from top to bottom so bands never cross; nodes without flow are dropped; labels break in two lines; the padding keeps two-line labels apart. The card spans the whole row. Checked by screenshots of the live page across monthly and semester periods.
2026-12-01 14:36:30 -06:00
alberto 2404a3a66b F1: Sankey stopped nodes bottom to top M-CHAT, psicológica, neuropediátrica; full card width; layout test removed 2026-12-01 14:20:58 -06:00
alberto 58fdfd53d7 F1: Sankey stopped nodes in the rightmost column 2026-12-01 14:14:00 -06:00
alberto 6a6691bdd5 F1e: page case for the complete child; Gobernanza case without the removed sections 2026-12-01 14:05:40 -06:00
alberto 5bd7793cf7 Merge parity/F1h 2026-12-01 14:04:28 -06:00
alberto 7d2a861993 F1: record section test expects the dotted line with its markers 2026-12-01 14:04:28 -06:00
alberto 0fd5cc70ec F1: whole-number axis range typed as a pair; explicit ranges win 2026-12-01 13:51:14 -06:00
alberto 71777537e1 F1h: Gobernanza without Vista previa and Subir archivos, button spacing
Keep preview state in Modelos and reset the toggle on domain changes. Hide the form while collapsed so the current selections, run monitor and result dialog survive toggling. Keep the existing evaluation and PDF handlers.

Use one wrapping button-row class with space-3 gaps and block margins. Inside table cells use the existing cell padding between rows. Apply the same class to the indicators export and keep the existing domain navigation bottom margin.

Delete the training upload UI and hand-edit the client and OpenAPI. Preserve the generator format and update the Modelos component spec and Gobernanza page case to cover both toggle states.
2026-12-01 13:49:28 -06:00
alberto e14a85261c Merge parity/F1g 2026-12-01 13:45:25 -06:00
alberto b001594ac7 Merge parity/F1f 2026-12-01 13:45:25 -06:00