cqframework / cql-execution

A JavaScript framework for executing CQL
Apache License 2.0
65 stars 30 forks source link

Concept equivalency not working with multiple codes #272

Closed cmoesel closed 2 years ago

cmoesel commented 2 years ago

From chat.fhir.org:

Hi when we encounter an array of codings like this:

"code": {
            "coding": [
                {
                    "system": "http://snomed.info/sct",
                    "code": "57630001",
                    "display": "First trimester pregnancy (finding)",
                    "userSelected": false
                },
                {
                    "system": "http://e-imo.com/products/problem-it",
                    "code": "3544144",
                    "display": "Less than 8 weeks gestation of pregnancy",
                    "userSelected": false
                }
            ],
            "text": "Less than 8 weeks gestation of pregnancy"
        },

we noticed the CQL execution engine (https://github.com/cqframework/cql-execution) fails to recognize the codes. The same cql works if we have only 1 coding.

Here's the CQL we used:

code "First trimester pregnancy (finding)": '57630001' from "http://snomed.info/sct"
define "No first trimester finding":
        not exists(
    [Condition] R
            where (R.code ~ "First trimester pregnancy (finding)"))

As mentioned, we don't think the cql is the issue, we think the engine can't read the multiple codings. Any ideas where in the cql-execution engine code it does that check?

cmoesel commented 2 years ago

As it turns out, the CQL execution engine is handling this correctly (see full thread at chat.fhir.org link above). The issue was in the way the underlying system was passing around data. Not a bug.