From db0413c735be38399ff6f1ec392ddfa8909f0b31 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 2 Aug 2023 22:11:43 +1000 Subject: [PATCH] Don't load resources from core examples package --- RELEASE_NOTES.md | 3 +++ .../org/hl7/fhir/utilities/npm/NpmPackage.java | 7 ++++++- .../java/org/hl7/fhir/validation/IgLoader.java | 14 ++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index ec2c36118..df79ca631 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,8 +2,11 @@ * Fix invalid integer detection * Improved invariant checking +* Create warnings for status on terminology resources ## Other code changes * Update obligation handling code for split definitions * Update ICF importer to handle grouping levels +* fix up copy directory for case differences + diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java index a9098c50a..dec5d8c76 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java @@ -1266,6 +1266,11 @@ public class NpmPackage { return Utilities.existsInList(npm.asString("type"), "fhir.core", "Core"); } + public boolean isCoreExamples() { + return name().startsWith("hl7.fhir.r") && name().endsWith(".examples"); + } + + public boolean isTx() { return npm.asString("name").startsWith("hl7.terminology"); } @@ -1369,5 +1374,5 @@ public class NpmPackage { public void setSize(int size) { this.size = size; } - + } \ No newline at end of file diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java index 56f980694..ef39e2750 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java @@ -520,12 +520,14 @@ public class IgLoader implements IValidationEngineLoader { } } - if (loadInContext) { -// getContext().getLoadedPackages().add(pi.name() + "#" + pi.version()); - getContext().loadFromPackage(pi, ValidatorUtils.loaderForVersion(pi.fhirVersion())); - } - for (String s : pi.listResources("CodeSystem", "ConceptMap", "ImplementationGuide", "CapabilityStatement", "SearchParameter", "Conformance", "StructureMap", "ValueSet", "StructureDefinition")) { - res.put(s, TextFile.streamToBytes(pi.load("package", s))); + if (!pi.isCoreExamples()) { + if (loadInContext) { + // getContext().getLoadedPackages().add(pi.name() + "#" + pi.version()); + getContext().loadFromPackage(pi, ValidatorUtils.loaderForVersion(pi.fhirVersion())); + } + for (String s : pi.listResources("CodeSystem", "ConceptMap", "ImplementationGuide", "CapabilityStatement", "SearchParameter", "Conformance", "StructureMap", "ValueSet", "StructureDefinition")) { + res.put(s, TextFile.streamToBytes(pi.load("package", s))); + } } String ini = "[FHIR]\r\nversion=" + pi.fhirVersion() + "\r\n"; res.put("version.info", ini.getBytes());