Skip to content

Commit

Permalink
Merge pull request #149 from samply/fix/tnm_query
Browse files Browse the repository at this point in the history
feat: add product of tmn-c and tmn-p
  • Loading branch information
patrickskowronekdkfz authored Dec 2, 2024
2 parents 066ba85 + a7c4def commit 1c91448
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions packages/lib/src/cql-translator-service/ast-to-cql-translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1c91448

Please sign in to comment.