F1: training form driven by the API schema; Sankey stopped nodes at the left
The training form flattens the discriminated source union generically: the discriminator becomes a select labelled by each variant's title, a variant's fields hide unless it is chosen, and the payload keeps only the chosen variant's fields. No variant names, option labels or Hz labels live in the WebApp. The Sankey places the three 'Se quedó en' nodes in the leftmost column, every node at its own position.
This commit is contained in:
@@ -339,6 +339,21 @@ describe('TEA clinical figures', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('places the stopped nodes at the left and gives every node its own position', () => {
|
||||
const node = teaSankey({ populations: {}, strata: {} }).data[0] as unknown as {
|
||||
node: { label: string[]; x: number[]; y: number[] };
|
||||
};
|
||||
const stopped = node.node.label.flatMap((label, index) =>
|
||||
label.startsWith('Se quedó en') ? [index] : [],
|
||||
);
|
||||
expect(stopped).toHaveLength(3);
|
||||
expect(Math.max(...stopped.map((index) => node.node.x[index]))).toBeLessThan(
|
||||
Math.min(...node.node.x.filter((_, index) => !stopped.includes(index))),
|
||||
);
|
||||
const places = node.node.x.map((x, index) => `${x}|${node.node.y[index]}`);
|
||||
expect(new Set(places).size).toBe(places.length);
|
||||
});
|
||||
|
||||
it('splits prevalence by sex and diagnosis and includes children without a recorded sex', () => {
|
||||
const r = {
|
||||
populations: { 'initial-population': 7 },
|
||||
|
||||
Reference in New Issue
Block a user