Ajustar indicadores, fecha de corte y ficha de CaMa y CaCu
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { bars, grouped, hiddenNote, Mode, unavailable } from './bars';
|
||||
import { bars, grouped, hiddenNote, Mode, subsequentHistory, unavailable } from './bars';
|
||||
import { scenarioBars } from './figures';
|
||||
import { Reading } from './measures';
|
||||
|
||||
@@ -17,6 +17,59 @@ describe('bars', () => {
|
||||
['1', '25.0 %'],
|
||||
]);
|
||||
});
|
||||
it('aggregates only named abnormal cytology results without changing the denominator', () => {
|
||||
const cell = (n: number) => ({ 'initial-population': n });
|
||||
const r: Reading = {
|
||||
populations: { 'initial-population': 10 },
|
||||
strata: {
|
||||
category: { NILM: cell(4), LSIL: cell(2), HSIL: cell(1), no_data: cell(3) },
|
||||
'age_group-category': {
|
||||
'25-34|NILM': cell(4),
|
||||
'25-34|LSIL': cell(2),
|
||||
'25-34|HSIL': cell(1),
|
||||
'25-34|no_data': cell(3),
|
||||
},
|
||||
},
|
||||
};
|
||||
const catalog = ['NILM', 'LSIL', 'HSIL'].map((code) => ({ code, label: code, color: '#000' }));
|
||||
const aggregate = { label: 'Anormal', color: '#f00', codes: ['LSIL', 'HSIL'] };
|
||||
const t = bars({ kind: 'counts', label: 'x', measure: 'M', catalog, aggregate }, () => r)!;
|
||||
expect(t.rows[1].cells).toEqual(['3', '30.0 %']);
|
||||
const g = grouped(
|
||||
{
|
||||
kind: 'grouped',
|
||||
label: 'x',
|
||||
measure: 'M',
|
||||
catalog,
|
||||
aggregate,
|
||||
stratum: 'age_group',
|
||||
order: ['25-34'],
|
||||
unit: 'pacientes',
|
||||
ofAll: true,
|
||||
},
|
||||
() => r,
|
||||
)!;
|
||||
expect(g.groups[0].rows[1].text).toBe('3/10 · 30.0 %');
|
||||
});
|
||||
it('shows the form history within subsequent screening without treating missing answers as a category', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
strata: {
|
||||
round: { subsequent: { 'initial-population': 5 } },
|
||||
subsequent_history: {
|
||||
within_1_year: { 'initial-population': 1 },
|
||||
'3_or_more_years': { 'initial-population': 2 },
|
||||
no_data: { 'initial-population': 2 },
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(subsequentHistory(r)).toEqual([
|
||||
{ label: 'Un año o menos', text: '1/5 · 20.0 %' },
|
||||
{ label: 'Dos años', text: '0/5 · 0.0 %' },
|
||||
{ label: 'Tres o más años', text: '2/5 · 40.0 %' },
|
||||
]);
|
||||
expect(subsequentHistory({ populations: {}, strata: {} })).toBeUndefined();
|
||||
});
|
||||
it('a group with no patients has no rate', () => {
|
||||
const r: Reading = {
|
||||
populations: {},
|
||||
|
||||
Reference in New Issue
Block a user