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.
This commit is contained in:
2026-12-03 13:50:53 -06:00
parent 98eda5bc28
commit d8b9452870
7 changed files with 152 additions and 13 deletions
+44
View File
@@ -0,0 +1,44 @@
import { describe, expect, it } from 'vitest';
import { logAxis } from './figures';
describe('logAxis', () => {
it('uses the 1-2-3-5-7 sequence across decades with decimal labels', () => {
expect(logAxis([0.1, 10])).toMatchObject({
type: 'log',
tickmode: 'array',
tickvals: [0.1, 0.2, 0.3, 0.5, 0.7, 1, 2, 3, 5, 7, 10],
ticktext: ['0.1', '0.2', '0.3', '0.5', '0.7', '1', '2', '3', '5', '7', '10'],
});
});
it('covers the data range with whole decades', () => {
expect(logAxis(new Set([4.5, 1.2])).tickvals).toEqual([1, 2, 3, 5, 7, 10]);
expect(logAxis([1]).tickvals).toEqual([1]);
});
it('keeps small decimal ticks distinct and large ticks out of scientific notation', () => {
expect(logAxis([0.001, 0.01]).ticktext).toEqual([
'0.001',
'0.002',
'0.003',
'0.005',
'0.007',
'0.01',
]);
expect(logAxis([1e21, 1e22]).ticktext).toEqual([
'1000000000000000000000',
'2000000000000000000000',
'3000000000000000000000',
'5000000000000000000000',
'7000000000000000000000',
'10000000000000000000000',
]);
});
it('ignores missing, nonfinite and nonpositive values', () => {
const invalid = [null, undefined, NaN, Infinity, -Infinity, -1, 0];
expect(logAxis([...invalid, 0.1, 10])).toEqual(logAxis([0.1, 10]));
expect(logAxis(invalid)).toMatchObject({ tickvals: [], ticktext: [] });
expect(logAxis([])).toMatchObject({ tickvals: [], ticktext: [] });
});
});