bzkf / orwdp

Apache License 2.0
0 stars 0 forks source link

Malformed CQL #7

Open BoehmDo opened 3 months ago

BoehmDo commented 3 months ago

Some Queries lead to malformed CQL Expressions, containing an additional closing Parenthesis

CQL1:

using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'

codesystem icd10: 'http://fhir.de/CodeSystem/bfarm/icd-10-gm'
codesystem loinc: 'http://loinc.org'

context Patient

define "Histologie 59847-4":
  from [Observation: Code '59847-4' from loinc] O
    where O.value.as(CodeableConcept)).coding.code = '8822/1'

define Criterion:
  exists (from [Condition: Code 'C50.0' from icd10] C
    with "Histologie 59847-4" O
      such that C.evidence.detail.reference = 'Observation/' + O.id)

define InInitialPopulation:
  Criterion

CQL2:

using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'

codesystem loinc: 'http://loinc.org'

context Patient

define Criterion:
  exists (from [Observation: Code '59847-4' from loinc] O
    where O.value.as(CodeableConcept)).coding.code = '8245/3')

define InInitialPopulation:
  Criterion

SQ1:

{
  "version": "http://to_be_decided.com/draft-1/schema#",
  "display": "",
  "inclusionCriteria": [
    [
      {
        "termCodes": [
          {
            "code": "C50.0",
            "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
            "version": "2024",
            "display": "Brustwarze und Warzenhof"
          }
        ],
        "attributeFilters": [
          {
            "criteria": [
              {
                "termCodes": [
                  {
                    "code": "59847-4",
                    "display": "Histology and Behavior ICD-O-3 Cancer",
                    "system": "http://loinc.org"
                  }
                ],
                "context": {
                  "code": "Histologie",
                  "display": "Histologie",
                  "system": "bzkf.dktk.oncology"
                },
                "valueFilter": {
                  "selectedConcepts": [
                    {
                      "code": "8822/1",
                      "display": "Abdominale Fibromatose",
                      "system": "urn:oid:2.16.840.1.113883.6.43.1"
                    }
                  ],
                  "type": "concept"
                }
              }
            ],
            "type": "reference",
            "attributeCode": {
              "code": "detail",
              "display": "detail",
              "system": "http://hl7.org/fhir/StructureDefinition"
            }
          }
        ],
        "context": {
          "code": "Primaerdiagnose",
          "system": "bzkf.dktk.oncology",
          "display": "Primaerdiagnose"
        }
      }
    ]
  ]
}