FHIR Chat · Could not resolve onsetDateTime [Condition] · cql

Stream: cql

Topic: Could not resolve onsetDateTime [Condition]


view this post on Zulip ravi.kuchi (Jun 11 2021 at 02:06):

Hi, I am executing the library as below:

library FMCNAActivityDefinition version '1.0.0'
using FHIR version '4.0.0'
include "FHIRHelpers" version '4.0.0' called FHIRHelpers
codesystem "ICD10": 'http://hl7.org/fhir/sid/icd-10'
code "COLD":
'P80.0' from "ICD10"
context Patient
define "Get Condition from Code Declaration":
[Condition: code = "COLD"]

define "FirstCold":
First([Condition: "COLD"] C sort by onsetDateTime desc)

I am getting the below error:
Could not resolve identifier onsetDateTime in the current library.

view this post on Zulip Bryn Rhodes (Jun 11 2021 at 14:26):

Choices in the FHIR model are represented by the root element name, not the type-specific name, so this would be sort by (onset as FHIR.dateTime) desc. The cast is required in this case because the choice has two possibilities that are sortable, DateTime and String, so you have to select which one you want to use.

view this post on Zulip Bryn Rhodes (Jun 11 2021 at 14:26):

Note that there is a 4.0.1 model info that is recommended for use with FHIR. Unless you have a specific reason to stay on the 4.0.0 version of FHIR.


Last updated: Apr 12 2022 at 19:14 UTC