Merge parity/F2a

This commit is contained in:
2026-12-03 13:55:41 -06:00
7 changed files with 292 additions and 76 deletions
+5
View File
@@ -22,6 +22,11 @@ test('tea indicators: every tab loads, and the follow-up list exports to Excel',
await expect( await expect(
indicators.locator('[data-measure="M23_PACIENTES_EVALUADOS"] mat-button-toggle-group'), indicators.locator('[data-measure="M23_PACIENTES_EVALUADOS"] mat-button-toggle-group'),
).toHaveCount(0); ).toHaveCount(0);
await expect(
indicators
.locator('[data-measure="M23_PACIENTES_EVALUADOS"]')
.getByRole('heading', { name: 'Pacientes en tamizaje por resultado diagnóstico' }),
).toBeVisible();
await expect( await expect(
indicators.getByRole('heading', { name: 'Porcentaje de EEG normal y anormal' }), indicators.getByRole('heading', { name: 'Porcentaje de EEG normal y anormal' }),
).toHaveCount(0); ).toHaveCount(0);
+98 -33
View File
@@ -272,6 +272,17 @@ export function fill(template: string, r: Reading): string {
export function boxFigure(r: Reading, period: string): Figure { export function boxFigure(r: Reading, period: string): Figure {
const q1 = r.low ?? r.score!; const q1 = r.low ?? r.score!;
const q3 = r.high ?? r.score!; const q3 = r.high ?? r.score!;
const label = (text: string, y: number, yanchor: 'top' | 'middle' | 'bottom') => ({
x: period,
y,
text: `${text} ${decimal(y)}`,
xref: 'x' as const,
yref: 'y' as const,
xanchor: 'left' as const,
yanchor,
xshift: 56,
showarrow: false,
});
return { return {
data: [ data: [
{ {
@@ -285,11 +296,16 @@ export function boxFigure(r: Reading, period: string): Figure {
upperfence: [q3], upperfence: [q3],
marker: { color: '#4269C2' }, marker: { color: '#4269C2' },
fillcolor: 'rgba(66,105,194,0.55)', fillcolor: 'rgba(66,105,194,0.55)',
hovertemplate: `Q1 ${decimal(q1)} · mediana ${decimal(r.score!)} · Q3 ${decimal(q3)} días<extra></extra>`, hoverinfo: 'skip',
} as Partial<Plotly.Data>, } as Partial<Plotly.Data>,
], ],
layout: { layout: {
showlegend: false, showlegend: false,
annotations: [
label('Q3', q3, 'bottom'),
label('Mediana', r.score!, 'middle'),
label('Q1', q1, 'top'),
],
yaxis: { title: { text: 'días' }, rangemode: 'tozero', ...valueAxis([q1, r.score!, q3]) }, yaxis: { title: { text: 'días' }, rangemode: 'tozero', ...valueAxis([q1, r.score!, q3]) },
}, },
}; };
@@ -418,19 +434,26 @@ export function ageShare(r: Reading, axis: string): Figure {
const bands = ageBands(cells); const bands = ageBands(cells);
const x = bands.map(ageLabel); const x = bands.map(ageLabel);
return { return {
data: TEA_SEXES.map(({ code, color }) => ({ data: TEA_SEXES.map(({ code, color }) => {
const rows = bands.map((band) => cells[`${band}|${code}`]);
const shares = rows.map((row) =>
row?.['denominator'] ? (100 * (row['numerator'] ?? 0)) / row['denominator'] : null,
);
return {
type: 'bar', type: 'bar',
name: name(code), name: name(code),
x, x,
y: bands.map((band) => { y: shares,
const row = cells[`${band}|${code}`];
return row?.['denominator'] ? (100 * (row['numerator'] ?? 0)) / row['denominator'] : null;
}),
marker: { color }, marker: { color },
texttemplate: '%{y:.1~f} %', text: shares.map((share, i) =>
share === null
? ''
: `${percent(share)} % (${rows[i]['numerator'] ?? 0}/${rows[i]['denominator']})`,
),
textposition: 'outside', textposition: 'outside',
hovertemplate: '%{x}: %{y:.1~f} %<extra>%{fullData.name}</extra>', hovertemplate: '%{x}: %{text}<extra>%{fullData.name}</extra>',
})), };
}),
layout: { layout: {
barmode: 'group', barmode: 'group',
xaxis: { title: { text: 'Grupo de edad' }, type: 'category' }, xaxis: { title: { text: 'Grupo de edad' }, type: 'category' },
@@ -507,6 +530,31 @@ export function historyFigure(
layout: { ...layout(panel.axis ?? 'Pacientes', [0, ...totals]), barmode: 'stack' }, layout: { ...layout(panel.axis ?? 'Pacientes', [0, ...totals]), barmode: 'stack' },
}; };
} }
if (panel.kind === 'rate') {
const lines = [
{ name: 'Total', color: line, at: (r?: Reading) => r?.score },
...TEA_SEXES.map(({ code, color }) => ({
name: name(code),
color,
at: (r?: Reading) => r?.rates?.['sex']?.[code],
})),
];
const data = lines.map(({ name: label, color, at }) => ({
x,
y: series.map((s) => at(s.r) ?? null),
mode: 'lines+markers' as const,
name: label,
line: { color },
marker: { color },
}));
return {
data,
layout: layout(
panel.axis ?? '',
data.flatMap((d) => d.y),
),
};
}
const k = panel.kind === 'percent' ? 100 : 1; const k = panel.kind === 'percent' ? 100 : 1;
const at = (v?: number) => (v === undefined ? null : v * k); const at = (v?: number) => (v === undefined ? null : v * k);
const band = [ const band = [
@@ -594,7 +642,7 @@ export function teaSankey(r: Reading): Figure {
type: 'sankey', type: 'sankey',
arrangement: 'fixed', arrangement: 'fixed',
node: { node: {
label: shown.map((index) => nodes[index].label), label: shown.map((index) => `${nodes[index].label} · ${count(nodes[index].value)}`),
color: shown.map((index) => nodes[index].color), color: shown.map((index) => nodes[index].color),
pad: 36, pad: 36,
hovertemplate, hovertemplate,
@@ -613,46 +661,63 @@ export function teaSankey(r: Reading): Figure {
}; };
} }
const RATE_UNIT = 'por 10 000 niños';
const perTenThousand = (n: number) => n.toLocaleString('es-MX', { maximumFractionDigits: 1 });
function prevalenceCounts(r: Reading, sex?: string): { confirmed: number; total: number } {
if (!sex) {
return { confirmed: counted(r, 'confirmed'), total: r.populations['initial-population'] ?? 0 };
}
return {
confirmed: r.strata['sex-category']?.[`${sex}|confirmed`]?.['initial-population'] ?? 0,
total: r.strata['sex']?.[sex]?.['initial-population'] ?? 0,
};
}
export function prevalenceHeadline(r: Reading, sex?: string) {
const found = sex ? r.rates?.['sex']?.[sex] : r.score;
if (found === undefined) return undefined;
const { confirmed, total } = prevalenceCounts(r, sex);
return {
value: perTenThousand(found),
detail: `${RATE_UNIT} · ${count(confirmed)} confirmados de ${count(total)} niños`,
};
}
export function teaSexBars(r: Reading, selectedSex?: string): Figure { export function teaSexBars(r: Reading, selectedSex?: string): Figure {
const cells = r.strata['sex-category'] ?? {};
const x = TEA_SEXES.map(({ code }) => name(code)); const x = TEA_SEXES.map(({ code }) => name(code));
const y = TEA_SEXES.map(({ code }) => r.rates?.['sex']?.[code] ?? 0);
return { return {
data: [ data: [
{ code: 'confirmed', label: 'Diagnóstico confirmado' }, {
{ code: 'in_population', label: 'Sin diagnóstico confirmado' },
].map(({ code: category, label }, i) => {
const y = TEA_SEXES.map(
({ code }) => cells[`${code}|${category}`]?.['initial-population'] ?? 0,
);
return {
type: 'bar', type: 'bar',
name: label, name: 'Prevalencia registrada',
x, x,
y, y,
marker: { marker: {
color: TEA_SEXES.map(({ color }) => (i ? rgba(color, 0.25) : color)),
line: {
color: TEA_SEXES.map(({ color }) => color), color: TEA_SEXES.map(({ color }) => color),
line: {
color: '#000000',
width: TEA_SEXES.map(({ code }) => (code === selectedSex ? 2 : 0)), width: TEA_SEXES.map(({ code }) => (code === selectedSex ? 2 : 0)),
}, },
}, },
customdata: TEA_SEXES.map(({ code }, j) => { text: y.map((value) => perTenThousand(value)),
const total = r.strata['sex']?.[code]?.['initial-population'] ?? 0; textposition: 'outside',
return [percent(total ? (100 * y[j]) / total : 0), total]; cliponaxis: false,
}), customdata: TEA_SEXES.map(({ code }) => {
hovertemplate: const { confirmed, total } = prevalenceCounts(r, code);
'%{x} · %{fullData.name}<br>%{y:d} niños, %{customdata[0]} % de %{customdata[1]}<extra></extra>', return [confirmed, total];
};
}), }),
hovertemplate: `%{x}<br>%{text} ${RATE_UNIT}<br>%{customdata[0]} confirmados de %{customdata[1]} niños<extra></extra>`,
},
],
layout: { layout: {
barmode: 'group', showlegend: false,
xaxis: { title: { text: 'Sexo' }, type: 'category' }, xaxis: { title: { text: 'Sexo' }, type: 'category' },
yaxis: { yaxis: {
title: { text: 'Niños' }, title: { text: 'Casos por 10 000 niños' },
rangemode: 'tozero', rangemode: 'tozero',
...valueAxis( ...valueAxis(y),
TEA_SEXES.map(({ code }) => r.strata['sex']?.[code]?.['initial-population'] ?? 0),
),
}, },
}, },
}; };
+9
View File
@@ -42,6 +42,7 @@ export interface Reading {
high?: number; high?: number;
unit?: string; unit?: string;
strata: Record<string, Record<string, Record<string, number>>>; strata: Record<string, Record<string, Record<string, number>>>;
rates?: Record<string, Record<string, number>>;
} }
function counts(group: { function counts(group: {
@@ -57,8 +58,15 @@ export function reading(report: MeasureReport | undefined): Reading | undefined
if (!group) return undefined; if (!group) return undefined;
const score = group.measureScore; const score = group.measureScore;
const strata: Reading['strata'] = {}; const strata: Reading['strata'] = {};
const rates: Record<string, Record<string, number>> = {};
for (const s of group.stratifier ?? []) { for (const s of group.stratifier ?? []) {
const name = (s.code ?? []).map((c) => code(c) ?? c.text ?? '').join('-'); const name = (s.code ?? []).map((c) => code(c) ?? c.text ?? '').join('-');
const scored = (s.stratum ?? []).filter((x) => x.measureScore?.value !== undefined);
if (scored.length) {
rates[name] = Object.fromEntries(
scored.map((x) => [x.value?.text ?? '', x.measureScore!.value!]),
);
}
strata[name] = Object.fromEntries( strata[name] = Object.fromEntries(
(s.stratum ?? []).map((x) => [ (s.stratum ?? []).map((x) => [
x.component?.length x.component?.length
@@ -75,6 +83,7 @@ export function reading(report: MeasureReport | undefined): Reading | undefined
high: (ext(score, 'ic-alto') ?? ext(score, 'q3'))?.valueDecimal, high: (ext(score, 'ic-alto') ?? ext(score, 'q3'))?.valueDecimal,
unit: score?.unit, unit: score?.unit,
strata, strata,
...(Object.keys(rates).length ? { rates } : {}),
}; };
} }
+9 -7
View File
@@ -157,7 +157,7 @@ export const PAGES: Record<string, Page> = {
figures: [ figures: [
{ {
kind: 'sex-counts', kind: 'sex-counts',
title: 'Pacientes evaluados por resultado diagnóstico', title: 'Pacientes en tamizaje por resultado diagnóstico',
measure: 'M23_PACIENTES_EVALUADOS', measure: 'M23_PACIENTES_EVALUADOS',
axis: 'Conteo (paciente)', axis: 'Conteo (paciente)',
catalog: { catalog: {
@@ -416,7 +416,7 @@ export const PAGES: Record<string, Page> = {
export interface HistoryPanel { export interface HistoryPanel {
title: string; title: string;
measure: string; measure: string;
kind: 'stack' | 'percent' | 'median'; kind: 'stack' | 'percent' | 'median' | 'rate';
series?: { code: string; label: string; color: string }[]; series?: { code: string; label: string; color: string }[];
axis?: string; axis?: string;
group?: string; group?: string;
@@ -573,7 +573,7 @@ export const HISTORY: Record<string, History> = {
kind: 'median', kind: 'median',
}, },
stack( stack(
'Pacientes evaluados por resultado diagnóstico', 'Pacientes en tamizaje por resultado diagnóstico',
'M23_PACIENTES_EVALUADOS', 'M23_PACIENTES_EVALUADOS',
'Pacientes', 'Pacientes',
[ [
@@ -612,10 +612,12 @@ export const HISTORY: Record<string, History> = {
measure: 'M30_RESULTADO_EEG', measure: 'M30_RESULTADO_EEG',
kind: 'percent', kind: 'percent',
}, },
stack('Prevalencia registrada de TEA', 'M31_PREVALENCIA', 'Niños', [ {
['confirmed', 'Diagnóstico confirmado', OLIVE], title: 'Prevalencia registrada de TEA',
['in_population', 'Sin diagnóstico confirmado', GREY], measure: 'M31_PREVALENCIA',
]), kind: 'rate',
axis: 'Casos por 10 000 niños',
},
], ],
}, },
}; };
+11 -6
View File
@@ -101,16 +101,16 @@
<mat-card-content> <mat-card-content>
<h2 class="box-title">Resumen</h2> <h2 class="box-title">Resumen</h2>
<p> <p>
Al cierre del periodo <mark>{{ period }}</mark>, se evaluaron Al cierre del periodo <mark>{{ period }}</mark>, se registraron en el tamizaje
<mark>{{ t.evaluated }}</mark> niños entre 16 y 36 meses; <mark>{{ t.evaluated }}</mark> niños entre 16 y 36 meses;
<mark>{{ t.mchatOnly }}</mark> únicamente tienen M-CHAT, <mark>{{ t.mchatOnly }}</mark> únicamente tienen M-CHAT,
<mark>{{ t.psychology }}</mark> hasta la evaluación psicológica y <mark>{{ t.psychology }}</mark> hasta la evaluación psicológica y
<mark>{{ t.neuropediatrics }}</mark> presentan evaluación neuropediátrica. En este <mark>{{ t.neuropediatrics }}</mark> presentan evaluación neuropediátrica. En este
periodo el <mark>{{ t.confirmed }}</mark> de los pacientes tiene diagnóstico periodo el <mark>{{ t.confirmed }}</mark> de los pacientes tiene diagnóstico
confirmado de TEA (CIE-10 F84.0). Las ventanas de tiempo<sup>*</sup> de tamizaje confirmado de TEA (CIE-10 F84.0). La mediana de la ventana de tiempo de tamizaje de
son: <mark>{{ t.toAdos }}</mark> de M-CHAT (psicología) a ADOS-2, M-CHAT (psicología) a ADOS-2 es <mark>{{ t.toAdos }}</mark> y la mediana de ADOS-2 a
<mark>{{ t.toDiagnosis }}</mark> de ADOS-2 a diagnóstico. El tiempo<sup>*</sup> de diagnóstico es <mark>{{ t.toDiagnosis }}</mark>. La mediana del tiempo de tamizaje
tamizaje completo de M-CHAT a diagnóstico fue de <mark>{{ t.whole }}</mark>. completo de M-CHAT a diagnóstico fue de <mark>{{ t.whole }}</mark>.
</p> </p>
<p> <p>
De los <mark>{{ t.diagnosed }}</mark> niños con diagnóstico confirmado en este De los <mark>{{ t.diagnosed }}</mark> niños con diagnóstico confirmado en este
@@ -118,7 +118,6 @@
<mark>{{ t.missing }}</mark> por realizarlo. <mark>{{ t.unusable }}</mark> estudios <mark>{{ t.missing }}</mark> por realizarlo. <mark>{{ t.unusable }}</mark> estudios
de EEG no son aceptables para un análisis. de EEG no son aceptables para un análisis.
</p> </p>
<p class="state">*tomando la mediana de los tiempos</p>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
} @else if (reports.isLoading()) { } @else if (reports.isLoading()) {
@@ -147,6 +146,12 @@
<mat-button-toggle value="female">Femenino</mat-button-toggle> <mat-button-toggle value="female">Femenino</mat-button-toggle>
<mat-button-toggle value="male">Masculino</mat-button-toggle> <mat-button-toggle value="male">Masculino</mat-button-toggle>
</mat-button-toggle-group> </mat-button-toggle-group>
@if (prevalenceOf(f); as p) {
<div class="kpi-value">
{{ p.value }}
<span class="kpi-qualifier">{{ p.detail }}</span>
</div>
}
} }
@if (reports.isLoading()) { @if (reports.isLoading()) {
<app-loading what="la figura" [figure]="true" /> <app-loading what="la figura" [figure]="true" />
+5
View File
@@ -14,6 +14,7 @@ import {
countBars, countBars,
fill, fill,
nestedDonut, nestedDonut,
prevalenceHeadline,
rateDots, rateDots,
routeFigure, routeFigure,
scenarioBars, scenarioBars,
@@ -137,6 +138,10 @@ export class TabIndicadores {
const r = measure ? this.rd(measure) : undefined; const r = measure ? this.rd(measure) : undefined;
return r && r.score !== undefined ? boxFigure(r, this.applied() ?? '') : undefined; return r && r.score !== undefined ? boxFigure(r, this.applied() ?? '') : undefined;
} }
protected prevalenceOf(spec: FigureSpec) {
const r = this.rd(spec.measure);
return r ? prevalenceHeadline(r, this.prevalenceSex()) : undefined;
}
protected readonly teaSummary = computed(() => { protected readonly teaSummary = computed(() => {
const rd = (c: string) => this.loaded()?.get(c); const rd = (c: string) => this.loaded()?.get(c);
const status = rd('M28_CASOS_POR_ESTADO'); const status = rd('M28_CASOS_POR_ESTADO');
+150 -25
View File
@@ -4,14 +4,17 @@ import { teaSteps } from '../paciente/tea-data';
import { import {
ageShare, ageShare,
ageStack, ageStack,
boxFigure,
historyFigure, historyFigure,
nestedDonut, nestedDonut,
prevalenceHeadline,
sexCountBars, sexCountBars,
shareDonut, shareDonut,
teaAlterations, teaAlterations,
teaSankey, teaSankey,
teaSexBars, teaSexBars,
} from './figures'; } from './figures';
import { reading } from './measures';
import type { Catalog } from './pages'; import type { Catalog } from './pages';
import { import {
ageMonths, ageMonths,
@@ -369,35 +372,145 @@ describe('TEA clinical figures', () => {
}); });
}); });
it('groups prevalence bars by sex and uses transparency for unconfirmed diagnoses', () => { it('carries the count in every node label, including the stops', () => {
const figure = teaSexBars({ const figure = teaSankey({
populations: { 'initial-population': 7 }, populations: { 'initial-population': 18 },
strata: { strata: {
sex: { female: { 'initial-population': 3 }, male: { 'initial-population': 3 } }, category: {
'sex-category': { mchat_only: { 'initial-population': 6 },
'female|confirmed': { 'initial-population': 2 }, psychology: { 'initial-population': 2 },
'female|in_population': { 'initial-population': 1 }, neuropediatrics: { 'initial-population': 5 },
'male|confirmed': { 'initial-population': 1 }, eeg: { 'initial-population': 5 },
'male|in_population': { 'initial-population': 2 },
'no_data|in_population': { 'initial-population': 1 },
}, },
}, },
}); });
expect(figure.layout?.barmode).toBe('group'); expect(figure.data[0]).toMatchObject({
expect(figure.data).toMatchObject([ node: {
{ label: [
type: 'bar', 'M-CHAT · 18',
x: ['Masculino', 'Femenino'], 'Evaluación<br>psicológica · 12',
y: [1, 2], 'Evaluación<br>neuropediátrica · 10',
marker: { color: ['#4269C2', '#C24269'] }, 'EEG de<br>buena calidad · 5',
}, 'Se quedó en evaluación<br>neuropediátrica · 5',
{ 'Se quedó en evaluación<br>psicológica · 2',
type: 'bar', 'Se quedó en M-CHAT · 6',
x: ['Masculino', 'Femenino'], ],
y: [2, 1],
marker: { color: ['rgba(66,105,194,0.25)', 'rgba(194,66,105,0.25)'] },
}, },
});
});
it('annotates only the median and the quartiles on the box', () => {
const figure = boxFigure({ populations: {}, score: 12.5, low: 8, high: 20 }, '2025-S1');
expect(figure.layout?.annotations?.map((a) => a.text)).toEqual([
'Q3 20',
'Mediana 12.5',
'Q1 8',
]); ]);
expect(figure.data[0]).toMatchObject({ hoverinfo: 'skip' });
});
const prevalence = {
populations: { 'initial-population': 12 },
score: 3333.3333,
unit: 'por 10 000',
strata: {
category: { confirmed: { 'initial-population': 4 } },
sex: {
female: { 'initial-population': 4 },
male: { 'initial-population': 6 },
no_data: { 'initial-population': 2 },
},
'sex-category': {
'female|confirmed': { 'initial-population': 1 },
'female|in_population': { 'initial-population': 3 },
'male|confirmed': { 'initial-population': 3 },
'male|in_population': { 'initial-population': 3 },
'no_data|in_population': { 'initial-population': 2 },
},
},
rates: { sex: { female: 2500, male: 5000, no_data: 0 } },
};
it('shows the prevalence rate per 10,000 as the bar text and the counts in the hover', () => {
const figure = teaSexBars(prevalence, 'female');
expect(figure.layout?.barmode).toBeUndefined();
expect(figure.data).toHaveLength(1);
expect(figure.data[0]).toMatchObject({
type: 'bar',
x: ['Masculino', 'Femenino'],
y: [5000, 2500],
text: ['5,000', '2,500'],
customdata: [
[3, 6],
[1, 4],
],
marker: { color: ['#4269C2', '#C24269'], line: { width: [0, 2] } },
});
expect(figure.data[0]).toMatchObject({
hovertemplate: expect.stringContaining(
'%{customdata[0]} confirmados de %{customdata[1]} niños',
),
});
});
it('puts the total or the chosen sex rate in the headline', () => {
expect(prevalenceHeadline(prevalence)).toEqual({
value: '3,333.3',
detail: 'por 10 000 niños · 4 confirmados de 12 niños',
});
expect(prevalenceHeadline(prevalence, 'male')).toEqual({
value: '5,000',
detail: 'por 10 000 niños · 3 confirmados de 6 niños',
});
expect(prevalenceHeadline({ populations: {}, strata: {} })).toBeUndefined();
});
it('reads the rate of each stratum from the report', () => {
const r = reading({
resourceType: 'MeasureReport',
status: 'complete',
type: 'summary',
measure: 'M31',
period: { start: '2025-01-01', end: '2025-06-30' },
group: [
{
measureScore: { value: 3333.3, unit: 'por 10 000' },
stratifier: [
{
code: [{ coding: [{ code: 'sex' }] }],
stratum: [
{ value: { text: 'male' }, measureScore: { value: 5000 } },
{ value: { text: 'female' }, measureScore: { value: 2500 } },
],
},
{
code: [{ coding: [{ code: 'category' }] }],
stratum: [{ value: { text: 'confirmed' } }],
},
],
},
],
});
expect(r).toMatchObject({ score: 3333.3, unit: 'por 10 000' });
expect(r?.rates).toEqual({ sex: { male: 5000, female: 2500 } });
});
it('plots the prevalence rate over time as one line per sex and one for the total', () => {
const figure = historyFigure(
{ title: 'Prevalencia', measure: 'M31', kind: 'rate', axis: 'Casos por 10 000 niños' },
[
{ label: 'Ene', r: prevalence },
{ label: 'Feb', r: undefined },
],
'#9C42C2',
'Mes',
);
expect(figure.data).toMatchObject([
{ name: 'Total', y: [3333.3333, null], mode: 'lines+markers' },
{ name: 'Masculino', y: [5000, null] },
{ name: 'Femenino', y: [2500, null] },
]);
expect(figure.layout?.yaxis?.title).toMatchObject({ text: 'Casos por 10 000 niños' });
}); });
it('groups diagnostic results by sex using crossed counts', () => { it('groups diagnostic results by sex using crossed counts', () => {
@@ -474,8 +587,20 @@ describe('TEA clinical figures', () => {
const figure = ageShare(byAgeAndSex, '% de pacientes con EEG'); const figure = ageShare(byAgeAndSex, '% de pacientes con EEG');
expect(figure.layout?.barmode).toBe('group'); expect(figure.layout?.barmode).toBe('group');
expect(figure.data).toMatchObject([ expect(figure.data).toMatchObject([
{ name: 'Masculino', x: ageGroups, y: [25, 100], marker: { color: '#4269C2' } }, {
{ name: 'Femenino', x: ageGroups, y: [50, null], marker: { color: '#C24269' } }, name: 'Masculino',
x: ageGroups,
y: [25, 100],
text: ['25 % (1/4)', '100 % (1/1)'],
marker: { color: '#4269C2' },
},
{
name: 'Femenino',
x: ageGroups,
y: [50, null],
text: ['50 % (1/2)', ''],
marker: { color: '#C24269' },
},
]); ]);
}); });