Closed msargentibm closed 4 years ago
USCore is not supported directly by the cql-engine. The cql-translator project has a set of mappings call "modelinfos" that provide a way for it to emit ELM in terms of a FHIR model from CQL that's written in terms of USCore (or other FHIR-based models). In other words, when the issue you referenced was opened we were thinking of adding a "USCoreModelResolver" to support it directly and then the issue was closed when we decided to handle it in the cql-translator instead.
Does that answer your question?
Thanks for the response.
The strategy you described makes sense, but I am still a bit confused. The ELM I posted was a result of running the cql tranlsator on this CQL:
library "Test" version '1.0.0'
using "USCore" version '3.1.0'
context Patient
As far as I can tell, the translation is using the provided model info file for us core.
FWIW, I just modified the ELM by hand and changed PatientProfile
to Patient
. With that change the cql is successfully retrieving the USCore patient resource I was trying to retrieve.
Are there flags I need to use during translation to successfully pick up model information that maps from USCore to FHIR (PatientProfile to Patient in this case)?
It seems like maybe the model info changed recently?
It looks like the model info for USCore no longer has a target
included for the PatientProfile.
Before:
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="USCore" name="PatientProfile" target="Patient" identifier="http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" label="US Core Patient Profile" retrievable="true" baseType="USCore.DomainResource">
After:
<typeInfo baseType="USCore.DomainResource" namespace="USCore" name="PatientProfile" identifier="http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" label="US Core Patient Profile" retrievable="true" xsi:type="ClassInfo">
Does the model info need fixed/updated?
I'm happy to close this issue and open up a separate issue in that project if that makes sense.
Sorry, I wasn't clear. The work to emit the ELM in terms of a FHIR for FHIR-based models is ongoing. It's not yet complete. One of the first targets is actually QICore:
https://github.com/cqframework/clinical_quality_language/issues/507
Thanks again for the response. If you don't mind, I'll echo back my current understanding of the answer and if it seems correct then I can close this issue.
I guess I'm still wondering about the latest USCore model info change and why the PatientProfile
dropped the target="Patient"
portion of its defintion. It seemed that the translator understood that target in that case was a mapping back to the FHIR type to use when requesting a resource from the FHIR server. Although, I'm happy to open a separate issue in the correct project to ask about that change.
Thanks again for your responses! It certainly helps take away some of the guesswork involved in being new to working with all of the available cql tooling.
The intention is to have the CQL to ELM translator take a model info, a CQL written against that model info, and create ELM that just references the base FHIR model.
Yes.
Mapping to FHIR is a work in progress. Using the USCore model info (or any arbitrary model info) offers no guarantees about the correctness of the ELM emitted by the translator.
Yes, and we are attempting to support USCore/QICore fully by generating the modelInfos ourselves.
Mapping QICore to base FHIR is being targeted specifically. Some of this work seems general enough where it would apply to an arbitrary IG/model info
The work we're doing should apply to any FHIR-based model. When generating the ModelInfos it looks at a profile and its dependencies recursively all the way down to the base FHIR spec. So, assuming the QICore generation works, so should USCore.
The code for the generation is located here (you'll note that both QICore and USCore are listed as examples) which works directly from the official StructureDefinitions
I guess I'm still wondering about the latest USCore model info change and why the PatientProfile dropped the target="Patient" portion of its defintion.
I would file an issue on the https://github.com/cqframework/clinical_quality_language repo.
Thanks for your help addressing my questions.
((If there is a better forum for questions about the engine, I am happy to move discussion elsewhere.))
Does the CqlEngine currently support running with USCore? I saw this closed issue (https://github.com/DBCG/cql_engine/issues/232) and I wasn't sure what that meant for support for USCore currently.
I'm initially trying to run a very simple ELM to get started:
However, I am getting the following error:
ca.uhn.fhir.parser.DataFormatException: Unknown resource name "PatientProfile" (this name is not known in FHIR version "R4")
.I think this stems from using the
R4FhirModelResolver
class in aCompositeDataProvider
I am passing to theCqlEngine
since its FHIRContext only contains information in the base FHIR spec. Based on the closed issue I linked to, I was not sure if I needed a custom ModelResolver or DataProvider, or if running with USCore should be possible using existing code in this project.I would appreciate any guidance that can be offered. Thank you!