Merge pull request #1487 from hapifhir/2023-11-gg-hasTemplateIdOf
2023 11 gg has template id of
This commit is contained in:
commit
55a960e982
|
@ -216,9 +216,10 @@ public class Resource30_40 {
|
|||
public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, BaseAdvisor_30_40 advisor) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
if (src instanceof org.hl7.fhir.r4.model.Parameters) {
|
||||
if (((org.hl7.fhir.r4.model.Parameters) src).hasParameterValue("profile-url"))
|
||||
return ExpansionProfile30_40.convertExpansionProfile((org.hl7.fhir.r4.model.Parameters) src);
|
||||
else return Parameters30_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src);
|
||||
// if (((org.hl7.fhir.r4.model.Parameters) src).hasParameterValue("profile-url"))
|
||||
// return ExpansionProfile30_40.convertExpansionProfile((org.hl7.fhir.r4.model.Parameters) src);
|
||||
// else
|
||||
return Parameters30_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src);
|
||||
}
|
||||
if (src instanceof org.hl7.fhir.r4.model.Account)
|
||||
return Account30_40.convertAccount((org.hl7.fhir.r4.model.Account) src);
|
||||
|
|
|
@ -292,9 +292,10 @@ public class Resource30_50 {
|
|||
public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
if (src instanceof org.hl7.fhir.r5.model.Parameters) {
|
||||
if (((org.hl7.fhir.r5.model.Parameters) src).hasParameterValue("profile-url"))
|
||||
return ExpansionProfile30_50.convertExpansionProfile((org.hl7.fhir.r5.model.Parameters) src);
|
||||
else return Parameters30_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src);
|
||||
// if (((org.hl7.fhir.r5.model.Parameters) src).hasParameterValue("profile-url"))
|
||||
// return ExpansionProfile30_50.convertExpansionProfile((org.hl7.fhir.r5.model.Parameters) src);
|
||||
// else
|
||||
return Parameters30_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src);
|
||||
}
|
||||
if (src instanceof org.hl7.fhir.r5.model.ActivityDefinition)
|
||||
return ActivityDefinition30_50.convertActivityDefinition((org.hl7.fhir.r5.model.ActivityDefinition) src);
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.hl7.fhir.dstu2.formats.JsonParser;
|
|||
import org.hl7.fhir.dstu2.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.hl7.fhir.dstu3.formats.JsonParser;
|
|||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.hl7.fhir.r4.formats.JsonParser;
|
|||
import org.hl7.fhir.r4.formats.XmlParser;
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
import org.hl7.fhir.r5.conformance.StructureDefinitionHacker;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.hl7.fhir.r4.formats.JsonParser;
|
|||
import org.hl7.fhir.r4.formats.XmlParser;
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
import org.hl7.fhir.r5.conformance.StructureDefinitionHacker;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hl7.fhir.convertors.loaders.loaderR5.R3ToR5Loader;
|
|||
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R5ToR5Loader;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext.SimpleWorkerContextBuilder;
|
||||
import org.hl7.fhir.r5.model.CapabilityStatement;
|
||||
|
|
|
@ -13,10 +13,13 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r4.formats.JsonParser;
|
||||
import org.hl7.fhir.r4.model.CapabilityStatement;
|
||||
import org.hl7.fhir.r4.model.IntegerType;
|
||||
import org.hl7.fhir.r4.model.OperationOutcome;
|
||||
import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity;
|
||||
import org.hl7.fhir.r4.model.OperationOutcome.IssueType;
|
||||
import org.hl7.fhir.r4.model.Parameters;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.r4.utils.client.FHIRToolingClient;
|
||||
import org.hl7.fhir.r4.terminologies.JurisdictionUtilities;
|
||||
import org.hl7.fhir.utilities.CSVReader;
|
||||
|
@ -63,6 +66,16 @@ public class VSACImporter extends OIDBasedValueSetImporter {
|
|||
errs.put(oid, "Expansion: " +e.getMessage());
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
while (isIncomplete(vs.getExpansion())) {
|
||||
Parameters p = new Parameters();
|
||||
p.addParameter("offset", vs.getExpansion().getParameter("offset").getValueIntegerType().getValue() + vs.getExpansion().getParameter("count").getValueIntegerType().getValue());
|
||||
ValueSet vse = fhirToolingClient.expandValueset(vs.getUrl(), p);
|
||||
vs.getExpansion().getContains().addAll(vse.getExpansion().getContains());
|
||||
vs.getExpansion().setParameter(vse.getExpansion().getParameter());
|
||||
}
|
||||
vs.getExpansion().setOffsetElement(null);
|
||||
vs.getExpansion().getParameter().clear();
|
||||
|
||||
|
||||
if (vs.hasTitle()) {
|
||||
if (vs.getTitle().equals(vs.getDescription())) {
|
||||
|
@ -97,6 +110,12 @@ public class VSACImporter extends OIDBasedValueSetImporter {
|
|||
System.out.println("Done. " + i + " ValueSets");
|
||||
}
|
||||
|
||||
private boolean isIncomplete(ValueSetExpansionComponent expansion) {
|
||||
IntegerType c = expansion.getParameter("count").getValueIntegerType();
|
||||
IntegerType offset = expansion.getParameter("offset").getValueIntegerType();
|
||||
return c.getValue() + offset.getValue() < expansion.getTotal();
|
||||
}
|
||||
|
||||
private String makeValidName(String name) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
boolean upper = true;
|
||||
|
|
|
@ -99,6 +99,7 @@ import org.hl7.fhir.r4.utils.TranslatingUtilities;
|
|||
import org.hl7.fhir.r4.utils.formats.CSVWriter;
|
||||
import org.hl7.fhir.r4.utils.formats.XLSXWriter;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
|
@ -252,7 +253,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
private ProfileKnowledgeProvider pkp;
|
||||
private boolean igmode;
|
||||
private boolean exception;
|
||||
private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions();
|
||||
private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions(FhirPublication.R4);
|
||||
private boolean newSlicingProcessing;
|
||||
|
||||
public ProfileUtilities(IWorkerContext context, List<ValidationMessage> messages, ProfileKnowledgeProvider pkp) {
|
||||
|
|
|
@ -885,6 +885,13 @@ public class Parameters extends Resource implements IBaseParameters {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Parameters addParameter(String name, int i) {
|
||||
addParameter().setName(name).setValue(new IntegerType(i));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Parameters addParameter(String name, String s) {
|
||||
if (s != null)
|
||||
addParameter().setName(name).setValue(new StringType(s));
|
||||
|
|
|
@ -3268,6 +3268,14 @@ public class ValueSet extends MetadataResource {
|
|||
|
||||
}
|
||||
|
||||
public ValueSetExpansionParameterComponent getParameter(String name) {
|
||||
for (ValueSetExpansionParameterComponent t : getParameter()) {
|
||||
if (name.equals(t.getName())) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Block()
|
||||
|
@ -6241,6 +6249,8 @@ public class ValueSet extends MetadataResource {
|
|||
return ResourceType.ValueSet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Search parameter: <b>date</b>
|
||||
* <p>
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.TypedElementDefinition;
|
|||
import org.hl7.fhir.r4.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.FunctionDetails;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.MergedList;
|
||||
import org.hl7.fhir.utilities.MergedList.MergeNode;
|
||||
import org.hl7.fhir.utilities.SourceLocation;
|
||||
|
@ -121,7 +122,7 @@ public class FHIRPathEngine {
|
|||
private Map<String, StructureDefinition> allTypes = new HashMap<String, StructureDefinition>();
|
||||
private boolean legacyMode; // some R2 and R3 constraints assume that != is valid for emptty sets, so when
|
||||
// running for R2/R3, this is set ot true
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R4);
|
||||
private ProfileUtilities profileUtilities;
|
||||
private String location; // for error messages
|
||||
private boolean allowPolymorphicNames;
|
||||
|
|
|
@ -157,6 +157,7 @@ import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
|||
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
||||
import org.hl7.fhir.r4.utils.LiquidEngine.LiquidDocument;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.LoincLinker;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
||||
|
@ -1047,7 +1048,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
|
|||
private List<ConceptMapRenderInstructions> renderingMaps = new ArrayList<ConceptMapRenderInstructions>();
|
||||
private boolean pretty;
|
||||
private boolean canonicalUrlsAsLinks;
|
||||
private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions();
|
||||
private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions(FhirPublication.R4);
|
||||
|
||||
public NarrativeGenerator(String prefix, String basePath, IWorkerContext context) {
|
||||
super();
|
||||
|
|
|
@ -117,6 +117,7 @@ import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
|
|||
import org.hl7.fhir.r4.utils.FHIRPathUtilityClasses.FunctionDetails;
|
||||
import org.hl7.fhir.r4.utils.validation.IResourceValidator;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
|
@ -256,7 +257,7 @@ public class StructureMapUtilities {
|
|||
private ITransformerServices services;
|
||||
private ProfileKnowledgeProvider pkp;
|
||||
private Map<String, Integer> ids = new HashMap<String, Integer>();
|
||||
private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions();
|
||||
private TerminologyServiceOptions terminologyServiceOptions = new TerminologyServiceOptions(FhirPublication.R4);
|
||||
|
||||
public StructureMapUtilities(IWorkerContext worker, ITransformerServices services, ProfileKnowledgeProvider pkp) {
|
||||
super();
|
||||
|
|
|
@ -383,6 +383,17 @@ public class FHIRToolingClient {
|
|||
public ValueSet expandValueset(String vsUrl, Parameters expParams) {
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put("url", vsUrl);
|
||||
if (expParams != null) {
|
||||
for (ParametersParameterComponent p : expParams.getParameter()) {
|
||||
if (p.getValue() == null) {
|
||||
throw new FHIRException("Non-value Parameters are not supported for parameter '"+p.getName()+"'");
|
||||
} else if (p.getValue() instanceof PrimitiveType) {
|
||||
parameters.put(p.getName(), p.getValue().primitiveValue());
|
||||
} else {
|
||||
throw new FHIRException("Complex Parameters are not supported for parameter '"+p.getName()+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
org.hl7.fhir.r4.utils.client.network.ResourceRequest<Resource> result = null;
|
||||
try {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package org.hl7.fhir.r4.context;
|
||||
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
public class CacheTestUtils {
|
||||
public static final ValidationOptions validationOptions = new ValidationOptions().withGuessSystem()
|
||||
public static final ValidationOptions validationOptions = new ValidationOptions(FhirPublication.R4, null).withGuessSystem()
|
||||
.withVersionFlexible(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ import org.hl7.fhir.r4b.utils.XVerExtensionManager;
|
|||
import org.hl7.fhir.r4b.utils.XVerExtensionManager.XVerExtensionStatus;
|
||||
import org.hl7.fhir.r4b.utils.formats.CSVWriter;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
|
@ -341,7 +342,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
private ProfileKnowledgeProvider pkp;
|
||||
private boolean igmode;
|
||||
private boolean exception;
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R4B);
|
||||
private boolean newSlicingProcessing;
|
||||
private String defWebRoot;
|
||||
private boolean autoFixSliceNames;
|
||||
|
|
|
@ -117,7 +117,7 @@ public class RenderingContext {
|
|||
private boolean header;
|
||||
private boolean contained;
|
||||
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R4B);
|
||||
private boolean noSlowLookup;
|
||||
private String tooCostlyNoteEmpty;
|
||||
private String tooCostlyNoteNotEmpty;
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.ClassTypeInfo;
|
|||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.TypedElementDefinition;
|
||||
import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.MergedList;
|
||||
import org.hl7.fhir.utilities.MergedList.MergeNode;
|
||||
import org.hl7.fhir.utilities.SourceLocation;
|
||||
|
@ -122,7 +123,7 @@ public class FHIRPathEngine {
|
|||
private Map<String, StructureDefinition> allTypes = new HashMap<String, StructureDefinition>();
|
||||
private boolean legacyMode; // some R2 and R3 constraints assume that != is valid for emptty sets, so when
|
||||
// running for R2/R3, this is set ot true
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R4B);
|
||||
private ProfileUtilities profileUtilities;
|
||||
private String location; // for error messages
|
||||
private boolean allowPolymorphicNames;
|
||||
|
|
|
@ -72,6 +72,7 @@ import org.hl7.fhir.r4b.utils.FHIRPathUtilityClasses.FunctionDetails;
|
|||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r4b.utils.validation.IResourceValidator;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
@ -192,7 +193,7 @@ public class StructureMapUtilities {
|
|||
private ITransformerServices services;
|
||||
private ProfileKnowledgeProvider pkp;
|
||||
private final Map<String, Integer> ids = new HashMap<String, Integer>();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R4B);
|
||||
private final ProfileUtilities profileUtilities;
|
||||
|
||||
public StructureMapUtilities(IWorkerContext worker, ITransformerServices services, ProfileKnowledgeProvider pkp) {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package org.hl7.fhir.r4b.context;
|
||||
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
public class CacheTestUtils {
|
||||
public static final ValidationOptions validationOptions = new ValidationOptions().withGuessSystem()
|
||||
public static final ValidationOptions validationOptions = new ValidationOptions(FhirPublication.R4B).withGuessSystem()
|
||||
.withVersionFlexible(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
|||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
||||
import org.hl7.fhir.r5.utils.LiquidEngine;
|
||||
import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
|
||||
|
@ -252,7 +253,7 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
private String processTemplate(String template, String name, Map<String, Base> vars) {
|
||||
LiquidEngine engine = new LiquidEngine(contextRight, this);
|
||||
LiquidDocument doc = engine.parse(template, name+".template");
|
||||
return engine.evaluate(doc, Tuple.fromMap(vars), vars);
|
||||
return engine.evaluate(doc, Tuple.fromMap(FhirPublication.R5, vars), vars);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,7 +51,6 @@ import org.hl7.fhir.r5.conformance.ElementRedirection;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.AllowUnknownProfile;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.ElementDefinitionCounter;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
||||
import org.hl7.fhir.r5.elementmodel.Property;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
|
@ -97,6 +96,7 @@ import org.hl7.fhir.r5.model.ValueSet;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.TranslatingUtilities;
|
||||
|
@ -104,6 +104,7 @@ import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
|||
import org.hl7.fhir.r5.utils.XVerExtensionManager.XVerExtensionStatus;
|
||||
import org.hl7.fhir.r5.utils.formats.CSVWriter;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
|
@ -423,7 +424,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
private ProfileKnowledgeProvider pkp;
|
||||
// private boolean igmode;
|
||||
private boolean exception;
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R5);
|
||||
private boolean newSlicingProcessing;
|
||||
private String defWebRoot;
|
||||
private boolean autoFixSliceNames;
|
||||
|
|
|
@ -61,7 +61,6 @@ import org.hl7.fhir.exceptions.TerminologyServiceException;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ILoggingService.LogCategory;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache.CacheToken;
|
||||
import org.hl7.fhir.r5.model.ActorDefinition;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
|
@ -121,9 +120,13 @@ import org.hl7.fhir.r5.renderers.OperationOutcomeRenderer;
|
|||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpander;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyOperationContext;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyOperationContext.TerminologyServiceProtectionException;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache.CacheToken;
|
||||
import org.hl7.fhir.r5.terminologies.validation.VSCheckerException;
|
||||
import org.hl7.fhir.r5.terminologies.validation.ValueSetValidator;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
||||
|
@ -134,6 +137,7 @@ import org.hl7.fhir.r5.utils.ResourceUtilities;
|
|||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.client.EFhirClientException;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TimeTracker;
|
||||
import org.hl7.fhir.utilities.ToolingClientLogger;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
|
@ -678,6 +682,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem fetchCodeSystem(String system, FhirPublication fhirVersion) {
|
||||
return fetchCodeSystem(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem fetchCodeSystem(String system) {
|
||||
if (system == null) {
|
||||
|
@ -701,6 +710,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return cs;
|
||||
}
|
||||
|
||||
|
||||
public CodeSystem fetchCodeSystem(String system, String version, FhirPublication fhirVersion) {
|
||||
return fetchCodeSystem(system, version);
|
||||
}
|
||||
|
||||
public CodeSystem fetchCodeSystem(String system, String version) {
|
||||
if (version == null) {
|
||||
return fetchCodeSystem(system);
|
||||
|
@ -718,6 +732,15 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return cs;
|
||||
}
|
||||
|
||||
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system, FhirPublication fhirVersion) {
|
||||
return fetchSupplementedCodeSystem(system);
|
||||
}
|
||||
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system, String version, FhirPublication fhirVersion) {
|
||||
return fetchSupplementedCodeSystem(system, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system) {
|
||||
CodeSystem cs = fetchCodeSystem(system);
|
||||
|
@ -742,6 +765,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return cs;
|
||||
}
|
||||
|
||||
|
||||
public boolean supportsSystem(String system, FhirPublication fhirVersion) throws TerminologyServiceException {
|
||||
return supportsSystem(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSystem(String system) throws TerminologyServiceException {
|
||||
synchronized (lock) {
|
||||
|
@ -917,7 +945,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
List<String> allErrors = new ArrayList<>();
|
||||
|
||||
// ok, first we try to expand locally
|
||||
ValueSetExpander vse = constructValueSetExpanderSimple();
|
||||
ValueSetExpander vse = constructValueSetExpanderSimple(new ValidationOptions(vs.getFHIRPublicationVersion()));
|
||||
res = null;
|
||||
try {
|
||||
res = vse.expand(vs, p);
|
||||
|
@ -1329,16 +1357,16 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return res;
|
||||
}
|
||||
|
||||
protected ValueSetExpander constructValueSetExpanderSimple() {
|
||||
return new ValueSetExpander(this, new TerminologyOperationContext(this));
|
||||
protected ValueSetExpander constructValueSetExpanderSimple(ValidationOptions options) {
|
||||
return new ValueSetExpander(this, new TerminologyOperationContext(this, options));
|
||||
}
|
||||
|
||||
protected ValueSetValidator constructValueSetCheckerSimple( ValidationOptions options, ValueSet vs, ValidationContextCarrier ctxt) {
|
||||
return new ValueSetValidator(this, new TerminologyOperationContext(this), options, vs, ctxt, expParameters, tcc.getTxcaps());
|
||||
protected ValueSetValidator constructValueSetCheckerSimple(ValidationOptions options, ValueSet vs, ValidationContextCarrier ctxt) {
|
||||
return new ValueSetValidator(this, new TerminologyOperationContext(this, options), options, vs, ctxt, expParameters, tcc.getTxcaps());
|
||||
}
|
||||
|
||||
protected ValueSetValidator constructValueSetCheckerSimple( ValidationOptions options, ValueSet vs) {
|
||||
return new ValueSetValidator(this, new TerminologyOperationContext(this), options, vs, expParameters, tcc.getTxcaps());
|
||||
return new ValueSetValidator(this, new TerminologyOperationContext(this, options), options, vs, expParameters, tcc.getTxcaps());
|
||||
}
|
||||
|
||||
protected Parameters constructParameters(ValueSet vs, boolean hierarchical) {
|
||||
|
@ -1762,6 +1790,15 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getResourceNames(FhirPublication fhirVersion) {
|
||||
return getResourceNames();
|
||||
}
|
||||
|
||||
public Set<String> getResourceNamesAsSet(FhirPublication fhirVersion) {
|
||||
return getResourceNamesAsSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getResourceNamesAsSet() {
|
||||
Set<String> res = new HashSet<String>();
|
||||
|
@ -2187,6 +2224,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
|
||||
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_, FhirPublication fhirVersion) {
|
||||
return fetchResourcesByType(class_);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_) {
|
||||
|
||||
|
@ -2254,6 +2295,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
private boolean forPublication;
|
||||
private boolean cachingAllowed = true;
|
||||
|
||||
public Resource fetchResourceById(String type, String uri, FhirPublication fhirVersion) {
|
||||
return fetchResourceById(type, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource fetchResourceById(String type, String uri) {
|
||||
synchronized (lock) {
|
||||
|
@ -2286,6 +2331,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri, FhirPublication fhirVersion) {
|
||||
return fetchResource(class_, uri);
|
||||
}
|
||||
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri) {
|
||||
try {
|
||||
return fetchResourceWithException(class_, uri, null);
|
||||
|
@ -2293,7 +2342,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri, String version, FhirPublication fhirVersion) {
|
||||
return fetchResource(class_, uri, version);
|
||||
}
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri, String version) {
|
||||
try {
|
||||
return fetchResourceWithExceptionByVersion(class_, uri, version, null);
|
||||
|
@ -2335,6 +2387,46 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> boolean hasResource(Class<T> class_, String uri, FhirPublication fhirVersion) {
|
||||
try {
|
||||
return fetchResourceWithException(class_, uri) != null;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Resource> boolean hasResource(String cls, String uri, FhirPublication fhirVersion) {
|
||||
try {
|
||||
return fetchResourceWithException(cls, uri) != null;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Resource> boolean hasResourceVersion(Class<T> class_, String uri, String version, FhirPublication fhirVersion) {
|
||||
try {
|
||||
return fetchResourceWithExceptionByVersion(class_, uri, version, null) != null;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Resource> boolean hasResourceVersion(String cls, String uri, String version, FhirPublication fhirVersion) {
|
||||
try {
|
||||
return fetchResourceWithExceptionByVersion(cls, uri, version, null) != null;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Resource> boolean hasResource(Class<T> class_, String uri, Resource sourceOfReference) {
|
||||
try {
|
||||
return fetchResourceWithExceptionByVersion(class_, uri, version, null) != null;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public TranslationServices translator() {
|
||||
return translator;
|
||||
|
@ -2540,6 +2632,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return logger;
|
||||
}
|
||||
|
||||
|
||||
public StructureDefinition fetchTypeDefinition(String typeName, FhirPublication fhirVersion) {
|
||||
return fetchTypeDefinition(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureDefinition fetchTypeDefinition(String typeName) {
|
||||
if (Utilities.isAbsoluteUrl(typeName)) {
|
||||
|
@ -2579,6 +2676,12 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return typeManager.getDefinitions(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StructureDefinition> fetchTypeDefinitions(String typeName, FhirPublication fhirVersion) {
|
||||
return typeManager.getDefinitions(typeName);
|
||||
}
|
||||
|
||||
|
||||
public boolean isPrimitiveType(String type) {
|
||||
return typeManager.isPrimitive(type);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformation;
|
||||
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
public interface IContextResourceLoader {
|
||||
/**
|
||||
* @return List of the resource types that should be loaded
|
||||
*/
|
||||
List<String> getTypes();
|
||||
|
||||
/**
|
||||
* Request to actually load the resources and do whatever is required
|
||||
*
|
||||
* @param stream
|
||||
* @param isJson
|
||||
* @return A bundle because some single resources become multiple resources after loading
|
||||
* @throws FHIRException
|
||||
* @throws IOException
|
||||
*/
|
||||
Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
|
||||
/**
|
||||
* Load a single resources (lazy load)
|
||||
*
|
||||
* @param stream
|
||||
* @param isJson
|
||||
* @return
|
||||
* @throws FHIRException - throw this if you a single resource can't be returned - can't lazy load in this circumstance
|
||||
* @throws IOException
|
||||
*/
|
||||
Resource loadResource(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
|
||||
/**
|
||||
* called when a new package is being loaded
|
||||
*
|
||||
* this is called by loadPackageAndDependencies when a new package is loaded
|
||||
* @param npm
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws JsonSyntaxException
|
||||
*/
|
||||
IContextResourceLoader getNewLoader(NpmPackage npm) throws JsonSyntaxException, IOException;
|
||||
|
||||
/**
|
||||
* called when processing R2 for implicit code systems in ValueSets
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CodeSystem> getCodeSystems();
|
||||
|
||||
/**
|
||||
* if this is true, then the loader will patch canonical URLs and cross-links
|
||||
* to add /X.X/ into the URL so that different versions can be loaded safely
|
||||
*
|
||||
* default is false
|
||||
*/
|
||||
void setPatchUrls(boolean value);
|
||||
|
||||
/**
|
||||
* patch the URL if necessary
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
String patchUrl(String url, String resourceType);
|
||||
|
||||
/**
|
||||
* set this to false (default is true) if you don't want profiles loaded
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
IContextResourceLoader setLoadProfiles(boolean value);
|
||||
|
||||
/**
|
||||
* Called during the loading process - the loader can decide which resources to load.
|
||||
* At this point, only the .index.json is being read
|
||||
*
|
||||
* @param pi
|
||||
* @param pri
|
||||
* @return
|
||||
*/
|
||||
boolean wantLoad(NpmPackage pi, PackageResourceInformation pri);
|
||||
}
|
|
@ -2,8 +2,6 @@ package org.hl7.fhir.r5.context;
|
|||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -47,19 +45,15 @@ import org.fhir.ucum.UcumService;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache.CacheToken;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.ParserType;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.ConceptMap;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
||||
import org.hl7.fhir.r5.model.NamingSystem;
|
||||
import org.hl7.fhir.r5.model.PackageInformation;
|
||||
import org.hl7.fhir.r5.model.Parameters;
|
||||
|
@ -72,20 +66,18 @@ import org.hl7.fhir.r5.profilemodel.PEDefinition;
|
|||
import org.hl7.fhir.r5.profilemodel.PEBuilder.PEElementPropertiesPolicy;
|
||||
import org.hl7.fhir.r5.profilemodel.PEBuilder;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TimeTracker;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformation;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
|
@ -111,415 +103,12 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public interface IWorkerContext {
|
||||
|
||||
class ValidationResult {
|
||||
private ConceptDefinitionComponent definition;
|
||||
private String preferredDisplay;
|
||||
private String system;
|
||||
private String version;
|
||||
private IssueSeverity severity;
|
||||
private String message;
|
||||
private TerminologyServiceErrorClass errorClass;
|
||||
private String txLink;
|
||||
private String diagnostics;
|
||||
private List<OperationOutcomeIssueComponent> issues = new ArrayList<>();
|
||||
private CodeableConcept codeableConcept;
|
||||
private Set<String> unknownSystems;
|
||||
private boolean inactive;
|
||||
private String status;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValidationResult [definition=" + definition + ", system=" + system + ", severity=" + severity + ", message=" + message + ", errorClass="
|
||||
+ errorClass + ", txLink=" + txLink + "]";
|
||||
}
|
||||
|
||||
public ValidationResult(IssueSeverity severity, String message, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
|
||||
public ValidationResult(String system, String version, ConceptDefinitionComponent definition, String preferredDisplay) {
|
||||
this.system = system;
|
||||
this.version = version;
|
||||
this.definition = definition;
|
||||
this.preferredDisplay = preferredDisplay;
|
||||
}
|
||||
|
||||
public ValidationResult(IssueSeverity severity, String message, String system, String version, ConceptDefinitionComponent definition, String preferredDisplay, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
this.system = system;
|
||||
this.version = version;
|
||||
this.definition = definition;
|
||||
this.preferredDisplay = preferredDisplay;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
|
||||
public ValidationResult(IssueSeverity severity, String message, TerminologyServiceErrorClass errorClass, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
this.errorClass = errorClass;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOk() {
|
||||
return severity == null || severity == IssueSeverity.INFORMATION || severity == IssueSeverity.WARNING;
|
||||
}
|
||||
|
||||
public String getSystem() {
|
||||
return system;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
if (preferredDisplay != null) {
|
||||
return preferredDisplay;
|
||||
} else {
|
||||
return definition == null ? null : definition.getDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
this.preferredDisplay = display;
|
||||
}
|
||||
|
||||
public void setSystem(String system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return definition == null ? null : definition.getCode();
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition == null ? null : definition.getDefinition();
|
||||
}
|
||||
|
||||
public void setDefinition(ConceptDefinitionComponent definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public ConceptDefinitionComponent asConceptDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public IssueSeverity getSeverity() {
|
||||
return severity;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public boolean IsNoService() {
|
||||
return errorClass == TerminologyServiceErrorClass.NOSERVICE;
|
||||
}
|
||||
|
||||
public TerminologyServiceErrorClass getErrorClass() {
|
||||
return errorClass;
|
||||
}
|
||||
|
||||
public ValidationResult setSeverity(IssueSeverity severity) {
|
||||
this.severity = severity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult addToMessage(String message) {
|
||||
this.message = this.message == null ? message : this.message +"; "+ message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult setErrorClass(TerminologyServiceErrorClass errorClass) {
|
||||
this.errorClass = errorClass;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTxLink() {
|
||||
return txLink;
|
||||
}
|
||||
|
||||
public ValidationResult setTxLink(String txLink) {
|
||||
this.txLink = txLink;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasMessage() {
|
||||
return message != null;
|
||||
}
|
||||
|
||||
public String getDiagnostics() {
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
public void setDiagnostics(String diagnostics) {
|
||||
this.diagnostics = diagnostics;
|
||||
}
|
||||
|
||||
public Coding asCoding() {
|
||||
if (isOk() && definition != null && definition.getCode() != null) {
|
||||
return new Coding(system, definition.getCode(), definition.getDisplay());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<OperationOutcomeIssueComponent> getIssues() {
|
||||
return issues;
|
||||
}
|
||||
|
||||
public ValidationResult addCodeableConcept(CodeableConcept vcc) {
|
||||
if (!vcc.isEmpty()) {
|
||||
codeableConcept = vcc;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodeableConcept getCodeableConcept() {
|
||||
return codeableConcept;
|
||||
}
|
||||
|
||||
public Set<String> getUnknownSystems() {
|
||||
return unknownSystems;
|
||||
}
|
||||
|
||||
public ValidationResult setUnknownSystems(Set<String> unknownSystems) {
|
||||
this.unknownSystems = unknownSystems;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String unknownSystems() {
|
||||
if (unknownSystems == null) {
|
||||
return null;
|
||||
}
|
||||
if (unknownSystems.size() == 1) {
|
||||
return unknownSystems.iterator().next();
|
||||
} else {
|
||||
return String.join(",", unknownSystems);
|
||||
}
|
||||
}
|
||||
|
||||
public void setIssues(List<OperationOutcomeIssueComponent> issues) {
|
||||
if (this.issues != null) {
|
||||
issues.addAll(this.issues);
|
||||
}
|
||||
this.issues = issues;
|
||||
|
||||
}
|
||||
|
||||
public void trimPath(String prefix) {
|
||||
if (issues != null) {
|
||||
for (OperationOutcomeIssueComponent iss : issues) {
|
||||
for (int i = iss.getLocation().size() -1; i >= 0; i--) {
|
||||
var s = iss.getLocation().get(i).primitiveValue();
|
||||
if (prefix.equals(s)) {
|
||||
iss.getLocation().remove(i);
|
||||
} else if (s.startsWith(prefix+".")) {
|
||||
iss.getLocation().get(i).setValueAsString(s.substring(prefix.length()+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isInactive() {
|
||||
return inactive;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public ValidationResult setStatus(boolean inactive, String status) {
|
||||
this.inactive = inactive;
|
||||
if (!"inactive".equals(status)) {
|
||||
this.status = status;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CodingValidationRequest {
|
||||
private Coding coding;
|
||||
private ValidationResult result;
|
||||
private CacheToken cacheToken;
|
||||
private String vs;
|
||||
private ValueSet vsObj;
|
||||
|
||||
public CodingValidationRequest(Coding coding) {
|
||||
super();
|
||||
this.coding = coding;
|
||||
}
|
||||
|
||||
public CodingValidationRequest(Coding coding, String vs) {
|
||||
super();
|
||||
this.coding = coding;
|
||||
this.vs = vs;
|
||||
}
|
||||
|
||||
public CodingValidationRequest(Coding coding, ValueSet vsObj) {
|
||||
super();
|
||||
this.coding = coding;
|
||||
this.vsObj = vsObj;
|
||||
}
|
||||
|
||||
public String getVs() {
|
||||
return vs;
|
||||
}
|
||||
|
||||
public ValueSet getVsObj() {
|
||||
return vsObj;
|
||||
}
|
||||
|
||||
public ValidationResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ValidationResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Coding getCoding() {
|
||||
return coding;
|
||||
}
|
||||
|
||||
public boolean hasResult() {
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* internal logic; external users of batch validation should ignore this property
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public CacheToken getCacheToken() {
|
||||
return cacheToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* internal logic; external users of batch validation should ignore this property
|
||||
*
|
||||
* @param cacheToken
|
||||
*/
|
||||
public void setCacheToken(CacheToken cacheToken) {
|
||||
this.cacheToken = cacheToken;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public interface IContextResourceLoader {
|
||||
/**
|
||||
* @return List of the resource types that should be loaded
|
||||
*/
|
||||
List<String> getTypes();
|
||||
|
||||
/**
|
||||
* Request to actually load the resources and do whatever is required
|
||||
*
|
||||
* @param stream
|
||||
* @param isJson
|
||||
* @return A bundle because some single resources become multiple resources after loading
|
||||
* @throws FHIRException
|
||||
* @throws IOException
|
||||
*/
|
||||
Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
|
||||
/**
|
||||
* Load a single resources (lazy load)
|
||||
*
|
||||
* @param stream
|
||||
* @param isJson
|
||||
* @return
|
||||
* @throws FHIRException - throw this if you a single resource can't be returned - can't lazy load in this circumstance
|
||||
* @throws IOException
|
||||
*/
|
||||
Resource loadResource(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
|
||||
/**
|
||||
* called when a new package is being loaded
|
||||
*
|
||||
* this is called by loadPackageAndDependencies when a new package is loaded
|
||||
* @param npm
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws JsonSyntaxException
|
||||
*/
|
||||
IContextResourceLoader getNewLoader(NpmPackage npm) throws JsonSyntaxException, IOException;
|
||||
|
||||
/**
|
||||
* called when processing R2 for implicit code systems in ValueSets
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<CodeSystem> getCodeSystems();
|
||||
|
||||
/**
|
||||
* if this is true, then the loader will patch canonical URLs and cross-links
|
||||
* to add /X.X/ into the URL so that different versions can be loaded safely
|
||||
*
|
||||
* default is false
|
||||
*/
|
||||
void setPatchUrls(boolean value);
|
||||
|
||||
/**
|
||||
* patch the URL if necessary
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
String patchUrl(String url, String resourceType);
|
||||
|
||||
/**
|
||||
* set this to false (default is true) if you don't want profiles loaded
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
IContextResourceLoader setLoadProfiles(boolean value);
|
||||
|
||||
/**
|
||||
* Called during the loading process - the loader can decide which resources to load.
|
||||
* At this point, only the .index.json is being read
|
||||
*
|
||||
* @param pi
|
||||
* @param pri
|
||||
* @return
|
||||
*/
|
||||
boolean wantLoad(NpmPackage pi, PackageResourceInformation pri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version of the definitions loaded in context
|
||||
* Get the version of the base definitions loaded in context
|
||||
* This *does not* have to be 5.0 (R5) - the context can load other versions
|
||||
*
|
||||
* Note that more than one version might be loaded at once, but one version is always the default / master
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getVersion();
|
||||
|
@ -576,6 +165,8 @@ public interface IWorkerContext {
|
|||
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri) throws FHIRException;
|
||||
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri, Resource sourceOfReference) throws FHIRException;
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri, String version);
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri, FhirPublication fhirVersion);
|
||||
public <T extends Resource> T fetchResource(Class<T> class_, String uri, String version, FhirPublication fhirVersion);
|
||||
|
||||
/** has the same functionality as fetchResource, but passes in information about the source of the
|
||||
* reference (this may affect resolution of version)
|
||||
|
@ -597,6 +188,7 @@ public interface IWorkerContext {
|
|||
* @param canonicalForSource
|
||||
* @return
|
||||
*/
|
||||
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_, FhirPublication fhirVersion);
|
||||
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_);
|
||||
|
||||
/**
|
||||
|
@ -614,6 +206,7 @@ public interface IWorkerContext {
|
|||
* @return
|
||||
*/
|
||||
public Resource fetchResourceById(String type, String uri);
|
||||
public Resource fetchResourceById(String type, String uri, FhirPublication fhirVersion);
|
||||
|
||||
/**
|
||||
* find whether a resource is available.
|
||||
|
@ -626,6 +219,8 @@ public interface IWorkerContext {
|
|||
* @return
|
||||
*/
|
||||
public <T extends Resource> boolean hasResource(Class<T> class_, String uri);
|
||||
public <T extends Resource> boolean hasResource(Class<T> class_, String uri, Resource sourceOfReference);
|
||||
public <T extends Resource> boolean hasResource(Class<T> class_, String uri, FhirPublication fhirVersion);
|
||||
|
||||
/**
|
||||
* cache a resource for later retrieval using fetchResource.
|
||||
|
@ -668,10 +263,12 @@ public interface IWorkerContext {
|
|||
* @return a list of the resource names defined for this version
|
||||
*/
|
||||
public List<String> getResourceNames();
|
||||
public List<String> getResourceNames(FhirPublication fhirVersion);
|
||||
/**
|
||||
* @return a set of the resource names defined for this version
|
||||
*/
|
||||
public Set<String> getResourceNamesAsSet();
|
||||
public Set<String> getResourceNamesAsSet(FhirPublication fhirVersion);
|
||||
|
||||
// -- Terminology services ------------------------------------------------------
|
||||
|
||||
|
@ -702,6 +299,8 @@ public interface IWorkerContext {
|
|||
*/
|
||||
public CodeSystem fetchCodeSystem(String system);
|
||||
public CodeSystem fetchCodeSystem(String system, String version);
|
||||
public CodeSystem fetchCodeSystem(String system, FhirPublication fhirVersion);
|
||||
public CodeSystem fetchCodeSystem(String system, String version, FhirPublication fhirVersion);
|
||||
|
||||
/**
|
||||
* Like fetchCodeSystem, except that the context will find any CodeSysetm supplements and merge them into the
|
||||
|
@ -710,6 +309,8 @@ public interface IWorkerContext {
|
|||
*/
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system);
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system, String version);
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system, FhirPublication fhirVersion);
|
||||
public CodeSystem fetchSupplementedCodeSystem(String system, String version, FhirPublication fhirVersion);
|
||||
|
||||
/**
|
||||
* True if the underlying terminology service provider will do
|
||||
|
@ -727,6 +328,7 @@ public interface IWorkerContext {
|
|||
* @throws Exception
|
||||
*/
|
||||
public boolean supportsSystem(String system) throws TerminologyServiceException;
|
||||
public boolean supportsSystem(String system, FhirPublication fhirVersion) throws TerminologyServiceException;
|
||||
|
||||
/**
|
||||
* ValueSet Expansion - see $expand
|
||||
|
@ -929,6 +531,7 @@ public interface IWorkerContext {
|
|||
* @return
|
||||
*/
|
||||
public StructureDefinition fetchTypeDefinition(String typeName);
|
||||
public StructureDefinition fetchTypeDefinition(String typeName, FhirPublication fhirVersion);
|
||||
|
||||
/**
|
||||
* This finds all the structure definitions that have the given typeName
|
||||
|
@ -937,6 +540,7 @@ public interface IWorkerContext {
|
|||
* @return
|
||||
*/
|
||||
public List<StructureDefinition> fetchTypeDefinitions(String n);
|
||||
public List<StructureDefinition> fetchTypeDefinitions(String n, FhirPublication fhirVersion);
|
||||
|
||||
/**
|
||||
* return whether type is primitive type. This is called a lot, and needs a high performance implementation
|
||||
|
|
|
@ -63,6 +63,15 @@ public class TypeManager {
|
|||
}
|
||||
types.add(sd);
|
||||
}
|
||||
if (Utilities.isAbsoluteUrl(type)) {
|
||||
type = sd.getTypeTail();
|
||||
types = typeDefinitions.get(type);
|
||||
if (types == null) {
|
||||
types = new HashSet<>();
|
||||
typeDefinitions.put(type, types);
|
||||
}
|
||||
types.add(sd);
|
||||
}
|
||||
if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
|
||||
primitiveNames.add(sd.getType());
|
||||
} else if (sd.getKind() == StructureDefinitionKind.COMPLEXTYPE) {
|
||||
|
|
|
@ -56,6 +56,7 @@ import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
|||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.ElementDecoration;
|
||||
import org.hl7.fhir.utilities.ElementDecoration.DecorationType;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.NamedItemList;
|
||||
import org.hl7.fhir.utilities.NamedItemList.NamedItem;
|
||||
import org.hl7.fhir.utilities.SourceLocation;
|
||||
|
@ -1544,5 +1545,8 @@ public class Element extends Base implements NamedItem {
|
|||
return false;
|
||||
}
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.fromCode(property.getStructure().getVersion());
|
||||
}
|
||||
|
||||
}
|
|
@ -36,6 +36,8 @@ import java.util.Map;
|
|||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
@ -339,6 +341,18 @@ public abstract class Base implements Serializable, IBase, IElement {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Base getChildValueByName(String name) {
|
||||
Property p = getChildByName(name);
|
||||
if (p != null && p.hasValues()) {
|
||||
if (p.getValues().size() > 1) {
|
||||
throw new Error("Too manye values for "+name+" found");
|
||||
} else {
|
||||
return p.getValues().get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Base[] listChildrenByName(String name, boolean checkValid) throws FHIRException {
|
||||
if (name.equals("*")) {
|
||||
List<Property> children = new ArrayList<Property>();
|
||||
|
@ -570,4 +584,5 @@ public abstract class Base implements Serializable, IBase, IElement {
|
|||
return validationMessages != null ? validationMessages : new ArrayList<>();
|
||||
}
|
||||
|
||||
public abstract FhirPublication getFHIRPublicationVersion();
|
||||
}
|
|
@ -48,6 +48,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
|
|||
import org.hl7.fhir.instance.model.api.IBaseElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.StandardsStatus;
|
||||
/**
|
||||
* Element Type: Base definition for all elements in a resource.
|
||||
|
@ -517,7 +518,10 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.R5;
|
||||
}
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ExpressionNode {
|
|||
Encode, Decode, Escape, Unescape, Trim, Split, Join, LowBoundary, HighBoundary, Precision,
|
||||
|
||||
// Local extensions to FHIRPath
|
||||
HtmlChecks1, HtmlChecks2, AliasAs, Alias, Comparable;
|
||||
HtmlChecks1, HtmlChecks2, AliasAs, Alias, Comparable, hasTemplateIdOf;
|
||||
|
||||
public static Function fromCode(String name) {
|
||||
if (name.equals("empty")) return Function.Empty;
|
||||
|
@ -157,6 +157,7 @@ public class ExpressionNode {
|
|||
if (name.equals("lowBoundary")) return Function.LowBoundary;
|
||||
if (name.equals("highBoundary")) return Function.HighBoundary;
|
||||
if (name.equals("precision")) return Function.Precision;
|
||||
if (name.equals("hasTemplateIdOf")) return Function.hasTemplateIdOf;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -260,6 +261,7 @@ public class ExpressionNode {
|
|||
case LowBoundary: return "lowBoundary";
|
||||
case HighBoundary: return "highBoundary";
|
||||
case Precision: return "precision";
|
||||
case hasTemplateIdOf: return "hasTemplateIdOf";
|
||||
default: return "?custom?";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ package org.hl7.fhir.r5.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.r5.model.Enumerations.*;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
|
@ -482,6 +484,11 @@ public abstract class Resource extends BaseResource implements IAnyResource {
|
|||
return getIdElement().getIdPart();
|
||||
}
|
||||
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.R5;
|
||||
}
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
|
@ -37,20 +37,24 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
|
||||
public class Tuple extends Base {
|
||||
|
||||
private static final long serialVersionUID = -8402411970797277451L;
|
||||
private Map<String, List<Base>> properties = new HashMap<>();
|
||||
private FhirPublication publicationVersion;
|
||||
|
||||
public static Tuple fromMapList(Map<String, List<Base>> map) {
|
||||
public static Tuple fromMapList(FhirPublication publicationVersion, Map<String, List<Base>> map) {
|
||||
Tuple res = new Tuple();
|
||||
res.properties.putAll(map);
|
||||
res.publicationVersion = publicationVersion;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Tuple fromMap(Map<String, Base> map) {
|
||||
public static Tuple fromMap(FhirPublication publicationVersion,Map<String, Base> map) {
|
||||
Tuple res = new Tuple();
|
||||
res.publicationVersion = publicationVersion;
|
||||
for (String key : map.keySet()) {
|
||||
List<Base> list = new ArrayList<>();
|
||||
list.add(map.get(key));
|
||||
|
@ -106,4 +110,7 @@ public class Tuple extends Base {
|
|||
}
|
||||
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return publicationVersion;
|
||||
}
|
||||
}
|
|
@ -34,6 +34,8 @@ package org.hl7.fhir.r5.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -42,12 +44,21 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
|||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
||||
import org.hl7.fhir.r5.model.TypeDetails.ProfiledTypeSorter;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
|
||||
|
||||
public class TypeDetails {
|
||||
public class ProfiledTypeSorter implements Comparator<ProfiledType> {
|
||||
|
||||
@Override
|
||||
public int compare(ProfiledType o1, ProfiledType o2) {
|
||||
return o1.uri.compareTo(o2.uri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String FHIR_NS = "http://hl7.org/fhir/StructureDefinition/";
|
||||
public static final String FP_NS = "http://hl7.org/fhirpath/";
|
||||
public static final String FP_String = "http://hl7.org/fhirpath/System.String";
|
||||
|
@ -419,20 +430,30 @@ public class TypeDetails {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String describe() {
|
||||
return getTypes().toString();
|
||||
return Utilities.sorted(getTypes()).toString();
|
||||
}
|
||||
|
||||
public String describeMin() {
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (ProfiledType pt : types)
|
||||
for (ProfiledType pt : sortedTypes(types))
|
||||
b.append(pt.describeMin());
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
private List<ProfiledType> sortedTypes(List<ProfiledType> types2) {
|
||||
List<ProfiledType> list = new ArrayList<>();
|
||||
Collections.sort(list, new ProfiledTypeSorter());
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
for (ProfiledType pt : types)
|
||||
return pt.uri;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (collectionStatus == null ? collectionStatus.SINGLETON.toString() : collectionStatus.toString()) + getTypes().toString();
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.model.Address;
|
||||
import org.hl7.fhir.r5.model.Annotation;
|
||||
import org.hl7.fhir.r5.model.BackboneType;
|
||||
|
@ -79,6 +78,7 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
|||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.terminologies.JurisdictionUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.hl7.fhir.r5.conformance.profile.BindingResolution;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.ElementChoiceGroup;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.ExtensionContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
|
@ -74,6 +73,7 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
|||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.StructureDefinitionRendererMode;
|
||||
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.PublicationHacker;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Map;
|
|||
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
|
@ -27,6 +26,7 @@ import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
|||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
|
|
@ -15,10 +15,6 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.r5.comparison.VersionComparisonAnnotation;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache.CacheToken;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
|
@ -53,7 +49,11 @@ import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
|||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache.CacheToken;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.LoincLinker;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
|
|
@ -157,7 +157,7 @@ public class RenderingContext {
|
|||
private boolean header;
|
||||
private boolean contained;
|
||||
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R5);
|
||||
private boolean noSlowLookup;
|
||||
private String tooCostlyNoteEmpty;
|
||||
private String tooCostlyNoteNotEmpty;
|
||||
|
|
|
@ -129,6 +129,7 @@ import org.hl7.fhir.utilities.Utilities;
|
|||
import org.hl7.fhir.utilities.i18n.AcceptLanguageHeader;
|
||||
import org.hl7.fhir.utilities.i18n.AcceptLanguageHeader.LanguagePreference;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
public class ValueSetExpander extends ValueSetProcessBase {
|
||||
|
||||
|
@ -540,7 +541,7 @@ public class ValueSetExpander extends ValueSetProcessBase {
|
|||
// importValueSet(imp.getValue(), params, expParams);
|
||||
|
||||
CodeSystem cs = context.fetchSupplementedCodeSystem(exc.getSystem());
|
||||
if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) && context.supportsSystem(exc.getSystem())) {
|
||||
if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) && context.supportsSystem(exc.getSystem(), opContext.getOptions().getFhirVersion())) {
|
||||
ValueSetExpansionOutcome vse = context.expandVS(exc, false, false);
|
||||
ValueSet valueset = vse.getValueset();
|
||||
if (valueset == null)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package org.hl7.fhir.r5.terminologies.utilities;
|
||||
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache.CacheToken;
|
||||
|
||||
public class CodingValidationRequest {
|
||||
private Coding coding;
|
||||
private ValidationResult result;
|
||||
private CacheToken cacheToken;
|
||||
private String vs;
|
||||
private ValueSet vsObj;
|
||||
|
||||
public CodingValidationRequest(Coding coding) {
|
||||
super();
|
||||
this.coding = coding;
|
||||
}
|
||||
|
||||
public CodingValidationRequest(Coding coding, String vs) {
|
||||
super();
|
||||
this.coding = coding;
|
||||
this.vs = vs;
|
||||
}
|
||||
|
||||
public CodingValidationRequest(Coding coding, ValueSet vsObj) {
|
||||
super();
|
||||
this.coding = coding;
|
||||
this.vsObj = vsObj;
|
||||
}
|
||||
|
||||
public String getVs() {
|
||||
return vs;
|
||||
}
|
||||
|
||||
public ValueSet getVsObj() {
|
||||
return vsObj;
|
||||
}
|
||||
|
||||
public ValidationResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ValidationResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Coding getCoding() {
|
||||
return coding;
|
||||
}
|
||||
|
||||
public boolean hasResult() {
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* internal logic; external users of batch validation should ignore this property
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public CacheToken getCacheToken() {
|
||||
return cacheToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* internal logic; external users of batch validation should ignore this property
|
||||
*
|
||||
* @param cacheToken
|
||||
*/
|
||||
public void setCacheToken(CacheToken cacheToken) {
|
||||
this.cacheToken = cacheToken;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
package org.hl7.fhir.r5.terminologies.utilities;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -43,7 +43,6 @@ import lombok.Setter;
|
|||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
|
@ -53,7 +52,6 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -713,7 +711,7 @@ public class TerminologyCache {
|
|||
return s;
|
||||
}
|
||||
|
||||
protected String hashJson(String s) {
|
||||
public String hashJson(String s) {
|
||||
return String.valueOf(s.trim().hashCode());
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import org.hl7.fhir.r5.context.IWorkerContext;
|
|||
import org.hl7.fhir.r5.model.OperationOutcome.IssueType;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyOperationContext.TerminologyServiceProtectionException;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -40,11 +41,13 @@ public class TerminologyOperationContext {
|
|||
private List<String> contexts = new ArrayList<>();
|
||||
private IWorkerContext worker;
|
||||
private boolean original;
|
||||
private ValidationOptions options;
|
||||
|
||||
public TerminologyOperationContext(IWorkerContext worker) {
|
||||
public TerminologyOperationContext(IWorkerContext worker, ValidationOptions options) {
|
||||
super();
|
||||
this.worker = worker;
|
||||
this.original = true;
|
||||
this.options = options;
|
||||
|
||||
if (EXPANSION_DEAD_TIME_SECS == 0 || debugging) {
|
||||
deadTime = 0;
|
||||
|
@ -53,12 +56,13 @@ public class TerminologyOperationContext {
|
|||
}
|
||||
}
|
||||
|
||||
private TerminologyOperationContext() {
|
||||
private TerminologyOperationContext(ValidationOptions options) {
|
||||
super();
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public TerminologyOperationContext copy() {
|
||||
TerminologyOperationContext ret = new TerminologyOperationContext();
|
||||
TerminologyOperationContext ret = new TerminologyOperationContext(this.options);
|
||||
ret.worker = worker;
|
||||
ret.contexts.addAll(contexts);
|
||||
ret.deadTime = deadTime;
|
||||
|
@ -82,5 +86,9 @@ public class TerminologyOperationContext {
|
|||
return original;
|
||||
}
|
||||
|
||||
public ValidationOptions getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,259 @@
|
|||
package org.hl7.fhir.r5.terminologies.utilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
|
||||
public class ValidationResult {
|
||||
private ConceptDefinitionComponent definition;
|
||||
private String preferredDisplay;
|
||||
private String system;
|
||||
private String version;
|
||||
private IssueSeverity severity;
|
||||
private String message;
|
||||
private TerminologyServiceErrorClass errorClass;
|
||||
private String txLink;
|
||||
private String diagnostics;
|
||||
private List<OperationOutcomeIssueComponent> issues = new ArrayList<>();
|
||||
private CodeableConcept codeableConcept;
|
||||
private Set<String> unknownSystems;
|
||||
private boolean inactive;
|
||||
private String status;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValidationResult [definition=" + definition + ", system=" + system + ", severity=" + severity + ", message=" + message + ", errorClass="
|
||||
+ errorClass + ", txLink=" + txLink + "]";
|
||||
}
|
||||
|
||||
public ValidationResult(IssueSeverity severity, String message, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
|
||||
public ValidationResult(String system, String version, ConceptDefinitionComponent definition, String preferredDisplay) {
|
||||
this.system = system;
|
||||
this.version = version;
|
||||
this.definition = definition;
|
||||
this.preferredDisplay = preferredDisplay;
|
||||
}
|
||||
|
||||
public ValidationResult(IssueSeverity severity, String message, String system, String version, ConceptDefinitionComponent definition, String preferredDisplay, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
this.system = system;
|
||||
this.version = version;
|
||||
this.definition = definition;
|
||||
this.preferredDisplay = preferredDisplay;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
|
||||
public ValidationResult(IssueSeverity severity, String message, TerminologyServiceErrorClass errorClass, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.message = message;
|
||||
this.errorClass = errorClass;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOk() {
|
||||
return severity == null || severity == IssueSeverity.INFORMATION || severity == IssueSeverity.WARNING;
|
||||
}
|
||||
|
||||
public String getSystem() {
|
||||
return system;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
if (preferredDisplay != null) {
|
||||
return preferredDisplay;
|
||||
} else {
|
||||
return definition == null ? null : definition.getDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
this.preferredDisplay = display;
|
||||
}
|
||||
|
||||
public void setSystem(String system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return definition == null ? null : definition.getCode();
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition == null ? null : definition.getDefinition();
|
||||
}
|
||||
|
||||
public void setDefinition(ConceptDefinitionComponent definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public ConceptDefinitionComponent asConceptDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public IssueSeverity getSeverity() {
|
||||
return severity;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public boolean IsNoService() {
|
||||
return errorClass == TerminologyServiceErrorClass.NOSERVICE;
|
||||
}
|
||||
|
||||
public TerminologyServiceErrorClass getErrorClass() {
|
||||
return errorClass;
|
||||
}
|
||||
|
||||
public ValidationResult setSeverity(IssueSeverity severity) {
|
||||
this.severity = severity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult addToMessage(String message) {
|
||||
this.message = this.message == null ? message : this.message +"; "+ message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult setErrorClass(TerminologyServiceErrorClass errorClass) {
|
||||
this.errorClass = errorClass;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTxLink() {
|
||||
return txLink;
|
||||
}
|
||||
|
||||
public ValidationResult setTxLink(String txLink) {
|
||||
this.txLink = txLink;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasMessage() {
|
||||
return message != null;
|
||||
}
|
||||
|
||||
public String getDiagnostics() {
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
public void setDiagnostics(String diagnostics) {
|
||||
this.diagnostics = diagnostics;
|
||||
}
|
||||
|
||||
public Coding asCoding() {
|
||||
if (isOk() && definition != null && definition.getCode() != null) {
|
||||
return new Coding(system, definition.getCode(), definition.getDisplay());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<OperationOutcomeIssueComponent> getIssues() {
|
||||
return issues;
|
||||
}
|
||||
|
||||
public ValidationResult addCodeableConcept(CodeableConcept vcc) {
|
||||
if (!vcc.isEmpty()) {
|
||||
codeableConcept = vcc;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodeableConcept getCodeableConcept() {
|
||||
return codeableConcept;
|
||||
}
|
||||
|
||||
public Set<String> getUnknownSystems() {
|
||||
return unknownSystems;
|
||||
}
|
||||
|
||||
public ValidationResult setUnknownSystems(Set<String> unknownSystems) {
|
||||
this.unknownSystems = unknownSystems;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String unknownSystems() {
|
||||
if (unknownSystems == null) {
|
||||
return null;
|
||||
}
|
||||
if (unknownSystems.size() == 1) {
|
||||
return unknownSystems.iterator().next();
|
||||
} else {
|
||||
return String.join(",", unknownSystems);
|
||||
}
|
||||
}
|
||||
|
||||
public void setIssues(List<OperationOutcomeIssueComponent> issues) {
|
||||
if (this.issues != null) {
|
||||
issues.addAll(this.issues);
|
||||
}
|
||||
this.issues = issues;
|
||||
|
||||
}
|
||||
|
||||
public void trimPath(String prefix) {
|
||||
if (issues != null) {
|
||||
for (OperationOutcomeIssueComponent iss : issues) {
|
||||
for (int i = iss.getLocation().size() -1; i >= 0; i--) {
|
||||
var s = iss.getLocation().get(i).primitiveValue();
|
||||
if (prefix.equals(s)) {
|
||||
iss.getLocation().remove(i);
|
||||
} else if (s.startsWith(prefix+".")) {
|
||||
iss.getLocation().get(i).setValueAsString(s.substring(prefix.length()+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isInactive() {
|
||||
return inactive;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public ValidationResult setStatus(boolean inactive, String status) {
|
||||
this.inactive = inactive;
|
||||
if (!"inactive".equals(status)) {
|
||||
this.status = status;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -44,7 +44,6 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.NoTerminologyServiceException;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.elementmodel.LanguageUtils;
|
||||
import org.hl7.fhir.r5.extensions.ExtensionConstants;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
|
@ -83,11 +82,13 @@ import org.hl7.fhir.r5.terminologies.providers.URICodeSystem;
|
|||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyOperationContext;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyOperationContext.TerminologyServiceProtectionException;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValueSetProcessBase;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier.ValidationContextResourceProxy;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.AcceptLanguageHeader;
|
||||
|
@ -780,7 +781,7 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
|||
|
||||
|
||||
private ConceptDefinitionComponent findCountryCode(String code) {
|
||||
ValidationResult vr = context.validateCode(new ValidationOptions(), "urn:iso:std:iso:3166", null, code, null);
|
||||
ValidationResult vr = context.validateCode(new ValidationOptions(FhirPublication.R5), "urn:iso:std:iso:3166", null, code, null);
|
||||
return vr == null || !vr.isOk() ? null : new ConceptDefinitionComponent(code).setDisplay(vr.getDisplay()).setDefinition(vr.getDefinition());
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.formats.XmlParser;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
|
|
|
@ -8,10 +8,11 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
|
||||
import org.fhir.ucum.UcumEssenceService;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.model.Parameters;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.r5.utils.R5Hacker;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
|
@ -125,7 +126,7 @@ public class TestingUtilities extends BaseTestingUtilities {
|
|||
return swc;
|
||||
}
|
||||
|
||||
public static SimpleWorkerContext getWorkerContext(NpmPackage npmPackage, IWorkerContext.IContextResourceLoader loader) throws Exception {
|
||||
public static SimpleWorkerContext getWorkerContext(NpmPackage npmPackage, IContextResourceLoader loader) throws Exception {
|
||||
SimpleWorkerContext swc = new SimpleWorkerContext.SimpleWorkerContextBuilder().withAllowLoadingDuplicates(true).withUserAgent(TestConstants.USER_AGENT)
|
||||
.withTerminologyCachePath(getTerminologyCacheDirectory()).fromPackage(npmPackage, loader, true);
|
||||
TerminologyCache.setCacheErrors(true);
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.SourcedChildDefinitions;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.BaseDateTimeType;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
|
@ -47,6 +46,7 @@ import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
|
|||
import org.hl7.fhir.r5.model.ExpressionNode.Function;
|
||||
import org.hl7.fhir.r5.model.ExpressionNode.Kind;
|
||||
import org.hl7.fhir.r5.model.ExpressionNode.Operation;
|
||||
import org.hl7.fhir.r5.model.Identifier;
|
||||
import org.hl7.fhir.r5.model.IntegerType;
|
||||
import org.hl7.fhir.r5.model.Property;
|
||||
import org.hl7.fhir.r5.model.Property.PropertyMatcher;
|
||||
|
@ -60,6 +60,7 @@ import org.hl7.fhir.r5.model.TimeType;
|
|||
import org.hl7.fhir.r5.model.TypeConvertor;
|
||||
import org.hl7.fhir.r5.model.TypeDetails;
|
||||
import org.hl7.fhir.r5.model.TypeDetails.ProfiledType;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IssueMessage;
|
||||
|
@ -68,6 +69,7 @@ import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.ClassTypeInfo;
|
|||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.TypedElementDefinition;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||
import org.hl7.fhir.utilities.MergedList;
|
||||
import org.hl7.fhir.utilities.MergedList.MergeNode;
|
||||
|
@ -148,7 +150,7 @@ public class FHIRPathEngine {
|
|||
private Set<String> primitiveTypes = new HashSet<String>();
|
||||
private Map<String, StructureDefinition> allTypes = new HashMap<String, StructureDefinition>();
|
||||
private boolean legacyMode; // some R2 and R3 constraints assume that != is valid for emptty sets, so when running for R2/R3, this is set ot true
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R5);
|
||||
private ProfileUtilities profileUtilities;
|
||||
private String location; // for error messages
|
||||
private boolean allowPolymorphicNames;
|
||||
|
@ -1436,7 +1438,7 @@ public class FHIRPathEngine {
|
|||
case LowBoundary: return checkParamCount(lexer, location, exp, 0, 1);
|
||||
case HighBoundary: return checkParamCount(lexer, location, exp, 0, 1);
|
||||
case Precision: return checkParamCount(lexer, location, exp, 0);
|
||||
|
||||
case hasTemplateIdOf: return checkParamCount(lexer, location, exp, 1);
|
||||
case Custom: return checkParamCount(lexer, location, exp, details.getMinParameters(), details.getMaxParameters());
|
||||
}
|
||||
return false;
|
||||
|
@ -3141,7 +3143,7 @@ public class FHIRPathEngine {
|
|||
}
|
||||
} else {
|
||||
while (sd != null) {
|
||||
if (sd.getType().equals(exp.getName())) {
|
||||
if (sd.getType().equals(exp.getName()) || sd.getTypeTail().equals(exp.getName())) {
|
||||
result.add(item);
|
||||
break;
|
||||
}
|
||||
|
@ -3627,7 +3629,10 @@ public class FHIRPathEngine {
|
|||
checkContextContinuous(focus, exp.getFunction().toCode(), exp);
|
||||
return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Integer);
|
||||
}
|
||||
|
||||
case hasTemplateIdOf: {
|
||||
checkParamTypes(exp, exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_String));
|
||||
return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Boolean);
|
||||
}
|
||||
case Custom : {
|
||||
return hostServices.checkFunction(this, context.appInfo,exp.getName(), focus, paramTypes);
|
||||
}
|
||||
|
@ -3862,7 +3867,8 @@ public class FHIRPathEngine {
|
|||
case LowBoundary : return funcLowBoundary(context, focus, exp);
|
||||
case HighBoundary : return funcHighBoundary(context, focus, exp);
|
||||
case Precision : return funcPrecision(context, focus, exp);
|
||||
|
||||
case hasTemplateIdOf: return funcHasTemplateIdOf(context, focus, exp);
|
||||
|
||||
|
||||
case Custom: {
|
||||
List<List<Base>> params = new ArrayList<List<Base>>();
|
||||
|
@ -3890,6 +3896,53 @@ public class FHIRPathEngine {
|
|||
}
|
||||
}
|
||||
|
||||
private List<Base> funcHasTemplateIdOf(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
|
||||
List<Base> result = new ArrayList<Base>();
|
||||
List<Base> swb = execute(context, focus, exp.getParameters().get(0), true);
|
||||
String sw = convertToString(swb);
|
||||
|
||||
StructureDefinition sd = this.worker.fetchResource(StructureDefinition.class, sw);
|
||||
if (focus.size() == 1 && sd != null) {
|
||||
boolean found = false;
|
||||
for (Identifier id : sd.getIdentifier()) {
|
||||
if (id.getValue().startsWith("urn:hl7ii:")) {
|
||||
String[] p = id.getValue().split("\\:");
|
||||
if (p.length == 4) {
|
||||
found = found || hasTemplateId(focus.get(0), p[2], p[3]);
|
||||
}
|
||||
} else if (id.getValue().startsWith("urn:oid:")) {
|
||||
found = found || hasTemplateId(focus.get(0), id.getValue().substring(8));
|
||||
}
|
||||
}
|
||||
result.add(new BooleanType(found));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean hasTemplateId(Base base, String rv) {
|
||||
List<Base> templateIds = base.listChildrenByName("templateId");
|
||||
for (Base templateId : templateIds) {
|
||||
Base root = templateId.getChildValueByName("root");
|
||||
Base extension = templateId.getChildValueByName("extension");
|
||||
if (extension == null && root != null && rv.equals(root.primitiveValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasTemplateId(Base base, String rv, String ev) {
|
||||
List<Base> templateIds = base.listChildrenByName("templateId");
|
||||
for (Base templateId : templateIds) {
|
||||
Base root = templateId.getChildValueByName("root");
|
||||
Base extension = templateId.getChildValueByName("extension");
|
||||
if (extension != null && ev.equals(extension.primitiveValue()) && root != null && rv.equals(root.primitiveValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<Base> funcSqrt(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
|
||||
if (focus.size() != 1) {
|
||||
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS, "sqrt", focus.size());
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.hl7.fhir.r5.model.Resource;
|
|||
import org.hl7.fhir.r5.model.StringType;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
public class FHIRPathUtilityClasses {
|
||||
|
@ -56,6 +57,10 @@ public class FHIRPathUtilityClasses {
|
|||
public Base copy() {
|
||||
throw new Error("Not Implemented");
|
||||
}
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.R5;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ClassTypeInfo extends Base {
|
||||
|
@ -119,6 +124,10 @@ public class FHIRPathUtilityClasses {
|
|||
public Base copy() {
|
||||
throw new Error("Not Implemented");
|
||||
}
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.R5;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TypedElementDefinition {
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.hl7.fhir.r5.model.Property;
|
|||
import org.hl7.fhir.r5.model.Reference;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.StringType;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.graphql.Argument;
|
||||
import org.hl7.fhir.utilities.graphql.Argument.ArgumentListStatus;
|
||||
|
@ -126,6 +127,10 @@ public class GraphQLEngine implements IGraphQLEngine {
|
|||
public Base copy() {
|
||||
throw new Error("Not Implemented");
|
||||
}
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.R5;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SearchWrapper extends Base {
|
||||
|
@ -220,6 +225,9 @@ public class GraphQLEngine implements IGraphQLEngine {
|
|||
throw new Error("Not Implemented");
|
||||
}
|
||||
|
||||
public FhirPublication getFHIRPublicationVersion() {
|
||||
return FhirPublication.R5;
|
||||
}
|
||||
}
|
||||
|
||||
private IWorkerContext context;
|
||||
|
|
|
@ -40,7 +40,6 @@ import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
import org.hl7.fhir.r5.elementmodel.Property;
|
||||
|
@ -64,11 +63,13 @@ import org.hl7.fhir.r5.model.TypeDetails.ProfiledType;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.renderers.TerminologyRenderer;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.FHIRLexer;
|
||||
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||
|
@ -105,7 +106,7 @@ public class StructureMapUtilities {
|
|||
private ITransformerServices services;
|
||||
private ProfileKnowledgeProvider pkp;
|
||||
private final Map<String, Integer> ids = new HashMap<String, Integer>();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions();
|
||||
private ValidationOptions terminologyServiceOptions = new ValidationOptions(FhirPublication.R5);
|
||||
private final ProfileUtilities profileUtilities;
|
||||
private boolean exceptionsForChecks = true;
|
||||
private boolean debug;
|
||||
|
|
|
@ -6,11 +6,14 @@ import org.hl7.fhir.r5.model.Parameters;
|
|||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.plantuml.tim.stdlib.GetVariableValue;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -91,7 +94,7 @@ public class BaseWorkerContextTests {
|
|||
public void testAddServerValidationParametersDisplayWarning() throws IOException {
|
||||
BaseWorkerContext baseWorkerContext = getBaseWorkerContext();
|
||||
Parameters pin = new Parameters();
|
||||
baseWorkerContext.addServerValidationParameters(new ValueSet(), pin, new ValidationOptions().setDisplayWarningMode(true));
|
||||
baseWorkerContext.addServerValidationParameters(new ValueSet(), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())).setDisplayWarningMode(true));
|
||||
assertEquals("lenient-display-validation", pin.getParameter("mode").getValue().primitiveValue());
|
||||
}
|
||||
|
||||
|
@ -99,7 +102,7 @@ public class BaseWorkerContextTests {
|
|||
public void testAddServerValidationParametersVsAsUrl() throws IOException {
|
||||
BaseWorkerContext baseWorkerContext = getBaseWorkerContext();
|
||||
Parameters pin = new Parameters();
|
||||
baseWorkerContext.addServerValidationParameters(new ValueSet().setUrl("http://dummy.org/vs"), pin, new ValidationOptions().setVsAsUrl(true));
|
||||
baseWorkerContext.addServerValidationParameters(new ValueSet().setUrl("http://dummy.org/vs"), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())).setVsAsUrl(true));
|
||||
assertEquals("uri", pin.getParameter("url").getValue().fhirType());
|
||||
assertEquals("http://dummy.org/vs", pin.getParameter("url").getValue().primitiveValue());
|
||||
}
|
||||
|
@ -109,7 +112,7 @@ public class BaseWorkerContextTests {
|
|||
BaseWorkerContext baseWorkerContext = getBaseWorkerContext();
|
||||
|
||||
Parameters pin = new Parameters();
|
||||
baseWorkerContext.addServerValidationParameters(new ValueSet(), pin, new ValidationOptions());
|
||||
baseWorkerContext.addServerValidationParameters(new ValueSet(), pin, new ValidationOptions(FhirPublication.fromCode(baseWorkerContext.getVersion())));
|
||||
assertNull(pin.getParameter("mode"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
|
||||
public class CacheTestUtils {
|
||||
public static final ValidationOptions validationOptions = new ValidationOptions().withGuessSystem().withVersionFlexible(false);
|
||||
public static final ValidationOptions validationOptions = new ValidationOptions(FhirPublication.R5).withGuessSystem().withVersionFlexible(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,11 @@ import org.hl7.fhir.r5.model.ValueSet;
|
|||
import org.hl7.fhir.r5.terminologies.client.ITerminologyClient;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpander;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.terminologies.validation.ValueSetValidator;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.ToolingClientLogger;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
@ -60,7 +63,7 @@ public class SimpleWorkerContextTests {
|
|||
TerminologyCache.CacheToken cacheToken;
|
||||
|
||||
@Mock
|
||||
IWorkerContext.ValidationResult expectedValidationResult;
|
||||
ValidationResult expectedValidationResult;
|
||||
|
||||
@Mock
|
||||
ValueSetExpansionOutcome expectedExpansionResult;
|
||||
|
@ -137,7 +140,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
@Test
|
||||
public void testValidateCodingWithCache() throws IOException {
|
||||
ValidationOptions validationOptions = new ValidationOptions().withGuessSystem().withVersionFlexible(false);
|
||||
ValidationOptions validationOptions = new ValidationOptions(FhirPublication.R5).withGuessSystem().withVersionFlexible(false);
|
||||
ValueSet valueSet = new ValueSet();
|
||||
Coding coding = new Coding();
|
||||
|
||||
|
@ -146,7 +149,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
ValidationContextCarrier ctxt = mock(ValidationContextCarrier.class);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
|
@ -157,7 +160,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
@Test
|
||||
public void testValidateCodingWithValueSetChecker() throws IOException {
|
||||
ValidationOptions validationOptions = new ValidationOptions().withGuessSystem().withVersionFlexible(false);
|
||||
ValidationOptions validationOptions = new ValidationOptions(FhirPublication.R5).withGuessSystem().withVersionFlexible(false);
|
||||
ValueSet valueSet = new ValueSet();
|
||||
Coding coding = new Coding();
|
||||
|
||||
|
@ -168,7 +171,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
ValidationContextCarrier ctxt = mock(ValidationContextCarrier.class);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
|
@ -180,7 +183,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
@Test
|
||||
public void testValidateCodingWithServer() throws IOException {
|
||||
ValidationOptions validationOptions = new ValidationOptions().withGuessSystem().withVersionFlexible(false).withNoClient();
|
||||
ValidationOptions validationOptions = new ValidationOptions(FhirPublication.R5).withGuessSystem().withVersionFlexible(false).withNoClient();
|
||||
ValueSet valueSet = new ValueSet();
|
||||
Coding coding = new Coding();
|
||||
|
||||
|
@ -190,7 +193,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
ValidationContextCarrier ctxt = mock(ValidationContextCarrier.class);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
|
@ -207,7 +210,7 @@ public class SimpleWorkerContextTests {
|
|||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(CacheTestUtils.validationOptions, codeableConcept, valueSet, expParameters);
|
||||
Mockito.doReturn(expectedValidationResult).when(terminologyCache).getValidation(cacheToken);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
ValidationResult actualValidationResult = context.validateCode(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple, times(0)).validateCode("CodeableConcept", codeableConcept);
|
||||
|
@ -225,7 +228,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(CacheTestUtils.validationOptions, codeableConcept, valueSet, expParameters);
|
||||
|
||||
IWorkerContext.ValidationResult validationResultB = context.validateCode(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
ValidationResult validationResultB = context.validateCode(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
assertEquals(expectedValidationResult, validationResultB);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple).validateCode("CodeableConcept", codeableConcept);
|
||||
|
@ -247,7 +250,7 @@ public class SimpleWorkerContextTests {
|
|||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(validationOptions, codeableConcept, valueSet, expParameters);
|
||||
|
||||
IWorkerContext.ValidationResult validationResultB = context.validateCode(validationOptions, codeableConcept, valueSet);
|
||||
ValidationResult validationResultB = context.validateCode(validationOptions, codeableConcept, valueSet);
|
||||
|
||||
assertEquals(expectedValidationResult, validationResultB);
|
||||
|
||||
|
@ -328,6 +331,19 @@ public class SimpleWorkerContextTests {
|
|||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
||||
}
|
||||
|
||||
private class ValidationOptionsFhirPublicationMatcher implements ArgumentMatcher<ValidationOptions> {
|
||||
|
||||
final FhirPublication fhirPublication;
|
||||
|
||||
ValidationOptionsFhirPublicationMatcher(FhirPublication fhirPublication) {
|
||||
this.fhirPublication = fhirPublication;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(ValidationOptions argument) {
|
||||
return fhirPublication.toCode().equals(argument.getFhirVersion().toCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpandValueSet4ArgsWithValueSetExpanderSimple() throws IOException {
|
||||
|
||||
|
@ -343,7 +359,7 @@ public class SimpleWorkerContextTests {
|
|||
Mockito.doReturn(expectedExpansionResult).when(valueSetExpanderSimple).expand(eq(vs),
|
||||
argThat(new ParametersMatcher(pInWithDependentResources)));
|
||||
|
||||
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple();
|
||||
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple(argThat(new ValidationOptionsFhirPublicationMatcher(vs.getFHIRPublicationVersion())));
|
||||
|
||||
ValueSetExpansionOutcome actualExpansionResult = context.expandVS(vs, true, true, true, pIn);
|
||||
|
||||
|
@ -370,7 +386,7 @@ public class SimpleWorkerContextTests {
|
|||
Mockito.doReturn(expectedExpansionResult).when(valueSetExpanderSimple).expand(eq(vs),
|
||||
argThat(new ParametersMatcher(pInWithDependentResources)));
|
||||
|
||||
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple();
|
||||
Mockito.doReturn(valueSetExpanderSimple).when(context).constructValueSetExpanderSimple(argThat(new ValidationOptionsFhirPublicationMatcher(vs.getFHIRPublicationVersion())));
|
||||
|
||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(eq(vs), argThat(new ParametersMatcher(pInWithDependentResources)), eq(params));
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.hl7.fhir.r5.model.Parameters;
|
|||
import org.hl7.fhir.r5.model.TerminologyCapabilities;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.utilities.tests.ResourceLoaderTests;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -118,12 +120,12 @@ public class TerminologyCacheTests implements ResourceLoaderTests {
|
|||
terminologyCacheA.cacheTerminologyCapabilities(terminologyCapabilities);
|
||||
terminologyCacheA.cacheCapabilityStatement(capabilityStatement);
|
||||
|
||||
IWorkerContext.ValidationResult codingResultA = new IWorkerContext.ValidationResult(ValidationMessage.IssueSeverity.INFORMATION, "dummyInfo", null);
|
||||
ValidationResult codingResultA = new ValidationResult(ValidationMessage.IssueSeverity.INFORMATION, "dummyInfo", null);
|
||||
TerminologyCache.CacheToken codingTokenA = terminologyCacheA.generateValidationToken(CacheTestUtils.validationOptions,
|
||||
coding, valueSet, new Parameters());
|
||||
terminologyCacheA.cacheValidation(codingTokenA, codingResultA, true);
|
||||
|
||||
IWorkerContext.ValidationResult codeableConceptResultA = new IWorkerContext.ValidationResult(ValidationMessage.IssueSeverity.INFORMATION, "dummyInfo", null);
|
||||
ValidationResult codeableConceptResultA = new ValidationResult(ValidationMessage.IssueSeverity.INFORMATION, "dummyInfo", null);
|
||||
TerminologyCache.CacheToken codeableConceptTokenA = terminologyCacheA.generateValidationToken(CacheTestUtils.validationOptions,
|
||||
concept, valueSet, new Parameters());
|
||||
terminologyCacheA.cacheValidation(codeableConceptTokenA, codeableConceptResultA, true);
|
||||
|
@ -160,7 +162,7 @@ public class TerminologyCacheTests implements ResourceLoaderTests {
|
|||
assertTrue(a.equalsDeep(b));
|
||||
}
|
||||
|
||||
private void assertValidationResultEquals(IWorkerContext.ValidationResult a, IWorkerContext.ValidationResult b) {
|
||||
private void assertValidationResultEquals(ValidationResult a, ValidationResult b) {
|
||||
assertEquals(a.getSeverity(), b.getSeverity());
|
||||
assertEquals(a.getMessage(), b.getMessage());
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
|||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathUtilityClasses.FunctionDetails;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
@ -102,11 +104,20 @@ public class FHIRPathTests {
|
|||
}
|
||||
|
||||
private static FHIRPathEngine fp;
|
||||
private final Map<String, Resource> resources = new HashMap<String, Resource>();
|
||||
private final Map<String, Base> resources = new HashMap<String, Base>();
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
fp = new FHIRPathEngine(TestingUtilities.getSharedWorkerContext());
|
||||
public static void setUp() throws FileNotFoundException, FHIRException, IOException {
|
||||
if (!TestingUtilities.getSharedWorkerContext().hasPackage("hl7.cda.us.ccda", null)) {
|
||||
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true);
|
||||
NpmPackage npm = pcm.loadPackage("hl7.cda.uv.core", "2.0.0");
|
||||
TestingUtilities.getSharedWorkerContext().loadFromPackage(npm, null);
|
||||
npm = pcm.loadPackage("hl7.cda.us.ccda", "current");
|
||||
TestingUtilities.getSharedWorkerContext().loadFromPackage(npm, null);
|
||||
}
|
||||
if (fp == null) {
|
||||
fp = new FHIRPathEngine(TestingUtilities.getSharedWorkerContext());
|
||||
}
|
||||
}
|
||||
|
||||
public static Stream<Arguments> data() throws ParserConfigurationException, SAXException, IOException {
|
||||
|
@ -168,7 +179,7 @@ public class FHIRPathTests {
|
|||
fail = TestResultType.EXECUTION;
|
||||
};
|
||||
fp.setAllowPolymorphicNames("lenient/polymorphics".equals(test.getAttribute("mode")));
|
||||
Resource res = null;
|
||||
Base res = null;
|
||||
|
||||
List<Base> outcome = new ArrayList<Base>();
|
||||
|
||||
|
@ -187,7 +198,9 @@ public class FHIRPathTests {
|
|||
if (!Utilities.noString(input)) {
|
||||
res = resources.get(input);
|
||||
if (res == null) {
|
||||
if (input.endsWith(".json")) {
|
||||
if ("cda".equals(test.getAttribute("mode"))) {
|
||||
res = Manager.makeParser(fp.getWorker(), FhirFormat.XML).parseSingle(TestingUtilities.loadTestResourceStream("r5", input), null);
|
||||
} else if (input.endsWith(".json")) {
|
||||
res = new JsonParser().parse(TestingUtilities.loadTestResourceStream("r5", input));
|
||||
} else {
|
||||
res = new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", input));
|
||||
|
@ -200,7 +213,7 @@ public class FHIRPathTests {
|
|||
if (Utilities.noString(input)) {
|
||||
fp.check(null, null, node);
|
||||
} else {
|
||||
fp.check(res, res.getResourceType().toString(), res.getResourceType().toString(), node);
|
||||
fp.check(res, res.fhirType(), res.fhirType(), node);
|
||||
}
|
||||
Assertions.assertTrue(fail != TestResultType.SEMANTICS, String.format("Expected exception didn't occur checking %s", expression));
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -39,12 +39,12 @@ import org.hl7.fhir.utilities.validation.ValidationOptions;
|
|||
*/
|
||||
public class TerminologyServiceOptions extends ValidationOptions {
|
||||
|
||||
public TerminologyServiceOptions() {
|
||||
super();
|
||||
public TerminologyServiceOptions(FhirPublication fhirVersion) {
|
||||
super(fhirVersion);
|
||||
}
|
||||
|
||||
public TerminologyServiceOptions(String lang) {
|
||||
super(lang);
|
||||
public TerminologyServiceOptions(FhirPublication fhirVersion, String lang) {
|
||||
super(fhirVersion, lang);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.hl7.fhir.utilities.validation;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.AcceptLanguageHeader;
|
||||
|
||||
|
@ -23,12 +24,14 @@ public class ValidationOptions {
|
|||
private boolean versionFlexible = true;
|
||||
private boolean useValueSetDisplays;
|
||||
private boolean englishOk = true;
|
||||
private FhirPublication fhirVersion;
|
||||
|
||||
public ValidationOptions() {
|
||||
public ValidationOptions(FhirPublication fhirVersion) {
|
||||
super();
|
||||
this.fhirVersion = fhirVersion;
|
||||
}
|
||||
|
||||
public ValidationOptions(String language) {
|
||||
public ValidationOptions(FhirPublication fhirVersion, String language) {
|
||||
super();
|
||||
if (!Utilities.noString(language)) {
|
||||
langs = new AcceptLanguageHeader(language, false);
|
||||
|
@ -36,7 +39,7 @@ public class ValidationOptions {
|
|||
}
|
||||
|
||||
public static ValidationOptions defaults() {
|
||||
return new ValidationOptions("en, en-US");
|
||||
return new ValidationOptions(FhirPublication.R5, "en, en-US");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,7 +265,7 @@ public class ValidationOptions {
|
|||
}
|
||||
|
||||
public ValidationOptions copy() {
|
||||
ValidationOptions n = new ValidationOptions();
|
||||
ValidationOptions n = new ValidationOptions(fhirVersion);
|
||||
n.langs = langs == null ? null : langs.copy();
|
||||
n.useServer = useServer;
|
||||
n.useClient = useClient;
|
||||
|
@ -293,6 +296,8 @@ public class ValidationOptions {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public FhirPublication getFhirVersion() {
|
||||
return fhirVersion;
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,7 @@ import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
|||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
|||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SystemOutLoggingService;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.elementmodel.LanguageUtils;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
|
@ -47,6 +46,7 @@ import org.hl7.fhir.r5.renderers.spreadsheets.ConceptMapSpreadsheetGenerator;
|
|||
import org.hl7.fhir.r5.renderers.spreadsheets.StructureDefinitionSpreadsheetGenerator;
|
||||
import org.hl7.fhir.r5.renderers.spreadsheets.ValueSetSpreadsheetGenerator;
|
||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.SystemExitManager;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
|
|
|
@ -10,9 +10,9 @@ import java.util.Set;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
|
|
|
@ -68,7 +68,6 @@ import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.SourcedChildDefinitions;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.elementmodel.Element.SpecialElement;
|
||||
import org.hl7.fhir.r5.elementmodel.JsonParser;
|
||||
|
@ -152,6 +151,7 @@ import org.hl7.fhir.r5.model.ValueSet;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.renderers.DataRenderer;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.BuildExtensions;
|
||||
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
|
@ -175,6 +175,7 @@ import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPo
|
|||
import org.hl7.fhir.r5.utils.validation.constants.IdStatus;
|
||||
import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.HL7WorkGroups;
|
||||
import org.hl7.fhir.utilities.HL7WorkGroups.HL7WorkGroup;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||
|
@ -596,7 +597,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
|
||||
private boolean validateValueSetCodesOnTxServer = true;
|
||||
private QuestionnaireMode questionnaireMode;
|
||||
private ValidationOptions baseOptions = new ValidationOptions();
|
||||
private ValidationOptions baseOptions = new ValidationOptions(FhirPublication.R5);
|
||||
private Map<String, CanonicalResourceLookupResult> crLookups = new HashMap<>();
|
||||
private boolean logProgress;
|
||||
private CodingsObserver codingObserver;
|
||||
|
@ -1119,7 +1120,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
// public API
|
||||
private boolean checkCode(List<ValidationMessage> errors, Element element, String path, String code, String system, String version, String display, boolean checkDisplay, NodeStack stack) throws TerminologyServiceException {
|
||||
long t = System.nanoTime();
|
||||
boolean ss = context.supportsSystem(system);
|
||||
boolean ss = context.supportsSystem(system, baseOptions.getFhirVersion());
|
||||
timeTracker.tx(t, "ss "+system);
|
||||
if (ss) {
|
||||
t = System.nanoTime();
|
||||
|
@ -1381,7 +1382,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
boolean atLeastOneSystemIsSupported = false;
|
||||
for (Coding nextCoding : cc.getCoding()) {
|
||||
String nextSystem = nextCoding.getSystem();
|
||||
if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) {
|
||||
if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem, baseOptions.getFhirVersion())) {
|
||||
atLeastOneSystemIsSupported = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1473,7 +1474,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
public boolean checkBindings(List<ValidationMessage> errors, String path, Element element, NodeStack stack, ValueSet valueset, Coding nextCoding) {
|
||||
boolean ok = true;
|
||||
if (isNotBlank(nextCoding.getCode()) && isNotBlank(nextCoding.getSystem()) && context.supportsSystem(nextCoding.getSystem())) {
|
||||
if (isNotBlank(nextCoding.getCode()) && isNotBlank(nextCoding.getSystem()) && context.supportsSystem(nextCoding.getSystem(), baseOptions.getFhirVersion())) {
|
||||
ValidationResult vr = checkCodeOnServer(stack, valueset, nextCoding, false);
|
||||
if (vr != null && vr.isOk()) {
|
||||
for (OperationOutcomeIssueComponent iss : vr.getIssues()) {
|
||||
|
@ -1534,7 +1535,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
boolean atLeastOneSystemIsSupported = false;
|
||||
for (Coding nextCoding : cc.getCoding()) {
|
||||
String nextSystem = nextCoding.getSystem();
|
||||
if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) {
|
||||
if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem, baseOptions.getFhirVersion())) {
|
||||
atLeastOneSystemIsSupported = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1595,7 +1596,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
String nextCode = nextCoding.getCode();
|
||||
String nextSystem = nextCoding.getSystem();
|
||||
String nextVersion = nextCoding.getVersion();
|
||||
if (isNotBlank(nextCode) && isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) {
|
||||
if (isNotBlank(nextCode) && isNotBlank(nextSystem) && context.supportsSystem(nextSystem, baseOptions.getFhirVersion())) {
|
||||
ValidationResult vr = checkCodeOnServer(stack, nextCode, nextSystem, nextVersion, null, false);
|
||||
if (vr != null && vr.isOk()) {
|
||||
for (OperationOutcomeIssueComponent iss : vr.getIssues()) {
|
||||
|
@ -4259,16 +4260,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (sd != null && (sd.getTypeTail().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot()) {
|
||||
return sd;
|
||||
}
|
||||
if (sd.getAbstract()) {
|
||||
if (sd != null && sd.getAbstract()) {
|
||||
StructureDefinition sdt = context.fetchTypeDefinition(type);
|
||||
StructureDefinition tt = sdt;
|
||||
while (tt != null) {
|
||||
if (tt.getBaseDefinition().equals(sd.getUrl())) {
|
||||
return sdt;
|
||||
}
|
||||
tt = context.fetchResource(StructureDefinition.class, tt.getBaseDefinition());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -4748,7 +4748,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
throw new DefinitionException(context.formatMessagePlural(criteriaElement.getType().size(), I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES, discriminator, ed.getId(), profile.getVersionedUrl(), criteriaElement.typeSummary()));
|
||||
} else
|
||||
throw new DefinitionException(context.formatMessage(I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_NO_TYPES, discriminator, ed.getId(), profile.getVersionedUrl()));
|
||||
if (discriminator.isEmpty()) {
|
||||
if (discriminator.isEmpty()) {
|
||||
expression.append(" and $this is " + type);
|
||||
} else {
|
||||
expression.append(" and " + discriminator + " is " + type);
|
||||
|
@ -4830,11 +4830,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
private String makeTypeForFHIRPath(String type) {
|
||||
if (Utilities.isAbsoluteUrl(type)) {
|
||||
if (type.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
||||
return tail(type);
|
||||
return typeTail(type);
|
||||
} else if (type.startsWith("http://hl7.org/cda/stds/core/StructureDefinition/")) {
|
||||
return "CDA."+tail(type);
|
||||
return "CDA."+typeTail(type);
|
||||
} else {
|
||||
return tail(type); // todo?
|
||||
return typeTail(type); // todo?
|
||||
}
|
||||
} else {
|
||||
String ptype = type.substring(0, 1).toLowerCase() + type.substring(1);
|
||||
|
@ -4846,6 +4846,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
}
|
||||
|
||||
private String typeTail(String type) {
|
||||
return type.contains("/") ? type.substring(type.lastIndexOf("/")+1) : type;
|
||||
}
|
||||
|
||||
private boolean isBaseDefinition(String url) {
|
||||
boolean b = url.startsWith("http://hl7.org/fhir/") && !url.substring(40).contains("/");
|
||||
return b;
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.hl7.fhir.r5.elementmodel.Element;
|
|||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
|
@ -68,7 +69,7 @@ public class CodeSystemValidator extends BaseValidator {
|
|||
} // todo... try getting the value set the other way...
|
||||
|
||||
if (supp != null) {
|
||||
if (context.supportsSystem(supp)) {
|
||||
if (context.supportsSystem(supp, options.getFhirVersion())) {
|
||||
List<Element> concepts = cs.getChildrenByName("concept");
|
||||
int ce = 0;
|
||||
for (Element concept : concepts) {
|
||||
|
@ -234,7 +235,7 @@ public class CodeSystemValidator extends BaseValidator {
|
|||
private boolean validateSupplementConcept(List<ValidationMessage> errors, Element concept, NodeStack stack, String supp, ValidationOptions options) {
|
||||
String code = concept.getChildValue("code");
|
||||
if (!Utilities.noString(code)) {
|
||||
org.hl7.fhir.r5.context.IWorkerContext.ValidationResult res = context.validateCode(options, systemFromCanonical(supp), versionFromCanonical(supp), code, null);
|
||||
org.hl7.fhir.r5.terminologies.utilities.ValidationResult res = context.validateCode(options, systemFromCanonical(supp), versionFromCanonical(supp), code, null);
|
||||
return rule(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, stack.getLiteralPath(), res.isOk(), I18nConstants.CODESYSTEM_CS_SUPP_INVALID_CODE, supp, code);
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
@ -6,8 +6,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
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.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
|
@ -15,7 +13,9 @@ import org.hl7.fhir.r5.model.Coding;
|
|||
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.utilities.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
|
@ -24,10 +23,12 @@ import org.hl7.fhir.r5.model.StringType;
|
|||
import org.hl7.fhir.r5.model.TimeType;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier.ValidationContextResourceProxy;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
|
@ -767,7 +768,7 @@ public class QuestionnaireValidator extends BaseValidator {
|
|||
|
||||
long t = System.nanoTime();
|
||||
ValidationContextCarrier vc = makeValidationContext(errors, qSrc);
|
||||
ValidationResult res = context.validateCode(new ValidationOptions(stack.getWorkingLang()), c, vs, vc);
|
||||
ValidationResult res = context.validateCode(new ValidationOptions(FhirPublication.R5, stack.getWorkingLang()), c, vs, vc);
|
||||
timeTracker.tx(t, "vc "+c.getSystem()+"#"+c.getCode()+" '"+c.getDisplay()+"'");
|
||||
if (!res.isOk()) {
|
||||
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
|||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||
|
@ -36,10 +35,12 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
|||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IssueMessage;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
|
@ -894,7 +895,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
}
|
||||
|
||||
private boolean serverSupportsValueSet(String ref) {
|
||||
ValidationResult vr = context.validateCode(new ValidationOptions().withCheckValueSetOnly().withVsAsUrl().withNoClient(), new Coding("http://loinc.org", "5792-7", null), new ValueSet().setUrl(ref));
|
||||
ValidationResult vr = context.validateCode(new ValidationOptions(FhirPublication.R5).withCheckValueSetOnly().withVsAsUrl().withNoClient(), new Coding("http://loinc.org", "5792-7", null), new ValueSet().setUrl(ref));
|
||||
return vr.getErrorClass() == null || vr.getErrorClass() == TerminologyServiceErrorClass.UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ package org.hl7.fhir.validation.instance.type;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.model.Coding;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.CodingValidationRequest;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Set;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext.SimpleWorkerContextBuilder;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
|
|
|
@ -54,8 +54,8 @@ import org.hl7.fhir.convertors.loaders.loaderR5.R2016MayToR5Loader;
|
|||
import org.hl7.fhir.convertors.loaders.loaderR5.R2ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R3ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
|
||||
import org.hl7.fhir.r5.context.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Parameters;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.utilities.CSFile;
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.formats.XmlParser;
|
||||
|
@ -37,6 +36,7 @@ import org.hl7.fhir.r5.model.UriType;
|
|||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.test.utils.CompareUtilities;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
|
@ -241,7 +241,7 @@ public class TerminologyServiceTests {
|
|||
} else {
|
||||
vs = engine.getContext().fetchResource(ValueSet.class, p.getParameterValue("url").primitiveValue());
|
||||
}
|
||||
ValidationOptions options = new ValidationOptions();
|
||||
ValidationOptions options = new ValidationOptions(FhirPublication.R5);
|
||||
if (p.hasParameter("displayLanguage")) {
|
||||
options = options.withLanguage(p.getParameterString("displayLanguage"));
|
||||
} else if (lang != null ) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.hl7.fhir.validation.tests.utilities;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.tests.TestConfig;
|
||||
|
|
Loading…
Reference in New Issue