feat(cacu): presentar KPI provisionales de tiempo a tratamiento

Adapta 245622b a las secciones de oportunidad del PR #20 y reutiliza el contrato C3r. Conserva la ruta y los paneles reservados del Histórico.
This commit is contained in:
Angel Capetillo Zavala
2026-11-22 05:53:59 -06:00
parent 17cef51d90
commit b8bf57e235
10 changed files with 140 additions and 28 deletions
@@ -17,7 +17,7 @@ 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, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, CACU_FIGURAS_CLINICAS, CACU_FIGURAS_OPORTUNIDAD, CAMA_CONFIRMACION_KPI, CAMA_FIGURAS_OPORTUNIDAD, CACU_FIGURA_CLINICA_PENDIENTE, KpiCardSlot, TEA_FIGURAS_CLINICAS, TEA_FIGURAS_OPORTUNIDAD, camaKpiCards } from './indicadores-kpi';
import { CACU_RESULTADO_KPI, CACU_TRATAMIENTO_KPIS, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, CACU_FIGURAS_CLINICAS, CACU_FIGURAS_OPORTUNIDAD, CAMA_CONFIRMACION_KPI, CAMA_FIGURAS_OPORTUNIDAD, CACU_FIGURA_CLINICA_PENDIENTE, KpiCardSlot, TEA_FIGURAS_CLINICAS, TEA_FIGURAS_OPORTUNIDAD, camaKpiCards } from './indicadores-kpi';
import { TeaResumenPeriodo } from './tea-resumen-periodo';
import { IndicadorKpiPanel } from './indicador-kpi-panel';
import { IndicadorScreeningRoute } from './indicador-screening-route';
@@ -363,11 +363,15 @@ export class IndicadoresPage {
return [...definitions.slice(0, diagnosis < 0 ? definitions.length : diagnosis), CACU_RESULTADO_KPI,
...definitions.slice(diagnosis < 0 ? definitions.length : diagnosis)];
}
// What the KPI grid draws. CaMa adds explicit pending cards for opportunity indicators the catalog does not publish.
// CaCu's treatment cards follow the existing KPIs without changing the initial-period anchor.
get kpiCards(): KpiCardSlot[] {
if (this.dominio === 'cama') return camaKpiCards(id => this.catalog().some(item => item.id === id));
return this.opportunityKpis.map(definition => ({ definition, pending: false }));
const cards = this.opportunityKpis.map(definition => ({ definition, pending: false }));
if (this.dominio !== 'cacu') return cards;
const tratamiento = CACU_TRATAMIENTO_KPIS.map(definition => ({ definition, pending: !this.kpiIndicator(definition.id) }));
return cards.length || tratamiento.some(card => !card.pending) ? [...cards, ...tratamiento] : [];
}
esKpiTratamientoCacu(id: string) { return this.dominio === 'cacu' && CACU_TRATAMIENTO_KPIS.some(kpi => kpi.id === id); }
private readonly catalogRequests = new Subject<void>();
readonly catalog = signal<Indicador[]>([]);
// Ids of the indicators to render; null shows the whole catalog.
@@ -396,7 +400,7 @@ export class IndicadoresPage {
const selected = new Set(this.selectedIndicators());
return { items: this.catalogOrder().filter(item => selected.has(item.id)) };
});
// The figures of «Indicadores de oportunidad»: TEA's time figures under its summary, and CaCu's six times, each a
// The figures of «Indicadores de oportunidad»: TEA's time figures under its summary, and CaCu's five times, each a
// pending slot while the catalog does not publish its indicator. The rest are the clinical ones.
// The domain is not a signal: each result reads the items first, so a new catalog recomputes it whichever domain it was last for.
readonly oportunidadSlots = computed((): { item?: Indicador; titulo: string }[] => {
@@ -424,8 +428,9 @@ export class IndicadoresPage {
readonly clinicosItems = computed(() => {
const items = this.searchResults().items;
if (this.dominio === 'cacu') {
// The time figures went to the opportunity section; an indicator with no figure has nothing to draw here.
const clinicos = items.filter(item => item.figuras.length && !CACU_FIGURAS_OPORTUNIDAD.some(figura => figura.id === item.id));
// The opportunity section already presents the time figures and the treatment KPIs.
const clinicos = items.filter(item => item.figuras.length && !this.esKpiTratamientoCacu(item.id)
&& !CACU_FIGURAS_OPORTUNIDAD.some(figura => figura.id === item.id));
return [...CACU_FIGURAS_CLINICAS.flatMap(id => clinicos.filter(item => item.id === id)), ...clinicos.filter(item => !CACU_FIGURAS_CLINICAS.includes(item.id))];
}
return this.dominio === 'tea' ? items.filter(item => !TEA_FIGURAS_OPORTUNIDAD.includes(item.id)) : items;