@for (card of kpis; track dominio + ':' + card.definition.id) {
@if (card.pending) {
}
}
- @if (dominio === 'cacu') {
+ @if (dominio === 'cacu' && !screeningRouteAvailable) {
} @else if (dominio === 'cama') {
diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts
index daac41c..233cd44 100644
--- a/src/app/features/indicadores/indicadores-page.ts
+++ b/src/app/features/indicadores/indicadores-page.ts
@@ -17,11 +17,11 @@ import { applyGlobal, domainTypes, GlobalFilterState, IndicadoresMemory, pending
import { IndicadorPeriodFilters } from './indicador-period-filters';
import { IndicadorCatalogCard } from './indicador-catalog-card';
import { esSocioConteos } from './indicadores-conteos-pareados';
-import { CACU_RESULTADO_KPI, CACU_TRATAMIENTO_KPIS, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, KpiCardSlot, cacuPendingKpiCards, camaKpiCards } from './indicadores-kpi';
+import { CACU_RESULTADO_KPI, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, KpiCardSlot, camaKpiCards } from './indicadores-kpi';
import { TeaResumenPeriodo } from './tea-resumen-periodo';
import { IndicadorKpiPanel } from './indicador-kpi-panel';
import { IndicadorScreeningRoute } from './indicador-screening-route';
-import { ROUTE_IDS, ROUTE_ONLY_IDS } from './screening-route';
+import { CACU_SIN_TARJETA, ROUTE_IDS } from './screening-route';
import { IndicadorKpiCard } from './indicador-kpi-card';
import { figureApplied, independentFigurePeriods } from './indicadores-figure-selection';
import { identityElementId, indicatorIdentity } from './indicadores-identities';
@@ -342,18 +342,18 @@ export class IndicadoresPage {
return this.dominio === 'cacu' && ROUTE_IDS.every(id => this.catalog().some(item => item.id === id));
}
// How many indicators the graphic section shows: all the catalog, except in CaMa, which draws only some of them.
- get availableKpis() {
- const definitions = this.dominio === 'cacu' ? [...this.kpisByDomain.cacu, ...CACU_TRATAMIENTO_KPIS] : this.kpisByDomain[this.dominio];
- return definitions.filter(definition => this.catalog().some(item => item.id === definition.id));
- }
+ get availableKpis() { return this.kpisByDomain[this.dominio].filter(definition => this.catalog().some(item => item.id === definition.id)); }
// TEA shows a summary paragraph instead of its cards for exactly one explicitly chosen period.
get teaResumenPeriodo(): string | undefined {
const selection = this.filters?.applied.selection;
return this.dominio === 'tea' && selection?.mode === 'explicit' && selection.periodos.length === 1 ? selection.periodos[0] : undefined;
}
+ // With the route chart, CaCu's strip keeps the cytology count: its times are drawn by the chart, so they get no card.
get opportunityKpis() {
const definitions = this.availableKpis;
- if (this.dominio !== 'cacu' || (!definitions.length && !this.catalog().some(item => item.id === CACU_RESULTADO_KPI.id))) return definitions;
+ if (this.dominio !== 'cacu') return definitions;
+ if (this.screeningRouteAvailable) return definitions.filter(definition => definition.contrato !== 'C3r');
+ if (!definitions.length && !this.catalog().some(item => item.id === CACU_RESULTADO_KPI.id)) return definitions;
// Keep the established KPI definitions and initial-period anchor intact.
const diagnosis = definitions.findIndex(item => item.id === 'cacu_dias_toma_diagnostico');
return [...definitions.slice(0, diagnosis < 0 ? definitions.length : diagnosis), CACU_RESULTADO_KPI,
@@ -362,8 +362,7 @@ export class IndicadoresPage {
// What the KPI grid draws. CaMa adds explicit pending cards for opportunity indicators the catalog does not publish.
get kpiCards(): KpiCardSlot[] {
if (this.dominio === 'cama') return camaKpiCards(id => this.catalog().some(item => item.id === id));
- const cards = this.opportunityKpis.map(definition => ({ definition, pending: false }));
- return this.dominio === 'cacu' ? [...cards, ...cacuPendingKpiCards(cards.map(card => card.definition.id))] : cards;
+ return this.opportunityKpis.map(definition => ({ definition, pending: false }));
}
private readonly catalogRequests = new Subject
();
readonly catalog = signal([]);
@@ -374,10 +373,11 @@ export class IndicadoresPage {
// Stable presentation order. Pins no longer reorder the summary.
readonly catalogOrder = computed(() => {
const catalog = this.catalog();
- // The route chart draws its own measures: they get no card of their own once it is there.
- const route = this.screeningRouteAvailable ? ROUTE_ONLY_IDS : [];
+ // CaCu's page draws the cytology result and the confirmation as cards, and the route chart. The times of the route
+ // get no card of their own once the chart is there; the rest live in the history (they have no figure here).
+ const hidden = this.screeningRouteAvailable ? [...ROUTE_IDS, ...CACU_SIN_TARJETA] : [];
return this.dominio === 'cacu'
- ? [...catalog.filter(item => item.id === 'cacu_eu7'), ...catalog.filter(item => item.id !== 'cacu_eu7' && !route.includes(item.id))]
+ ? [...catalog.filter(item => item.id === 'cacu_eu7'), ...catalog.filter(item => item.id !== 'cacu_eu7' && !hidden.includes(item.id))]
: this.dominio === 'cama' ? this.cardsDeCama(catalog)
: catalog.filter(item => !item.vistas || item.vistas.includes('resumen'));
});
diff --git a/src/app/features/indicadores/indicadores-screening-route-page.spec.ts b/src/app/features/indicadores/indicadores-screening-route-page.spec.ts
index e80d3a8..2eff58c 100644
--- a/src/app/features/indicadores/indicadores-screening-route-page.spec.ts
+++ b/src/app/features/indicadores/indicadores-screening-route-page.spec.ts
@@ -10,7 +10,7 @@ import { IndicadorCatalogCard } from './indicador-catalog-card';
import { IndicadoresPage } from './indicadores-page';
import { IndicadoresMemory } from './indicadores-memory';
import { Dominio } from './indicadores.models';
-import { ROUTE_IDS, ROUTE_ONLY_IDS } from './screening-route';
+import { CACU_SIN_TARJETA, ROUTE_IDS, ROUTE_ONLY_IDS } from './screening-route';
const item = (id: string, contrato = 'C3r') => ({ id, titulo: id, contrato, figuras: [], tipos_periodo: ['semestre', 'mes'] });
@@ -32,15 +32,16 @@ describe('Ruta del tamizaje: página de CaCu', () => {
const ruta = () => fixture.nativeElement.querySelector('app-indicador-screening-route');
const tarjetas = () => fixture.debugElement.queryAll(By.directive(IndicadorCatalogCard)).map(d => (d.componentInstance as IndicadorCatalogCard).indicador.id);
- it('con las siete medidas publicadas aparece la gráfica y sus medidas exclusivas no tienen tarjeta', () => {
- // Pins down: the chart replaces the cards of the five measures only it draws, while the cytology's and the diagnosis'
- // keep theirs. Fails if the chart stops appearing, or a measure it draws also shows as a card.
- abrir('cacu', [item('cacu_eu7', 'C2'), ...ROUTE_IDS.map(id => item(id))]);
+ it('con las siete medidas publicadas aparece la gráfica y CaCu deja solo las tarjetas que la gráfica no dibuja', () => {
+ // Pins down: the chart replaces the cards of every measure it reads, the proportions without a figure and the times to
+ // treatment live in the history, and the cytology result and its confirmation keep theirs. Fails if the chart stops
+ // appearing, or one of those measures also shows as a card.
+ abrir('cacu', [item('cacu_eu7', 'C2'), item('cacu_confirmacion_citologia', 'C2'), item('ind1', 'C1'), item('cacu_eu13', 'C1'),
+ item('cacu_riesgo_banda', 'C2'), item('cacu_dias_toma_tratamiento'), item('cacu_dias_diagnostico_tratamiento'), ...ROUTE_IDS.map(id => item(id))]);
expect(ruta()).not.toBeNull();
const ids = tarjetas();
- for (const id of ROUTE_ONLY_IDS) expect(ids).not.toContain(id);
- expect(ids).toContain('cacu_eu_tiempo_reporte');
- expect(ids).toContain('cacu_eu7');
+ for (const id of [...ROUTE_IDS, ...CACU_SIN_TARJETA]) expect(ids).not.toContain(id);
+ expect(ids).toEqual(['cacu_eu7', 'cacu_confirmacion_citologia']);
});
it('si el catálogo no publica alguna de las siete, no hay gráfica y las medidas conservan sus tarjetas', () => {
// Fails if the chart appears with a measure missing, or the cards of the others disappear anyway.
diff --git a/src/app/features/indicadores/screening-route.ts b/src/app/features/indicadores/screening-route.ts
index 0f8f768..0f75d33 100644
--- a/src/app/features/indicadores/screening-route.ts
+++ b/src/app/features/indicadores/screening-route.ts
@@ -28,6 +28,8 @@ export const ROUTE_STEPS: readonly RouteStep[] = [
export const ROUTE_IDS: readonly string[] = [...new Set(ROUTE_STEPS.flatMap(s => [s.sinceSample, s.sinceStep]))];
/** The measures only this chart draws: the cytology's and the diagnosis' keep their own cards. */
+/** CaCu's measures with no card on the page: the two times to treatment, the proportions without a figure and the risk by band. They are in the history. */
+export const CACU_SIN_TARJETA: readonly string[] = ['cacu_dias_toma_tratamiento', 'cacu_dias_diagnostico_tratamiento', 'ind1', 'cacu_eu13', 'cacu_riesgo_banda'];
export const ROUTE_ONLY_IDS: readonly string[] = ROUTE_IDS.filter(id => id !== 'cacu_eu_tiempo_reporte' && id !== 'cacu_dias_toma_diagnostico');
export type RouteView = 'cumulative' | 'steps';