Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed CQL for concept with children and linked criterion #136

Closed
juliangruendner opened this issue Jul 9, 2024 · 2 comments
Closed
Assignees
Milestone

Comments

@juliangruendner
Copy link
Contributor

The CQL that is being produced for concepts with children and linked criteria seems to be incorrect.

Example:

{
  "version": "http://to_be_decided.com/draft-1/schema#",
  "display": "",
  "inclusionCriteria": [
    [
      {
        "termCodes": [
          {
            "code": "C50",
            "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
            "version": "2024",
            "display": "Bösartige Neubildung der Brustdrüse [Mamma]"
          }
        ],
        "attributeFilters": [
          {
            "criteria": [
              {
                "termCodes": [
                  {
                    "code": "21902-2",
                    "display": "Stage group.pathology Cancer",
                    "system": "http://loinc.org"
                  }
                ],
                "context": {
                  "code": "TNMp",
                  "display": "TNMp",
                  "system": "bzkf.dktk.oncology"
                }
              }
            ],
            "type": "reference",
            "attributeCode": {
              "code": "assessment",
              "display": "assessment",
              "system": "http://hl7.org/fhir/StructureDefinition"
            }
          }
        ],
        "context": {
          "code": "Primaerdiagnose",
          "system": "bzkf.dktk.oncology",
          "display": "Primaerdiagnose"
        }
      }
    ]
  ]
}

leads to the following CQL

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 1":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 2":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 3":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 4":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 5":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 6":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 7":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 8":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 9":
  [Observation: Code '59847-4' from loinc]

define "Histologie 59847-4 10":
  [Observation: Code '59847-4' from loinc]

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

define InInitialPopulation:
  Criterion
@alexanderkiel
Copy link
Member

Should be already fixed by #122 in v0.3.0. Did you use this version?

@BoehmDo
Copy link

BoehmDo commented Jul 9, 2024

You are correct, this was produced using an older sq2cql version. I updated the dependency and the cql ist looking good now! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants