feat(cama): the four BI-RADS charts as two, mammograms and patients on one card

How: PARES_CONTEOS pairs two C2 counts of the same finding, one per exam and one
per patient, with the map from exam category to patient category (BI-RADS 4A,
4B and 4C are a patient's BI-RADS 4). The exams' card
(cama_birads_456_mastografia) draws IndicadorConteosPareados: a donut of the
mammograms by category with their total in the centre, and grouped bars with
each patient BI-RADS next to its mammograms and "≈ n por paciente" at the end of
each pair. Both counts come from the same period request; a suppressed cell
leaves its sum, ratio and the donut undrawn instead of using zero. The patients'
indicator has no card of its own in Resumen (esSocioConteos); it still feeds its
opportunity card and Histórico.

Implications: the view depends on the exams' and patients' category ids
(B4A..B6, BIRADS_4..BIRADS_6) matching grupoDe; a renamed category makes the view
reject the answer as incompatible. The real API already publishes both
indicators with these ids.
This commit is contained in:
rockdrigo
2026-11-09 19:56:36 -06:00
parent 3aba7fe329
commit 8c3e41527c
7 changed files with 353 additions and 3 deletions
@@ -13,6 +13,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { catchError, first, map, of, startWith, Subject, switchMap, takeUntil } from 'rxjs';
import { Dominio, isDominio, Indicador, Tema } from './indicadores.models';
import { vistaEscenario } from './indicadores-eu7-escenario';
import { esSocioConteos } from './indicadores-conteos-pareados';
import { IndicadoresService } from './indicadores.service';
import { applyGlobal, domainTypes, GlobalFilterState, IndicadoresMemory, pending, validDraft } from './indicadores-memory';
import { IndicadorPeriodFilters } from './indicador-period-filters';
@@ -314,7 +315,9 @@ export class IndicadoresPage {
readonly catalogOrder = computed(() => {
const catalog = this.catalog();
// The interactive views go first.
const resumen = catalog.filter(item => !item.vistas || item.vistas.includes('resumen'));
// A paired partner is drawn on its pair's card, not on one of its own.
const ids = catalog.map(item => item.id);
const resumen = catalog.filter(item => (!item.vistas || item.vistas.includes('resumen')) && !esSocioConteos(this.dominio, item.id, ids));
const primero = (item: Indicador) => !!vistaEscenario(this.dominio, item);
return [...resumen.filter(primero), ...resumen.filter(item => !primero(item))];
});