diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/R5ExtensionsLoader.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/R5ExtensionsLoader.java index a207c3b68..7cf33370e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/R5ExtensionsLoader.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/R5ExtensionsLoader.java @@ -190,7 +190,10 @@ public class R5ExtensionsLoader { context.cacheResourceFromPackage(vs, vs.getSourcePackage()); for (ConceptSetComponent inc : vs.getCompose().getInclude()) { for (CanonicalType t : inc.getValueSet()) { - loadValueSet(t.asStringValue(), context, valueSets, codeSystems); + ValueSet vsi = context.fetchResource(ValueSet.class, t.getValue()); + if (vsi == null) { + loadValueSet(t.asStringValue(), context, valueSets, codeSystems); + } } if (inc.hasSystem()) { if (!inc.hasVersion()) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java index 3cf91c952..7d7f1ce4b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java @@ -4605,6 +4605,11 @@ public boolean hasTarget() { } + @Override + public String toString() { + return key + ":" + expression + (severity == null ? "("+severity.asStringValue()+")" : ""); + } + } @Block() @@ -13093,6 +13098,10 @@ If a pattern[x] is declared on a repeating element, the pattern applies to all r return t; } + public boolean repeats() { + return !Utilities.existsInList(getMax(), "0", "1"); + } + // end addition } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java index 4705cbab3..7f659bc4d 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/StructureDefinition.java @@ -1499,6 +1499,34 @@ public class StructureDefinition extends CanonicalResource { } +//added from java-adornments.txt: + + public ElementDefinition getElementByPath(String path) { + if (path == null) { + return null; + } + for (ElementDefinition ed : getElement()) { + if (path.equals(ed.getPath()) || (path+"[x]").equals(ed.getPath())) { + return ed; + } + } + return null; + } + + + public ElementDefinition getElementById(String id) { + if (id == null) { + return null; + } + for (ElementDefinition ed : getElement()) { + if (id.equals(ed.getId())) { + return ed; + } + } + return null; + } + +//end addition } /** diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/CommaSeparatedStringBuilder.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/CommaSeparatedStringBuilder.java index 7cdc295b7..b69b9504d 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/CommaSeparatedStringBuilder.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/CommaSeparatedStringBuilder.java @@ -161,4 +161,14 @@ public class CommaSeparatedStringBuilder { } return res; } + + public static String joinWrapped(String sep, String leftWrap, String rightWrap, Collection list) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(sep); + for (String s : list) { + if (s != null) { + b.append(leftWrap+s+rightWrap); + } + } + return b.toString(); + } } \ No newline at end of file diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java index 1c25d9281..94cbb8cd8 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java @@ -85,7 +85,7 @@ import org.hl7.fhir.validation.instance.utils.NodeStack; public class BaseValidator implements IValidationContextResourceLoader { - public class BooleanHolder { + public static class BooleanHolder { private boolean value = true; public BooleanHolder() { diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache index 73f590b0b..3c979b9b5 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/loinc.cache @@ -6562,7 +6562,6 @@ v: { "error" : "The provided code 'http://loinc.org#5792-7' was not found in the value set 'http://hl7.org/fhir/ValueSet/birthDate'", "class" : "UNKNOWN", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome", "issue" : [{ @@ -6586,3 +6585,68 @@ v: { } ------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "76534-7", + "display" : "Systolic blood pressure by Noninvasive" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"false", "guessSystem":"false", "activeOnly":"false", "membershipOnly":"false", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "Systolic blood pressure by Noninvasive", + "code" : "76534-7", + "system" : "http://loinc.org", + "version" : "2.74", + "server" : "http://tx-dev.fhir.org/r4", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://loinc.org", + "code" : "76534-7" +}, "url": "http://hl7.org/fhir/ValueSet/observation-vitalsignresult--0", "version": "4.0.1", "langs":"", "useServer":"true", "useClient":"false", "guessSystem":"false", "activeOnly":"false", "membershipOnly":"false", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "Systolic blood pressure by Noninvasive", + "code" : "76534-7", + "severity" : "error", + "error" : "The provided code 'http://loinc.org#76534-7' was not found in the value set 'http://hl7.org/fhir/ValueSet/observation-vitalsignresult--0|4.0.1'", + "class" : "UNKNOWN", + "server" : "http://tx-dev.fhir.org/r4", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome", + "issue" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-server", + "valueUrl" : "http://tx-dev.fhir.org/r4" + }], + "severity" : "error", + "code" : "code-invalid", + "details" : { + "coding" : [{ + "system" : "http://hl7.org/fhir/tools/CodeSystem/tx-issue-type", + "code" : "not-in-vs" + }], + "text" : "The provided code 'http://loinc.org#76534-7' was not found in the value set 'http://hl7.org/fhir/ValueSet/observation-vitalsignresult--0|4.0.1'" + }, + "location" : ["Coding.code"], + "expression" : ["Coding.code"] + }] +} + +} +------------------------------------------------------------------------------------- diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/smart-app-launchCodeSystemuser-access-category.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/smart-app-launchCodeSystemuser-access-category.cache new file mode 100644 index 000000000..3ba438219 --- /dev/null +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/smart-app-launchCodeSystemuser-access-category.cache @@ -0,0 +1,42 @@ +------------------------------------------------------------------------------------- +{"code" : { + "system" : "http://hl7.org/fhir/smart-app-launch/CodeSystem/user-access-category", + "code" : "laboratory", + "display" : "Laboratory" +}, "valueSet" :null, "langs":"", "useServer":"true", "useClient":"false", "guessSystem":"false", "activeOnly":"false", "membershipOnly":"false", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "code" : "laboratory", + "severity" : "error", + "error" : "A definition for CodeSystem 'http://hl7.org/fhir/smart-app-launch/CodeSystem/user-access-category' could not be found, so the code cannot be validated", + "class" : "CODESYSTEM_UNSUPPORTED", + "server" : "http://tx-dev.fhir.org/r4", + "unknown-systems" : "http://hl7.org/fhir/smart-app-launch/CodeSystem/user-access-category", + "issues" : { + "resourceType" : "OperationOutcome", + "issue" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-server", + "valueUrl" : "http://tx-dev.fhir.org/r4" + }], + "severity" : "error", + "code" : "not-found", + "details" : { + "coding" : [{ + "system" : "http://hl7.org/fhir/tools/CodeSystem/tx-issue-type", + "code" : "not-found" + }], + "text" : "A definition for CodeSystem 'http://hl7.org/fhir/smart-app-launch/CodeSystem/user-access-category' could not be found, so the code cannot be validated" + }, + "location" : ["Coding.system"], + "expression" : ["Coding.system"] + }] +} + +} +------------------------------------------------------------------------------------- diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/vs-externals.json b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/vs-externals.json index 09e1bcb13..e2bc65c0a 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/vs-externals.json +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/4.0.1/vs-externals.json @@ -8,6 +8,7 @@ "server" : "https://tx.ontoserver.csiro.au/fhir", "filename" : "vs-2a3253d9-d12e-45f3-877e-0dc2654b3904.json" }, + "http://hl7.org/fhir/smart-app-launch/ValueSet/user-access-category" : null, "http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType" : null, "http://loinc.org/vs/LL4048-6" : null, "https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_SEITENLOKALISATION" : null diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/all-systems.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/all-systems.cache index ffcf94bf3..eb877f88f 100644 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/all-systems.cache +++ b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/all-systems.cache @@ -214,7 +214,6 @@ v: { "code" : "text/plain", "system" : "urn:ietf:bcp:13", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -239,7 +238,6 @@ v: { "error" : "The provided code 'http://snomed.info/sct#271649006 ('Systolic blood pressure')' was not found in the value set 'http://hl7.org/fhir/ValueSet/observation-vitalsignresult|5.0.0'", "class" : "UNKNOWN", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome", "issue" : [{ @@ -277,7 +275,6 @@ v: { "code" : "json", "system" : "urn:ietf:bcp:13", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -299,7 +296,6 @@ v: { "code" : "001", "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome", "issue" : [{ @@ -335,7 +331,6 @@ v: { "code" : "nl-NL", "system" : "urn:ietf:bcp:47", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -356,7 +351,6 @@ v: { "code" : "en-AU", "system" : "urn:ietf:bcp:47", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -377,7 +371,6 @@ v: { "code" : "en", "system" : "urn:ietf:bcp:47", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome" } @@ -400,7 +393,6 @@ v: { "code" : "001", "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm", "server" : "http://tx-dev.fhir.org/r4", - "unknown-systems" : "", "issues" : { "resourceType" : "OperationOutcome", "issue" : [{ @@ -422,3 +414,24 @@ v: { } ------------------------------------------------------------------------------------- +{"code" : { + "code" : "image/gif" +}, "url": "http://hl7.org/fhir/ValueSet/mimetypes", "version": "5.0.0", "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"true", "activeOnly":"false", "membershipOnly":"false", "displayWarningMode":"false", "versionFlexible":"false", "profile": { + "resourceType" : "Parameters", + "parameter" : [{ + "name" : "profile-url", + "valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891" + }] +}}#### +v: { + "display" : "image/gif", + "code" : "image/gif", + "system" : "urn:ietf:bcp:13", + "server" : "http://tx-dev.fhir.org/r4", + "unknown-systems" : "", + "issues" : { + "resourceType" : "OperationOutcome" +} + +} +-------------------------------------------------------------------------------------