From 08161db1c415a28b2fc2567f524da09b3537b010 Mon Sep 17 00:00:00 2001 From: Angel Capetillo Zavala Date: Sat, 21 Nov 2026 01:27:55 -0600 Subject: [PATCH] feat(indicadores): map CaCu measures to the indicator ids the page reads --- .../fixtures/cacu_fhir_measures.json | 1033 +++++++++++++++++ .../fixtures/regresion_cacu_tea_mapeo.json | 66 +- .../indicadores/indicadores-cacu-fhir.spec.ts | 133 +++ .../indicadores/indicadores-cacu-fhir.ts | 15 + .../indicadores/indicadores-cama-fhir.spec.ts | 6 +- .../features/indicadores/indicadores-fhir.ts | 5 +- 6 files changed, 1220 insertions(+), 38 deletions(-) create mode 100644 src/app/features/indicadores/fixtures/cacu_fhir_measures.json create mode 100644 src/app/features/indicadores/indicadores-cacu-fhir.spec.ts create mode 100644 src/app/features/indicadores/indicadores-cacu-fhir.ts diff --git a/src/app/features/indicadores/fixtures/cacu_fhir_measures.json b/src/app/features/indicadores/fixtures/cacu_fhir_measures.json new file mode 100644 index 0000000..c4201a1 --- /dev/null +++ b/src/app/features/indicadores/fixtures/cacu_fhir_measures.json @@ -0,0 +1,1033 @@ +{ + "resourceType": "Bundle", + "type": "searchset", + "total": 7, + "link": [ + { + "relation": "self", + "url": "http://webapi/cacu/fhir/Measure?_count=50&_offset=0" + } + ], + "entry": [ + { + "fullUrl": "http://webapi/cacu/fhir/Measure/CACU-CONFIRMACION-CITOLOGIA", + "resource": { + "resourceType": "Measure", + "id": "CACU-CONFIRMACION-CITOLOGIA", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C2" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "mes" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/figuras", + "valueString": "fig_c2_donas" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/figuras", + "valueString": "fig_c2_barras" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "NORMAL" + }, + { + "url": "etiqueta", + "valueString": "Normal" + }, + { + "url": "color", + "valueString": "#9DBFE3" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "LIEBG" + }, + { + "url": "etiqueta", + "valueString": "LIEBG (CIN 1)" + }, + { + "url": "color", + "valueString": "#E8C28E" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "LIEAG" + }, + { + "url": "etiqueta", + "valueString": "LIEAG (CIN 2 y 3)" + }, + { + "url": "color", + "valueString": "#D98E4A" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "CIS" + }, + { + "url": "etiqueta", + "valueString": "Carcinoma in situ" + }, + { + "url": "color", + "valueString": "#B55A1F" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "CARCINOMA" + }, + { + "url": "etiqueta", + "valueString": "Carcinoma invasor" + }, + { + "url": "color", + "valueString": "#7A2E0E" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "SIN_BIOPSIA" + }, + { + "url": "etiqueta", + "valueString": "Sin biopsia aún" + }, + { + "url": "color", + "valueString": "#C9CDD2" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "SIN_DATO" + }, + { + "url": "etiqueta", + "valueString": "Biopsia sin grado" + }, + { + "url": "color", + "valueString": "#C9CDD2" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + } + ], + "url": "https://isssteleon.org/fhir/Measure/CACU-CONFIRMACION-CITOLOGIA", + "version": "0.1.2", + "name": "cacu_confirmacion_citologia", + "title": "Tasa de confirmación histopatológica", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "paciente" + } + ] + }, + "description": "De las pacientes cuya última citología del periodo con resultado y calidad de espécimen satisfactoria es de alto grado (ASC-H, LIEAG o carcinoma in situ), cuántas tienen cada grado en la biopsia que esa citología originó, por resultado citológico. A la fecha de corte: sin un plazo máximo, una paciente «sin biopsia aún» puede pasar a un grado mientras lleguen reportes.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "cohort" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "TOTAL" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_confirmacion_citologia" + } + } + ], + "stratifier": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "biopsia_grado" + } + ] + } + }, + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "citologia_alto_grado" + } + ], + "text": "Citología de alto grado" + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + }, + { + "fullUrl": "http://webapi/cacu/fhir/Measure/CACU-DIAS-TOMA-DIAGNOSTICO", + "resource": { + "resourceType": "Measure", + "id": "CACU-DIAS-TOMA-DIAGNOSTICO", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C3r" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "mes" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/figuras", + "valueString": "fig_c3r_caja" + } + ], + "url": "https://isssteleon.org/fhir/Measure/CACU-DIAS-TOMA-DIAGNOSTICO", + "version": "0.2.3", + "name": "cacu_dias_toma_diagnostico", + "title": "Tiempo de tamizaje a diagnóstico", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "examen" + } + ] + }, + "description": "Días naturales de la toma de cada citología del periodo a la primera nota médica posterior que la resuelve: un diagnóstico CIE-10 de la lista (normal, benigno, lesión o cáncer), escrito por una de las especialidades que diagnostican, dentro del horizonte y a la fecha de corte. Entran todas las citologías, sean de tamizaje o no; se excluyen las de pacientes con un diagnóstico de cáncer cervicouterino anterior a la toma.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "continuous-variable" + } + ] + }, + "improvementNotation": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation", + "code": "decrease" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "TOTAL" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_dias_toma_diagnostico" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "measure-observation" + } + ] + }, + "description": "Unidades con valor", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_dias_toma_diagnostico" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "measure-population-exclusion" + } + ] + }, + "description": "Unidades sin valor", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_dias_toma_diagnostico" + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + }, + { + "fullUrl": "http://webapi/cacu/fhir/Measure/CACU-EU-TIEMPO-REPORTE", + "resource": { + "resourceType": "Measure", + "id": "CACU-EU-TIEMPO-REPORTE", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C3r" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "mes" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/figuras", + "valueString": "fig_c3r_caja" + } + ], + "url": "https://isssteleon.org/fhir/Measure/CACU-EU-TIEMPO-REPORTE", + "version": "0.2.1", + "name": "cacu_eu_tiempo_reporte", + "title": "Días de la toma de la citología a su resultado", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "examen" + } + ] + }, + "description": "Días naturales de la toma de cada citología del periodo a su resultado, a la fecha de corte. Las que aún no tienen resultado y siguen dentro del horizonte no se miden; las que lo pasaron sin resultado cuentan en los excluidos.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "continuous-variable" + } + ] + }, + "improvementNotation": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation", + "code": "decrease" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "TOTAL" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu_tiempo_reporte" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "measure-observation" + } + ] + }, + "description": "Unidades con valor", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu_tiempo_reporte" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "measure-population-exclusion" + } + ] + }, + "description": "Unidades sin valor", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu_tiempo_reporte" + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + }, + { + "fullUrl": "http://webapi/cacu/fhir/Measure/CACU-EU13", + "resource": { + "resourceType": "Measure", + "id": "CACU-EU13", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C1" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "mes" + } + ], + "url": "https://isssteleon.org/fhir/Measure/CACU-EU13", + "version": "0.3.2", + "name": "cacu_eu13", + "title": "Tasa de detección histopatológica", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "paciente" + } + ] + }, + "description": "De todas las mujeres tamizadas en el periodo, las que tienen una biopsia reportada con LIEAG (CIN 2 y 3), carcinoma in situ o carcinoma invasor, originada por una de sus citologías del periodo.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "proportion" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "principal" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu13_denominador" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "denominator" + } + ] + }, + "description": "Denominador", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu13_denominador" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "numerator" + } + ] + }, + "description": "Numerador", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu13_numerador" + } + } + ], + "stratifier": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "grupo_edad" + } + ], + "text": "grupo_edad" + } + }, + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "estatus_seguimiento" + } + ], + "text": "Estatus de seguimiento" + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + }, + { + "fullUrl": "http://webapi/cacu/fhir/Measure/CACU-EU7", + "resource": { + "resourceType": "Measure", + "id": "CACU-EU7", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C2" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "mes" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/figuras", + "valueString": "fig_c2_donas" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/figuras", + "valueString": "fig_c2_barras" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "NORMAL" + }, + { + "url": "etiqueta", + "valueString": "Normal" + }, + { + "url": "color", + "valueString": "#9DBFE3" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "ASC-US" + }, + { + "url": "etiqueta", + "valueString": "ASC-US" + }, + { + "url": "color", + "valueString": "#2F6DB3" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "LIEBG" + }, + { + "url": "etiqueta", + "valueString": "LIEBG" + }, + { + "url": "color", + "valueString": "#E8C28E" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "ASC-H" + }, + { + "url": "etiqueta", + "valueString": "ASC-H" + }, + { + "url": "color", + "valueString": "#D98E4A" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "LIEAG" + }, + { + "url": "etiqueta", + "valueString": "LIEAG" + }, + { + "url": "color", + "valueString": "#B55A1F" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "CIS" + }, + { + "url": "etiqueta", + "valueString": "Carcinoma in situ" + }, + { + "url": "color", + "valueString": "#7A2E0E" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + }, + { + "extension": [ + { + "url": "codigo", + "valueCode": "SIN_DATO" + }, + { + "url": "etiqueta", + "valueString": "Sin dato" + }, + { + "url": "color", + "valueString": "#C9CDD2" + } + ], + "url": "https://isssteleon.org/fhir/StructureDefinition/categoria" + } + ], + "url": "https://isssteleon.org/fhir/Measure/CACU-EU7", + "version": "0.3.3", + "name": "cacu_eu7", + "title": "Distribución de resultados citológicos", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "paciente" + } + ] + }, + "description": "Cuántas pacientes caen en cada resultado citológico en el periodo, cada una en el de su última citología con resultado y calidad de espécimen satisfactoria. «Sin dato»: resultado no disponible o de calidad de espécimen insatisfactoria a la fecha de corte.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "cohort" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "TOTAL" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_eu7" + } + } + ], + "stratifier": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "resultado" + } + ] + } + }, + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "grupo_edad" + } + ], + "text": "grupo_edad" + } + }, + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "estatus_seguimiento" + } + ], + "text": "Estatus de seguimiento" + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + }, + { + "fullUrl": "http://webapi/cacu/fhir/Measure/CACU-RIESGO-BANDA", + "resource": { + "resourceType": "Measure", + "id": "CACU-RIESGO-BANDA", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C2" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + } + ], + "url": "https://isssteleon.org/fhir/Measure/CACU-RIESGO-BANDA", + "version": "0.1.0", + "name": "cacu_riesgo_banda", + "title": "Pacientes en vigilancia por banda de riesgo de CIN2+", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "paciente" + } + ] + }, + "description": "Cuántas pacientes de la cohorte de vigilancia, con citología índice en el periodo, caen en cada banda de riesgo estimado de CIN2+. Cuenta el lote de evaluaciones vigente (confirmado). «Sin dato»: la paciente no tiene evaluación confirmada en ese lote.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "cohort" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "TOTAL" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_riesgo_banda" + } + } + ], + "stratifier": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/estratificador", + "code": "probabilidad" + } + ] + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + }, + { + "fullUrl": "http://webapi/cacu/fhir/Measure/IND1", + "resource": { + "resourceType": "Measure", + "id": "IND1", + "extension": [ + { + "url": "https://isssteleon.org/fhir/StructureDefinition/contrato", + "valueCode": "C1" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "semestre" + }, + { + "url": "https://isssteleon.org/fhir/StructureDefinition/tipos-periodo", + "valueCode": "mes" + } + ], + "url": "https://isssteleon.org/fhir/Measure/IND1", + "version": "0.3.2", + "name": "cacu_ind1", + "title": "Pacientes con citología anómala", + "status": "active", + "subjectCodeableConcept": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/unidad", + "code": "paciente" + } + ] + }, + "description": "Proporción de pacientes con citología tomada en el periodo con al menos un resultado anómalo: ASC-US, LIEBG, ASC-H, LIEAG o carcinoma in situ (sistema Bethesda). Una paciente con varias citologías cuenta una vez.", + "scoring": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-scoring", + "code": "proportion" + } + ] + }, + "improvementNotation": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation", + "code": "decrease" + } + ] + }, + "group": [ + { + "code": { + "coding": [ + { + "system": "https://isssteleon.org/fhir/CodeSystem/grupo-medida", + "code": "principal" + } + ] + }, + "population": [ + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "initial-population" + } + ] + }, + "description": "Unidades del periodo", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_ind1_denominador" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "denominator" + } + ] + }, + "description": "Denominador", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_ind1_denominador" + } + }, + { + "code": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/measure-population", + "code": "numerator" + } + ] + }, + "description": "Numerador", + "criteria": { + "language": "text/x-dbt-metric", + "expression": "cacu_ind1_numerador" + } + } + ] + } + ] + }, + "search": { + "mode": "match" + } + } + ] +} diff --git a/src/app/features/indicadores/fixtures/regresion_cacu_tea_mapeo.json b/src/app/features/indicadores/fixtures/regresion_cacu_tea_mapeo.json index f2002e2..fbcc85d 100644 --- a/src/app/features/indicadores/fixtures/regresion_cacu_tea_mapeo.json +++ b/src/app/features/indicadores/fixtures/regresion_cacu_tea_mapeo.json @@ -1,8 +1,8 @@ { "cacu/CACU-CONFIRMACION-CITOLOGIA": { - "id": "CACU_CONFIRMACION_CITOLOGIA", + "id": "cacu_confirmacion_citologia", "indicador": { - "id": "CACU_CONFIRMACION_CITOLOGIA", + "id": "cacu_confirmacion_citologia", "version": "0.1.2", "titulo": "Tasa de confirmación histopatológica", "contrato": "C2", @@ -19,7 +19,7 @@ "filtros": [] }, "metadatos": { - "id": "CACU_CONFIRMACION_CITOLOGIA", + "id": "cacu_confirmacion_citologia", "version": "0.1.2", "descripcion": "De las pacientes cuya última citología del periodo con resultado y calidad de espécimen satisfactoria es de alto grado (ASC-H, LIEAG o carcinoma in situ), cuántas tienen cada grado en la biopsia que esa citología originó, por resultado citológico. A la fecha de corte: sin un plazo máximo, una paciente «sin biopsia aún» puede pasar a un grado mientras lleguen reportes.", "ficha": { @@ -41,7 +41,7 @@ }, "datos": { "total": { - "id": "CACU_CONFIRMACION_CITOLOGIA", + "id": "cacu_confirmacion_citologia", "titulo": "Tasa de confirmación histopatológica", "version": "0.1.2", "contrato": "C2", @@ -80,7 +80,7 @@ "filas": [] }, "citologia_alto_grado": { - "id": "CACU_CONFIRMACION_CITOLOGIA", + "id": "cacu_confirmacion_citologia", "titulo": "Tasa de confirmación histopatológica", "version": "0.1.2", "contrato": "C2", @@ -122,9 +122,9 @@ } }, "cacu/CACU-DIAS-TOMA-DIAGNOSTICO": { - "id": "CACU_DIAS_TOMA_DIAGNOSTICO", + "id": "cacu_dias_toma_diagnostico", "indicador": { - "id": "CACU_DIAS_TOMA_DIAGNOSTICO", + "id": "cacu_dias_toma_diagnostico", "version": "0.2.3", "titulo": "Tiempo de tamizaje a diagnóstico", "contrato": "C3r", @@ -139,7 +139,7 @@ "filtros": [] }, "metadatos": { - "id": "CACU_DIAS_TOMA_DIAGNOSTICO", + "id": "cacu_dias_toma_diagnostico", "version": "0.2.3", "descripcion": "Días naturales de la toma de cada citología del periodo a la primera nota médica posterior que la resuelve: un diagnóstico CIE-10 de la lista (normal, benigno, lesión o cáncer), escrito por una de las especialidades que diagnostican, dentro del horizonte y a la fecha de corte. Entran todas las citologías, sean de tamizaje o no; se excluyen las de pacientes con un diagnóstico de cáncer cervicouterino anterior a la toma.", "ficha": { @@ -171,7 +171,7 @@ }, "datos": { "total": { - "id": "CACU_DIAS_TOMA_DIAGNOSTICO", + "id": "cacu_dias_toma_diagnostico", "titulo": "Tiempo de tamizaje a diagnóstico", "version": "0.2.3", "contrato": "C3r", @@ -239,9 +239,9 @@ } }, "cacu/CACU-EU-TIEMPO-REPORTE": { - "id": "CACU_EU_TIEMPO_REPORTE", + "id": "cacu_eu_tiempo_reporte", "indicador": { - "id": "CACU_EU_TIEMPO_REPORTE", + "id": "cacu_eu_tiempo_reporte", "version": "0.2.1", "titulo": "Días de la toma de la citología a su resultado", "contrato": "C3r", @@ -256,7 +256,7 @@ "filtros": [] }, "metadatos": { - "id": "CACU_EU_TIEMPO_REPORTE", + "id": "cacu_eu_tiempo_reporte", "version": "0.2.1", "descripcion": "Días naturales de la toma de cada citología del periodo a su resultado, a la fecha de corte. Las que aún no tienen resultado y siguen dentro del horizonte no se miden; las que lo pasaron sin resultado cuentan en los excluidos.", "ficha": { @@ -288,7 +288,7 @@ }, "datos": { "total": { - "id": "CACU_EU_TIEMPO_REPORTE", + "id": "cacu_eu_tiempo_reporte", "titulo": "Días de la toma de la citología a su resultado", "version": "0.2.1", "contrato": "C3r", @@ -356,9 +356,9 @@ } }, "cacu/CACU-EU13": { - "id": "CACU_EU13", + "id": "cacu_eu13", "indicador": { - "id": "CACU_EU13", + "id": "cacu_eu13", "version": "0.3.2", "titulo": "Tasa de detección histopatológica", "contrato": "C1", @@ -376,7 +376,7 @@ "filtros": [] }, "metadatos": { - "id": "CACU_EU13", + "id": "cacu_eu13", "version": "0.3.2", "descripcion": "De todas las mujeres tamizadas en el periodo, las que tienen una biopsia reportada con LIEAG (CIN 2 y 3), carcinoma in situ o carcinoma invasor, originada por una de sus citologías del periodo.", "ficha": { @@ -408,7 +408,7 @@ }, "datos": { "total": { - "id": "CACU_EU13", + "id": "cacu_eu13", "titulo": "Tasa de detección histopatológica", "version": "0.3.2", "contrato": "C1", @@ -474,7 +474,7 @@ ] }, "grupo_edad": { - "id": "CACU_EU13", + "id": "cacu_eu13", "titulo": "Tasa de detección histopatológica", "version": "0.3.2", "contrato": "C1", @@ -592,7 +592,7 @@ ] }, "estatus_seguimiento": { - "id": "CACU_EU13", + "id": "cacu_eu13", "titulo": "Tasa de detección histopatológica", "version": "0.3.2", "contrato": "C1", @@ -652,9 +652,9 @@ } }, "cacu/CACU-EU7": { - "id": "CACU_EU7", + "id": "cacu_eu7", "indicador": { - "id": "CACU_EU7", + "id": "cacu_eu7", "version": "0.3.3", "titulo": "Distribución de resultados citológicos", "contrato": "C2", @@ -672,7 +672,7 @@ "filtros": [] }, "metadatos": { - "id": "CACU_EU7", + "id": "cacu_eu7", "version": "0.3.3", "descripcion": "Cuántas pacientes caen en cada resultado citológico en el periodo, cada una en el de su última citología con resultado y calidad de espécimen satisfactoria. «Sin dato»: resultado no disponible o de calidad de espécimen insatisfactoria a la fecha de corte.", "ficha": { @@ -694,7 +694,7 @@ }, "datos": { "total": { - "id": "CACU_EU7", + "id": "cacu_eu7", "titulo": "Distribución de resultados citológicos", "version": "0.3.3", "contrato": "C2", @@ -733,7 +733,7 @@ "filas": [] }, "grupo_edad": { - "id": "CACU_EU7", + "id": "cacu_eu7", "titulo": "Distribución de resultados citológicos", "version": "0.3.3", "contrato": "C2", @@ -773,7 +773,7 @@ "filas": [] }, "estatus_seguimiento": { - "id": "CACU_EU7", + "id": "cacu_eu7", "titulo": "Distribución de resultados citológicos", "version": "0.3.3", "contrato": "C2", @@ -815,9 +815,9 @@ } }, "cacu/CACU-RIESGO-BANDA": { - "id": "CACU_RIESGO_BANDA", + "id": "cacu_riesgo_banda", "indicador": { - "id": "CACU_RIESGO_BANDA", + "id": "cacu_riesgo_banda", "version": "0.1.0", "titulo": "Pacientes en vigilancia por banda de riesgo de CIN2+", "contrato": "C2", @@ -831,7 +831,7 @@ "filtros": [] }, "metadatos": { - "id": "CACU_RIESGO_BANDA", + "id": "cacu_riesgo_banda", "version": "0.1.0", "descripcion": "Cuántas pacientes de la cohorte de vigilancia, con citología índice en el periodo, caen en cada banda de riesgo estimado de CIN2+. Cuenta el lote de evaluaciones vigente (confirmado). «Sin dato»: la paciente no tiene evaluación confirmada en ese lote.", "ficha": { @@ -853,7 +853,7 @@ }, "datos": { "total": { - "id": "CACU_RIESGO_BANDA", + "id": "cacu_riesgo_banda", "titulo": "Pacientes en vigilancia por banda de riesgo de CIN2+", "version": "0.1.0", "contrato": "C2", @@ -894,9 +894,9 @@ } }, "cacu/IND1": { - "id": "IND1", + "id": "ind1", "indicador": { - "id": "IND1", + "id": "ind1", "version": "0.3.2", "titulo": "Pacientes con citología anómala", "contrato": "C1", @@ -911,7 +911,7 @@ "filtros": [] }, "metadatos": { - "id": "IND1", + "id": "ind1", "version": "0.3.2", "descripcion": "Proporción de pacientes con citología tomada en el periodo con al menos un resultado anómalo: ASC-US, LIEBG, ASC-H, LIEAG o carcinoma in situ (sistema Bethesda). Una paciente con varias citologías cuenta una vez.", "ficha": { @@ -943,7 +943,7 @@ }, "datos": { "total": { - "id": "IND1", + "id": "ind1", "titulo": "Pacientes con citología anómala", "version": "0.3.2", "contrato": "C1", diff --git a/src/app/features/indicadores/indicadores-cacu-fhir.spec.ts b/src/app/features/indicadores/indicadores-cacu-fhir.spec.ts new file mode 100644 index 0000000..be2a426 --- /dev/null +++ b/src/app/features/indicadores/indicadores-cacu-fhir.spec.ts @@ -0,0 +1,133 @@ +// What this module covers: how CaCu's FHIR measures reach the indicator page: the page's id of each measure, and what the +// initial-period anchor (`cacu_eu7`) makes of a C2 Measure that publishes, or does not publish, its category labels. +// The Measure and the report are synthetic and minimal: the shape of `GET /cacu/fhir/Measure` and `/MeasureReport`. +import { Bundle, resources } from './fhir'; +import { Measure, Report, datosDeReportes, indicadorDeMeasure, indicadorId } from './indicadores-fhir'; +import { c2Figure } from './indicadores-c2-adapter'; +import { FigureSelection } from './indicadores.models'; +import measuresData from './fixtures/cacu_fhir_measures.json'; +import { CACU_MEASURE_IDS } from './indicadores-cacu-fhir'; +import { ID_CONFIRMACION } from './indicadores-confirmacion-citologia'; +import { CACU_RESULTADO_KPI, KPI_BY_DOMAIN, kpiResult } from './indicadores-kpi'; +import { GlobalApplied } from './indicadores-memory'; + +const STRUCTURE = 'https://isssteleon.org/fhir/StructureDefinition'; +const ENDPOINT = ['CACU-CONFIRMACION-CITOLOGIA', 'CACU-DIAS-TOMA-DIAGNOSTICO', 'CACU-EU-TIEMPO-REPORTE', 'CACU-EU13', 'CACU-EU7', + 'CACU-RIESGO-BANDA', 'IND1']; +const etiqueta = (codigo: string, texto: string, color: string) => ({ url: `${STRUCTURE}/categoria`, extension: [ + { url: 'codigo', valueCode: codigo }, { url: 'etiqueta', valueString: texto }, { url: 'color', valueString: color }] }); +const eu7 = (extra: object[]): Measure => ({ + resourceType: 'Measure', id: 'CACU-EU7', version: '0.3.3', title: 'Distribución de resultados citológicos', + subjectCodeableConcept: { coding: [{ code: 'paciente' }] }, + extension: [{ url: `${STRUCTURE}/contrato`, valueCode: 'C2' }, { url: `${STRUCTURE}/tipos-periodo`, valueCode: 'semestre' }, ...extra], + group: [{ code: { coding: [{ code: 'TOTAL' }] }, population: [], stratifier: [{ code: [{ coding: [{ code: 'resultado' }] }], stratum: [] }] }], +} as unknown as Measure); +const reporte = (): Report => ({ + resourceType: 'MeasureReport', id: 'CACU-EU7-1', period: { start: '2025-07-01', end: '2025-12-31' }, + group: [{ code: { coding: [{ code: 'TOTAL' }] }, population: [{ code: { coding: [{ code: 'initial-population' }] }, count: 12 }], + stratifier: [{ code: [{ coding: [{ code: 'resultado' }] }], stratum: [ + { value: { coding: [{ code: 'NORMAL' }] }, population: [{ code: { coding: [{ code: 'initial-population' }] }, count: 8 }] }, + { value: { coding: [{ code: 'ASC-US' }] }, population: [{ code: { coding: [{ code: 'initial-population' }] }, count: 3 }] }, + { value: { coding: [{ code: 'SIN_DATO' }] }, population: [{ code: { coding: [{ code: 'initial-population' }] }, count: 1 }] }, + ] }] }], +} as unknown as Report); +const aplicado: GlobalApplied = { tipo: 'semestre', selection: { mode: 'explicit', periodos: ['2025-S2'] }, revision: 0 }; +const ancla = KPI_BY_DOMAIN.cacu[0]; + +describe('Identificadores de CaCu entre FHIR y la página', () => { + it('cada medida que publica el WebApi tiene el id de minúsculas que usa la página y ninguno se repite', () => { + // Pins down: the table covers the seven measures `GET /cacu/fhir/Measure` lists and the ids are unique. Fails if a + // measure is published without a correspondence (it would come back as `CACU_X`, which no card matches) or two + // measures collapse into one page id. + const ids = ENDPOINT.map(indicadorId); + expect(ids.sort()).toEqual(['cacu_confirmacion_citologia', 'cacu_dias_toma_diagnostico', 'cacu_eu13', 'cacu_eu7', + 'cacu_eu_tiempo_reporte', 'cacu_riesgo_banda', 'ind1']); + expect(ENDPOINT.every(id => Object.hasOwn(CACU_MEASURE_IDS, id))).toBe(true); + }); + + it('los ids que la página busca (ancla, tiempos, confirmación) existen entre los publicados', () => { + // Pins down: the page's own constants (the KPI definitions of CaCu, the confirmation card's id and the result-time KPI) + // are values of the table. Fails if the page renames one of them without the table: the catalog would keep `CACU_EU7` + // while the page looks for `cacu_eu7`, and no initial period would be searched. + const publicados = Object.values(CACU_MEASURE_IDS); + for (const id of [...KPI_BY_DOMAIN.cacu.map(k => k.id), CACU_RESULTADO_KPI.id, ID_CONFIRMACION, 'cacu_eu7']) { + expect(publicados).toContain(id); + } + }); + + it('el catálogo de una medida de CaCu lleva el id de la página y sus figuras', () => { + // Pins down: the catalog entry takes the page id and the `figuras` the Measure publishes. Fails if the mapper stops + // using the CaCu table or drops the figures. + const item = indicadorDeMeasure(eu7([{ url: `${STRUCTURE}/figuras`, valueString: 'fig_c2_donas' }, + { url: `${STRUCTURE}/figuras`, valueString: 'fig_c2_barras' }])); + expect(item.id).toBe('cacu_eu7'); + expect(item.figuras).toEqual(['fig_c2_donas', 'fig_c2_barras']); + }); +}); + +describe('El ancla de CaCu con y sin etiquetas de categoría publicadas', () => { + it('con etiquetas, los conteos del periodo son filas y el ancla muestra el total', () => { + // Pins down: a C2 Measure that publishes its categories gives one row per category and the anchor KPI the sum + // (12 patients), so the initial-period search can stop on the period. Fails if the rows stop following the Measure's + // categories or the anchor no longer accepts a CaCu partition. + const measure = eu7([etiqueta('NORMAL', 'Normal', '#9DBFE3'), etiqueta('ASC-US', 'ASC-US', '#2F6DB3'), + etiqueta('SIN_DATO', 'Sin dato', '#C9CDD2')]); + const datos = datosDeReportes(measure, [reporte()], 'semestre'); + expect(datos.filas.map(f => [f['categoria'], f['n']])).toEqual([['NORMAL', 8], ['ASC-US', 3], ['SIN_DATO', 1]]); + const resultado = kpiResult(datos, ancla, 'cacu', aplicado); + expect(resultado.state).toBe('Disponible'); + expect(resultado.value).toBe(12); + }); + + it('sin etiquetas, el mismo reporte no deja filas y el ancla no encuentra periodo', () => { + // Pins down the failure the Measure without `categoria` causes: the report counts 12 patients, but with no declared + // category there is no row, so the anchor reads «Sin filas utilizables» and the initial period stays empty. Fails + // if the page starts inventing categories from the report (it must keep asking the Measure). + const datos = datosDeReportes(eu7([]), [reporte()], 'semestre'); + expect(datos.filas).toEqual([]); + expect(kpiResult(datos, ancla, 'cacu', aplicado).state).toBe('Sin filas utilizables'); + }); +}); + +// `fixtures/cacu_fhir_measures.json` is the Measure bundle `GET /cacu/fhir/Measure` returns from the dbt definitions once +// CaCu declares its figures and category labels (WebApi with the figures and labels declared in Transformation); the reports are built +// from the categories each Measure declares, as the WebApi would count them. +const publicadas = resources(measuresData as unknown as Bundle, 'Measure') as Measure[]; +const medida = (id: string) => publicadas.find(m => m.id === id)!; +const declaradas = (m: Measure) => (m.extension ?? []).filter(e => e.url.endsWith('/categoria')) + .map(e => e.extension!.find(x => x.url === 'codigo')!.valueCode!); +const codigo = (c: string) => ({ coding: [{ code: c }] }); +const reporteDe = (m: Measure, conteos: number[]): Report => ({ + resourceType: 'MeasureReport', id: `${m.id}-1`, period: { start: '2025-07-01', end: '2025-12-31' }, + group: [{ code: codigo('TOTAL'), population: [{ code: codigo('initial-population'), count: conteos.reduce((a, b) => a + b, 0) }], + stratifier: [{ code: [codigo('categoria')], stratum: declaradas(m).map((c, i) => ({ + value: codigo(c), population: [{ code: codigo('initial-population'), count: conteos[i] }] })) }] }], +} as unknown as Report); + +describe('Las medidas de CaCu como las publica el WebApi con figuras y etiquetas declaradas', () => { + it('el catálogo ofrece las figuras que cada contrato sabe dibujar y deja sin ellas las que aún no', () => { + // Pins down: C2 measures offer the donut and the bars, the two C3r the box plot, and the C1 and the risk bands none + // yet (no declared figure the renderer supports). Fails if a CaCu measure loses its figures or gains one that was not + // checked against the renderer. + const figuras = Object.fromEntries(publicadas.map(m => [indicadorDeMeasure(m).id, indicadorDeMeasure(m).figuras])); + expect(figuras).toEqual({ + cacu_confirmacion_citologia: ['fig_c2_donas', 'fig_c2_barras'], cacu_dias_toma_diagnostico: ['fig_c3r_caja'], + cacu_eu_tiempo_reporte: ['fig_c3r_caja'], cacu_eu13: [], cacu_eu7: ['fig_c2_donas', 'fig_c2_barras'], + cacu_riesgo_banda: [], ind1: [], + }); + }); + + it('con las etiquetas publicadas, el ancla muestra el total y el donut y las barras se dibujan', () => { + // Pins down the whole chain for the anchor: published categories -> rows -> «Pacientes evaluadas» total (16) -> + // supported C2 donut and bars. Fails if the page cannot read what the WebApi publishes for CaCu's distribution. + const eu7 = medida('CACU-EU7'); + const datos = datosDeReportes(eu7, [reporteDe(eu7, [8, 3, 2, 1, 1, 0, 1])], 'semestre'); + const resultado = kpiResult(datos, ancla, 'cacu', aplicado); + expect(resultado).toMatchObject({ state: 'Disponible', value: 16 }); + for (const figura of ['fig_c2_donas', 'fig_c2_barras']) { + const dibujo = c2Figure(datos, { dominio: 'cacu', indicador: 'cacu_eu7', figura, tipoPeriodo: 'semestre', tema: 'claro', + periodos: ['2025-S2'] } as unknown as FigureSelection); + expect(dibujo.status).toBe('supported'); + } + }); +}); diff --git a/src/app/features/indicadores/indicadores-cacu-fhir.ts b/src/app/features/indicadores/indicadores-cacu-fhir.ts new file mode 100644 index 0000000..a4adba9 --- /dev/null +++ b/src/app/features/indicadores/indicadores-cacu-fhir.ts @@ -0,0 +1,15 @@ +// How CaCu's FHIR measures map onto what the indicator page reads: the page's id of each measure. +// +// The WebApi names a measure `CACU-EU7`, `CACU-CONFIRMACION-CITOLOGIA` or `IND1`; the page, its KPI definitions, the +// initial-period anchor and the cards that have a view of their own (`cacu_eu7`, `cacu_confirmacion_citologia`, the +// time pair) all use the lower-case ids below. The generic rule would give `CACU_EU7`, which none of them matches, so +// the correspondence is explicit, as CaMa's is, and a measure outside it keeps the generic rule. +export const CACU_MEASURE_IDS: Readonly> = { + 'CACU-CONFIRMACION-CITOLOGIA': 'cacu_confirmacion_citologia', + 'CACU-DIAS-TOMA-DIAGNOSTICO': 'cacu_dias_toma_diagnostico', + 'CACU-EU-TIEMPO-REPORTE': 'cacu_eu_tiempo_reporte', + 'CACU-EU13': 'cacu_eu13', + 'CACU-EU7': 'cacu_eu7', + 'CACU-RIESGO-BANDA': 'cacu_riesgo_banda', + 'IND1': 'ind1', +}; diff --git a/src/app/features/indicadores/indicadores-cama-fhir.spec.ts b/src/app/features/indicadores/indicadores-cama-fhir.spec.ts index 7f7c406..d9ddbda 100644 --- a/src/app/features/indicadores/indicadores-cama-fhir.spec.ts +++ b/src/app/features/indicadores/indicadores-cama-fhir.spec.ts @@ -50,10 +50,10 @@ describe('Identificadores de CaMa entre FHIR y la página', () => { }); it('el id de una medida de otro dominio sigue la regla general', () => { - // Pins down: only CaMa's measures use the table; TEA's and CaCu's keep `-` to `_`. Fails if the table captures - // ids of other domains or the generic rule changes. + // Pins down: only CaMa's table maps CaMa's measures, and TEA's keep `-` to `_` (CaCu has a table of its own, see + // indicadores-cacu-fhir.spec.ts). Fails if CaMa's table captures ids of other domains or the generic rule changes. expect(indicadorId('M21-diagnosticados-con-eeg')).toBe('M21_diagnosticados_con_eeg'); - expect(indicadorId('CACU-EU7')).toBe('CACU_EU7'); + expect(Object.hasOwn(CAMA_MEASURE_IDS, 'CACU-EU7')).toBe(false); }); it('el catálogo lleva contrato, figuras y periodos de cada medida', () => { diff --git a/src/app/features/indicadores/indicadores-fhir.ts b/src/app/features/indicadores/indicadores-fhir.ts index 5b85c77..af71b10 100644 --- a/src/app/features/indicadores/indicadores-fhir.ts +++ b/src/app/features/indicadores/indicadores-fhir.ts @@ -13,6 +13,7 @@ import { CAMA_MEASURE_IDS, CATEGORIA_HISTOPATOLOGIA_PAGINA, esMedidaCama, ESTRATO_BIRADS_PAGINA, ETIQUETA_CATEGORIA_NO_DECLARADA, GRUPO_PRINCIPAL_FHIR, GRUPO_PRINCIPAL_PAGINA, GRUPOS_HISTOPATOLOGIA_PAGINA, } from './indicadores-cama-fhir'; +import { CACU_MEASURE_IDS } from './indicadores-cacu-fhir'; // The indicator page over the WebApi's FHIR endpoint (`//fhir/`): `Measure` for the catalog and the technical // sheet, `MeasureReport` for the data rows. Everything is mapped into the shapes the page already reads, and checked @@ -40,8 +41,8 @@ const POPULATION_GROUP: Record = { }; // `M21-diagnosticados-con-eeg` <-> `M21_diagnosticados_con_eeg`, the ids the page and its TEA texts use; CaMa's measures -// have an explicit correspondence (`CAMA-BIRADS456-PACIENTE` -> `cama_birads_456_paciente`). -export const indicadorId = (measureId: string) => CAMA_MEASURE_IDS[measureId] ?? measureId.replace(/-/g, '_'); +// and CaCu's have an explicit correspondence (`CAMA-BIRADS456-PACIENTE` -> `cama_birads_456_paciente`, `CACU-EU7` -> `cacu_eu7`). +export const indicadorId = (measureId: string) => CAMA_MEASURE_IDS[measureId] ?? CACU_MEASURE_IDS[measureId] ?? measureId.replace(/-/g, '_'); const stratifierCode = (s: Stratifier) => code(Array.isArray(s.code) ? s.code[0] : s.code); // Age groups travel as `16_23`; the page names them `16-23`. export const estratoValor = (value: string) => /^\d+_\d+$/.test(value) ? value.replace('_', '-') : value;