Sin tiempos publicados en el periodo.
}
@@ -137,15 +137,6 @@
{{ p.value }}
@@ -156,7 +147,7 @@
@if (reports.isLoading()) {
} @else if (figureOf(f); as fig) {
-
+
} @else {
Sin datos publicados
}
@@ -228,7 +219,7 @@
@if (reports.isLoading()) {
} @else if (figureOf(f); as fig) {
-
+
} @else {
Sin datos en el periodo.
}
diff --git a/src/app/indicadores/tab-indicadores.ts b/src/app/indicadores/tab-indicadores.ts
index f7dec71..c847c78 100644
--- a/src/app/indicadores/tab-indicadores.ts
+++ b/src/app/indicadores/tab-indicadores.ts
@@ -50,7 +50,6 @@ export class TabIndicadores {
protected readonly type = signal
('semester');
protected readonly options = computed(() => periods(this.type()));
protected readonly chosen = signal(undefined);
- protected readonly prevalenceSex = signal(undefined);
protected readonly applied = signal(undefined);
protected readonly page = computed(() => PAGES[this.domain()]);
@@ -106,6 +105,7 @@ export class TabIndicadores {
});
}
+ protected readonly clinicalHeight = 430;
protected readonly pending = 'Indicador no publicado en el catálogo institucional.';
protected setType(type: PeriodType): void {
this.type.set(type);
@@ -140,7 +140,7 @@ export class TabIndicadores {
}
protected prevalenceOf(spec: FigureSpec) {
const r = this.rd(spec.measure);
- return r ? prevalenceHeadline(r, this.prevalenceSex()) : undefined;
+ return r ? prevalenceHeadline(r) : undefined;
}
protected readonly teaSummary = computed(() => {
const rd = (c: string) => this.loaded()?.get(c);
@@ -198,7 +198,7 @@ export class TabIndicadores {
case 'sankey':
return teaSankey(r);
case 'sex-bars':
- return teaSexBars(r, this.prevalenceSex());
+ return teaSexBars(r);
case 'alterations':
return teaAlterations(r);
case 'age-stack':
diff --git a/src/app/indicadores/tea-indicators.spec.ts b/src/app/indicadores/tea-indicators.spec.ts
index be53565..3a07991 100644
--- a/src/app/indicadores/tea-indicators.spec.ts
+++ b/src/app/indicadores/tea-indicators.spec.ts
@@ -399,14 +399,18 @@ describe('TEA clinical figures', () => {
});
});
- it('annotates only the median and the quartiles on the box', () => {
- const figure = boxFigure({ populations: {}, strata: {}, 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' });
+ it('shows the quartiles and the median in the hover of the box instead of annotations', () => {
+ const figure = boxFigure(
+ { populations: {}, strata: {}, score: 12.5, low: 8, high: 20 },
+ '2025-S1',
+ );
+ expect(figure.layout?.annotations).toBeUndefined();
+ expect(figure.data[0]).toMatchObject({
+ q1: [8],
+ median: [12.5],
+ q3: [20],
+ hovertemplate: 'Q3: %{q3:.1~f}
Mediana: %{median:.1~f}
Q1: %{q1:.1~f}',
+ });
});
const prevalence = {
@@ -432,7 +436,7 @@ describe('TEA clinical figures', () => {
};
it('shows the prevalence rate per 10,000 as the bar text and the counts in the hover', () => {
- const figure = teaSexBars(prevalence, 'female');
+ const figure = teaSexBars(prevalence);
expect(figure.layout?.barmode).toBeUndefined();
expect(figure.data).toHaveLength(1);
expect(figure.data[0]).toMatchObject({
@@ -444,7 +448,7 @@ describe('TEA clinical figures', () => {
[3, 6],
[1, 4],
],
- marker: { color: ['#4269C2', '#C24269'], line: { width: [0, 2] } },
+ marker: { color: ['#4269C2', '#C24269'] },
});
expect(figure.data[0]).toMatchObject({
hovertemplate: expect.stringContaining(
@@ -453,15 +457,11 @@ describe('TEA clinical figures', () => {
});
});
- it('puts the total or the chosen sex rate in the headline', () => {
+ it('puts the total 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();
});
@@ -567,20 +567,36 @@ describe('TEA clinical figures', () => {
};
const ageGroups = ['16 a 23 meses', '24 a 36 meses'];
- it('stacks diagnostic status in one bar per sex in each age group', () => {
+ it('stacks diagnostic status as percentages in one bar per sex in each age group', () => {
const figure = ageStack(byAgeAndSex, ['Confirmados', 'En proceso']);
expect(figure.layout?.barmode).toBe('stack');
expect(figure.data).toMatchObject([
- { x: ageGroups, offsetgroup: 'male', y: [1, 1], marker: { color: '#4269C2' } },
- { x: ageGroups, offsetgroup: 'male', y: [3, 0], marker: { color: 'rgba(66,105,194,0.25)' } },
- { x: ageGroups, offsetgroup: 'female', y: [1, 0], marker: { color: '#C24269' } },
+ {
+ x: ageGroups,
+ offsetgroup: 'male',
+ y: [25, 100],
+ text: ['25 %', '100 %'],
+ marker: { color: '#4269C2' },
+ },
+ {
+ x: ageGroups,
+ offsetgroup: 'male',
+ y: [75, 0],
+ text: ['75 %', ''],
+ marker: { color: 'rgba(66,105,194,0.25)' },
+ },
+ { x: ageGroups, offsetgroup: 'female', y: [50, 0], marker: { color: '#C24269' } },
{
x: ageGroups,
offsetgroup: 'female',
- y: [1, 0],
+ y: [50, 0],
marker: { color: 'rgba(194,66,105,0.25)' },
},
]);
+ expect(figure.layout?.yaxis).toMatchObject({
+ title: { text: '% de pacientes' },
+ ticksuffix: ' %',
+ });
});
it('groups EEG percentages by age and sex and omits missing denominators', () => {
@@ -591,14 +607,14 @@ describe('TEA clinical figures', () => {
name: 'Masculino',
x: ageGroups,
y: [25, 100],
- text: ['25 % (1/4)', '100 % (1/1)'],
+ text: ['25 %', '100 %'],
marker: { color: '#4269C2' },
},
{
name: 'Femenino',
x: ageGroups,
y: [50, null],
- text: ['50 % (1/2)', ''],
+ text: ['50 %', ''],
marker: { color: '#C24269' },
},
]);
diff --git a/src/app/plot.ts b/src/app/plot.ts
index 22f38eb..b6592c8 100644
--- a/src/app/plot.ts
+++ b/src/app/plot.ts
@@ -52,7 +52,11 @@ function layoutOf(layout: Partial = {}): Partial {
}
function withRoom(data: Partial[]): Plotly.Data[] {
- return data.map((d) => (d.type === 'pie' ? { automargin: true, ...d } : d)) as Plotly.Data[];
+ return data.map((d) => {
+ if (d.type === 'pie') return { automargin: true, ...d };
+ if (d.type === 'bar') return { cliponaxis: false, ...d };
+ return d;
+ }) as Plotly.Data[];
}
const CONFIG: Partial = {
responsive: true,