Clarify CaCu and CaMa chart labels

This commit is contained in:
Angel Capetillo Zavala
2026-12-03 15:18:22 -06:00
parent d38c795c8a
commit 63f6e16d19
13 changed files with 122 additions and 51 deletions
+7 -7
View File
@@ -157,15 +157,15 @@ describe('bars', () => {
);
const y = (f.data[0] as any).y;
expect(y).toEqual([
'Detección inicial<br>n = 0',
'Detección subsecuente<br>n = 8',
'Sin dato<br>n = 2',
'Detección inicial<br>Pacientes: 0',
'Detección subsecuente<br>Pacientes: 8',
'Sin dato<br>Pacientes: 2',
]);
expect((f.data[0] as any).x).toEqual([0, 75, 100]);
});
it('leaves out a group that does not reconcile', () => {
const f = draw(reading({ 'subsequent|NILM': 6 }, 10));
expect((f.data[0] as any).y).toEqual(['Detección subsecuente<br>n = 6']);
expect((f.data[0] as any).y).toEqual(['Detección subsecuente<br>Pacientes: 6']);
});
});
});
@@ -173,7 +173,7 @@ describe('bars', () => {
describe('shared views of cytology and HPV by genotype', () => {
const HPV = [
{ code: 'negative', label: 'Negativo', color: '#42A77E', group: '' },
{ code: 'positive_other', label: 'Positivo', color: '#A8C243', group: '' },
{ code: 'positive_other', label: 'Positivo sin genotipo', color: '#A8C243', group: '' },
];
const reading = (cells: Record<string, number>): Reading => ({
populations: { 'initial-population': Object.values(cells).reduce((a, b) => a + b, 0) },
@@ -198,7 +198,7 @@ describe('shared views of cytology and HPV by genotype', () => {
it('does not list a hidden category but keeps it in the total and the percentages', () => {
const t = bars(counts, () => reading({}))!;
expect(t.rows.map((x) => x.label)).toEqual(['Negativo', 'Positivo']);
expect(t.rows.map((x) => x.label)).toEqual(['Negativo', 'Positivo sin genotipo']);
expect(t.rows.map((x) => x.cells)).toEqual([
['5', '50.0 %'],
['2', '20.0 %'],
@@ -247,7 +247,7 @@ describe('shared views of cytology and HPV by genotype', () => {
});
expect((own.data[0] as any).x).toEqual([80]); // 4 of the 5 the catalog draws
expect((all.data[0] as any).x).toEqual([40]); // 4 of the group's 10 reports
expect((all.data[0] as any).y).toEqual(['25-34<br>n = 10']);
expect((all.data[0] as any).y).toEqual(['25-34<br>Reportes: 10']);
});
});