Skip to content

Commit 0fb9698

Browse files
authored
Mapping for implicit dependency on FHIR (#1484)
* WIP * QICore mapping * Rev to 3.20.1
1 parent b9f7ad3 commit 0fb9698

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/LibraryBuilder.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,6 +2753,22 @@ public Expression applyTargetMap(Expression source, String targetMap) {
27532753
TypeSpecifier argumentSignature = null;
27542754
if (this.options.getSignatureLevel() != SignatureLevel.None) {
27552755
if (qualifiedFunctionName.equals("FHIRHelpers.ToInterval")) {
2756+
// Force loading of the FHIR model, as it's an implicit
2757+
// dependency of the the target mapping here.
2758+
var fhirVersion = "4.0.1";
2759+
var qiCoreModel = this.getModel("QICore");
2760+
if (qiCoreModel != null) {
2761+
var version = qiCoreModel.getModelInfo().getVersion();
2762+
if (version.equals("3.3.0")) {
2763+
fhirVersion = "4.0.0";
2764+
} else if (version.startsWith("3")) {
2765+
fhirVersion = "3.0.1";
2766+
}
2767+
}
2768+
2769+
// Force the FHIR model to be loaded.
2770+
this.modelManager.resolveModel("FHIR", fhirVersion);
2771+
27562772
NamedTypeSpecifier namedTypeSpecifier =
27572773
new NamedTypeSpecifier().withName(dataTypeToQName(resolveTypeName("FHIR", "Period")));
27582774
argumentSignature = namedTypeSpecifier;

Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/ModelManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ public Model resolveModel(ModelIdentifier modelIdentifier) {
268268

269269
if (model == null && this.globalCache.containsKey(modelIdentifier)) {
270270
model = this.globalCache.get(modelIdentifier);
271-
this.models.put(modelPath, model);
271+
models.put(modelPath, model);
272+
modelsByUri.put(model.getModelInfo().getUrl(), model);
272273
}
273274

274275
if (model == null) {

0 commit comments

Comments
 (0)