medizininformatik-initiative / sq2cql

1 stars 1 forks source link

Fix Reference Comparison for Multi-Valued Paths #119

Closed alexanderkiel closed 1 month ago

alexanderkiel commented 2 months ago

In the query mentioned in https://github.com/bzkf/orwdp/issues/8, the expression C.stage.assessment.reference evaluates to a list. If that list actually contains more than one element, the evaluation fails. The solution would be to use contains instead of =.

library Test
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 "TNMp 21902-2":
  [Observation: Code '21902-2' from loinc]

define Criterion:
  exists (from [Condition: Code 'C50.0' from icd10] C
    with "TNMp 21902-2" O
      such that C.stage.assessment.reference = 'Observation/' + O.id)

define InInitialPopulation:
  Criterion
juliangruendner commented 1 month ago

@alexanderkiel i am closing this as the PR is already merged into develop