diff --git a/packages/demo/public/catalogues/catalogue-dktk.json b/packages/demo/public/catalogues/catalogue-dktk.json index 6c8b5d09..b14f045d 100644 --- a/packages/demo/public/catalogues/catalogue-dktk.json +++ b/packages/demo/public/catalogues/catalogue-dktk.json @@ -18212,7 +18212,19 @@ { "key": "0", "name": "0", - "description": "0" + "description": "0", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18227,67 +18239,223 @@ { "key": "1", "name": "1", - "description": "1" + "description": "1", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "1" + }, + { + "value": "21899-0", + "name": "1" + } + ] + ] }, { "key": "1a", "name": "1a", - "description": "1a" + "description": "1a", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1a1", "name": "1a1", - "description": "1a1" + "description": "1a1", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1a2", "name": "1a2", - "description": "1a2" + "description": "1a2", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1b", "name": "1b", - "description": "1b" + "description": "1b", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1b1", "name": "1b1", - "description": "1b1" + "description": "1b1", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1b2", "name": "1b2", - "description": "1b2" + "description": "1b2", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1c", "name": "1c", - "description": "1c" + "description": "1c", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1c1", "name": "1c1", - "description": "1c1" + "description": "1c1", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1c2", "name": "1c2", - "description": "1c2" + "description": "1c2", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1c3", "name": "1c3", - "description": "1c3" + "description": "1c3", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "1d", "name": "1d", - "description": "1d" + "description": "1d", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { - "key": "1mic", - "name": "1mic", - "description": "1mic" + "key": "1mi", + "name": "1mi", + "description": "1mi", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18302,37 +18470,121 @@ { "key": "2", "name": "2", - "description": "2" + "description": "2", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "2a", "name": "2a", - "description": "2a" + "description": "2a", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "2a1", "name": "2a1", - "description": "2a1" + "description": "2a1", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "2a2", "name": "2a2", - "description": "2a2" + "description": "2a2", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "2b", "name": "2b", - "description": "2b" + "description": "2b", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "2c", "name": "2c", - "description": "2c" + "description": "2c", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "2d", "name": "2d", - "description": "2d" + "description": "2d", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18347,27 +18599,87 @@ { "key": "3", "name": "3", - "description": "3" + "description": "3", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "3a", "name": "3a", - "description": "3a" + "description": "3a", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "3b", "name": "3b", - "description": "3b" + "description": "3b", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "3c", "name": "3c", - "description": "3c" + "description": "3c", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "3d", "name": "3d", - "description": "3d" + "description": "3d", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18382,32 +18694,104 @@ { "key": "4", "name": "4", - "description": "4" + "description": "4", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "4a", "name": "4a", - "description": "4a" + "description": "4a", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "4b", "name": "4b", - "description": "4b" + "description": "4b", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "4c", "name": "4c", - "description": "4c" + "description": "4c", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "4d", "name": "4d", - "description": "4d" + "description": "4d", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "4e", "name": "4e", - "description": "4e" + "description": "4e", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18420,9 +18804,21 @@ "type": "EQUALS", "criteria": [ { - "key": "is", - "name": "is", - "description": "is" + "key": "a", + "name": "a", + "description": "a", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18434,40 +18830,107 @@ "fieldType": "single-select", "type": "EQUALS", "criteria": [ + { + "key": "is", + "name": "is", + "description": "is", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] + }, { "key": "is(DCIS)", "name": "is(DCIS)", - "description": "is(DCIS)" + "description": "is(DCIS)", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "is(LCIS)", "name": "is(LCIS)", - "description": "is(LCIS)" + "description": "is(LCIS)", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { "key": "is(Paget)", "name": "is(Paget)", - "description": "is(Paget)" - } - ] - }, - { - "key": "21905-5", - "name": "TNM-T", - "subCategoryName": "is (Prostata)", - "system": "", - "fieldType": "single-select", - "type": "EQUALS", - "criteria": [ - { - "key": "is(pu)", - "name": "is(pu)", - "description": "is(pu)" + "description": "is(Paget)", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] }, { - "key": "is(pd)", + "key": "is(pd", "name": "is(pd)", - "description": "is(pd)" + "description": "is(pd)", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] + }, + { + "key": "is(pu)", + "name": "is(pu)", + "description": "is(pu)", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] }, @@ -18482,7 +18945,19 @@ { "key": "X", "name": "X", - "description": "X" + "description": "X", + "aggregatedValue": [ + [ + { + "value": "21905-5", + "name": "0" + }, + { + "value": "21899-0", + "name": "0" + } + ] + ] } ] } diff --git a/packages/lib/src/cql-translator-service/ast-to-cql-translator.ts b/packages/lib/src/cql-translator-service/ast-to-cql-translator.ts index f9fe0480..3a763f75 100644 --- a/packages/lib/src/cql-translator-service/ast-to-cql-translator.ts +++ b/packages/lib/src/cql-translator-service/ast-to-cql-translator.ts @@ -121,7 +121,8 @@ const getSingleton = (criterion: AstBottomLayerValue): string => { case "observationMolecularMarkerSeqRefNCBI": case "observationMolecularMarkerEnsemblID": case "department": - case "TNM-x": { + case "TNMp": + case "TNMc": { if (typeof criterion.value === "string") { // TODO: Check if we really need to do this or we can somehow tell cql to do that expansion it self if (criterion.value.slice(-1) === "%") { diff --git a/packages/lib/src/cql-translator-service/cqlquery-mappings.ts b/packages/lib/src/cql-translator-service/cqlquery-mappings.ts index 324ef556..827bc931 100644 --- a/packages/lib/src/cql-translator-service/cqlquery-mappings.ts +++ b/packages/lib/src/cql-translator-service/cqlquery-mappings.ts @@ -61,7 +61,8 @@ export const alias = new Map([ ["medicationStatement", "exists [MedicationStatement: category in Code '{{K}}' from {{A1}}]"], ["hasSpecimen", "exists [Specimen]"], ["specimen", "exists [Specimen: Code '{{C}}' from {{A1}}]"], - ["TNM-x", "exists from [Observation: Code '21908-9' from {{A1}}] O\nwhere O.component.where(code.coding contains Code '{{K}}' from {{A1}}).value.coding contains Code '{{C}}' from {{A2}}"], + ["TNMc", "exists from [Observation: Code '21908-9' from {{A1}}] O\nwhere O.component.where(code.coding contains Code '{{K}}' from {{A1}}).value.coding contains Code '{{C}}' from {{A2}}"], + ["TNMp", "exists from [Observation: Code '21902-2' from {{A1}}] O\nwhere O.component.where(code.coding contains Code '{{K}}' from {{A1}}).value.coding contains Code '{{C}}' from {{A2}}"], ["Organization", "Patient.managingOrganization.reference = \"Organization Ref\"('Klinisches Krebsregister/ITM')"], ["department", "exists from [Encounter] I\nwhere I.identifier.value = '{{C}}' "], ["uiccstadium", "(exists ([Observation: Code '21908-9' from loinc] O where O.value.coding.code contains '{{C}}')) or (exists ([Observation: Code '21902-2' from loinc] O where O.value.coding.code contains '{{C}}'))"] @@ -89,12 +90,19 @@ export const alias = new Map([ ["age_at_diagnosis", {type: "conditionRangeAge"}], ["age_at_primary_diagnosis", {type: "primaryConditionRangeAge"}], ["21908-9", {type: "uiccstadium", alias: ["loinc", "uiccstadiumcs"]}], - ["21905-5", {type: "TNM-x", alias: ["loinc", "TNMTCS"]}], //tnm component - ["21906-3", {type: "TNM-x", alias: ["loinc", "TNMNCS"]}], //tnm component - ["21907-1", {type: "TNM-x", alias: ["loinc", "TNMMCS"]}], //tnm component - ["42030-7", {type: "TNM-x", alias: ["loinc", "TNMmSymbolCS"]}], //tnm component - ["59479-6", {type: "TNM-x", alias: ["loinc", "TNMySymbolCS"]}], //tnm component - ["21983-2", {type: "TNM-x", alias: ["loinc", "TNMrSymbolCS"]}], //tnm component + ["21905-5", {type: "TNMc", alias: ["loinc", "TNMTCS"]}], //tnm component + ["21906-3", {type: "TNMc", alias: ["loinc", "TNMNCS"]}], //tnm component + ["21907-1", {type: "TNMc", alias: ["loinc", "TNMMCS"]}], //tnm component + ["42030-7", {type: "TNMc", alias: ["loinc", "TNMmSymbolCS"]}], //tnm component + ["59479-6", {type: "TNMc", alias: ["loinc", "TNMySymbolCS"]}], //tnm component + ["21983-2", {type: "TNMc", alias: ["loinc", "TNMrSymbolCS"]}], //tnm component + ["21899-0", {type: "TNMp", alias: ["loinc", "TNMTCS"]}], //tnm component + ["21900-6", {type: "TNMp", alias: ["loinc", "TNMNCS"]}], //tnm component + ["21901-4", {type: "TNMp", alias: ["loinc", "TNMMCS"]}], //tnm component + ["42030-7", {type: "TNMp", alias: ["loinc", "TNMmSymbolCS"]}], //tnm component + ["59479-6", {type: "TNMp", alias: ["loinc", "TNMySymbolCS"]}], //tnm component + ["21983-2", {type: "TNMp", alias: ["loinc", "TNMrSymbolCS"]}], //tnm component + ["Organization", {type: "Organization"}], //organization ["48018-6", {type: "observationMolecularMarkerName", alias: ["loinc", "molecularMarker"]}], //molecular marker name ["48005-3", {type: "observationMolecularMarkerAminoacidchange", alias: ["loinc"]}], //molecular marker