fix bug loading R5 extensions with imported value sets

This commit is contained in:
Grahame Grieve 2024-02-10 22:51:32 +11:00
parent 7d4b36a582
commit 20bf70ed68
9 changed files with 181 additions and 11 deletions

View File

@ -190,7 +190,10 @@ public class R5ExtensionsLoader {
context.cacheResourceFromPackage(vs, vs.getSourcePackage()); context.cacheResourceFromPackage(vs, vs.getSourcePackage());
for (ConceptSetComponent inc : vs.getCompose().getInclude()) { for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
for (CanonicalType t : inc.getValueSet()) { 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.hasSystem()) {
if (!inc.hasVersion()) { if (!inc.hasVersion()) {

View File

@ -4605,6 +4605,11 @@ public boolean hasTarget() {
} }
@Override
public String toString() {
return key + ":" + expression + (severity == null ? "("+severity.asStringValue()+")" : "");
}
} }
@Block() @Block()
@ -13093,6 +13098,10 @@ If a pattern[x] is declared on a repeating element, the pattern applies to all r
return t; return t;
} }
public boolean repeats() {
return !Utilities.existsInList(getMax(), "0", "1");
}
// end addition // end addition
} }

View File

@ -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
} }
/** /**

View File

@ -161,4 +161,14 @@ public class CommaSeparatedStringBuilder {
} }
return res; return res;
} }
public static String joinWrapped(String sep, String leftWrap, String rightWrap, Collection<String> list) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(sep);
for (String s : list) {
if (s != null) {
b.append(leftWrap+s+rightWrap);
}
}
return b.toString();
}
} }

View File

@ -85,7 +85,7 @@ import org.hl7.fhir.validation.instance.utils.NodeStack;
public class BaseValidator implements IValidationContextResourceLoader { public class BaseValidator implements IValidationContextResourceLoader {
public class BooleanHolder { public static class BooleanHolder {
private boolean value = true; private boolean value = true;
public BooleanHolder() { public BooleanHolder() {

View File

@ -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'", "error" : "The provided code 'http://loinc.org#5792-7' was not found in the value set 'http://hl7.org/fhir/ValueSet/birthDate'",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome", "resourceType" : "OperationOutcome",
"issue" : [{ "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"]
}]
}
}
-------------------------------------------------------------------------------------

View File

@ -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"]
}]
}
}
-------------------------------------------------------------------------------------

View File

@ -8,6 +8,7 @@
"server" : "https://tx.ontoserver.csiro.au/fhir", "server" : "https://tx.ontoserver.csiro.au/fhir",
"filename" : "vs-2a3253d9-d12e-45f3-877e-0dc2654b3904.json" "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://fhir.ch/ig/ch-ig/ValueSet/OrganizationType" : null,
"http://loinc.org/vs/LL4048-6" : null, "http://loinc.org/vs/LL4048-6" : null,
"https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_SEITENLOKALISATION" : null "https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_SEITENLOKALISATION" : null

View File

@ -214,7 +214,6 @@ v: {
"code" : "text/plain", "code" : "text/plain",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "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'", "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", "class" : "UNKNOWN",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome", "resourceType" : "OperationOutcome",
"issue" : [{ "issue" : [{
@ -277,7 +275,6 @@ v: {
"code" : "json", "code" : "json",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -299,7 +296,6 @@ v: {
"code" : "001", "code" : "001",
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm", "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome", "resourceType" : "OperationOutcome",
"issue" : [{ "issue" : [{
@ -335,7 +331,6 @@ v: {
"code" : "nl-NL", "code" : "nl-NL",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -356,7 +351,6 @@ v: {
"code" : "en-AU", "code" : "en-AU",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -377,7 +371,6 @@ v: {
"code" : "en", "code" : "en",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -400,7 +393,6 @@ v: {
"code" : "001", "code" : "001",
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm", "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"server" : "http://tx-dev.fhir.org/r4", "server" : "http://tx-dev.fhir.org/r4",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome", "resourceType" : "OperationOutcome",
"issue" : [{ "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"
}
}
-------------------------------------------------------------------------------------