Merge pull request #1431 from hapifhir/2023-09-gg-conceptmap-validation

2023 09 gg conceptmap validation
This commit is contained in:
Grahame Grieve 2023-09-06 10:53:53 +10:00 committed by GitHub
commit 571aacc3b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 425 additions and 138 deletions

View File

@ -12,6 +12,7 @@ import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Id30
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50; import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50; import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Url43_50;
import org.hl7.fhir.dstu3.model.Extension; import org.hl7.fhir.dstu3.model.Extension;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CanonicalType; import org.hl7.fhir.r5.model.CanonicalType;
@ -73,6 +74,7 @@ public class Requirements30_50 {
public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel"; public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel";
public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom"; public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom";
public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor"; public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor";
public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.reference";
public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"; public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement";
private static final String[] IGNORED_EXTENSION_URLS = new String[]{ private static final String[] IGNORED_EXTENSION_URLS = new String[]{
@ -93,6 +95,7 @@ public class Requirements30_50 {
COPYRIGHT_LABEL_EXTENSION_URL, COPYRIGHT_LABEL_EXTENSION_URL,
DERIVED_FROM_EXTENSION_URL, DERIVED_FROM_EXTENSION_URL,
ACTOR_EXTENSION_URL, ACTOR_EXTENSION_URL,
REFERENCE_EXTENSION_URL,
STATEMENT_EXTENSION_URL STATEMENT_EXTENSION_URL
}; };
public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException {
@ -159,6 +162,9 @@ public class Requirements30_50 {
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) { for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) {
tgt.getActor().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); tgt.getActor().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue()));
} }
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) {
tgt.getReference().add(Uri30_50.convertUrl((org.hl7.fhir.dstu3.model.UriType) ext.getValue()));
}
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) { for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) {
convertRequirementsStatement(ext, tgt.addStatement()); convertRequirementsStatement(ext, tgt.addStatement());
} }
@ -226,6 +232,9 @@ public class Requirements30_50 {
for (CanonicalType ref : src.getActor()) { for (CanonicalType ref : src.getActor()) {
tgt.addExtension(ACTOR_EXTENSION_URL, Uri30_50.convertCanonical(ref)); tgt.addExtension(ACTOR_EXTENSION_URL, Uri30_50.convertCanonical(ref));
} }
for (UrlType ref : src.getReference()) {
tgt.addExtension(REFERENCE_EXTENSION_URL, Uri30_50.convertUrl(ref));
}
for (RequirementsStatementComponent ref : src.getStatement()) { for (RequirementsStatementComponent ref : src.getStatement()) {
org.hl7.fhir.dstu3.model.Extension tgte = new org.hl7.fhir.dstu3.model.Extension(STATEMENT_EXTENSION_URL); org.hl7.fhir.dstu3.model.Extension tgte = new org.hl7.fhir.dstu3.model.Extension(STATEMENT_EXTENSION_URL);
tgt.addExtension(tgte); tgt.addExtension(tgte);

View File

@ -14,6 +14,7 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50; import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Url40_50; import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Url40_50;
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Url43_50;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r5.model.CanonicalType; import org.hl7.fhir.r5.model.CanonicalType;
@ -75,6 +76,7 @@ public class Requirements40_50 {
public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel"; public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel";
public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom"; public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom";
public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor"; public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor";
public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.reference";
public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"; public static final String STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement";
private static final String[] IGNORED_EXTENSION_URLS = new String[]{ private static final String[] IGNORED_EXTENSION_URLS = new String[]{
@ -95,6 +97,7 @@ public class Requirements40_50 {
COPYRIGHT_LABEL_EXTENSION_URL, COPYRIGHT_LABEL_EXTENSION_URL,
DERIVED_FROM_EXTENSION_URL, DERIVED_FROM_EXTENSION_URL,
ACTOR_EXTENSION_URL, ACTOR_EXTENSION_URL,
REFERENCE_EXTENSION_URL,
STATEMENT_EXTENSION_URL STATEMENT_EXTENSION_URL
}; };
@ -162,6 +165,9 @@ public class Requirements40_50 {
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) {
tgt.getActor().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue())); tgt.getActor().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
} }
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) {
tgt.getReference().add(Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) ext.getValue()));
}
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) { for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(STATEMENT_EXTENSION_URL)) {
convertRequirementsStatement(ext, tgt.addStatement()); convertRequirementsStatement(ext, tgt.addStatement());
} }
@ -229,6 +235,9 @@ public class Requirements40_50 {
for (CanonicalType ref : src.getActor()) { for (CanonicalType ref : src.getActor()) {
tgt.addExtension(ACTOR_EXTENSION_URL, Canonical40_50.convertCanonical(ref)); tgt.addExtension(ACTOR_EXTENSION_URL, Canonical40_50.convertCanonical(ref));
} }
for (UrlType ref : src.getReference()) {
tgt.addExtension(REFERENCE_EXTENSION_URL, Url40_50.convertUrl(ref));
}
for (RequirementsStatementComponent ref : src.getStatement()) { for (RequirementsStatementComponent ref : src.getStatement()) {
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(STATEMENT_EXTENSION_URL); org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(STATEMENT_EXTENSION_URL);
tgt.addExtension(tgte); tgt.addExtension(tgte);

View File

@ -75,6 +75,7 @@ public class Requirements43_50 {
public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel"; public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel";
public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom"; public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom";
public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor"; public static final String ACTOR_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor";
public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.reference";
public static final String REQUIREMENTS_STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement"; public static final String REQUIREMENTS_STATEMENT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement";
private static final String[] IGNORED_EXTENSION_URLS = new String[]{ private static final String[] IGNORED_EXTENSION_URLS = new String[]{
@ -96,6 +97,7 @@ public class Requirements43_50 {
COPYRIGHT_LABEL_EXTENSION_URL, COPYRIGHT_LABEL_EXTENSION_URL,
DERIVED_FROM_EXTENSION_URL, DERIVED_FROM_EXTENSION_URL,
ACTOR_EXTENSION_URL, ACTOR_EXTENSION_URL,
REFERENCE_EXTENSION_URL,
REQUIREMENTS_STATEMENT_EXTENSION_URL REQUIREMENTS_STATEMENT_EXTENSION_URL
}; };
public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4b.model.Basic src) throws FHIRException { public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4b.model.Basic src) throws FHIRException {
@ -161,6 +163,9 @@ public class Requirements43_50 {
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) { for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(ACTOR_EXTENSION_URL)) {
tgt.getActor().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue())); tgt.getActor().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue()));
} }
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) {
tgt.getReference().add(Url43_50.convertUrl((org.hl7.fhir.r4b.model.UrlType) ext.getValue()));
}
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(REQUIREMENTS_STATEMENT_EXTENSION_URL)) { for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl(REQUIREMENTS_STATEMENT_EXTENSION_URL)) {
convertRequirementsStatement(ext, tgt.addStatement()); convertRequirementsStatement(ext, tgt.addStatement());
} }
@ -228,6 +233,9 @@ public class Requirements43_50 {
for (CanonicalType ref : src.getActor()) { for (CanonicalType ref : src.getActor()) {
tgt.addExtension(ACTOR_EXTENSION_URL, Canonical43_50.convertCanonical(ref)); tgt.addExtension(ACTOR_EXTENSION_URL, Canonical43_50.convertCanonical(ref));
} }
for (UrlType ref : src.getReference()) {
tgt.addExtension(REFERENCE_EXTENSION_URL, Url43_50.convertUrl(ref));
}
for (RequirementsStatementComponent ref : src.getStatement()) { for (RequirementsStatementComponent ref : src.getStatement()) {
org.hl7.fhir.r4b.model.Extension tgte = new org.hl7.fhir.r4b.model.Extension(REQUIREMENTS_STATEMENT_EXTENSION_URL); org.hl7.fhir.r4b.model.Extension tgte = new org.hl7.fhir.r4b.model.Extension(REQUIREMENTS_STATEMENT_EXTENSION_URL);
tgt.addExtension(tgte); tgt.addExtension(tgte);

View File

@ -19,6 +19,7 @@
"actor": [ "actor": [
"http://hl7.org/fhir/ActorDefinition/server" "http://hl7.org/fhir/ActorDefinition/server"
], ],
"reference" : ["http://hl7.org"],
"statement": [ "statement": [
{ {
"key": "req-1", "key": "req-1",

View File

@ -937,7 +937,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
// 2nd pass: What can we do internally // 2nd pass: What can we do internally
// 3rd pass: hit the server // 3rd pass: hit the server
for (CodingValidationRequest t : codes) { for (CodingValidationRequest t : codes) {
t.setCacheToken(txCache != null ? txCache.generateValidationToken(options, t.getCoding(), vs, expParameters) : null); t.setCacheToken(txCache != null ? txCache.generateValidationToken(options, t.getCoding(), vs == null ? t.getVsObj() : vs, expParameters) : null);
if (t.getCoding().hasSystem()) { if (t.getCoding().hasSystem()) {
codeSystemsUsed.add(t.getCoding().getSystem()); codeSystemsUsed.add(t.getCoding().getSystem());
} }
@ -949,7 +949,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
for (CodingValidationRequest t : codes) { for (CodingValidationRequest t : codes) {
if (!t.hasResult()) { if (!t.hasResult()) {
try { try {
ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs); ValueSetValidator vsc = constructValueSetCheckerSimple(options, vs == null ? t.getVsObj() : vs);
vsc.setThrowToServer(options.isUseServer() && tcc.getClient() != null); vsc.setThrowToServer(options.isUseServer() && tcc.getClient() != null);
ValidationResult res = vsc.validateCode("Coding", t.getCoding()); ValidationResult res = vsc.validateCode("Coding", t.getCoding());
if (txCache != null) { if (txCache != null) {
@ -983,12 +983,16 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
Set<String> systems = new HashSet<>(); Set<String> systems = new HashSet<>();
for (CodingValidationRequest codingValidationRequest : codes) { for (CodingValidationRequest codingValidationRequest : codes) {
if (!codingValidationRequest.hasResult()) { if (!codingValidationRequest.hasResult()) {
Parameters pIn = constructParameters(options, codingValidationRequest, vs); Parameters pIn = constructParameters(options, codingValidationRequest, vs == null ? codingValidationRequest.getVsObj() : vs);
setTerminologyOptions(options, pIn); setTerminologyOptions(options, pIn);
BundleEntryComponent be = batch.addEntry(); BundleEntryComponent be = batch.addEntry();
be.setResource(pIn); be.setResource(pIn);
be.getRequest().setMethod(HTTPVerb.POST); be.getRequest().setMethod(HTTPVerb.POST);
if (vs != null || codingValidationRequest.getVsObj() != null) {
be.getRequest().setUrl("ValueSet/$validate-code");
} else {
be.getRequest().setUrl("CodeSystem/$validate-code"); be.getRequest().setUrl("CodeSystem/$validate-code");
}
be.setUserData("source", codingValidationRequest); be.setUserData("source", codingValidationRequest);
systems.add(codingValidationRequest.getCoding().getSystem()); systems.add(codingValidationRequest.getCoding().getSystem());
} }
@ -1010,7 +1014,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
BundleEntryComponent r = resp.getEntry().get(i); BundleEntryComponent r = resp.getEntry().get(i);
if (r.getResource() instanceof Parameters) { if (r.getResource() instanceof Parameters) {
t.setResult(processValidationResult((Parameters) r.getResource(), vs == null ? null : vs.getUrl())); t.setResult(processValidationResult((Parameters) r.getResource(), vs != null ? vs.getUrl() : t.getVsObj() != null ? t.getVsObj().getUrl() : null));
if (txCache != null) { if (txCache != null) {
txCache.cacheValidation(t.getCacheToken(), t.getResult(), TerminologyCache.PERMANENT); txCache.cacheValidation(t.getCacheToken(), t.getResult(), TerminologyCache.PERMANENT);
} }

View File

@ -364,6 +364,7 @@ public interface IWorkerContext {
private ValidationResult result; private ValidationResult result;
private CacheToken cacheToken; private CacheToken cacheToken;
private String vs; private String vs;
private ValueSet vsObj;
public CodingValidationRequest(Coding coding) { public CodingValidationRequest(Coding coding) {
super(); super();
@ -376,10 +377,20 @@ public interface IWorkerContext {
this.vs = vs; this.vs = vs;
} }
public CodingValidationRequest(Coding coding, ValueSet vsObj) {
super();
this.coding = coding;
this.vsObj = vsObj;
}
public String getVs() { public String getVs() {
return vs; return vs;
} }
public ValueSet getVsObj() {
return vsObj;
}
public ValidationResult getResult() { public ValidationResult getResult() {
return result; return result;
} }

View File

@ -85,7 +85,20 @@ public class RequirementsRenderer extends ResourceRenderer {
} }
} }
} }
if (req.hasReference()) {
XhtmlNode p = x.para();
p.tx("References: ");
int i = 0;
for (UrlType c : req.getReference()) {
i++;
if (i>1) p.tx(", ");
String url = c.getValue();
if (url.contains("#")) {
url = url.substring(0, url.indexOf("#"));
}
p.ah(c.getValue()).tx(url);
}
}
XhtmlNode tbl = x.table("grid"); XhtmlNode tbl = x.table("grid");
for (RequirementsStatementComponent stmt : req.getStatement()) { for (RequirementsStatementComponent stmt : req.getStatement()) {
@ -151,7 +164,7 @@ public class RequirementsRenderer extends ResourceRenderer {
XhtmlNode li = ul.li(); XhtmlNode li = ul.li();
li.tx("References: "); li.tx("References: ");
int i = 0; int i = 0;
for (UrlType c : stmt.getSatisfiedBy()) { for (UrlType c : stmt.getReference()) {
i++; i++;
if (i>1) li.tx(", "); if (i>1) li.tx(", ");
String url = c.getValue(); String url = c.getValue();

View File

@ -850,8 +850,10 @@ public class I18nConstants {
public static final String CONCEPTMAP_GROUP_TARGET_MISSING = "CONCEPTMAP_GROUP_TARGET_MISSING"; public static final String CONCEPTMAP_GROUP_TARGET_MISSING = "CONCEPTMAP_GROUP_TARGET_MISSING";
public static final String CONCEPTMAP_GROUP_TARGET_UNKNOWN = "CONCEPTMAP_GROUP_TARGET_UNKNOWN"; public static final String CONCEPTMAP_GROUP_TARGET_UNKNOWN = "CONCEPTMAP_GROUP_TARGET_UNKNOWN";
public static final String CONCEPTMAP_GROUP_SOURCE_CODE_INVALID = "CONCEPTMAP_GROUP_SOURCE_CODE_INVALID"; public static final String CONCEPTMAP_GROUP_SOURCE_CODE_INVALID = "CONCEPTMAP_GROUP_SOURCE_CODE_INVALID";
public static final String CONCEPTMAP_GROUP_SOURCE_CODE_INVALID_VS = "CONCEPTMAP_GROUP_SOURCE_CODE_INVALID_VS";
public static final String CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID = "CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID"; public static final String CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID = "CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID";
public static final String CONCEPTMAP_GROUP_TARGET_CODE_INVALID = "CONCEPTMAP_GROUP_TARGET_CODE_INVALID"; public static final String CONCEPTMAP_GROUP_TARGET_CODE_INVALID = "CONCEPTMAP_GROUP_TARGET_CODE_INVALID";
public static final String CONCEPTMAP_GROUP_TARGET_CODE_INVALID_VS = "CONCEPTMAP_GROUP_TARGET_CODE_INVALID_VS";
public static final String CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID = "CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID"; public static final String CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID = "CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID";
public static final String CONCEPTMAP_GROUP_TARGET_PROPERTY_INVALID = "CONCEPTMAP_GROUP_TARGET_PROPERTY_INVALID"; public static final String CONCEPTMAP_GROUP_TARGET_PROPERTY_INVALID = "CONCEPTMAP_GROUP_TARGET_PROPERTY_INVALID";
public static final String CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_MISMATCH = "CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_MISMATCH"; public static final String CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_MISMATCH = "CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_MISMATCH";
@ -983,6 +985,10 @@ public class I18nConstants {
public static final String CODESYSTEM_CS_COUNT_NO_CONTENT_ALLOWED = "CODESYSTEM_CS_COUNT_NO_CONTENT_ALLOWED"; public static final String CODESYSTEM_CS_COUNT_NO_CONTENT_ALLOWED = "CODESYSTEM_CS_COUNT_NO_CONTENT_ALLOWED";
public static final String VALUESET_CIRCULAR_REFERENCE = "VALUESET_CIRCULAR_REFERENCE"; public static final String VALUESET_CIRCULAR_REFERENCE = "VALUESET_CIRCULAR_REFERENCE";
public static final String VALUESET_SUPPLEMENT_MISSING = "VALUESET_SUPPLEMENT_MISSING"; public static final String VALUESET_SUPPLEMENT_MISSING = "VALUESET_SUPPLEMENT_MISSING";
public static final String CONCEPTMAP_VS_TOO_MANY_CODES = "CONCEPTMAP_VS_TOO_MANY_CODES";
public static final String CONCEPTMAP_VS_INVALID_CONCEPT_CODE = "CONCEPTMAP_VS_INVALID_CONCEPT_CODE";
public static final String CONCEPTMAP_VS_INVALID_CONCEPT_CODE_VER = "CONCEPTMAP_VS_INVALID_CONCEPT_CODE_VER";
public static final String VALUESET_INC_TOO_MANY_CODES = "VALUESET_INC_TOO_MANY_CODES";
} }

View File

@ -905,12 +905,14 @@ SM_TARGET_TRANSLATE_BINDING_VS_TARGET = The target variable refers to an unknown
SM_TARGET_TRANSLATE_BINDING_VSE_TARGET = There was an error expanding the target value set, so this concept map can''t be checked: ''{0}'' SM_TARGET_TRANSLATE_BINDING_VSE_TARGET = There was an error expanding the target value set, so this concept map can''t be checked: ''{0}''
SM_TARGET_TRANSLATE_BINDING_TARGET_WRONG = The map produces one or more codes that the target value set does not include: {0} SM_TARGET_TRANSLATE_BINDING_TARGET_WRONG = The map produces one or more codes that the target value set does not include: {0}
CONCEPTMAP_GROUP_SOURCE_MISSING = No Source Code System, so the source codes cannot be checked CONCEPTMAP_GROUP_SOURCE_MISSING = No Source Code System, so the source codes cannot be checked
CONCEPTMAP_GROUP_SOURCE_UNKNOWN = Unknown Source Code System {0}, so the source codes cannot be checked CONCEPTMAP_GROUP_SOURCE_UNKNOWN = The Source Code System {0} is not fully defined and populated, and no sourceScope is specified, so the source code checking will not be performed
CONCEPTMAP_GROUP_TARGET_MISSING = No Target Code System, so the target codes cannot be checked CONCEPTMAP_GROUP_TARGET_MISSING = No Target Code System, so the target codes cannot be checked
CONCEPTMAP_GROUP_TARGET_UNKNOWN = Unknown Target Code System {0}, so the target codes cannot be checked CONCEPTMAP_GROUP_TARGET_UNKNOWN = The Target Code System {0} is not fully defined and populated, and no targetScope is specified, so the target code checking will not be performed
CONCEPTMAP_GROUP_SOURCE_CODE_INVALID = The source code ''{0}'' is not valid in the code system {1} CONCEPTMAP_GROUP_SOURCE_CODE_INVALID = The source code ''{0}'' is not valid in the code system {1}
CONCEPTMAP_GROUP_SOURCE_CODE_INVALID_VS = The source code ''{0}'' is not valid in the value set {1}
CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID = The source display ''{0}'' is not valid. Possible codes {1} CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID = The source display ''{0}'' is not valid. Possible codes {1}
CONCEPTMAP_GROUP_TARGET_CODE_INVALID =The target code ''{0}'' is not valid in the code system {1} CONCEPTMAP_GROUP_TARGET_CODE_INVALID = The target code ''{0}'' is not valid in the code system {1}
CONCEPTMAP_GROUP_TARGET_CODE_INVALID_VS = The target code ''{0}'' is not valid in the value set {1}
CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID = The target display ''{0}'' is not valid. Possible displays {1} CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID = The target display ''{0}'' is not valid. Possible displays {1}
CONCEPTMAP_GROUP_TARGET_PROPERTY_INVALID = The property code ''{0}'' is not known CONCEPTMAP_GROUP_TARGET_PROPERTY_INVALID = The property code ''{0}'' is not known
CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_MISMATCH = The type of this property should be {1} not {0} CONCEPTMAP_GROUP_TARGET_PROPERTY_TYPE_MISMATCH = The type of this property should be {1} not {0}
@ -1043,4 +1045,7 @@ CODESYSTEM_CS_COUNT_NO_CONTENT_ALLOWED = The code system says it has no content
VALUESET_CIRCULAR_REFERENCE = Found a circularity pointing to {0} processing ValueSet with pathway {1} VALUESET_CIRCULAR_REFERENCE = Found a circularity pointing to {0} processing ValueSet with pathway {1}
VALUESET_SUPPLEMENT_MISSING_one = Required supplement not found: {1} VALUESET_SUPPLEMENT_MISSING_one = Required supplement not found: {1}
VALUESET_SUPPLEMENT_MISSING_other = Required supplements not found: {1} VALUESET_SUPPLEMENT_MISSING_other = Required supplements not found: {1}
CONCEPTMAP_VS_TOO_MANY_CODES = The concept map has too many codes to validate ({0})
CONCEPTMAP_VS_INVALID_CONCEPT_CODE = The code ''{1}'' in the system {0} is not valid in the value set ''{2}''
CONCEPTMAP_VS_INVALID_CONCEPT_CODE_VER = The code ''{2}'' in the system {0} version {1} is not valid in the value set ''{3}''
VALUESET_INC_TOO_MANY_CODES = The value set include has too many codes to validate ({0})

View File

@ -1,15 +1,19 @@
package org.hl7.fhir.validation.instance.type; package org.hl7.fhir.validation.instance.type;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.context.IWorkerContext.CodingValidationRequest;
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
import org.hl7.fhir.r5.elementmodel.Element; import org.hl7.fhir.r5.elementmodel.Element;
import org.hl7.fhir.r5.model.CodeSystem; import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r5.model.Coding; import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.Enumerations.CodeSystemContentMode; import org.hl7.fhir.r5.model.Enumerations.CodeSystemContentMode;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.utils.XVerExtensionManager; import org.hl7.fhir.r5.utils.XVerExtensionManager;
import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.VersionUtilities;
@ -21,11 +25,15 @@ import org.hl7.fhir.utilities.validation.ValidationOptions;
import org.hl7.fhir.validation.BaseValidator; import org.hl7.fhir.validation.BaseValidator;
import org.hl7.fhir.validation.TimeTracker; import org.hl7.fhir.validation.TimeTracker;
import org.hl7.fhir.validation.instance.InstanceValidator; import org.hl7.fhir.validation.instance.InstanceValidator;
import org.hl7.fhir.validation.instance.type.ValueSetValidator.VSCodingValidationRequest;
import org.hl7.fhir.validation.instance.utils.NodeStack; import org.hl7.fhir.validation.instance.utils.NodeStack;
public class ConceptMapValidator extends BaseValidator { public class ConceptMapValidator extends BaseValidator {
public class PropertyDefinition { private static final int TOO_MANY_CODES_TO_VALIDATE = 1000;
public static class PropertyDefinition {
private String type; private String type;
private String system; private String system;
private CodeSystem cs; private CodeSystem cs;
@ -44,10 +52,57 @@ public class ConceptMapValidator extends BaseValidator {
public CodeSystem getCs() { public CodeSystem getCs() {
return cs; return cs;
} }
}
public static class CSReference {
private String url;
private String version;
private CodeSystem cs;
}
public static class VSReference {
private String url;
private String version;
private ValueSet vs;
}
public static class GroupContext {
private VSReference sourceScope;
private VSReference targetScope;
private CSReference source;
private CSReference target;
public boolean hasSourceCS() {
return source != null && source.cs != null;
}
public boolean hasSourceVS() {
return sourceScope != null && sourceScope.vs != null;
}
public boolean hasTargetCS() {
return target != null && target.cs != null;
}
public boolean hasTargetVS() {
return targetScope != null && targetScope.vs != null;
}
} }
public class CMCodingValidationRequest extends CodingValidationRequest {
private NodeStack stack;
public CMCodingValidationRequest(NodeStack stack, Coding code, ValueSet vs) {
super(code, vs);
this.stack = stack;
}
public NodeStack getStack() {
return stack;
}
}
private List<CMCodingValidationRequest> batch = new ArrayList<>();
public ConceptMapValidator(BaseValidator parent) { public ConceptMapValidator(BaseValidator parent) {
super(parent); super(parent);
} }
@ -84,100 +139,194 @@ public class ConceptMapValidator extends BaseValidator {
} }
} }
} }
VSReference sourceScope = readVSReference(cm, "sourceScope", "source");
VSReference targetScope = readVSReference(cm, "targetScope", "target");
List<Element> groups = cm.getChildrenByName("group"); List<Element> groups = cm.getChildrenByName("group");
int ci = 0; int ci = 0;
for (Element group : groups) { for (Element group : groups) {
ok = validateGroup(errors, group, stack.push(group, ci, null, null), props, attribs) && ok; ok = validateGroup(errors, group, stack.push(group, ci, null, null), props, attribs, options, sourceScope, targetScope) && ok;
ci++; ci++;
} }
if (!stack.isContained()) { if (!stack.isContained()) {
ok = checkShareableConceptMap(errors, cm, stack) && ok; ok = checkShareableConceptMap(errors, cm, stack) && ok;
} }
if (!batch.isEmpty()) {
if (batch.size() > TOO_MANY_CODES_TO_VALIDATE) {
ok = hint(errors, "2023-09-06", IssueType.BUSINESSRULE, stack.getLiteralPath(), false, I18nConstants.CONCEPTMAP_VS_TOO_MANY_CODES, batch.size()) && ok;
} else {
try {
long t = System.currentTimeMillis();
context.validateCodeBatch(ValidationOptions.defaults(), batch, null);
if (isDebug()) {
System.out.println(" : .. "+(System.currentTimeMillis()-t)+"ms");
}
for (CMCodingValidationRequest cv : batch) {
if (cv.getCoding().getVersion() == null) {
ok = rule(errors, "2023-09-06", IssueType.BUSINESSRULE, cv.getStack(), cv.getResult().isOk(), I18nConstants.CONCEPTMAP_VS_INVALID_CONCEPT_CODE, cv.getCoding().getSystem(), cv.getCoding().getCode(), cv.getVsObj().getUrl()) && ok;
} else {
ok = rule(errors, "2023-09-06", IssueType.BUSINESSRULE, cv.getStack(), cv.getResult().isOk(), I18nConstants.CONCEPTMAP_VS_INVALID_CONCEPT_CODE_VER, cv.getCoding().getSystem(), cv.getCoding().getVersion(), cv.getCoding().getCode(), cv.getVsObj().getUrl()) && ok;
}
}
} catch (Exception e) {
ok = false;
CMCodingValidationRequest cv = batch.get(0);
rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, cv.getStack().getLiteralPath(), false, e.getMessage());
}
}
}
return ok; return ok;
} }
private boolean validateGroup(List<ValidationMessage> errors, Element grp, NodeStack stack, Map<String, PropertyDefinition> props, Map<String, String> attribs) { private VSReference readVSReference(Element cm, String... names) {
for (String n : names) {
if (cm.hasChild(n)) {
Element e = cm.getNamedChild(n);
String ref = null;
if (e.isPrimitive()) {
ref = e.primitiveValue();
} else if (e.hasChild("reference")) {
ref = e.getNamedChildValue("reference");
}
if (ref != null) {
VSReference res = new VSReference();
if (ref.contains("|")) {
res.url = ref.substring(0, ref.indexOf("|"));
res.version = ref.substring(ref.indexOf("|")+1);
res.vs = context.fetchResource(ValueSet.class, res.url, res.version);
} else {
res.url = ref;
res.vs = context.fetchResource(ValueSet.class, res.url);
}
return res;
}
}
}
return null;
}
private boolean validateGroup(List<ValidationMessage> errors, Element grp, NodeStack stack, Map<String, PropertyDefinition> props, Map<String, String> attribs, ValidationOptions options, VSReference sourceScope, VSReference targetScope) {
boolean ok = true; boolean ok = true;
CodeSystem srcCS = null; GroupContext ctxt = new GroupContext();
CodeSystem tgtCS = null; ctxt.sourceScope = sourceScope;
ctxt.targetScope = targetScope;
Element e = grp.getNamedChild("source"); Element e = grp.getNamedChild("source");
if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_MISSING)) { if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_MISSING)) {
srcCS = context.fetchCodeSystem(e.getValue()); ctxt.source = readCSReference(e, grp.getNamedChild("sourceVersion"));
if (warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), srcCS != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_UNKNOWN, e.getValue())) { if (ctxt.source.cs != null) {
if (srcCS.getContent() == CodeSystemContentMode.NOTPRESENT) { if (ctxt.source.cs.getContent() == CodeSystemContentMode.NOTPRESENT) {
srcCS = null; ctxt.source.cs = null;
} else if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(srcCS), I18nConstants.CONCEPTMAP_GROUP_SOURCE_INCOMPLETE, e.getValue(), srcCS.getContent().toCode())) { } else if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(ctxt.source.cs), I18nConstants.CONCEPTMAP_GROUP_SOURCE_INCOMPLETE, e.getValue(), ctxt.source.cs.getContent().toCode())) {
srcCS = null; ctxt.source.cs = null;
}
} else {
warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), sourceScope != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_UNKNOWN, e.getValue());
} }
};
} }
e = grp.getNamedChild("target"); e = grp.getNamedChild("target");
if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_MISSING)) { if (warning(errors, "2023-03-05", IssueType.REQUIRED, grp.line(), grp.col(), stack.getLiteralPath(), e != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_MISSING)) {
tgtCS = context.fetchCodeSystem(e.getValue()); ctxt.target = readCSReference(e, grp.getNamedChild("targetVersion"));
if (warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), tgtCS != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_UNKNOWN, e.getValue())) { if (ctxt.target.cs != null) {
if (tgtCS.getContent() == CodeSystemContentMode.NOTPRESENT) { if (ctxt.target.cs.getContent() == CodeSystemContentMode.NOTPRESENT) {
tgtCS = null; ctxt.target.cs = null;
} else if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(tgtCS), I18nConstants.CONCEPTMAP_GROUP_TARGET_INCOMPLETE, e.getValue(), tgtCS.getContent().toCode())) { } else if (!warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), isOkCodeSystem(ctxt.target.cs), I18nConstants.CONCEPTMAP_GROUP_TARGET_INCOMPLETE, e.getValue(), ctxt.target.cs.getContent().toCode())) {
tgtCS = null; ctxt.target.cs = null;
} }
} else {
warning(errors, "2023-03-05", IssueType.NOTFOUND, grp.line(), grp.col(), stack.push(e, -1, null, null).getLiteralPath(), targetScope != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_UNKNOWN, e.getValue());
} }
} }
List<Element> elements = grp.getChildrenByName("element"); List<Element> elements = grp.getChildrenByName("element");
int ci = 0; int ci = 0;
for (Element element : elements) { for (Element element : elements) {
ok = validateGroupElement(errors, element, stack.push(element, ci, null, null), srcCS, tgtCS, props, attribs) && ok; ok = validateGroupElement(errors, element, stack.push(element, ci, null, null), props, attribs, options, ctxt) && ok;
ci++; ci++;
} }
return ok; return ok;
} }
private CSReference readCSReference(Element ref, Element version) {
CSReference res = new CSReference();
res.url = ref.primitiveValue();
if (version != null) {
res.version = version.primitiveValue();
} else if (res.url.contains("|")) {
res.version = res.url.substring(res.url.indexOf("|")+1);
res.url = res.url.substring(0, res.url.indexOf("|"));
}
res.cs = context.fetchCodeSystem(res.url, res.version);
return res;
}
private boolean isOkCodeSystem(CodeSystem tgtCS) { private boolean isOkCodeSystem(CodeSystem tgtCS) {
return tgtCS.getContent() != CodeSystemContentMode.EXAMPLE && tgtCS.getContent() != CodeSystemContentMode.FRAGMENT; return tgtCS.getContent() != CodeSystemContentMode.EXAMPLE && tgtCS.getContent() != CodeSystemContentMode.FRAGMENT;
} }
private boolean validateGroupElement(List<ValidationMessage> errors, Element src, NodeStack stack, CodeSystem srcCS, CodeSystem tgtCS, Map<String, PropertyDefinition> props, Map<String, String> attribs) { private boolean validateGroupElement(List<ValidationMessage> errors, Element src, NodeStack stack, Map<String, PropertyDefinition> props, Map<String, String> attribs, ValidationOptions options, GroupContext ctxt) {
boolean ok = true; boolean ok = true;
Element code = src.getNamedChild("code"); Element code = src.getNamedChild("code");
if (code != null && srcCS != null) { if (code != null) {
NodeStack cstack = stack.push(code, -1, null, null);
if (ctxt.hasSourceCS()) {
String c = code.getValue(); String c = code.getValue();
ConceptDefinitionComponent cd = CodeSystemUtilities.getCode(srcCS, c); ConceptDefinitionComponent cd = CodeSystemUtilities.getCode(ctxt.source.cs, c);
if (warningOrError(srcCS.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), cd != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_CODE_INVALID, c, srcCS.getVersionedUrl())) { if (warningOrError(ctxt.source.cs.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), cstack.getLiteralPath(), cd != null, I18nConstants.CONCEPTMAP_GROUP_SOURCE_CODE_INVALID, c, ctxt.source.cs.getVersionedUrl())) {
Element display = src.getNamedChild("display"); Element display = src.getNamedChild("display");
if (display != null) { if (display != null) {
warning(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), CodeSystemUtilities.checkDisplay(srcCS, cd, display.getValue()), I18nConstants.CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID, display.getValue(), CodeSystemUtilities.getDisplays(srcCS, cd)); warning(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), cstack.getLiteralPath(), CodeSystemUtilities.checkDisplay(ctxt.source.cs, cd, display.getValue()), I18nConstants.CONCEPTMAP_GROUP_SOURCE_DISPLAY_INVALID, display.getValue(), CodeSystemUtilities.getDisplays(ctxt.source.cs, cd));
}
if (ctxt.hasSourceVS() && ctxt.source != null) {
ValidationResult vr = context.validateCode(options.withCheckValueSetOnly().withNoServer(), ctxt.source.url, ctxt.source.version, c, null, ctxt.sourceScope.vs);
warningOrError(ctxt.source.cs.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-09-06", IssueType.REQUIRED, code.line(), code.col(), cstack.getLiteralPath(), vr.isOk(), I18nConstants.CONCEPTMAP_GROUP_SOURCE_CODE_INVALID_VS, c, ctxt.sourceScope.vs.getVersionedUrl());
} }
} else { } else {
ok = false; ok = false;
} }
} else {
addToBatch(code, cstack, ctxt.source, ctxt.sourceScope);
}
} }
List<Element> targets = src.getChildrenByName("target"); List<Element> targets = src.getChildrenByName("target");
int ci = 0; int ci = 0;
for (Element target : targets) { for (Element target : targets) {
ok = validateGroupElementTarget(errors, target, stack.push(target, ci, null, null), srcCS, tgtCS, props, attribs) && ok; ok = validateGroupElementTarget(errors, target, stack.push(target, ci, null, null), props, attribs, options, ctxt) && ok;
ci++; ci++;
} }
return ok; return ok;
} }
private boolean validateGroupElementTarget(List<ValidationMessage> errors, Element tgt, NodeStack stack, CodeSystem srcCS, CodeSystem tgtCS, Map<String, PropertyDefinition> props, Map<String, String> attribs) { private boolean validateGroupElementTarget(List<ValidationMessage> errors, Element tgt, NodeStack stack, Map<String, PropertyDefinition> props, Map<String, String> attribs, ValidationOptions options, GroupContext ctxt) {
boolean ok = true; boolean ok = true;
Element code = tgt.getNamedChild("code"); Element code = tgt.getNamedChild("code");
if (code != null && tgtCS != null) { if (code != null) {
NodeStack cstack = stack.push(code, -1, null, null);
if (ctxt.hasTargetCS()) {
String c = code.getValue(); String c = code.getValue();
ConceptDefinitionComponent cd = CodeSystemUtilities.getCode(tgtCS, c); ConceptDefinitionComponent cd = CodeSystemUtilities.getCode(ctxt.target.cs, c);
if (warningOrError(tgtCS.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), cd != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_CODE_INVALID, c, tgtCS.getVersionedUrl())) { if (warningOrError(ctxt.target.cs.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), cstack.getLiteralPath(), cd != null, I18nConstants.CONCEPTMAP_GROUP_TARGET_CODE_INVALID, c, ctxt.target.cs.getVersionedUrl())) {
Element display = tgt.getNamedChild("display"); Element display = tgt.getNamedChild("display");
if (display != null) { if (display != null) {
warning(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), stack.push(code, -1, null, null).getLiteralPath(), CodeSystemUtilities.checkDisplay(tgtCS, cd, display.getValue()), I18nConstants.CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID, display.getValue(), CodeSystemUtilities.getDisplays(tgtCS, cd)); warning(errors, "2023-03-05", IssueType.REQUIRED, code.line(), code.col(), cstack.getLiteralPath(), CodeSystemUtilities.checkDisplay(ctxt.target.cs, cd, display.getValue()), I18nConstants.CONCEPTMAP_GROUP_TARGET_DISPLAY_INVALID, display.getValue(), CodeSystemUtilities.getDisplays(ctxt.target.cs, cd));
}
if (ctxt.hasTargetVS() && ctxt.target != null) {
ValidationResult vr = context.validateCode(options.withCheckValueSetOnly().withNoServer(), ctxt.target.url, ctxt.target.version, c, null, ctxt.targetScope.vs);
warningOrError(ctxt.target.cs.getContent() == CodeSystemContentMode.COMPLETE, errors, "2023-09-06", IssueType.REQUIRED, code.line(), code.col(), cstack.getLiteralPath(), vr.isOk(), I18nConstants.CONCEPTMAP_GROUP_SOURCE_CODE_INVALID_VS, c, ctxt.targetScope.vs.getVersionedUrl());
} }
} else { } else {
ok = false; ok = false;
} }
} else {
addToBatch(code, cstack, ctxt.target, ctxt.targetScope);
}
} }
if (VersionUtilities.isR5Plus(context.getVersion())) { if (VersionUtilities.isR5Plus(context.getVersion())) {
@ -224,7 +373,6 @@ public class ConceptMapValidator extends BaseValidator {
} else { } else {
ok = false; ok = false;
} }
} else { } else {
ok = false; ok = false;
} }
@ -271,4 +419,12 @@ public class ConceptMapValidator extends BaseValidator {
} }
private void addToBatch(Element code, NodeStack stack, CSReference system, VSReference scope) {
if (scope.vs != null) {
Coding c = new Coding(system.url, code.primitiveValue(), null).setVersion(system.version);
batch.add(new CMCodingValidationRequest(stack, c, scope.vs));
}
}
} }

View File

@ -25,6 +25,8 @@ import org.hl7.fhir.validation.instance.utils.NodeStack;
public class ValueSetValidator extends BaseValidator { public class ValueSetValidator extends BaseValidator {
private static final int TOO_MANY_CODES_TO_VALIDATE = 1000;
private CodeSystemChecker getSystemValidator(String system, List<ValidationMessage> errors) { private CodeSystemChecker getSystemValidator(String system, List<ValidationMessage> errors) {
if (system == null) { if (system == null) {
return new GeneralCodeSystemChecker(context, xverManager, debug, errors); return new GeneralCodeSystemChecker(context, xverManager, debug, errors);
@ -149,7 +151,7 @@ public class ValueSetValidator extends BaseValidator {
List<VSCodingValidationRequest> batch = new ArrayList<>(); List<VSCodingValidationRequest> batch = new ArrayList<>();
boolean first = true; boolean first = true;
for (Element concept : concepts) { for (Element concept : concepts) {
// we treat the first differently because we want to know if tbe system is worth validating. if it is, then we batch the rest // we treat the first differently because we want to know if the system is worth validating. if it is, then we batch the rest
if (first) { if (first) {
systemOk = validateValueSetIncludeConcept(errors, concept, stack, stack.push(concept, cc, null, null), system, version, slv); systemOk = validateValueSetIncludeConcept(errors, concept, stack, stack.push(concept, cc, null, null), system, version, slv);
first = false; first = false;
@ -159,6 +161,9 @@ public class ValueSetValidator extends BaseValidator {
cc++; cc++;
} }
if (((InstanceValidator) parent).isValidateValueSetCodesOnTxServer() && batch.size() > 0 & !context.isNoTerminologyServer()) { if (((InstanceValidator) parent).isValidateValueSetCodesOnTxServer() && batch.size() > 0 & !context.isNoTerminologyServer()) {
if (batch.size() > TOO_MANY_CODES_TO_VALIDATE) {
ok = hint(errors, "2023-09-06", IssueType.BUSINESSRULE, stack.getLiteralPath(), false, I18nConstants.VALUESET_INC_TOO_MANY_CODES, batch.size()) && ok;
} else {
long t = System.currentTimeMillis(); long t = System.currentTimeMillis();
if (parent.isDebug()) { if (parent.isDebug()) {
System.out.println(" : Validate "+batch.size()+" codes from "+system+" for "+vsid); System.out.println(" : Validate "+batch.size()+" codes from "+system+" for "+vsid);
@ -181,6 +186,7 @@ public class ValueSetValidator extends BaseValidator {
rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, cv.getStack().getLiteralPath(), false, e.getMessage()); rule(errors, NO_RULE_DATE, IssueType.EXCEPTION, cv.getStack().getLiteralPath(), false, e.getMessage());
} }
} }
}
int cf = 0; int cf = 0;
for (Element filter : filters) { for (Element filter : filters) {

View File

@ -417,7 +417,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
private ValidationEngine buildVersionEngine(String ver, String txLog) throws Exception { private ValidationEngine buildVersionEngine(String ver, String txLog) throws Exception {
String server = FhirSettings.getTxFhirLocal(); String server = FhirSettings.getTxFhirDevelopment();
switch (ver) { switch (ver) {
case "1.0": return TestUtilities.getValidationEngine("hl7.fhir.r2.core#1.0.2", server, txLog, FhirPublication.DSTU2, true, "1.0.2"); case "1.0": return TestUtilities.getValidationEngine("hl7.fhir.r2.core#1.0.2", server, txLog, FhirPublication.DSTU2, true, "1.0.2");
case "1.4": return TestUtilities.getValidationEngine("hl7.fhir.r2b.core#1.4.0", server, txLog, FhirPublication.DSTU2016May, true, "1.4.0"); case "1.4": return TestUtilities.getValidationEngine("hl7.fhir.r2b.core#1.4.0", server, txLog, FhirPublication.DSTU2016May, true, "1.4.0");

View File

@ -12,7 +12,6 @@ v: {
"display" : "application/octet-stream", "display" : "application/octet-stream",
"code" : "application/octet-stream", "code" : "application/octet-stream",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -31,7 +30,6 @@ v: {
v: { v: {
"code" : "de-CH", "code" : "de-CH",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -51,7 +49,6 @@ v: {
"display" : "application/pdf", "display" : "application/pdf",
"code" : "application/pdf", "code" : "application/pdf",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -73,7 +70,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "Wrong Display Name 'Patient Authorization Signature' for http://loinc.org#59284-0 - should be one of 2 choices: 'Consent Document' or 'Consent' (for the language(s) 'en') (from Tx-Server)", "error" : "Wrong Display Name 'Patient Authorization Signature' for http://loinc.org#59284-0 - should be one of 2 choices: 'Consent Document' or 'Consent' (for the language(s) 'en') (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -93,7 +89,6 @@ v: {
"display" : "image/*", "display" : "image/*",
"code" : "image/*", "code" : "image/*",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -114,7 +109,6 @@ v: {
"code" : "d", "code" : "d",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -133,7 +127,6 @@ v: {
v: { v: {
"code" : "en-IN", "code" : "en-IN",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -153,7 +146,6 @@ v: {
"display" : "image/jpg", "display" : "image/jpg",
"code" : "image/jpg", "code" : "image/jpg",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -174,7 +166,6 @@ v: {
"code" : "min", "code" : "min",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -195,7 +186,6 @@ v: {
"code" : "mmol/L", "code" : "mmol/L",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -216,7 +206,6 @@ v: {
"code" : "%", "code" : "%",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -237,7 +226,6 @@ v: {
"code" : "kg", "code" : "kg",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -257,7 +245,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#cm' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#cm' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -278,7 +265,6 @@ v: {
"code" : "cm", "code" : "cm",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -298,7 +284,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#kg/m2' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#kg/m2' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -321,7 +306,6 @@ v: {
"code" : "112144000", "code" : "112144000",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -341,7 +325,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#kg' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#kg' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -361,7 +344,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#kg/m2' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#kg/m2' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -382,7 +364,6 @@ v: {
"code" : "wk", "code" : "wk",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -405,7 +386,6 @@ v: {
"code" : "722446000", "code" : "722446000",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -428,7 +408,6 @@ v: {
"code" : "371531000", "code" : "371531000",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -451,7 +430,6 @@ v: {
"code" : "4241000179101", "code" : "4241000179101",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -474,7 +452,6 @@ v: {
"code" : "422735006", "code" : "422735006",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -494,7 +471,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#min' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#min' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -514,7 +490,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#min' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#min' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -534,7 +509,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#min' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#min' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -554,7 +528,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#mmol/L' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#mmol/L' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -574,7 +547,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#mmol/L' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#mmol/L' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -594,7 +566,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#mmol/L' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#mmol/L' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -614,7 +585,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#%' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#%' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -634,7 +604,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#%' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#%' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -654,7 +623,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#%' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#%' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -674,7 +642,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#wk' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#wk' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodyweight|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -694,7 +661,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#wk' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#wk' is not in the value set 'http://hl7.org/fhir/ValueSet/ucum-bodylength|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -714,7 +680,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#kg' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#kg' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -735,7 +700,6 @@ v: {
"code" : "kg", "code" : "kg",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -755,7 +719,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#cm' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#cm' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -776,7 +739,6 @@ v: {
"code" : "cm", "code" : "cm",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -796,7 +758,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "The provided code 'http://unitsofmeasure.org#kg/m2' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)", "error" : "The provided code 'http://unitsofmeasure.org#kg/m2' is not in the value set 'https://mednet.swiss/fhir/ValueSet/mni-timeOfGestation|0.5.0' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -817,7 +778,6 @@ v: {
"code" : "kg/m2", "code" : "kg/m2",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -838,7 +798,6 @@ v: {
"code" : "wk", "code" : "wk",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -858,7 +817,6 @@ v: {
"display" : "json", "display" : "json",
"code" : "json", "code" : "json",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -878,7 +836,6 @@ v: {
"display" : "xml", "display" : "xml",
"code" : "xml", "code" : "xml",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -898,7 +855,6 @@ v: {
"display" : "application/fhir+json", "display" : "application/fhir+json",
"code" : "application/fhir+json", "code" : "application/fhir+json",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -918,7 +874,6 @@ v: {
"display" : "text/plain", "display" : "text/plain",
"code" : "text/plain", "code" : "text/plain",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -940,7 +895,6 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "Wrong Display Name 'Progress note' for http://snomed.info/sct#371532007 - should be one of 3 choices: 'Progress report', 'Report of subsequent visit' or 'Progress report (record artifact)' (for the language(s) '--') (from Tx-Server)", "error" : "Wrong Display Name 'Progress note' for http://snomed.info/sct#371532007 - should be one of 3 choices: 'Progress report', 'Report of subsequent visit' or 'Progress report (record artifact)' (for the language(s) '--') (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -963,7 +917,6 @@ v: {
"code" : "371525003", "code" : "371525003",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -983,7 +936,6 @@ v: {
"display" : "text/css", "display" : "text/css",
"code" : "text/css", "code" : "text/css",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1003,7 +955,6 @@ v: {
"display" : "German (Switzerland)", "display" : "German (Switzerland)",
"code" : "de-CH", "code" : "de-CH",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1026,7 +977,6 @@ v: {
"code" : "34133-9", "code" : "34133-9",
"system" : "http://loinc.org", "system" : "http://loinc.org",
"version" : "2.74", "version" : "2.74",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1046,7 +996,6 @@ v: {
"display" : "English (United States)", "display" : "English (United States)",
"code" : "en-US", "code" : "en-US",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1066,7 +1015,6 @@ v: {
"display" : "application/xml", "display" : "application/xml",
"code" : "application/xml", "code" : "application/xml",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1086,7 +1034,6 @@ v: {
"display" : "text/xml", "display" : "text/xml",
"code" : "text/xml", "code" : "text/xml",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1109,7 +1056,6 @@ v: {
"code" : "US", "code" : "US",
"system" : "urn:iso:std:iso:3166", "system" : "urn:iso:std:iso:3166",
"version" : "2018", "version" : "2018",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1129,7 +1075,6 @@ v: {
"display" : "text/cql.identifier", "display" : "text/cql.identifier",
"code" : "text/cql.identifier", "code" : "text/cql.identifier",
"system" : "urn:ietf:bcp:13", "system" : "urn:ietf:bcp:13",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1174,7 +1119,6 @@ v: {
"code" : "Not-at-all", "code" : "Not-at-all",
"system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9", "system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9",
"version" : "3.0.0", "version" : "3.0.0",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1219,7 +1163,6 @@ v: {
"code" : "Several-days", "code" : "Several-days",
"system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9", "system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9",
"version" : "3.0.0", "version" : "3.0.0",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1264,7 +1207,6 @@ v: {
"code" : "More than half the days", "code" : "More than half the days",
"system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9", "system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9",
"version" : "3.0.0", "version" : "3.0.0",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1309,7 +1251,6 @@ v: {
"code" : "Nearly every day", "code" : "Nearly every day",
"system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9", "system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/CSPHQ9",
"version" : "3.0.0", "version" : "3.0.0",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1330,7 +1271,6 @@ v: {
"code" : "kg", "code" : "kg",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1349,7 +1289,6 @@ v: {
v: { v: {
"code" : "en-AU", "code" : "en-AU",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1369,7 +1308,6 @@ v: {
"display" : "English", "display" : "English",
"code" : "en", "code" : "en",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1388,7 +1326,6 @@ v: {
v: { v: {
"code" : "en-US", "code" : "en-US",
"system" : "urn:ietf:bcp:47", "system" : "urn:ietf:bcp:47",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1409,7 +1346,6 @@ v: {
"code" : "wk", "code" : "wk",
"system" : "http://unitsofmeasure.org", "system" : "http://unitsofmeasure.org",
"version" : "2.0.1", "version" : "2.0.1",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1431,7 +1367,6 @@ v: {
"code" : "US", "code" : "US",
"system" : "urn:iso:std:iso:3166", "system" : "urn:iso:std:iso:3166",
"version" : "2018", "version" : "2018",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -1451,6 +1386,27 @@ v: {
"severity" : "error", "severity" : "error",
"error" : "Unknown Code '[%payloadFormat%]' in the system 'urn:ietf:bcp:13'; The provided code 'urn:ietf:bcp:13#[%payloadFormat%]' is not in the value set 'http://hl7.org/fhir/ValueSet/mimetypes|4.0.1' (from Tx-Server)", "error" : "Unknown Code '[%payloadFormat%]' in the system 'urn:ietf:bcp:13'; The provided code 'urn:ietf:bcp:13#[%payloadFormat%]' is not in the value set 'http://hl7.org/fhir/ValueSet/mimetypes|4.0.1' (from Tx-Server)",
"class" : "UNKNOWN", "class" : "UNKNOWN",
"issues" : {
"resourceType" : "OperationOutcome"
}
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "urn:iso:std:iso:3166",
"code" : "CHE"
}, "url": "http://hl7.org/fhir/ValueSet/jurisdiction", "version": "4.0.1", "langs":"", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"NO_MEMBERSHIP_CHECK", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
"resourceType" : "Parameters",
"parameter" : [{
"name" : "profile-url",
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
}]
}}####
v: {
"display" : "Switzerland",
"code" : "CHE",
"system" : "urn:iso:std:iso:3166",
"version" : "2018",
"unknown-systems" : "", "unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"

View File

@ -40,6 +40,48 @@ v: {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "urn:iso:std:iso:3166",
"code" : "CHE"
}, "url": "http://hl7.org/fhir/ValueSet/jurisdiction--0", "version": "4.0.1", "langs":"", "useServer":"true", "useClient":"false", "guessSystem":"false", "valueSetMode":"CHECK_MEMERSHIP_ONLY", "displayWarningMode":"false", "versionFlexible":"false", "profile": {
"resourceType" : "Parameters",
"parameter" : [{
"name" : "profile-url",
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
}]
}}####
v: {
"display" : "Switzerland",
"code" : "CHE",
"system" : "urn:iso:std:iso:3166",
"version" : "2018",
"issues" : {
"resourceType" : "OperationOutcome"
}
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "urn:iso:std:iso:3166",
"code" : "CHE"
}, "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" : "Switzerland",
"code" : "CHE",
"system" : "urn:iso:std:iso:3166",
"version" : "2018",
"issues" : {
"resourceType" : "OperationOutcome"
}
} }
------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------
{"code" : { {"code" : {

View File

@ -2771,7 +2771,6 @@ v: {
"code" : "38341003", "code" : "38341003",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -2794,7 +2793,6 @@ v: {
"code" : "42343007", "code" : "42343007",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"
} }
@ -2817,6 +2815,69 @@ v: {
"code" : "9014002", "code" : "9014002",
"system" : "http://snomed.info/sct", "system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/900000000000207008/version/20230731", "version" : "http://snomed.info/sct/900000000000207008/version/20230731",
"issues" : {
"resourceType" : "OperationOutcome"
}
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/2011000195101",
"code" : "264358009"
}, "url": "http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType", "version": "0.1.0", "langs":"en, en-US", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"true", "profile": {
"resourceType" : "Parameters",
"parameter" : [{
"name" : "profile-url",
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
}]
}}####
v: {
"code" : "264358009",
"system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/2011000195101/version/20230607",
"issues" : {
"resourceType" : "OperationOutcome"
}
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/2011000195101",
"code" : "264372000"
}, "url": "http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType", "version": "0.1.0", "langs":"en, en-US", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"true", "profile": {
"resourceType" : "Parameters",
"parameter" : [{
"name" : "profile-url",
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
}]
}}####
v: {
"code" : "264372000",
"system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/2011000195101/version/20230607",
"issues" : {
"resourceType" : "OperationOutcome"
}
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "http://snomed.info/sct",
"version" : "http://snomed.info/sct/2011000195101",
"code" : "46224007"
}, "url": "http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType", "version": "0.1.0", "langs":"en, en-US", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "displayWarningMode":"false", "versionFlexible":"true", "profile": {
"resourceType" : "Parameters",
"parameter" : [{
"name" : "profile-url",
"valueString" : "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"
}]
}}####
v: {
"severity" : "error",
"error" : "The provided code 'http://snomed.info/sct|http://snomed.info/sct/2011000195101#46224007' is not in the value set 'http://fhir.ch/ig/ch-ig/ValueSet/OrganizationType|0.1.0' (from Tx-Server)",
"class" : "UNKNOWN",
"unknown-systems" : "", "unknown-systems" : "",
"issues" : { "issues" : {
"resourceType" : "OperationOutcome" "resourceType" : "OperationOutcome"