Always report version on validation, and use the correct type for version in expansion parameters
This commit is contained in:
parent
40d73ba2ad
commit
0b71add74c
|
@ -193,6 +193,10 @@ public interface IWorkerContext {
|
|||
this.system = system;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return definition == null ? null : definition.getCode();
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.NoTerminologyServiceException;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
|
@ -252,6 +253,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
|
|||
public ValidationResult validateCode(String path, CodeableConcept code) throws FHIRException {
|
||||
// first, we validate the codings themselves
|
||||
ValidationProcessInfo info = new ValidationProcessInfo();
|
||||
|
||||
if (options.getValueSetMode() != ValueSetMode.CHECK_MEMERSHIP_ONLY) {
|
||||
int i = 0;
|
||||
for (Coding c : code.getCoding()) {
|
||||
|
@ -273,6 +275,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
|
|||
res = context.validateCode(options.withNoClient(), c, null);
|
||||
}
|
||||
} else {
|
||||
c.setUserData("cs", cs);
|
||||
res = validateCode(path+".coding["+i+"]", c, cs);
|
||||
}
|
||||
info.getIssues().addAll(res.getIssues());
|
||||
|
@ -309,6 +312,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
|
|||
cd.setDisplay(lookupDisplay(foundCoding));
|
||||
res.setDefinition(cd);
|
||||
res.setSystem(foundCoding.getSystem());
|
||||
res.setVersion(foundCoding.hasVersion() ? foundCoding.getVersion() : ((CodeSystem) foundCoding.getUserData("cs")).getVersion());
|
||||
res.setDisplay(cd.getDisplay());
|
||||
}
|
||||
return res;
|
||||
|
@ -318,11 +322,11 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
|
|||
String disp = lookupDisplay(foundCoding);
|
||||
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
|
||||
cd.setDisplay(disp);
|
||||
return new ValidationResult(IssueSeverity.WARNING, info.summary(), foundCoding.getSystem(), foundCoding.getVersion(), cd, disp, info.getIssues());
|
||||
return new ValidationResult(IssueSeverity.WARNING, info.summary(), foundCoding.getSystem(), foundCoding.hasVersion() ? foundCoding.getVersion() : ((CodeSystem) foundCoding.getUserData("cs")).getVersion(), cd, disp, info.getIssues());
|
||||
} else {
|
||||
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
|
||||
cd.setDisplay(lookupDisplay(foundCoding));
|
||||
return new ValidationResult(foundCoding.getSystem(), foundCoding.getVersion(), cd, getPreferredDisplay(cd, null));
|
||||
return new ValidationResult(foundCoding.getSystem(), foundCoding.hasVersion() ? foundCoding.getVersion() : ((CodeSystem) foundCoding.getUserData("cs")).getVersion(), cd, getPreferredDisplay(cd, null));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -583,9 +587,9 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
|
|||
}
|
||||
for (ConceptSetComponent inc : valueset.getCompose().getInclude()) {
|
||||
if (inc.hasSystem() && inc.getSystem().equals(code.getSystem())) {
|
||||
vi.setComposeVersion(inc.getVersion());
|
||||
for (ConceptReferenceComponent cc : inc.getConcept()) {
|
||||
if (cc.hasCode() && cc.getCode().equals(code.getCode())) {
|
||||
vi.setComposeVersion(inc.getVersion());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ import org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent;
|
|||
import org.hl7.fhir.r5.model.PrimitiveType;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.UriType;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent;
|
||||
|
@ -688,7 +689,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
|
|||
throw fail("Unable to expand imported value set "+vs.getUrl()+": " + vso.getError());
|
||||
}
|
||||
if (vs.hasVersion() || REPORT_VERSION_ANYWAY) {
|
||||
CanonicalType u = new CanonicalType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : ""));
|
||||
UriType u = new UriType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : ""));
|
||||
if (!existsInParams(exp.getParameter(), "version", u))
|
||||
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u));
|
||||
}
|
||||
|
@ -801,7 +802,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
|
|||
}
|
||||
ValueSet vs = vso.getValueset();
|
||||
if (vs.hasVersion() || REPORT_VERSION_ANYWAY) {
|
||||
CanonicalType u = new CanonicalType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : ""));
|
||||
UriType u = new UriType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : ""));
|
||||
if (!existsInParams(exp.getParameter(), "version", u)) {
|
||||
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u));
|
||||
}
|
||||
|
@ -835,7 +836,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx
|
|||
if (cs.getContent() != CodeSystemContentMode.COMPLETE && cs.getContent() != CodeSystemContentMode.FRAGMENT)
|
||||
throw failTSE("Code system " + inc.getSystem().toString() + " is incomplete");
|
||||
if (cs.hasVersion() || REPORT_VERSION_ANYWAY) {
|
||||
CanonicalType u = new CanonicalType(cs.getUrl() + (cs.hasVersion() ? "|"+cs.getVersion() : ""));
|
||||
UriType u = new UriType(cs.getUrl() + (cs.hasVersion() ? "|"+cs.getVersion() : ""));
|
||||
if (!existsInParams(exp.getParameter(), "version", u))
|
||||
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue