medizininformatik-initiative / sq2cql

1 stars 1 forks source link

Ensure Large Queries are Parseable in Blaze #69

Closed alexanderkiel closed 10 months ago

alexanderkiel commented 10 months ago

Currently we generate only one expression definition for inclusion and one for the optional exclusion criteria. If many criteria are used in a query, we will generate huge boolean expressions with thousands of expressions combined by and and or.

The CQL parsing implementation of Blaze has a limitation of about 500 expressions that can combined in a boolean expression.

The solution would be to create an expression definition for each criteria of the structured query in order to break up the huge boolean expressions. This will result in the following change.

Before:

library Retrieve version '1.0.0'
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'

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

context Patient

define InInitialPopulation:
  Patient.gender = 'female' and
  exists [Condition: Code 'C71.1' from icd10]

After:

library Retrieve version '1.0.0'
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0'

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

context Patient

define "Criterion 1":
    Patient.gender = 'female'

define "Criterion 2":
  exists [Condition: Code 'C71.1' from icd10]

define InInitialPopulation:
  "Criterion 1" and
  "Criterion 2"