From 12cdccf3bbd4d3814fdebfd6878322d54d661ded Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:25:09 +1100 Subject: [PATCH 01/10] Hack for wrong URLs in subscriptions backport --- .../loaders/loaderR5/R4BToR5Loader.java | 2 +- .../loaders/loaderR5/R4ToR5Loader.java | 2 +- .../StructureDefinitionHacker.java | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4BToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4BToR5Loader.java index 6b6744eb98..aa1f203b29 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4BToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4BToR5Loader.java @@ -123,7 +123,7 @@ public org.hl7.fhir.r5.model.Resource loadResource(InputStream stream, boolean i if (killPrimitives) { throw new FHIRException("Cannot kill primitives when using deferred loading"); } - if (r5 instanceof StructureDefinition && VersionUtilities.isR4BVer(version)) { + if (r5 instanceof StructureDefinition) { r5 = new StructureDefinitionHacker(version).fixSD((StructureDefinition) r5); } if (patchUrls) { diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4ToR5Loader.java index c8d6e9daf2..aed1755726 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4ToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R4ToR5Loader.java @@ -123,7 +123,7 @@ public org.hl7.fhir.r5.model.Resource loadResource(InputStream stream, boolean i if (killPrimitives) { throw new FHIRException("Cannot kill primitives when using deferred loading"); } - if (r5 instanceof StructureDefinition && VersionUtilities.isR4Ver(version)) { + if (r5 instanceof StructureDefinition) { r5 = new StructureDefinitionHacker(version).fixSD((StructureDefinition) r5); } if (patchUrls) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/StructureDefinitionHacker.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/StructureDefinitionHacker.java index 8e4c92e266..dd36c83941 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/StructureDefinitionHacker.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/StructureDefinitionHacker.java @@ -49,9 +49,29 @@ public Resource fixSD(StructureDefinition sd) { } } } + if (sd.getUrl().startsWith("http://hl7.org/fhir/uv/subscriptions-backport")) { + for (ElementDefinition ed : sd.getDifferential().getElement()) { + fixMarkdownR4BURLs(ed); + } + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + fixMarkdownR4BURLs(ed); + } + } return sd; } + private void fixMarkdownR4BURLs(ElementDefinition ed) { + if (ed.hasDefinition()) { + ed.setDefinition(ed.getDefinition().replace("http://hl7.org/fhir/R4B/", "http://hl7.org/fhir/R4/")); + } + if (ed.hasComment()) { + ed.setComment(ed.getComment().replace("http://hl7.org/fhir/R4B/", "http://hl7.org/fhir/R4/")); + } + if (ed.hasRequirements()) { + ed.setRequirements(ed.getRequirements().replace("http://hl7.org/fhir/R4B/", "http://hl7.org/fhir/R4/")); + } + } + private void fixDocSecURL(ElementDefinition ed) { for (TypeRefComponent tr : ed.getType()) { for (CanonicalType c : tr.getProfile()) { From 20929abc581af3b630f9b560358f3552c77fd961 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:25:27 +1100 Subject: [PATCH 02/10] fix for index out of bounds error --- .../org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java index 703aa78e2e..69bd5dcc8f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java @@ -2356,6 +2356,9 @@ protected void updateFromDefinition(ElementDefinition dest, ElementDefinition so } } if (profile != null) { + if (profile.getSnapshot().getElement().isEmpty()) { + throw new DefinitionException(context.formatMessage(I18nConstants.SNAPSHOT_IS_EMPTY, profile.getVersionedUrl())); + } ElementDefinition e = profile.getSnapshot().getElement().get(0); String webroot = profile.getUserString("webroot"); From 2b0d778767502a6b650de62d4ab56b46f2f4eea5 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:26:46 +1100 Subject: [PATCH 03/10] Element.removeExtension (support for instance-name and instance-description extensions in IG publisher) --- .../org/hl7/fhir/r5/context/BaseWorkerContext.java | 2 +- .../java/org/hl7/fhir/r5/elementmodel/Element.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index c03f2b92ec..d83f572eaf 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -2546,7 +2546,7 @@ public StructureDefinition fetchTypeDefinition(String typeName) { } } catch (Exception e) { // not sure what to do in this case? - System.out.println("Unable to generate snapshot @4 for "+p.getVersionedUrl()+": "+e.getMessage()); + System.out.println("Unable to generate snapshot @5 for "+p.getVersionedUrl()+": "+e.getMessage()); if (logger.isDebugLogging()) { e.printStackTrace(); } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java index bc73c401fc..546dfd9a6b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java @@ -1488,4 +1488,15 @@ public Element setNativeObject(Object nativeObject) { return this; } + public void removeExtension(String url) { + List rem = new ArrayList<>(); + for (Element e : children) { + if ("extension".equals(e.getName()) && url.equals(e.getChildValue("url"))) { + rem.add(e); + } + } + children.removeAll(rem); + } + + } \ No newline at end of file From c8357c8a139de23cd7c9b31d83ff6ec08655e61e Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:28:34 +1100 Subject: [PATCH 04/10] fix for NPE building sql-on-fhir --- .../src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java index bc005910bd..0742ef2e99 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ExpressionNode.java @@ -721,9 +721,9 @@ public List getDistalNames() { } else if (group != null) { names.addAll(group.getDistalNames()); } else if (function != null) { - names.addAll(null); + names.add(null); } else if (constant != null) { - names.addAll(null); + names.add(null); } else { names.add(name); } From 6066de7784aeb21d3f182825901792f1f92ed001 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:30:47 +1100 Subject: [PATCH 05/10] split terminology service tests --- .../ExternalTerminologyServiceTests.java | 2 - .../tests/LocalTerminologyServiceTests.java | 156 ++++++++++++++++++ 2 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/LocalTerminologyServiceTests.java diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java index f7af6afda6..ef09843f17 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java @@ -47,8 +47,6 @@ public JsonObjectPair(JsonObject suite, JsonObject test) { } private static final String SERVER = FhirSettings.getTxFhirDevelopment(); -// private static final String SERVER = FhirSettings.getTxFhirLocal(); -// private static final String SERVER = "https://r4.ontoserver.csiro.au/fhir"; @Parameters(name = "{index}: id {0}") diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/LocalTerminologyServiceTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/LocalTerminologyServiceTests.java new file mode 100644 index 0000000000..d6777e75c9 --- /dev/null +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/LocalTerminologyServiceTests.java @@ -0,0 +1,156 @@ +package org.hl7.fhir.terminology.tests; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.io.IOUtils; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; +import org.hl7.fhir.exceptions.DefinitionException; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.exceptions.FHIRFormatError; +import org.hl7.fhir.r5.formats.JsonParser; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.Constants; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.test.utils.TestingUtilities; +import org.hl7.fhir.utilities.json.model.JsonObject; +import org.hl7.fhir.utilities.settings.FhirSettings; +import org.hl7.fhir.validation.special.TxTester; +import org.hl7.fhir.validation.special.TxTester.ITxTesterLoader; +import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.condition.EnabledIf; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import com.google.common.base.Charsets; + +@RunWith(Parameterized.class) +@EnabledIf("localTxRunning") +public class LocalTerminologyServiceTests implements ITxTesterLoader { + + public static class JsonObjectPair { + public JsonObjectPair(JsonObject suite, JsonObject test) { + this.suite = suite; + this.test = test; + } + private JsonObject suite; + private JsonObject test; + } + + private static final String SERVER = FhirSettings.getTxFhirLocal(); + // private static final String SERVER = "https://r4.ontoserver.csiro.au/fhir"; + + + private static boolean localTxRunning() { + return new File("/Users/grahamegrieve/work/server/serverx").exists(); + } + + @Parameters(name = "{index}: id {0}") + public static Iterable data() throws IOException { + + String contents = TestingUtilities.loadTestResource("tx", "test-cases.json"); + externals = org.hl7.fhir.utilities.json.parser.JsonParser.parseObject(TestingUtilities.loadTestResource("tx", "messages-tx.fhir.org.json")); + + Map examples = new HashMap(); + manifest = org.hl7.fhir.utilities.json.parser.JsonParser.parseObject(contents); + for (org.hl7.fhir.utilities.json.model.JsonObject suite : manifest.getJsonObjects("suites")) { + String sn = suite.asString("name"); + for (org.hl7.fhir.utilities.json.model.JsonObject test : suite.getJsonObjects("tests")) { + String tn = test.asString("name"); + examples.put(sn+"."+tn, new JsonObjectPair(suite, test)); + } + } + + List names = new ArrayList(examples.size()); + names.addAll(examples.keySet()); + Collections.sort(names); + + List objects = new ArrayList(examples.size()); + for (String id : names) { + objects.add(new Object[]{id, examples.get(id)}); + } + return objects; + } + + private static org.hl7.fhir.utilities.json.model.JsonObject manifest; + private static org.hl7.fhir.utilities.json.model.JsonObject externals; + private JsonObjectPair setup; + private String version = "5.0.0"; + private static TxTester tester; + private List modes = new ArrayList<>(); + + public LocalTerminologyServiceTests(String name, JsonObjectPair setup) { + this.setup = setup; + } + + @SuppressWarnings("deprecation") + @Test + @Tag("excludedInSurefire") + public void test() throws Exception { + if (SERVER != null) { + if (tester == null) { + tester = new TxTester(this, SERVER, true, externals); + } + String err = tester.executeTest(setup.suite, setup.test, modes); + Assertions.assertTrue(err == null, err); + } else { + Assertions.assertTrue(true); + } + } + + public Resource loadResource(String filename) throws IOException, FHIRFormatError, FileNotFoundException, FHIRException, DefinitionException { + String contents = TestingUtilities.loadTestResource("tx", filename); + try (InputStream inputStream = IOUtils.toInputStream(contents, Charsets.UTF_8)) { + if (filename.contains(".json")) { + if (Constants.VERSION.equals(version) || "5.0".equals(version)) + return new JsonParser().parse(inputStream); + else if (org.hl7.fhir.dstu3.model.Constants.VERSION.equals(version) || "3.0".equals(version)) + return VersionConvertorFactory_30_50.convertResource(new org.hl7.fhir.dstu3.formats.JsonParser().parse(inputStream)); + else if (org.hl7.fhir.dstu2016may.model.Constants.VERSION.equals(version) || "1.4".equals(version)) + return VersionConvertorFactory_14_50.convertResource(new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(inputStream)); + else if (org.hl7.fhir.dstu2.model.Constants.VERSION.equals(version) || "1.0".equals(version)) + return VersionConvertorFactory_10_50.convertResource(new org.hl7.fhir.dstu2.formats.JsonParser().parse(inputStream)); + else if (org.hl7.fhir.r4.model.Constants.VERSION.equals(version) || "4.0".equals(version)) + return VersionConvertorFactory_40_50.convertResource(new org.hl7.fhir.r4.formats.JsonParser().parse(inputStream)); + else + throw new FHIRException("unknown version " + version); + } else { + if (Constants.VERSION.equals(version) || "5.0".equals(version)) + return new XmlParser().parse(inputStream); + else if (org.hl7.fhir.dstu3.model.Constants.VERSION.equals(version) || "3.0".equals(version)) + return VersionConvertorFactory_30_50.convertResource(new org.hl7.fhir.dstu3.formats.XmlParser().parse(inputStream)); + else if (org.hl7.fhir.dstu2016may.model.Constants.VERSION.equals(version) || "1.4".equals(version)) + return VersionConvertorFactory_14_50.convertResource(new org.hl7.fhir.dstu2016may.formats.XmlParser().parse(inputStream)); + else if (org.hl7.fhir.dstu2.model.Constants.VERSION.equals(version) || "1.0".equals(version)) + return VersionConvertorFactory_10_50.convertResource(new org.hl7.fhir.dstu2.formats.XmlParser().parse(inputStream)); + else if (org.hl7.fhir.r4.model.Constants.VERSION.equals(version) || "4.0".equals(version)) + return VersionConvertorFactory_40_50.convertResource(new org.hl7.fhir.r4.formats.XmlParser().parse(inputStream)); + else + throw new FHIRException("unknown version " + version); + } + } + } + + @Override + public String describe() { + return "Test cases"; + } + + @Override + public byte[] loadContent(String filename) throws FileNotFoundException, IOException { + return TestingUtilities.loadTestResourceBytes("tx", filename); + } +} \ No newline at end of file From 2e71297478a82dee660af46311e026136ad6b3e3 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:31:09 +1100 Subject: [PATCH 06/10] fix NPE validating concept maps --- .../hl7/fhir/validation/instance/type/ConceptMapValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/ConceptMapValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/ConceptMapValidator.java index 9e5e4a3d17..5665e0b7e5 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/ConceptMapValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/ConceptMapValidator.java @@ -329,7 +329,7 @@ private boolean validateGroupElementTarget(List errors, Eleme } } } else { - ok = (ctxt.source.cs.getContent() != CodeSystemContentMode.COMPLETE) & ok; + ok = (ctxt.target.cs.getContent() != CodeSystemContentMode.COMPLETE) & ok; } } else { addToBatch(code, cstack, ctxt.target, ctxt.targetScope); From 69a8c5b2e47caf8e39820214d6ec7b3f06d3daaa Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:31:39 +1100 Subject: [PATCH 07/10] Support for instance-name and instance-description in IG publisher --- .../main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java index 126d4cfb8e..60bf030590 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java @@ -258,6 +258,10 @@ public class ToolingExtensions { public static final String EXT_ID_CHOICE_GROUP = "http://hl7.org/fhir/tools/StructureDefinition/xml-choice-group"; public static final String EXT_DATE_RULES = "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-date-rules"; public static final String EXT_PROFILE_STYLE = "http://hl7.org/fhir/tools/StructureDefinition/type-profile-style"; + public static final String EXT_RESOURCE_NAME = "http://hl7.org/fhir/StructureDefinition/resource-instance-name"; + public static final String EXT_RESOURCE_DESC = "http://hl7.org/fhir/StructureDefinition/resource-instance-description"; + public static final String EXT_ARTIFACT_NAME = "http://hl7.org/fhir/StructureDefinition/artifact-name"; + public static final String EXT_ARTIFACT_DESC = "http://hl7.org/fhir/StructureDefinition/artifact-description"; // specific extension helpers From 7d15f271d059b1a2299d43ab6706e1b6999e7502 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:31:59 +1100 Subject: [PATCH 08/10] update ViewDefinition validator for change (alias -> name) --- .../org/hl7/fhir/r5/utils/sql/Validator.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/sql/Validator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/sql/Validator.java index aef51c7838..ba5b90db6f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/sql/Validator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/sql/Validator.java @@ -226,15 +226,15 @@ private void checkColumn(String path, JsonObject column, TypeDetails t) { warning(path+".path", expression, s); } String columnName = null; - JsonElement aliasJ = column.get("alias"); - if (aliasJ != null) { - if (aliasJ instanceof JsonString) { - columnName = aliasJ.asString(); + JsonElement nameJ = column.get("name"); + if (nameJ != null) { + if (nameJ instanceof JsonString) { + columnName = nameJ.asString(); if (!isValidName(columnName)) { - error(path+".name", aliasJ, "The name '"+columnName+"' is not valid", IssueType.VALUE); + error(path+".name", nameJ, "The name '"+columnName+"' is not valid", IssueType.VALUE); } } else { - error(path+".alias", aliasJ, "alias must be a string", IssueType.INVALID); + error(path+".name", nameJ, "name must be a string", IssueType.INVALID); } } if (columnName == null) { @@ -242,10 +242,12 @@ private void checkColumn(String path, JsonObject column, TypeDetails t) { if (names.size() == 1 && names.get(0) != null) { columnName = names.get(0); if (!isValidName(columnName)) { - error(path+".path", expression, "The name '"+columnName+"' found in the path expression is not a valid column name, so an alias is required", IssueType.INVARIANT); + error(path+".path", expression, "A column name is required. The natural name to chose is '"+columnName+"' (from the path)", IssueType.INVARIANT); + } else { + error(path, column, "A column name is required", IssueType.REQUIRED); } } else { - error(path, column, "The path does not resolve to a name, so an alias is required", IssueType.REQUIRED); + error(path, column, "A column name is required", IssueType.REQUIRED); } } // ok, name is sorted! From 6a78fdd1e05788b41fbb36f119b81351e78fa515 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 16:32:16 +1100 Subject: [PATCH 09/10] Add package use tracking to FHIR cache for validator.fhir.org --- .../fhir/utilities/npm/FilesystemPackageCacheManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java index f9cf0c7b2e..2876d7a691 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java @@ -242,6 +242,11 @@ public String getFolder() { } private NpmPackage loadPackageInfo(String path) throws IOException { + File f = new File(Utilities.path(path, "usage.ini")); + JsonObject j = f.exists() ? JsonParser.parseObject(f) : new JsonObject(); + j.set("date", new SimpleDateFormat("yyyy-MM-dd").format(new Date())); + JsonParser.compose(j, f, true); + NpmPackage pi = minimalMemory ? NpmPackage.fromFolderMinimal(path) : NpmPackage.fromFolder(path); return pi; } From 2f8a5a071e4abeadc3ea10cf13d625739909d48d Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 20 Oct 2023 21:30:25 +1100 Subject: [PATCH 10/10] validation by templateId for CDA --- .../hl7/fhir/r5/context/ContextUtilities.java | 11 ++ .../main/java/org/hl7/fhir/r5/model/Base.java | 12 +- .../fhir/utilities/i18n/I18nConstants.java | 2 + .../src/main/resources/Messages.properties | 6 +- .../instance/InstanceValidator.java | 43 +++-- .../4.0.1/all-systems.cache | 19 ++ .../4.0.1/snomed.cache | 167 ++++++++++++------ .../org.hl7.fhir.validation/4.0.1/ucum.cache | 90 +++++++--- pom.xml | 2 +- 9 files changed, 256 insertions(+), 96 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java index 987e4da940..7b211b8eb5 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java @@ -424,5 +424,16 @@ public StructureDefinition findType(String typeName) { return null; } + public StructureDefinition fetchProfileByIdentifier(String tid) { + for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) { + for (Identifier ii : sd.getIdentifier()) { + if (tid.equals(ii.getValue())) { + return sd; + } + } + } + return null; + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java index 2d781efeba..e644230cb1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Base.java @@ -541,7 +541,17 @@ public ValidationInfo addDefinition(StructureDefinition structure, ElementDefini return vi; } - + + public boolean hasValidated(StructureDefinition sd, ElementDefinition ed) { + if (validationInfo != null) { + for (ValidationInfo vi : validationInfo) { + if (vi.definition == ed && vi.structure == sd) { + return true; + } + } + } + return false; + } // validation messages: the validator does not populate these (yet) public Base addValidationMessage(ValidationMessage msg) { diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java index e81bc3a269..a8c2467750 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java @@ -1010,6 +1010,8 @@ public class I18nConstants { public static final String XSI_TYPE_WRONG = "XSI_TYPE_WRONG"; public static final String XSI_TYPE_UNNECESSARY = "XSI_TYPE_UNNECESSARY"; public static final String TERMINOLOGY_TX_OID_MULTIPLE_MATCHES = "TERMINOLOGY_TX_OID_MULTIPLE_MATCHES"; + public static final String CDA_UNKNOWN_TEMPLATE = "CDA_UNKNOWN_TEMPLATE"; + public static final String CDA_UNKNOWN_TEMPLATE_EXT = "CDA_UNKNOWN_TEMPLATE_EXT"; } diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index d350965dfe..d5b5e9018f 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -976,7 +976,7 @@ ED_INVARIANT_KEY_ALREADY_USED = The constraint key ''{0}'' already exists in the ED_INVARIANT_NO_EXPRESSION = The constraint ''{0}'' has no computable expression, so validators will not be able to check it ED_INVARIANT_EXPRESSION_CONFLICT = The constraint ''{0}'' has an expression ''{1}'', which differs from the earlier expression provided of ''{2}'' (invariants are allowed to repeat, but cannot differ) ED_INVARIANT_EXPRESSION_ERROR = Error in constraint ''{0}'' with expression ''{1}'': {2} -SNAPSHOT_IS_EMPTY = The snapshot for the profile ''{0}'' is empty (which should not happen) +SNAPSHOT_IS_EMPTY = The snapshot for the profile ''{0}'' is empty. This is usually due to a processing logged elsewhere TERMINOLOGY_TX_HINT = {1} TERMINOLOGY_TX_WARNING = {1} SD_ED_TYPE_WRONG_TYPE_one = The element has a type {0} which is different to the type {1} on the base profile {2} @@ -1062,8 +1062,10 @@ LOGICAL_MODEL_QNAME_MISMATCH = The QName ''{0}'' does not match the expected QNa FHIRPATH_CHOICE_NO_TYPE_SPECIFIER = The expression ''{0}'' refers to an element that is a choice, but doesn''t have an .ofType() so that SQL view runners can pre-determine the full element name FHIRPATH_CHOICE_SPURIOUS_TYPE_SPECIFIER = The expression ''{0}'' refers to an element that is not a choice, but has an .ofType(). SQL view runners are likely to pre-determine an incorrect full element name FHIRPATH_NOT_A_COLLECTION = Found a use of a collection operator on something that is not a collection at ''{0}'' - check that there's no mistakes in the expression syntax -TERMINOLOGY_TX_UNKNOWN_OID = The OID ''{0}'' is not known +TERMINOLOGY_TX_UNKNOWN_OID = The OID ''{0}'' is not known, so the code can't be validated TERMINOLOGY_TX_SYSTEM_NO_CODE = A code with no system has no defined meaning, and it cannot be validated. A system should be provided XSI_TYPE_WRONG = The xsi:type value ''{0}'' is wrong (should be ''{1}''). Note that xsi:type is unnecessary at this point XSI_TYPE_UNNECESSARY = xsi:type is unnecessary at this point TERMINOLOGY_TX_OID_MULTIPLE_MATCHES = The OID ''{0}'' matches multiple code systems ({1}) +CDA_UNKNOWN_TEMPLATE = The CDA Template {0} is not known +CDA_UNKNOWN_TEMPLATE_EXT = The CDA Template {0} / {1} is not known diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index bc3e83f69d..fbd90c707f 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -502,12 +502,14 @@ public FHIRPathEngine getFHIRPathEngine() { public boolean testMode; private boolean example ; private IDigitalSignatureServices signatureServices; + private ContextUtilities cu; public InstanceValidator(@Nonnull IWorkerContext theContext, @Nonnull IEvaluationContext hostServices, @Nonnull XVerExtensionManager xverManager) { super(theContext, xverManager, false); start = System.currentTimeMillis(); this.externalHostServices = hostServices; this.profileUtilities = new ProfileUtilities(theContext, null, null); + cu = new ContextUtilities(theContext); fpe = new FHIRPathEngine(context); validatorServices = new ValidatorHostServices(); fpe.setHostServices(validatorServices); @@ -1662,7 +1664,7 @@ private boolean convertCDACodeToCodeableConcept(List errors, c.setSystem("urn:oid:"+oid); ok = false; if (urls.size() == 0) { - rule(errors, "2023-10-11", IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_UNKNOWN_OID, oid); + warning(errors, "2023-10-11", IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_UNKNOWN_OID, oid); } else { rule(errors, "2023-10-11", IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_OID_MULTIPLE_MATCHES, oid, CommaSeparatedStringBuilder.join(",", urls)); } @@ -5799,6 +5801,25 @@ private boolean validateElement(ValidationContext valContext, List templates = element.getChildren("templateId"); + for (Element t : templates) { + String tid = "urn:hl7ii:"+t.getChildValue("root")+(t.hasChild("extension") ? ":"+t.getChildValue("extension") : ""); + StructureDefinition sd = cu.fetchProfileByIdentifier(tid); + if (sd == null) { + ok = rule(errors, "2023-10-20", IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, t.hasChild("extension") ? I18nConstants.CDA_UNKNOWN_TEMPLATE_EXT : I18nConstants.CDA_UNKNOWN_TEMPLATE, t.getChildValue("root"), t.getChildValue("extension")) && ok; + } else { + ElementDefinition ed = sd.getSnapshot().getElementFirstRep(); + if (!element.hasValidated(sd, ed)) { + element.addMessage(signpost(errors, NO_RULE_DATE, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(), I18nConstants.VALIDATION_VAL_PROFILE_SIGNPOST, sd.getVersionedUrl())); + ok = validateElement(valContext, errors, sd, ed, null, null, resource, element, actualType, stack, inCodeableConcept, checkDisplayInContext, extensionUrl, pct, mode) && ok; + } + } + } + } + return ok; } @@ -6060,13 +6081,15 @@ public boolean checkChildByDefinition(ValidationContext valContext, List errors, String path, bool boolean ok = true; String system = null; String code = element.getNamedChildValue(isPQ ? "unit" : "code"); - String oid = element.getNamedChildValue("codeSystem"); + String oid = isPQ ? "2.16.840.1.113883.6.8" : element.getNamedChildValue("codeSystem"); if (oid != null) { Set urls = context.urlsForOid(true, oid); if (urls.size() != 1) { @@ -6188,7 +6211,7 @@ private boolean checkCDACoding(List errors, String path, bool ok = false; if (urls.size() == 0) { - rule(errors, "2023-10-11", IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_UNKNOWN_OID, oid); + warning(errors, "2023-10-11", IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_UNKNOWN_OID, oid); } else { rule(errors, "2023-10-11", IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_OID_MULTIPLE_MATCHES, oid, CommaSeparatedStringBuilder.join(",", urls)); } diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/all-systems.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/all-systems.cache index 33e55b0c16..169fb075d3 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/all-systems.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/all-systems.cache @@ -1446,6 +1446,25 @@ v: { "severity" : "error", "error" : "The CodeSystem is unknown (from Tx-Server)", "class" : "UNKNOWN", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "code" : "en-US" +}, "url": "http://hl7.org/fhir/ValueSet/all-languages", "version": "4.0.1", "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"true", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "English (Region=United States)", + "code" : "en-US", + "system" : "urn:ietf:bcp:47", "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache index c1e9695ede..047a17c524 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/snomed.cache @@ -2963,7 +2963,6 @@ v: { "code" : "195967001", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -2985,7 +2984,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'HTN' for http://snomed.info/sct#59621000 - should be one of 5 choices: 'Essential hypertension', 'Idiopathic hypertension', 'Systemic primary arterial hypertension', 'Primary hypertension' or 'Essential hypertension (disorder)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3007,7 +3005,6 @@ v: { "code" : "396275006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3029,7 +3026,6 @@ v: { "code" : "78615007", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome", "issue" : [{ @@ -3100,7 +3096,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Theophylline' for http://snomed.info/sct#66493003 - should be one of 2 choices: 'Product containing theophylline (medicinal product)' or 'Theophylline-containing product' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3122,7 +3117,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Albuterol' for http://snomed.info/sct#91143003 - should be one of 3 choices: 'Product containing salbutamol (medicinal product)', 'Albuterol-containing product' or 'Salbutamol-containing product' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3144,7 +3138,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Prednisone preparation' for http://snomed.info/sct#10312003 - should be one of 2 choices: 'Product containing prednisone (medicinal product)' or 'Prednisone-containing product' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3166,7 +3159,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Hydrochlorothiazide 25mg tablet' for http://snomed.info/sct#376209006 - should be one of 2 choices: 'Hydrochlorothiazide 25 mg oral tablet' or 'Product containing precisely hydrochlorothiazide 25 milligram/1 each conventional release oral tablet (clinical drug)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3188,7 +3180,6 @@ v: { "code" : "247472004", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3210,7 +3201,6 @@ v: { "code" : "91936005", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3232,7 +3222,6 @@ v: { "code" : "56018004", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3254,7 +3243,6 @@ v: { "code" : "293586001", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3276,7 +3264,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Pruritis' for http://snomed.info/sct#32738000 - should be one of 6 choices: 'Pruritus', 'Itching', 'Itch', 'Itchy', 'Itch of skin' or 'Pruritus (finding)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3298,7 +3285,6 @@ v: { "code" : "62014003", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3320,7 +3306,6 @@ v: { "code" : "246075003", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3342,7 +3327,6 @@ v: { "code" : "73879007", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3363,7 +3347,6 @@ v: { "code" : "84100007", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3385,7 +3368,6 @@ v: { "code" : "84100007", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3407,7 +3389,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'MI' for http://snomed.info/sct#22298006 - should be one of 7 choices: 'Myocardial infarction', 'Infarction of heart', 'Cardiac infarction', 'Heart attack', 'Myocardial infarction (disorder)', 'Myocardial infarct' or 'MI - myocardial infarction' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3429,7 +3410,6 @@ v: { "code" : "399347008", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3451,7 +3431,6 @@ v: { "code" : "275937001", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3473,7 +3452,6 @@ v: { "code" : "160274005", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3495,7 +3473,6 @@ v: { "code" : "266924008", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3517,7 +3494,6 @@ v: { "code" : "160625004", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3539,7 +3515,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Trivial drinker - less than 1/day' for http://snomed.info/sct#266917007 - should be one of 2 choices: 'Trivial drinker - <1u/day' or 'Trivial drinker - <1u/day (finding)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3561,7 +3536,6 @@ v: { "code" : "50373000", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3583,7 +3557,6 @@ v: { "code" : "363808001", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3605,7 +3578,6 @@ v: { "code" : "60621009", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3627,7 +3599,6 @@ v: { "code" : "301898006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3649,7 +3620,6 @@ v: { "code" : "386725007", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3671,7 +3641,6 @@ v: { "code" : "364075005", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3693,7 +3662,6 @@ v: { "code" : "364074009", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3715,7 +3683,6 @@ v: { "code" : "86290005", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3737,7 +3704,6 @@ v: { "code" : "276362002", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3759,7 +3725,6 @@ v: { "code" : "251076008", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3781,7 +3746,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Systolic BP' for http://snomed.info/sct#271649006 - should be one of 3 choices: 'Systolic blood pressure', 'Systolic blood pressure (observable entity)' or 'SAP - Systolic arterial pressure' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3803,7 +3767,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Diastolic BP' for http://snomed.info/sct#271650006 - should be one of 3 choices: 'Diastolic blood pressure', 'Diastolic blood pressure (observable entity)' or 'DBP - diastolic blood pressure' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3825,7 +3788,6 @@ v: { "code" : "271807003", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3847,7 +3809,6 @@ v: { "code" : "32750006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3869,7 +3830,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Chest clear' for http://snomed.info/sct#48348007 - should be one of 3 choices: 'Normal breath sounds', 'Normal respiratory sounds' or 'Normal breath sounds (finding)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3891,7 +3851,6 @@ v: { "code" : "37931006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3913,7 +3872,6 @@ v: { "code" : "76863003", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3935,7 +3893,6 @@ v: { "code" : "88610006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3957,7 +3914,6 @@ v: { "code" : "277455002", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -3979,7 +3935,6 @@ v: { "code" : "60721002", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4001,7 +3956,6 @@ v: { "code" : "282290005", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4023,7 +3977,6 @@ v: { "code" : "249674001", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4043,7 +3996,6 @@ v: { "severity" : "error", "error" : "Unable to find code in http://snomed.info/sct (version http://snomed.info/sct/900000000000207008/version/20230731); Unknown Code '' in the system 'http://snomed.info/sct|http://snomed.info/sct/900000000000207008/version/20230731'; The provided code 'http://snomed.info/sct#' is not in the value set 'http://hl7.org/fhir/ValueSet/@all' (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4065,7 +4017,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Chest-X-ray' for http://snomed.info/sct#56350004 - should be one of 2 choices: 'Routine chest X-ray' or 'Routine chest X-ray (procedure)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4087,7 +4038,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Peak flow' for http://snomed.info/sct#313193002 - should be one of 4 choices: 'Peak flow rate (respiratory)', 'Peak flow rate', 'Peak flow rate (respiratory) (observable entity)' or 'PFR - Peak flow rate' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4109,7 +4059,6 @@ v: { "code" : "14657009", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4131,7 +4080,6 @@ v: { "code" : "23426006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4153,7 +4101,6 @@ v: { "code" : "252472004", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4175,7 +4122,6 @@ v: { "code" : "223468009", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4197,7 +4143,6 @@ v: { "code" : "363702006", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4219,7 +4164,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Skin of palmer surface of index finger' for http://snomed.info/sct#48856004 - should be one of 3 choices: 'Skin of palmar surface of index finger', 'Skin structure of palmar surface of index finger' or 'Skin structure of palmar surface of index finger (body structure)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4241,7 +4185,6 @@ v: { "severity" : "error", "error" : "Wrong Display Name 'Hydrocortisone cream' for http://snomed.info/sct#331646005 - should be one of 2 choices: 'Hydrocortisone creams' or 'Hydrocortisone creams (product)' (for the language(s) 'en') (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -4263,6 +4206,116 @@ v: { "code" : "185389009", "system" : "http://snomed.info/sct", "version" : "http://snomed.info/sct/900000000000207008/version/20230731", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://snomed.info/sct", + "code" : "78615007", + "display" : "with laterality" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "With laterality", + "code" : "78615007", + "system" : "http://snomed.info/sct", + "version" : "http://snomed.info/sct/900000000000207008/version/20230731", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome", + "issue" : [{ + "severity" : "information", + "code" : "invalid", + "details" : { + "text" : "The code '78615007' is valid but is not active" + } + }, + { + "severity" : "information", + "code" : "invalid", + "details" : { + "text" : "The code '78615007' is valid but is not active" + } + }, + { + "severity" : "information", + "code" : "invalid", + "details" : { + "text" : "The code '78615007' is valid but is not active" + } + }, + { + "severity" : "information", + "code" : "invalid", + "details" : { + "text" : "The code '78615007' is valid but is not active" + } + }, + { + "severity" : "information", + "code" : "invalid", + "details" : { + "text" : "The code '78615007' is valid but is not active" + } + }, + { + "severity" : "information", + "code" : "invalid", + "details" : { + "text" : "The code '78615007' is valid but is not active" + } + }] +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://snomed.info/sct", + "code" : "246075003", + "display" : "causative agent" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "Causative agent", + "code" : "246075003", + "system" : "http://snomed.info/sct", + "version" : "http://snomed.info/sct/900000000000207008/version/20230731", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://snomed.info/sct", + "code" : "363702006", + "display" : "has focus" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "Has focus", + "code" : "363702006", + "system" : "http://snomed.info/sct", + "version" : "http://snomed.info/sct/900000000000207008/version/20230731", "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/ucum.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/ucum.cache index 293f718226..635c4f27b3 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/ucum.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/ucum.cache @@ -14,7 +14,6 @@ v: { "code" : "%", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -36,7 +35,6 @@ v: { "code" : "L/min", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -58,7 +56,6 @@ v: { "code" : "%", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -79,7 +76,6 @@ v: { "severity" : "error", "error" : "The provided code 'http://unitsofmeasure.org#L/min' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-vitals-common--0|4.0.1' (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -101,7 +97,6 @@ v: { "code" : "cm", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -122,7 +117,6 @@ v: { "severity" : "error", "error" : "The provided code 'http://unitsofmeasure.org#cm' is not in the value set 'https://bb/ValueSet/BBDemographicAgeUnit--0|20190731' (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -144,7 +138,6 @@ v: { "code" : "min", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -166,7 +159,6 @@ v: { "code" : "mmol/L", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -188,7 +180,6 @@ v: { "code" : "kg", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -210,7 +201,6 @@ v: { "code" : "kg/m2", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -232,7 +222,6 @@ v: { "code" : "mm[Hg]", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -254,7 +243,6 @@ v: { "code" : "wk", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -276,7 +264,6 @@ v: { "code" : "mm[Hg]", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -298,7 +285,6 @@ v: { "code" : "{capsule}", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -320,7 +306,6 @@ v: { "code" : "{patch}", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -342,7 +327,6 @@ v: { "code" : "m", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -363,7 +347,6 @@ v: { "severity" : "error", "error" : "The provided code 'http://unitsofmeasure.org#m' is not in the value set 'http://hl7.org/fhir/ValueSet/age-units--0|4.0.1' (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -385,7 +368,6 @@ v: { "code" : "/min", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -407,7 +389,6 @@ v: { "code" : "mg", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -429,7 +410,6 @@ v: { "code" : "mm", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -451,7 +431,6 @@ v: { "code" : "kg", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -473,7 +452,6 @@ v: { "code" : "Cel", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -495,7 +473,6 @@ v: { "code" : "g", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -517,7 +494,6 @@ v: { "code" : "mm[Hg]{hg}", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -538,7 +514,6 @@ v: { "severity" : "error", "error" : "Error processing Unit: 'fmm[Hg]': The unit \"fmm[Hg]\" is unknown at character 1; Unknown Code 'fmm[Hg]' in the system 'http://unitsofmeasure.org'; The provided code 'http://unitsofmeasure.org#fmm[Hg]' is not in the value set 'http://hl7.org/fhir/ValueSet/@all' (from Tx-Server)", "class" : "UNKNOWN", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -560,6 +535,71 @@ v: { "code" : "J/C", "system" : "http://unitsofmeasure.org", "version" : "2.0.1", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://unitsofmeasure.org", + "code" : "h" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "h", + "code" : "h", + "system" : "http://unitsofmeasure.org", + "version" : "2.0.1", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://unitsofmeasure.org", + "code" : "ar" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "ar", + "code" : "ar", + "system" : "http://unitsofmeasure.org", + "version" : "2.0.1", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://unitsofmeasure.org", + "code" : "l" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "l", + "code" : "l", + "system" : "http://unitsofmeasure.org", + "version" : "2.0.1", "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" diff --git a/pom.xml b/pom.xml index bf94936adf..c939ec634a 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 32.0.1-jre 6.4.1 - 1.4.11 + 1.4.12-SNAPSHOT 2.15.2 5.9.2 1.8.2