diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java
index ac24b75f6..85d30c069 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java
@@ -139,4 +139,28 @@ public class ValueSetUtilities {
return -1;
}
+ public static ValueSet generateImplicitValueSet(String uri) {
+ if (uri.startsWith("http://snomed.info/sct"))
+ return generateImplicitSnomedValueSet(uri);
+ return null;
+ }
+
+ private static ValueSet generateImplicitSnomedValueSet(String uri) {
+ if ("http://snomed.info/sct?fhir_vs".equals(uri))
+ return makeImplicitSnomedValueSet(uri);
+ return null;
+ }
+
+ private static ValueSet makeImplicitSnomedValueSet(String uri) {
+ ValueSet vs = new ValueSet();
+ vs.setUrl(uri);
+ vs.setName("SCTValueSet");
+ vs.setTitle("SCT ValueSet");
+ vs.setDescription("All SNOMED CT Concepts");
+ vs.setCopyright("This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (SNOMED International), and distributed by agreement between SNOMED International and HL7. Implementer use of SNOMED CT is not covered by this agreement");
+ vs.setStatus(PublicationStatus.ACTIVE);
+ vs.getCompose().addInclude().setSystem("http://snomed.info/sct");
+ return vs;
+ }
+
}
diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java
index 30e41b786..be46593b9 100644
--- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java
+++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java
@@ -121,6 +121,7 @@ import org.hl7.fhir.r5.model.TypeDetails;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
+import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
@@ -2554,6 +2555,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
fr = context.fetchResource(ValueSet.class, reference);
}
}
+ if (fr == null)
+ fr = ValueSetUtilities.generateImplicitValueSet(reference);
txTime = txTime + (System.nanoTime() - t);
return fr;
}
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json
index b4eeb21eb..6768327e0 100644
--- a/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json
+++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/manifest.json
@@ -854,6 +854,34 @@
"errorCount": 1
}
},
+ "observation-maxvs-base.xml": {
+ "errorCount": 0,
+ "profile": {
+ "source": "maxvalueset-profile.xml",
+ "errorCount": 0
+ }
+ },
+ "observation-maxvs-ex.xml": {
+ "errorCount": 0,
+ "profile": {
+ "source": "maxvalueset-profile.xml",
+ "errorCount": 0
+ }
+ },
+ "observation-maxvs-text.xml": {
+ "errorCount": 0,
+ "profile": {
+ "source": "maxvalueset-profile.xml",
+ "errorCount": 0
+ }
+ },
+ "observation-maxvs-wrong.xml": {
+ "errorCount": 0,
+ "profile": {
+ "source": "maxvalueset-profile.xml",
+ "errorCount": 1
+ }
+ },
"bundle-local-refs.xml" : {
"errorCount": 0,
"warningCount": 0
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/maxvalueset-profile.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/maxvalueset-profile.xml
new file mode 100644
index 000000000..cdf7258f8
--- /dev/null
+++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/maxvalueset-profile.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-base.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-base.xml
new file mode 100644
index 000000000..dce49fd79
--- /dev/null
+++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-base.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-ex.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-ex.xml
new file mode 100644
index 000000000..2654340a5
--- /dev/null
+++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-ex.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-text.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-text.xml
new file mode 100644
index 000000000..882a2851a
--- /dev/null
+++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-text.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-wrong.xml b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-wrong.xml
new file mode 100644
index 000000000..83209001a
--- /dev/null
+++ b/org.hl7.fhir.validation/src/test/resources/validation-examples/observation-maxvs-wrong.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file