From a7c4def3755422e70030f1cc259cdea037867ba0 Mon Sep 17 00:00:00 2001 From: Patrick Skowronek Date: Thu, 14 Nov 2024 14:53:27 +0100 Subject: [PATCH] feat: add product of tmn-c and tmn-p --- .../ast-to-cql-translator.ts | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) 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 f31cd033..da1a614d 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 @@ -136,9 +136,7 @@ const getSingleton = (criterion: AstBottomLayerValue): string => { case "observationMolecularMarkerDNAchange": case "observationMolecularMarkerSeqRefNCBI": case "observationMolecularMarkerEnsemblID": - case "department": - case "TNMp": - case "TNMc": { + case "department": { 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 ( @@ -219,7 +217,33 @@ const getSingleton = (criterion: AstBottomLayerValue): string => { break; } + case "TNMp": + case "TNMc": { + if (typeof criterion.value === "string") { + expression += "("; + + expression += substituteCQLExpression( + criterion.key, + myCriterion.alias, + myCQL, + criterion.value as string, + ); + expression += ") or ("; + + const myCQL2: string = cqltemplate.get( + myCriterion.type == "TNMc" ? "TNMp" : "TNMc", + ); + expression += substituteCQLExpression( + criterion.key, + myCriterion.alias, + myCQL2, + criterion.value as string, + ); + expression += ")"; + } + break; + } case "conditionRangeDate": { expression += substituteRangeCQLExpression( criterion,