commit
af4ec00697
|
@ -2,16 +2,20 @@ package org.hl7.fhir.convertors.analytics;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.utilities.SimpleHTTPClient;
|
||||
import org.hl7.fhir.utilities.SimpleHTTPClient.HTTPResult;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.json.JsonTrackingParser;
|
||||
import org.hl7.fhir.utilities.json.JsonUtilities;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
|
@ -24,18 +28,21 @@ import org.w3c.dom.Document;
|
|||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public class PackageVisitor {
|
||||
|
||||
public interface IPackageVisitorProcessor {
|
||||
public void processResource(String pid, String version, String type, byte[] content) throws FHIRException;
|
||||
public void processResource(String pid, NpmPackage npm, String version, String type, String id, byte[] content) throws FHIRException, IOException, EOperationOutcome;
|
||||
}
|
||||
|
||||
private List<String> resourceTypes = new ArrayList<>();
|
||||
private List<String> versions = new ArrayList<>();
|
||||
private boolean corePackages;
|
||||
private boolean oldVersions;
|
||||
private boolean current;
|
||||
private IPackageVisitorProcessor processor;
|
||||
private FilesystemPackageCacheManager pcm;
|
||||
private PackageClient pc;
|
||||
|
@ -57,7 +64,13 @@ public class PackageVisitor {
|
|||
}
|
||||
|
||||
|
||||
public boolean isCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(boolean current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public boolean isCorePackages() {
|
||||
return corePackages;
|
||||
|
@ -99,20 +112,72 @@ public class PackageVisitor {
|
|||
System.out.println("Finding packages");
|
||||
pc = new PackageClient(PackageClient.PRIMARY_SERVER);
|
||||
pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
|
||||
|
||||
Map<String, String> cpidMap = getAllCIPackages();
|
||||
Set<String> cpidSet = new HashSet<>();
|
||||
System.out.println("Go: "+cpidMap.size()+" current packages");
|
||||
for (String s : cpidMap.keySet()) {
|
||||
processCurrentPackage(s, cpidMap.get(s), cpidSet);
|
||||
}
|
||||
Set<String> pidList = getAllPackages();
|
||||
System.out.println("Go: "+pidList.size()+" packages");
|
||||
for (String pid : pidList) {
|
||||
List<String> vList = listVersions(pid);
|
||||
if (oldVersions) {
|
||||
for (String v : vList) {
|
||||
processPackage(pid, v);
|
||||
System.out.println("Go: "+pidList.size()+" published packages");
|
||||
for (String pid : pidList) {
|
||||
if (!cpidSet.contains(pid)) {
|
||||
List<String> vList = listVersions(pid);
|
||||
if (oldVersions) {
|
||||
for (String v : vList) {
|
||||
processPackage(pid, v);
|
||||
}
|
||||
} else if (vList.isEmpty()) {
|
||||
System.out.println("No Packages for "+pid);
|
||||
} else {
|
||||
processPackage(pid, vList.get(vList.size() - 1));
|
||||
}
|
||||
} else if (vList.isEmpty()) {
|
||||
System.out.println("No Packages for "+pid);
|
||||
} else {
|
||||
processPackage(pid, vList.get(vList.size() - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processCurrentPackage(String url, String pid, Set<String> cpidSet) {
|
||||
try {
|
||||
String[] p = url.split("\\/");
|
||||
String repo = "https://build.fhir.org/ig/"+p[0]+"/"+p[1];
|
||||
NpmPackage npm = NpmPackage.fromUrl(repo+"/package.tgz");
|
||||
String fv = npm.fhirVersion();
|
||||
cpidSet.add(pid);
|
||||
|
||||
if (corePackages || !corePackage(npm)) {
|
||||
int c = 0;
|
||||
if (fv != null && (versions.isEmpty() || versions.contains(fv))) {
|
||||
for (String type : resourceTypes) {
|
||||
for (String s : npm.listResources(type)) {
|
||||
c++;
|
||||
try {
|
||||
processor.processResource(pid+"#current", npm, fv, type, s, TextFile.streamToBytes(npm.load("package", s)));
|
||||
} catch (Exception e) {
|
||||
System.out.println("####### Error loading "+pid+"#current["+fv+"]/"+type+" ####### "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Processed: "+pid+"#current: "+c+" resources");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to process: "+pid+"#current: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> getAllCIPackages() throws IOException {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
if (current) {
|
||||
JsonArray json = JsonTrackingParser.fetchJsonArray("https://build.fhir.org/ig/qas.json");
|
||||
for (JsonElement j : json) {
|
||||
JsonObject o = (JsonObject) j;
|
||||
String url = JsonUtilities.str(o, "repo");
|
||||
res.put(url, JsonUtilities.str(o, "package-id"));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<String> listVersions(String pid) throws IOException {
|
||||
|
@ -172,16 +237,34 @@ public class PackageVisitor {
|
|||
} catch (Throwable e) {
|
||||
System.out.println("Unable to process: "+pid+"#"+v+": "+e.getMessage());
|
||||
}
|
||||
int c = 0;
|
||||
if (fv != null && (versions.isEmpty() || versions.contains(fv))) {
|
||||
for (String type : resourceTypes) {
|
||||
for (String s : npm.listResources(type)) {
|
||||
c++;
|
||||
processor.processResource(pid+"#"+v, fv, type, TextFile.streamToBytes(npm.load("package", s)));
|
||||
if (corePackages || !corePackage(npm)) {
|
||||
int c = 0;
|
||||
if (fv != null && (versions.isEmpty() || versions.contains(fv))) {
|
||||
for (String type : resourceTypes) {
|
||||
for (String s : npm.listResources(type)) {
|
||||
c++;
|
||||
try {
|
||||
processor.processResource(pid+"#"+v, npm, fv, type, s, TextFile.streamToBytes(npm.load("package", s)));
|
||||
} catch (Exception e) {
|
||||
System.out.println("####### Error loading "+pid+"#"+v +"["+fv+"]/"+type+" ####### "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Processed: "+pid+"#"+v+": "+c+" resources");
|
||||
}
|
||||
System.out.println("Processed: "+pid+"#"+v+": "+c+" resources");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean corePackage(NpmPackage npm) {
|
||||
return npm != null && !Utilities.noString(npm.name()) && (
|
||||
npm.name().startsWith("hl7.terminology") ||
|
||||
npm.name().startsWith("hl7.fhir.r2.") ||
|
||||
npm.name().startsWith("hl7.fhir.r2b.") ||
|
||||
npm.name().startsWith("hl7.fhir.r3.") ||
|
||||
npm.name().startsWith("hl7.fhir.r4.") ||
|
||||
npm.name().startsWith("hl7.fhir.r4b.") ||
|
||||
npm.name().startsWith("hl7.fhir.r5."));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class SearchParameterAnalysis implements IPackageVisitorProcessor {
|
||||
|
@ -97,7 +98,7 @@ public class SearchParameterAnalysis implements IPackageVisitorProcessor {
|
|||
private Map<String, SearchParameterVersionAnalysis> versions = new HashMap<String, SearchParameterAnalysis.SearchParameterVersionAnalysis>();
|
||||
|
||||
@Override
|
||||
public void processResource(String pid, String version, String type, byte[] content) throws FHIRException {
|
||||
public void processResource(String pid, NpmPackage npm, String version, String type, String id, byte[] content) throws FHIRException {
|
||||
// System.out.println("v"+version+" "+type+" from "+pid);
|
||||
boolean core = pid.startsWith("hl7.fhir.r") && (pid.contains(".core") || pid.contains(".examples"));
|
||||
version = VersionUtilities.getMajMin(version);
|
||||
|
|
|
@ -224,7 +224,7 @@ public class OperationDefinition14_50 {
|
|||
if (src.hasDocumentation())
|
||||
tgt.setDocumentationElement(String14_50.convertStringToMarkdown(src.getDocumentationElement()));
|
||||
if (src.hasType())
|
||||
tgt.setType(Enumerations.FHIRTypes.fromCode(src.getType()));
|
||||
tgt.setType(Enumerations.FHIRTypes.fromCode(fixTypeCode(src.getType())));
|
||||
if (src.hasSearchType())
|
||||
tgt.setSearchTypeElement(Enumerations14_50.convertSearchParamType(src.getSearchTypeElement()));
|
||||
tgt.addTargetProfile(src.getProfile().getReference());
|
||||
|
@ -235,6 +235,14 @@ public class OperationDefinition14_50 {
|
|||
return tgt;
|
||||
}
|
||||
|
||||
private static String fixTypeCode(String type) {
|
||||
if ("Type".equals(type)) {
|
||||
return "DataType";
|
||||
} else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind> convertOperationKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.OperationDefinition.OperationKind> src) throws FHIRException {
|
||||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class CapabilityStatement30_50 {
|
|||
if (src.hasImplementation())
|
||||
tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation()));
|
||||
if (src.hasFhirVersion())
|
||||
tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion()));
|
||||
tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(fixCode(src.getFhirVersion())));
|
||||
if (src.hasAcceptUnknown())
|
||||
tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue()));
|
||||
for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
|
||||
|
@ -78,6 +78,14 @@ public class CapabilityStatement30_50 {
|
|||
return tgt;
|
||||
}
|
||||
|
||||
private static String fixCode(String v) {
|
||||
if ("STU3".equals(v)) {
|
||||
return "3.0.2";
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu3.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException {
|
||||
if (src == null)
|
||||
return null;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -29,22 +29,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -40,7 +40,7 @@ public class IGHelper {
|
|||
public static final String EXT_MAPPING_CSV = ToolingExtensions.EXT_IGP_MAPPING_CSV;
|
||||
public static final String EXT_BUNDLE = ToolingExtensions.EXT_IGP_BUNDLE;
|
||||
public static final String EXT_RESOURCE_INFO = ToolingExtensions.EXT_IGP_RESOURCE_INFO;
|
||||
public static final String EXT_CONTAINED_RESOURCE_INFO = ToolingExtensions.EXT_IGP_CONTAINED_RESOURCE_INFO;
|
||||
// public static final String EXT_CONTAINED_RESOURCE_INFO = ToolingExtensions.EXT_IGP_CONTAINED_RESOURCE_INFO;
|
||||
public static final String EXT_PRIVATE_BASE = ToolingExtensions.EXT_PRIVATE_BASE;
|
||||
|
||||
public static String readStringParameter(ImplementationGuideDefinitionComponent ig, String name) {
|
||||
|
|
|
@ -169,8 +169,8 @@ public class ToolingExtensions {
|
|||
public static final String EXT_IGP_MAPPING_CSV = "http://hl7.org/fhir/StructureDefinition/igpublisher-mapping-csv";
|
||||
public static final String EXT_IGP_BUNDLE = "http://hl7.org/fhir/StructureDefinition/igpublisher-bundle";
|
||||
public static final String EXT_IGP_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/resource-information";
|
||||
public static final String EXT_IGP_CONTAINED_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/contained-resource-information";
|
||||
public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion";
|
||||
// public static final String EXT_IGP_CONTAINED_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/contained-resource-information";
|
||||
// public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion";
|
||||
public static final String EXT_MAX_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet";
|
||||
public static final String EXT_MIN_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet";
|
||||
public static final String EXT_PROFILE_ELEMENT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element";
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.hl7.fhir.r5.model.Extension;
|
|||
import org.hl7.fhir.r5.model.PrimitiveType;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
|
@ -263,8 +264,8 @@ public class CapabilityStatementComparer extends CanonicalResourceComparer {
|
|||
}
|
||||
|
||||
private void compareExpectations(StructuralMatch<Element> combined, Element left, Element right, String path, CapabilityStatementComparison res, Element union, Element intersection) {
|
||||
Extension l = left.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation");
|
||||
Extension r = right.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation");
|
||||
Extension l = left.getExtensionByUrl(ToolingExtensions.EXT_CAP_STMT_EXPECT);
|
||||
Extension r = right.getExtensionByUrl(ToolingExtensions.EXT_CAP_STMT_EXPECT);
|
||||
if (l != null || r != null) {
|
||||
if (l == null) {
|
||||
union.addExtension(r.copy());
|
||||
|
@ -284,8 +285,8 @@ public class CapabilityStatementComparer extends CanonicalResourceComparer {
|
|||
sm.getMessages().add(new ValidationMessage(Source.ProfileComparer, IssueType.INFORMATIONAL, path+".extension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation')", "Changed value for expectation: '"+ls+"' vs '"+rs+"'", IssueSeverity.WARNING));
|
||||
String lowest = lower(ls, rs) ? ls : rs;
|
||||
String highest = lower(ls, rs) ? rs : ls;
|
||||
union.addExtension("http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation", new CodeType(lowest));
|
||||
intersection.addExtension("http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation", new CodeType(highest));
|
||||
union.addExtension(ToolingExtensions.EXT_CAP_STMT_EXPECT, new CodeType(lowest));
|
||||
intersection.addExtension(ToolingExtensions.EXT_CAP_STMT_EXPECT, new CodeType(highest));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
private ComparisonSession session;
|
||||
private Map<String, String> templates = new HashMap<>();
|
||||
private String folder;
|
||||
private String preamble;
|
||||
|
||||
public ComparisonRenderer(IWorkerContext contextLeft, IWorkerContext contextRight, String folder, ComparisonSession session) {
|
||||
super();
|
||||
|
@ -53,6 +54,14 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
this.folder = folder;
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public String getPreamble() {
|
||||
return preamble;
|
||||
}
|
||||
|
||||
public void setPreamble(String preamble) {
|
||||
this.preamble = preamble;
|
||||
}
|
||||
|
||||
public Map<String, String> getTemplates() {
|
||||
return templates;
|
||||
|
@ -61,6 +70,9 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
public File render(String leftName, String rightName) throws IOException {
|
||||
dumpBinaries();
|
||||
StringBuilder b = new StringBuilder();
|
||||
if (preamble != null) {
|
||||
b.append(preamble);
|
||||
}
|
||||
b.append("<table class=\"grid\">\r\n");
|
||||
b.append(" <tr>\r\n");
|
||||
b.append(" <td width=\"260\"><b>"+Utilities.escapeXml(leftName)+"</b></td>\r\n");
|
||||
|
|
|
@ -408,6 +408,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
|
||||
public interface ProfileKnowledgeProvider {
|
||||
class BindingResolution {
|
||||
public BindingResolution(String display, String url) {
|
||||
this.display = display;
|
||||
this.url = url;
|
||||
}
|
||||
public BindingResolution() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
public String display;
|
||||
public String url;
|
||||
}
|
||||
|
@ -735,14 +742,16 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
if (!Utilities.noString(b.toString())) {
|
||||
String msg = "The profile "+derived.getUrl()+" has "+ce+" "+Utilities.pluralize("element", ce)+" in the differential ("+b.toString()+") that don't have a matching element in the snapshot: check that the path and definitions are legal in the differential (including order)";
|
||||
System.out.println("Error in snapshot generation: "+msg);
|
||||
if (!debug) {
|
||||
System.out.println("Differential: ");
|
||||
for (ElementDefinition ed : derived.getDifferential().getElement())
|
||||
System.out.println(" "+ed.getId()+" = "+ed.getPath()+" : "+typeSummaryWithProfile(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" "+constraintSummary(ed));
|
||||
System.out.println("Snapshot: ");
|
||||
for (ElementDefinition ed : derived.getSnapshot().getElement())
|
||||
System.out.println(" "+ed.getId()+" = "+ed.getPath()+" : "+typeSummaryWithProfile(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" "+constraintSummary(ed));
|
||||
if (debug) {
|
||||
System.out.println("Error in snapshot generation: "+msg);
|
||||
if (!debug) {
|
||||
System.out.println("Differential: ");
|
||||
for (ElementDefinition ed : derived.getDifferential().getElement())
|
||||
System.out.println(" "+ed.getId()+" = "+ed.getPath()+" : "+typeSummaryWithProfile(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" "+constraintSummary(ed));
|
||||
System.out.println("Snapshot: ");
|
||||
for (ElementDefinition ed : derived.getSnapshot().getElement())
|
||||
System.out.println(" "+ed.getId()+" = "+ed.getPath()+" : "+typeSummaryWithProfile(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" "+constraintSummary(ed));
|
||||
}
|
||||
}
|
||||
if (exception)
|
||||
throw new DefinitionException(msg);
|
||||
|
@ -2507,8 +2516,12 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
generateSnapshot(context.fetchTypeDefinition("Extension"), sd, sd.getUrl(), webUrl, sd.getName());
|
||||
}
|
||||
}
|
||||
if (sd == null)
|
||||
System.out.println("Failed to find referenced profile: " + type.getProfile());
|
||||
if (sd == null) {
|
||||
if (debug) {
|
||||
System.out.println("Failed to find referenced profile: " + type.getProfile());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (sd == null)
|
||||
sd = context.fetchTypeDefinition(type.getWorkingCode());
|
||||
|
@ -5218,8 +5231,8 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
for (ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.getPieces().add(checkForNoChange(inv, gen.new Piece(null, inv.getKey()+": ", null).addStyle("font-weight:bold")));
|
||||
if (inv.getHumanElement().hasExtension("http://hl7.org/fhir/StructureDefinition/rendering-markdown")) {
|
||||
c.addMarkdown(inv.getHumanElement().getExtensionString("http://hl7.org/fhir/StructureDefinition/rendering-markdown"));
|
||||
if (inv.getHumanElement().hasExtension(ToolingExtensions.EXT_REND_MD)) {
|
||||
c.addMarkdown(inv.getHumanElement().getExtensionString(ToolingExtensions.EXT_REND_MD));
|
||||
} else {
|
||||
c.getPieces().add(checkForNoChange(inv, gen.new Piece(null, inv.getHuman(), null)));
|
||||
}
|
||||
|
@ -6694,8 +6707,9 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
|
||||
public void setNewSlicingProcessing(boolean newSlicingProcessing) {
|
||||
public ProfileUtilities setNewSlicingProcessing(boolean newSlicingProcessing) {
|
||||
this.newSlicingProcessing = newSlicingProcessing;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -238,8 +238,8 @@ public class XmlSchemaGenerator {
|
|||
|
||||
private String getNs(StructureDefinition sd) {
|
||||
String ns = "http://hl7.org/fhir";
|
||||
if (sd.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
|
||||
ns = ToolingExtensions.readStringExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
|
||||
if (sd.hasExtension(ToolingExtensions.EXT_XML_NAMESPACE))
|
||||
ns = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_XML_NAMESPACE);
|
||||
return ns;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ package org.hl7.fhir.r5.context;
|
|||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -146,6 +144,8 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
private final List<String> loadedPackages = new ArrayList<>();
|
||||
private boolean canNoTS;
|
||||
private XVerExtensionManager xverManager;
|
||||
private boolean allowLazyLoading = true;
|
||||
private boolean suppressDebugMessages;
|
||||
|
||||
private SimpleWorkerContext() throws IOException, FHIRException {
|
||||
super();
|
||||
|
@ -476,7 +476,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
if ((types == null || types.length == 0) && loader != null) {
|
||||
types = loader.getTypes();
|
||||
}
|
||||
if (VersionUtilities.isR2Ver(pi.fhirVersion()) || !pi.canLazyLoad()) {
|
||||
if (VersionUtilities.isR2Ver(pi.fhirVersion()) || !pi.canLazyLoad() || !allowLazyLoading) {
|
||||
// can't lazy load R2 because of valueset/codesystem implementation
|
||||
if (types.length == 0) {
|
||||
types = new String[] { "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem" };
|
||||
|
@ -680,9 +680,11 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
generateSnapshot(sd);
|
||||
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "snapshot", tail(sd.getUrl())+".xml")), sd);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to generate snapshot for "+tail(sd.getUrl()) +" from "+tail(sd.getBaseDefinition())+" because "+e.getMessage());
|
||||
if (true) {
|
||||
e.printStackTrace();
|
||||
if (!suppressDebugMessages) {
|
||||
System.out.println("Unable to generate snapshot for "+tail(sd.getUrl()) +" from "+tail(sd.getBaseDefinition())+" because "+e.getMessage());
|
||||
if (true) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
result.add(sd);
|
||||
|
@ -780,7 +782,9 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
generateSnapshot(p);
|
||||
} catch (Exception e) {
|
||||
// not sure what to do in this case?
|
||||
System.out.println("Unable to generate snapshot for "+uri+": "+e.getMessage());
|
||||
if (!suppressDebugMessages) {
|
||||
System.out.println("Unable to generate snapshot for "+uri+": "+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
|
@ -911,5 +915,22 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean isAllowLazyLoading() {
|
||||
return allowLazyLoading;
|
||||
}
|
||||
|
||||
public void setAllowLazyLoading(boolean allowLazyLoading) {
|
||||
this.allowLazyLoading = allowLazyLoading;
|
||||
}
|
||||
|
||||
public boolean isSuppressDebugMessages() {
|
||||
return suppressDebugMessages;
|
||||
}
|
||||
|
||||
public void setSuppressDebugMessages(boolean suppressDebugMessages) {
|
||||
this.suppressDebugMessages = suppressDebugMessages;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ public class Property {
|
|||
}
|
||||
|
||||
public String getXmlName() {
|
||||
if (definition.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name")) {
|
||||
return ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name");
|
||||
if (definition.hasExtension(ToolingExtensions.EXT_XML_NAME)) {
|
||||
return ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_XML_NAME);
|
||||
} else {
|
||||
return getName();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ private Map<String, Object> userData;
|
|||
if (userData == null)
|
||||
return false;
|
||||
else
|
||||
return userData.containsKey(name);
|
||||
return userData.containsKey(name) && (userData.get(name) != null);
|
||||
}
|
||||
|
||||
public String getUserString(String name) {
|
||||
|
|
|
@ -87,6 +87,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
addMarkdown(x, cm.getDescription());
|
||||
|
||||
x.br();
|
||||
int gc = 0;
|
||||
|
||||
CodeSystem cs = getContext().getWorker().fetchCodeSystem("http://hl7.org/fhir/concept-map-relationship");
|
||||
if (cs == null)
|
||||
|
@ -106,7 +107,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
sources.get("code").add(grp.getSource());
|
||||
targets.get("code").add(grp.getTarget());
|
||||
for (SourceElementComponent ccl : grp.getElement()) {
|
||||
ok = ok && ccl.getTarget().size() == 1 && ccl.getTarget().get(0).getDependsOn().isEmpty() && ccl.getTarget().get(0).getProduct().isEmpty();
|
||||
ok = ok && (ccl.getNoMap() || (ccl.getTarget().size() == 1 && ccl.getTarget().get(0).getDependsOn().isEmpty() && ccl.getTarget().get(0).getProduct().isEmpty()));
|
||||
for (TargetElementComponent ccm : ccl.getTarget()) {
|
||||
comment = comment || !Utilities.noString(ccm.getComment());
|
||||
for (OtherElementComponent d : ccm.getDependsOn()) {
|
||||
|
@ -122,6 +123,25 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
gc++;
|
||||
if (gc > 1) {
|
||||
x.hr();
|
||||
}
|
||||
XhtmlNode pp = x.para();
|
||||
pp.b().tx("Group "+gc);
|
||||
pp.tx("Mapping from ");
|
||||
if (grp.hasSource()) {
|
||||
renderCanonical(cm, pp, grp.getSource());
|
||||
} else {
|
||||
pp.code("unspecified code system");
|
||||
}
|
||||
pp.tx(" to ");
|
||||
if (grp.hasTarget()) {
|
||||
renderCanonical(cm, pp, grp.getTarget());
|
||||
} else {
|
||||
pp.code("unspecified code system");
|
||||
}
|
||||
|
||||
String display;
|
||||
if (ok) {
|
||||
// simple
|
||||
|
@ -132,45 +152,35 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
tr.td().b().tx("Target Code");
|
||||
if (comment)
|
||||
tr.td().b().tx("Comment");
|
||||
tr = tbl.tr();
|
||||
XhtmlNode td = tr.td().colspan(comment ? "4" : "3");
|
||||
td.tx("Mapping from ");
|
||||
if (grp.hasSource()) {
|
||||
renderCanonical(cm, td, grp.getSource());
|
||||
} else {
|
||||
td.code("unspecified code system");
|
||||
}
|
||||
td.tx(" to ");
|
||||
if (grp.hasTarget()) {
|
||||
renderCanonical(cm, td, grp.getTarget());
|
||||
} else {
|
||||
td.code("unspecified code system");
|
||||
}
|
||||
for (SourceElementComponent ccl : grp.getElement()) {
|
||||
tr = tbl.tr();
|
||||
td = tr.td();
|
||||
XhtmlNode td = tr.td();
|
||||
td.addText(ccl.getCode());
|
||||
display = ccl.hasDisplay() ? ccl.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getSource()), versionFromCanonical(grp.getSource()), ccl.getCode());
|
||||
if (display != null && !isSameCodeAndDisplay(ccl.getCode(), display))
|
||||
td.tx(" ("+display+")");
|
||||
TargetElementComponent ccm = ccl.getTarget().get(0);
|
||||
if (!ccm.hasRelationship())
|
||||
tr.td().tx(":"+"("+ConceptMapRelationship.EQUIVALENT.toCode()+")");
|
||||
else {
|
||||
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
|
||||
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
|
||||
tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
|
||||
} else {
|
||||
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));
|
||||
if (ccl.getNoMap()) {
|
||||
tr.td().colspan(comment ? "3" : "2").style("background-color: #efefef").tx("(not mapped)");
|
||||
} else {
|
||||
TargetElementComponent ccm = ccl.getTarget().get(0);
|
||||
if (!ccm.hasRelationship())
|
||||
tr.td().tx(":"+"("+ConceptMapRelationship.EQUIVALENT.toCode()+")");
|
||||
else {
|
||||
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
|
||||
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
|
||||
tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
|
||||
} else {
|
||||
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));
|
||||
}
|
||||
}
|
||||
td = tr.td();
|
||||
td.addText(ccm.getCode());
|
||||
display = ccm.hasDisplay() ? ccm.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getTarget()), versionFromCanonical(grp.getTarget()), ccm.getCode());
|
||||
if (display != null && !isSameCodeAndDisplay(ccm.getCode(), display))
|
||||
td.tx(" ("+display+")");
|
||||
if (comment)
|
||||
tr.td().addText(ccm.getComment());
|
||||
}
|
||||
td = tr.td();
|
||||
td.addText(ccm.getCode());
|
||||
display = ccm.hasDisplay() ? ccm.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getTarget()), versionFromCanonical(grp.getTarget()), ccm.getCode());
|
||||
if (display != null && !isSameCodeAndDisplay(ccm.getCode(), display))
|
||||
td.tx(" ("+display+")");
|
||||
if (comment)
|
||||
tr.td().addText(ccm.getComment());
|
||||
addUnmapped(tbl, grp);
|
||||
}
|
||||
} else {
|
||||
|
@ -398,7 +408,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
if (span2) {
|
||||
td.colspan("2");
|
||||
}
|
||||
td.b().tx("Code");
|
||||
td.b().tx("Codes");
|
||||
td.tx(" from ");
|
||||
if (cs == null)
|
||||
td.tx(url);
|
||||
|
|
|
@ -346,7 +346,7 @@ public class DataRenderer extends Renderer {
|
|||
"ExampleScenario", "GraphDefinition", "ImplementationGuide", "Library", "Measure", "MessageDefinition", "NamingSystem", "PlanDefinition"
|
||||
))
|
||||
return true;
|
||||
return sd.getBaseDefinitionElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-codegen-super");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -- 4. Language support ------------------------------------------------------
|
||||
|
|
|
@ -175,26 +175,28 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
if (i.getReadOnly()) {
|
||||
return true;
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_IS_SUBJ)) {
|
||||
return true;
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
return true;
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
return true;
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
|
||||
if (i.hasExtension(ToolingExtensions.EXT_O_LINK_PERIOD)) {
|
||||
return true;
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation")) {
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_CHOICE_ORIENT)) {
|
||||
return true;
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_DISPLAY_CAT)) {
|
||||
return true;
|
||||
}
|
||||
return checkForFlags(i.getItem());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Row addTreeRoot(HierarchicalTableGenerator gen, List<Row> rows, Questionnaire q, boolean hasFlags) throws IOException {
|
||||
Row r = gen.new Row();
|
||||
|
@ -249,21 +251,21 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-isSubject.html"), null, "Can change the subject of the questionnaire").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png"))));
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
flags.addPiece(gen.new Piece(getSpecLink("extension-questionnaire-hidden.html"), null, "Is a hidden item").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"))));
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-optionalDisplay.html"), null, "Is optional to display").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"))));
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-observationLinkPeriod"), null, "Is linked to an observation").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"))));
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation")) {
|
||||
String code = ToolingExtensions.readStringExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation");
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_CHOICE_ORIENT)) {
|
||||
String code = ToolingExtensions.readStringExtension(i, ToolingExtensions.EXT_Q_CHOICE_ORIENT);
|
||||
flags.addPiece(gen.new Piece(getSpecLink("extension-questionnaire-choiceorientation.html"), null, "Orientation: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"))));
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
|
||||
CodeableConcept cc = i.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").getValueCodeableConcept();
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_DISPLAY_CAT)) {
|
||||
CodeableConcept cc = i.getExtensionByUrl(ToolingExtensions.EXT_Q_DISPLAY_CAT).getValueCodeableConcept();
|
||||
String code = cc.getCode("http://hl7.org/fhir/questionnaire-display-category");
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-displayCategory"), null, "Category: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"))));
|
||||
}
|
||||
|
@ -666,8 +668,8 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
// if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation")) {
|
||||
// String code = ToolingExtensions.readStringExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation");
|
||||
// if (i.hasExtension(ToolingExtensions.EXT_Q_CHOICE_ORIENT)) {
|
||||
// String code = ToolingExtensions.readStringExtension(i, ToolingExtensions.EXT_Q_CHOICE_ORIENT);
|
||||
// flags.addPiece(gen.new Piece("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", null, "Orientation: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"))));
|
||||
//}
|
||||
|
||||
|
@ -681,21 +683,21 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
hasFlag = true;
|
||||
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "Can change the subject of the questionnaire").img(Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png"), "icon");
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
hasFlag = true;
|
||||
flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"), "icon");
|
||||
d.style("background-color: #eeeeee");
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
hasFlag = true;
|
||||
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "Is optional to display").img(Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"), "icon");
|
||||
flags.ah(ToolingExtensions.EXT_Q_OTP_DISP, "Is optional to display").img(Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"), "icon");
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
|
||||
hasFlag = true;
|
||||
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "Is linked to an observation").img(Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"), "icon");
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
|
||||
CodeableConcept cc = i.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").getValueCodeableConcept();
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_DISPLAY_CAT)) {
|
||||
CodeableConcept cc = i.getExtensionByUrl(ToolingExtensions.EXT_Q_DISPLAY_CAT).getValueCodeableConcept();
|
||||
String code = cc.getCode("http://hl7.org/fhir/questionnaire-display-category");
|
||||
hasFlag = true;
|
||||
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-displayCategory", "Category: "+code).img(Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"), "icon");
|
||||
|
@ -958,16 +960,16 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
|
||||
// appearance
|
||||
if (qi.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
|
||||
if (qi.hasExtension(ToolingExtensions.EXT_Q_DISPLAY_CAT)) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().ah("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").tx("Display Category");
|
||||
render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").getValue());
|
||||
tr.td().ah(ToolingExtensions.EXT_Q_DISPLAY_CAT).tx("Display Category");
|
||||
render(tr.td(), qi.getExtensionByUrl(ToolingExtensions.EXT_Q_DISPLAY_CAT).getValue());
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
|
||||
defn(tbl, "Hidden Item", "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory", "This item is a hidden question", null);
|
||||
if (ToolingExtensions.readBoolExtension(qi, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
defn(tbl, "Hidden Item", ToolingExtensions.EXT_Q_DISPLAY_CAT, "This item is a hidden question", null);
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
|
||||
defn(tbl, "Hidden Item", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "This item is optional to display", null);
|
||||
if (ToolingExtensions.readBoolExtension(qi, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
defn(tbl, "Hidden Item", ToolingExtensions.EXT_Q_OTP_DISP, "This item is optional to display", null);
|
||||
}
|
||||
|
||||
// formal definitions
|
||||
|
|
|
@ -429,7 +429,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// }
|
||||
// }
|
||||
//
|
||||
//// if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-choiceOrientation")) {
|
||||
//// if (i.hasExtension(" http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-choiceOrientation")) {
|
||||
//// String code = ToolingExtensions.readStringExtension(i, "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-choiceOrientation");
|
||||
//// flags.addPiece(gen.new Piece("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-observationLinkPeriod", null, "Orientation: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"))));
|
||||
////}
|
||||
|
@ -457,7 +457,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// hasFlag = true;
|
||||
// flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-observationLinkPeriod", "Is linked to an observation").img(Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"));
|
||||
// }
|
||||
// if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory")) {
|
||||
// if (i.hasExtension(" http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory")) {
|
||||
// CodeableConcept cc = i.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory").getValueCodeableConcept();
|
||||
// String code = cc.getCode("http://hl7.org/fhir/QuestionnaireResponse-display-category");
|
||||
// hasFlag = true;
|
||||
|
@ -727,7 +727,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// }
|
||||
//
|
||||
// // appearance
|
||||
// if (qi.hasExtension("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory")) {
|
||||
// if (qi.hasExtension(" http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory")) {
|
||||
// XhtmlNode tr = tbl.tr();
|
||||
// tr.td().ah("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory").tx("Display Category");
|
||||
// render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory").getValue());
|
||||
|
|
|
@ -118,7 +118,8 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
if (spd.hasModifier()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Modifiers");
|
||||
td = tr.td().tx("Allowed: ");
|
||||
td = tr.td();
|
||||
td.tx("Allowed: ");
|
||||
for (Enumeration<SearchModifierCode> t : spd.getModifier()) {
|
||||
td.sep(", ");
|
||||
td.tx(t.asStringValue());
|
||||
|
@ -127,7 +128,8 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
if (spd.hasChain()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Chains");
|
||||
td = tr.td().tx("Allowed: ");
|
||||
td = tr.td();
|
||||
td.tx("Allowed: ");
|
||||
for (StringType t : spd.getChain()) {
|
||||
td.sep(", ");
|
||||
td.tx(t.asStringValue());
|
||||
|
|
|
@ -34,6 +34,9 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
|||
|
||||
public abstract class TerminologyRenderer extends ResourceRenderer {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
|
||||
public TerminologyRenderer(RenderingContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
@ -309,8 +312,11 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
|
|||
a.tx("SNOMED-CT");
|
||||
}
|
||||
else {
|
||||
if (value.startsWith("http://hl7.org") && !Utilities.existsInList(value, "http://hl7.org/fhir/sid/icd-10-us"))
|
||||
System.out.println("Unable to resolve value set "+value);
|
||||
if (value.startsWith("http://hl7.org") && !Utilities.existsInList(value, "http://hl7.org/fhir/sid/icd-10-us")) {
|
||||
if (DEBUG) {
|
||||
System.out.println("Unable to resolve value set "+value);
|
||||
}
|
||||
}
|
||||
li.addText(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1292,7 +1292,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
|
|||
for (ConceptReferenceComponent cc : inc.getConcept()) {
|
||||
String code = cc.getCode();
|
||||
ConceptDefinitionComponent v = null;
|
||||
if (e != null) {
|
||||
if (e != null && code != null) {
|
||||
v = getConceptForCode(e.getConcept(), code);
|
||||
}
|
||||
if (v == null && vse != null) {
|
||||
|
|
|
@ -134,6 +134,7 @@ public class RenderingContext {
|
|||
private DateTimeFormatter dateYearFormat;
|
||||
private DateTimeFormatter dateYearMonthFormat;
|
||||
private boolean copyButton;
|
||||
private ProfileKnowledgeProvider pkp;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -194,6 +195,7 @@ public class RenderingContext {
|
|||
res.locale = locale;
|
||||
res.showComments = showComments;
|
||||
res.copyButton = copyButton;
|
||||
res.pkp = pkp;
|
||||
|
||||
res.terminologyServiceOptions = terminologyServiceOptions.copy();
|
||||
return res;
|
||||
|
@ -210,7 +212,7 @@ public class RenderingContext {
|
|||
|
||||
public ProfileUtilities getProfileUtilities() {
|
||||
if (profileUtilitiesR == null) {
|
||||
profileUtilitiesR = new ProfileUtilities(worker, null, null);
|
||||
profileUtilitiesR = new ProfileUtilities(worker, null, pkp);
|
||||
}
|
||||
return profileUtilitiesR;
|
||||
}
|
||||
|
@ -608,5 +610,12 @@ public class RenderingContext {
|
|||
return this;
|
||||
}
|
||||
|
||||
public void setPkp(ProfileKnowledgeProvider pkp) {
|
||||
this.pkp = pkp;
|
||||
}
|
||||
public ProfileKnowledgeProvider getPkp() {
|
||||
return pkp;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -492,7 +492,7 @@ public class GraphQLSchemaGenerator {
|
|||
private String getJsonFormat(StructureDefinition sd) throws FHIRException {
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||
if (!ed.getType().isEmpty() && ed.getType().get(0).getCodeElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"))
|
||||
return ed.getType().get(0).getCodeElement().getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type");
|
||||
return ed.getType().get(0).getCodeElement().getExtensionString(" http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type");
|
||||
}
|
||||
// all primitives but JSON_NUMBER_TYPES are represented as JSON strings
|
||||
if (JSON_NUMBER_TYPES.contains(sd.getName())) {
|
||||
|
|
|
@ -36,12 +36,12 @@ import org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPa
|
|||
public class IGHelper {
|
||||
|
||||
|
||||
public static final String EXT_SPREADSHEET = ToolingExtensions.EXT_IGP_SPREADSHEET;
|
||||
public static final String EXT_MAPPING_CSV = ToolingExtensions.EXT_IGP_MAPPING_CSV;
|
||||
public static final String EXT_BUNDLE = ToolingExtensions.EXT_IGP_BUNDLE;
|
||||
public static final String EXT_RESOURCE_INFO = ToolingExtensions.EXT_IGP_RESOURCE_INFO;
|
||||
public static final String EXT_CONTAINED_RESOURCE_INFO = ToolingExtensions.EXT_IGP_CONTAINED_RESOURCE_INFO;
|
||||
public static final String EXT_PRIVATE_BASE = ToolingExtensions.EXT_PRIVATE_BASE;
|
||||
// public static final String EXT_SPREADSHEET = ToolingExtensions.EXT_IGP_SPREADSHEET;
|
||||
// public static final String EXT_MAPPING_CSV = ToolingExtensions.EXT_IGP_MAPPING_CSV;
|
||||
// public static final String EXT_BUNDLE = ToolingExtensions.EXT_IGP_BUNDLE;
|
||||
// public static final String EXT_RESOURCE_INFO = ToolingExtensions.EXT_IGP_RESOURCE_INFO;
|
||||
// public static final String EXT_CONTAINED_RESOURCE_INFO = ToolingExtensions.EXT_IGP_CONTAINED_RESOURCE_INFO;
|
||||
// public static final String EXT_PRIVATE_BASE = ToolingExtensions.EXT_PRIVATE_BASE;
|
||||
|
||||
public static String readStringParameter(ImplementationGuideDefinitionComponent ig, String name) {
|
||||
for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) {
|
||||
|
|
|
@ -6,19 +6,19 @@ import java.lang.reflect.Modifier;
|
|||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
|
@ -29,7 +29,7 @@ import java.lang.reflect.Modifier;
|
|||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
@ -112,105 +112,115 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
|||
|
||||
public class ToolingExtensions {
|
||||
|
||||
// validated
|
||||
// private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
|
||||
// public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/codesystem-deprecated";
|
||||
public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition";
|
||||
public static final String EXT_CS_COMMENT = "http://hl7.org/fhir/StructureDefinition/codesystem-concept-comments";
|
||||
public static final String EXT_VS_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-concept-comments";
|
||||
public static final String EXT_CS_KEYWORD = "http://hl7.org/fhir/StructureDefinition/codesystem-keyWord";
|
||||
public static final String EXT_VS_KEYWORD = "http://hl7.org/fhir/StructureDefinition/valueset-keyWord";
|
||||
private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier";
|
||||
public static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation";
|
||||
public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source";
|
||||
public static final String EXT_ISSUE_MSG_ID = "http://hl7.org/fhir/StructureDefinition/operationoutcome-message-id";
|
||||
public static final String EXT_ISSUE_LINE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line";
|
||||
public static final String EXT_ISSUE_COL = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col";
|
||||
public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint";
|
||||
public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby";
|
||||
public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/regex";
|
||||
public static final String EXT_CONTROL = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl";
|
||||
public static final String EXT_MINOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs";
|
||||
public static final String EXT_MAXOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs";
|
||||
public static final String EXT_ALLOWEDRESOURCE = "http://hl7.org/fhir/StructureDefinition/questionnaire-allowedResource";
|
||||
public static final String EXT_REFERENCEFILTER = "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter";
|
||||
public static final String EXT_CODE_GENERATION_PARENT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-codegen-super";
|
||||
public static final String EXT_HIERARCHY = "http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy";
|
||||
public static final String EXT_BEST_PRACTICE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice";
|
||||
public static final String EXT_BEST_PRACTICE_EXPLANATION = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation";
|
||||
// unregistered?
|
||||
public static final String EXT_MAPPING_PREFIX = "http://hl7.org/fhir/tools/StructureDefinition/logical-mapping-prefix";
|
||||
public static final String EXT_MAPPING_SUFFIX = "http://hl7.org/fhir/tools/StructureDefinition/logical-mapping-suffix";
|
||||
|
||||
// public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover";
|
||||
public static final String EXT_QTYPE = "http://hl7.org/fhir/StructureDefinition/questionnnaire-baseType";
|
||||
// private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
|
||||
// private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter";
|
||||
// private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
|
||||
// private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
|
||||
private static final String EXT_FHIRTYPE = "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType";
|
||||
private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits";
|
||||
public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference";
|
||||
public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed";
|
||||
public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm";
|
||||
public static final String EXT_FMM_SUPPORT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm-support";
|
||||
public static final String EXT_FMM_DERIVED = "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom";
|
||||
public static final String EXT_SEC_CAT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category";
|
||||
public static final String EXT_RESOURCE_CATEGORY = "http://hl7.org/fhir/StructureDefinition/structuredefinition-category";
|
||||
public static final String EXT_RESOURCE_INTERFACE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-interface";
|
||||
public static final String EXT_RESOURCE_IMPLEMENTS = "http://hl7.org/fhir/StructureDefinition/structuredefinition-implements";
|
||||
public static final String EXT_TABLE_NAME = "http://hl7.org/fhir/StructureDefinition/structuredefinition-table-name";
|
||||
public static final String EXT_OO_FILE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-file";
|
||||
public static final String EXT_WORKGROUP = "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg";
|
||||
public static final String EXT_STANDARDS_STATUS = "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status";
|
||||
public static final String EXT_NORMATIVE_VERSION = "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version";
|
||||
public static final String EXT_ALLOWEDRESOURCE = "http://hl7.org/fhir/StructureDefinition/questionnaire-allowedResource";
|
||||
public static final String EXT_OO_FILE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-file";
|
||||
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
|
||||
public static final String EXT_PATTERN = "http://hl7.org/fhir/StructureDefinition/elementdefinition-pattern";
|
||||
public static final String EXT_XML_NAME = "http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name";
|
||||
public static final String EXT_BINDING_STYLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-binding-style";
|
||||
public static final String EXT_EXPLICIT_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name";
|
||||
public static final String EXT_TIME_FORMAT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-timeformat";
|
||||
|
||||
public static final String EXT_IGP_RESOURCES = "http://hl7.org/fhir/StructureDefinition/igpublisher-folder-resource";
|
||||
public static final String EXT_IGP_PAGES = "http://hl7.org/fhir/StructureDefinition/igpublisher-folder-pages";
|
||||
public static final String EXT_IGP_SPREADSHEET = "http://hl7.org/fhir/StructureDefinition/igpublisher-spreadsheet";
|
||||
public static final String EXT_IGP_MAPPING_CSV = "http://hl7.org/fhir/StructureDefinition/igpublisher-mapping-csv";
|
||||
public static final String EXT_IGP_BUNDLE = "http://hl7.org/fhir/StructureDefinition/igpublisher-bundle";
|
||||
public static final String EXT_IGP_BASE = "http://hl7.org/fhir/StructureDefinition/igpublisher-res-base";
|
||||
public static final String EXT_IGP_DEFNS = "http://hl7.org/fhir/StructureDefinition/igpublisher-res-defns";
|
||||
public static final String EXT_IGP_FORMAT = "http://hl7.org/fhir/StructureDefinition/igpublisher-res-format";
|
||||
public static final String EXT_IGP_SOURCE = "http://hl7.org/fhir/StructureDefinition/igpublisher-res-source";
|
||||
public static final String EXT_IGP_VERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-res-version";
|
||||
public static final String EXT_IGP_RESOURCES = "http://hl7.org/fhir/StructureDefinition/igpublisher-folder-resource";
|
||||
public static final String EXT_IGP_PAGES = "http://hl7.org/fhir/StructureDefinition/igpublisher-folder-pages";
|
||||
public static final String EXT_IGP_SPREADSHEET = "http://hl7.org/fhir/StructureDefinition/igpublisher-spreadsheet";
|
||||
public static final String EXT_IGP_MAPPING_CSV = "http://hl7.org/fhir/StructureDefinition/igpublisher-mapping-csv";
|
||||
public static final String EXT_IGP_BUNDLE = "http://hl7.org/fhir/StructureDefinition/igpublisher-bundle";
|
||||
public static final String EXT_IGP_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/resource-information";
|
||||
public static final String EXT_IGP_CONTAINED_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/contained-resource-information";
|
||||
public static final String EXT_PRIVATE_BASE = "http://hl7.org/fhir/tools/";
|
||||
public static final String EXT_BINARY_FORMAT = "http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format";
|
||||
public static final String EXT_IGP_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/resource-information";
|
||||
public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion";
|
||||
public static final String EXT_MAX_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet";
|
||||
public static final String EXT_MIN_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet";
|
||||
public static final String EXT_PROFILE_ELEMENT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element";
|
||||
public static final String EXT_LIST_PACKAGE = "http://hl7.org/fhir/StructureDefinition/list-packageId";
|
||||
|
||||
// validated
|
||||
// private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
|
||||
// public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/codesystem-deprecated";
|
||||
|
||||
private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits";
|
||||
private static final String EXT_FHIRTYPE = "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType";
|
||||
public static final String EXT_ALLOWED_TYPE = "http://hl7.org/fhir/StructureDefinition/operationdefinition-allowed-type";
|
||||
public static final String EXT_BEST_PRACTICE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice"; // Y
|
||||
public static final String EXT_BEST_PRACTICE_EXPLANATION = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation"; // Y
|
||||
public static final String EXT_BINDING_NAME = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName";
|
||||
public static final String EXT_CONTROL = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"; // Y
|
||||
public static final String EXT_CS_COMMENT = "http://hl7.org/fhir/StructureDefinition/codesystem-concept-comments"; // Y
|
||||
public static final String EXT_CS_KEYWORD = "http://hl7.org/fhir/StructureDefinition/codesystem-keyWord"; // Y
|
||||
public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition"; // Y
|
||||
public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint"; // Y
|
||||
public static final String EXT_EXPAND_GROUP = "http://hl7.org/fhir/StructureDefinition/valueset-expand-group";
|
||||
public static final String EXT_EXPAND_RULES = "http://hl7.org/fhir/StructureDefinition/valueset-expand-rules";
|
||||
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
|
||||
public static final String EXT_FHIR_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type";
|
||||
public static final String EXT_FMM_DERIVED = "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom";
|
||||
public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm";
|
||||
public static final String EXT_FMM_SUPPORT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm-support";
|
||||
public static final String EXT_HIERARCHY = "http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy"; // Y
|
||||
public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source"; // Y
|
||||
public static final String EXT_MAXOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs"; // Y
|
||||
public static final String EXT_MAX_DECIMALS = "http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces";
|
||||
public static final String EXT_MAX_SIZE = "http://hl7.org/fhir/StructureDefinition/maxSize";
|
||||
public static final String EXT_MAX_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet";
|
||||
public static final String EXT_MINOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs"; // Y
|
||||
public static final String EXT_MIN_LENGTH = "http://hl7.org/fhir/StructureDefinition/minLength";
|
||||
public static final String EXT_MIN_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet";
|
||||
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
|
||||
public static final String EXT_NORMATIVE_VERSION = "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version";
|
||||
public static final String EXT_PROFILE_ELEMENT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element";
|
||||
public static final String EXT_QTYPE = "http://hl7.org/fhir/StructureDefinition/questionnnaire-baseType";
|
||||
public static final String EXT_Q_UNIT = "http://hl7.org/fhir/StructureDefinition/questionnaire-unit";
|
||||
public static final String EXT_REFERENCEFILTER = "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter"; // Y
|
||||
public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/regex"; // Y
|
||||
public static final String EXT_RENDERED_VALUE = "http://hl7.org/fhir/StructureDefinition/rendered-value";
|
||||
public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/codesystem-replacedby";
|
||||
public static final String EXT_RESOURCE_CATEGORY = "http://hl7.org/fhir/StructureDefinition/structuredefinition-category";
|
||||
public static final String EXT_RESOURCE_INTERFACE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-interface";
|
||||
public static final String EXT_SEC_CAT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category";
|
||||
public static final String EXT_STANDARDS_STATUS = "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status";
|
||||
public static final String EXT_TABLE_NAME = "http://hl7.org/fhir/StructureDefinition/structuredefinition-table-name";
|
||||
public static final String EXT_TARGET_ID = "http://hl7.org/fhir/StructureDefinition/targetElement";
|
||||
public static final String EXT_TARGET_PATH = "http://hl7.org/fhir/StructureDefinition/targetPath";
|
||||
public static final String EXT_TRANSLATABLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable";
|
||||
public static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation"; // Y
|
||||
public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed";
|
||||
public static final String EXT_VALUESET_SYSTEM = "http://hl7.org/fhir/StructureDefinition/valueset-system";
|
||||
public static final String EXT_VS_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-concept-comments"; // Y
|
||||
public static final String EXT_VS_KEYWORD = "http://hl7.org/fhir/StructureDefinition/valueset-keyWord"; // Y
|
||||
public static final String EXT_WORKGROUP = "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg";
|
||||
public static final String EXT_XML_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
|
||||
public static final String EXT_Q_IS_SUBJ = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject";
|
||||
public static final String EXT_Q_HIDDEN = "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden";
|
||||
public static final String EXT_Q_OTP_DISP = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay";
|
||||
public static final String EXT_O_LINK_PERIOD = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod";
|
||||
public static final String EXT_Q_CHOICE_ORIENT = "http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation";
|
||||
public static final String EXT_Q_DISPLAY_CAT = "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory";
|
||||
public static final String EXT_REND_MD = "http://hl7.org/fhir/StructureDefinition/rendering-markdown";
|
||||
public static final String EXT_CAP_STMT_EXPECT = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation";
|
||||
public static final String EXT_ED_HEIRARCHY = "http://hl7.org/fhir/StructureDefinition/elementdefinition-heirarchy";
|
||||
|
||||
// in the tooling IG
|
||||
public static final String EXT_BINDING_ADDITIONAL = "http://hl7.org/fhir/tools/StructureDefinition/additional-binding";
|
||||
|
||||
// unregistered? - don't know what these are used for
|
||||
public static final String EXT_MAPPING_PREFIX = "http://hl7.org/fhir/tools/StructureDefinition/logical-mapping-prefix";
|
||||
public static final String EXT_MAPPING_SUFFIX = "http://hl7.org/fhir/tools/StructureDefinition/logical-mapping-suffix";
|
||||
|
||||
// for the v2 mapping project
|
||||
public static final String EXT_MAPPING_NAME = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-source-name";
|
||||
public static final String EXT_MAPPING_TYPE = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-source-type";
|
||||
public static final String EXT_MAPPING_CARD = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-source-cardinality";
|
||||
public static final String EXT_MAPPING_TGTTYPE = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-target-type";
|
||||
public static final String EXT_MAPPING_TGTCARD = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-target-cardinality";
|
||||
public static final String EXT_PRIVATE_BASE = "http://hl7.org/fhir/tools/";
|
||||
public static final String EXT_ALLOWED_TYPE = "http://hl7.org/fhir/StructureDefinition/operationdefinition-allowed-type";
|
||||
public static final String EXT_FHIR_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type";
|
||||
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
|
||||
public static final String EXT_RENDERED_VALUE = "http://hl7.org/fhir/StructureDefinition/rendered-value";
|
||||
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
|
||||
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
|
||||
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
|
||||
public static final String EXT_TRANSLATABLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable";
|
||||
public static final String EXT_PATTERN = "http://hl7.org/fhir/StructureDefinition/elementdefinition-pattern";
|
||||
public static final String EXT_BINDING_METHOD = "http://hl7.org/fhir/StructureDefinition/elementdefinition-binding-method";
|
||||
public static final String EXT_XML_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
public static final String EXT_XML_NAME = "http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name";
|
||||
public static final String EXT_BINDING_STYLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-binding-style";
|
||||
public static final String EXT_BINARY_FORMAT = "http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format";
|
||||
public static final String EXT_TARGET_ID = "http://hl7.org/fhir/StructureDefinition/targetElement";
|
||||
public static final String EXT_TARGET_PATH = "http://hl7.org/fhir/StructureDefinition/targetPath";
|
||||
public static final String EXT_VALUESET_SYSTEM = "http://hl7.org/fhir/StructureDefinition/valueset-system";
|
||||
public static final String EXT_EXPAND_RULES = "http://hl7.org/fhir/StructureDefinition/valueset-expand-rules";
|
||||
public static final String EXT_EXPAND_GROUP = "http://hl7.org/fhir/StructureDefinition/valueset-expand-group";
|
||||
public static final String EXT_BINDING_ADDITIONAL = "http://hl7.org/fhir/tools/StructureDefinition/additional-binding";
|
||||
public static final String EXT_MIN_LENGTH = "http://hl7.org/fhir/StructureDefinition/minLength";
|
||||
public static final String EXT_MAX_DECIMALS = "http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces";
|
||||
public static final String EXT_MAX_SIZE = "http://hl7.org/fhir/StructureDefinition/maxSize";
|
||||
|
||||
|
||||
// specific extension helpers
|
||||
|
||||
public static Extension makeIssueSource(Source source) {
|
||||
|
@ -241,15 +251,15 @@ public class ToolingExtensions {
|
|||
return getExtension(e, url) != null;
|
||||
}
|
||||
|
||||
// public static void addStringExtension(DomainResource dr, String url, String content) {
|
||||
// if (!StringUtils.isBlank(content)) {
|
||||
// Extension ex = getExtension(dr, url);
|
||||
// if (ex != null)
|
||||
// ex.setValue(new StringType(content));
|
||||
// else
|
||||
// dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
|
||||
// }
|
||||
// }
|
||||
// public static void addStringExtension(DomainResource dr, String url, String content) {
|
||||
// if (!StringUtils.isBlank(content)) {
|
||||
// Extension ex = getExtension(dr, url);
|
||||
// if (ex != null)
|
||||
// ex.setValue(new StringType(content));
|
||||
// else
|
||||
// dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
|
||||
// }
|
||||
// }
|
||||
|
||||
public static void addMarkdownExtension(DomainResource dr, String url, String content) {
|
||||
if (!StringUtils.isBlank(content)) {
|
||||
|
@ -338,10 +348,10 @@ public class ToolingExtensions {
|
|||
nc.getExtension().add(Factory.newExtension(EXT_CS_COMMENT, Factory.newString_(comment), true));
|
||||
}
|
||||
|
||||
// public static void markDeprecated(Element nc) {
|
||||
// setDeprecated(nc);
|
||||
// }
|
||||
//
|
||||
// public static void markDeprecated(Element nc) {
|
||||
// setDeprecated(nc);
|
||||
// }
|
||||
//
|
||||
|
||||
public static void addDefinition(Element nc, String definition) {
|
||||
if (!StringUtils.isBlank(definition))
|
||||
|
@ -477,37 +487,37 @@ public class ToolingExtensions {
|
|||
public static String getCSComment(ConceptDefinitionComponent c) {
|
||||
return readStringExtension(c, EXT_CS_COMMENT);
|
||||
}
|
||||
//
|
||||
// public static Boolean getDeprecated(Element c) {
|
||||
// return readBooleanExtension(c, EXT_DEPRECATED);
|
||||
// }
|
||||
//
|
||||
// public static Boolean getDeprecated(Element c) {
|
||||
// return readBooleanExtension(c, EXT_DEPRECATED);
|
||||
// }
|
||||
|
||||
public static boolean hasCSComment(ConceptDefinitionComponent c) {
|
||||
return findStringExtension(c, EXT_CS_COMMENT);
|
||||
}
|
||||
|
||||
// public static boolean hasDeprecated(Element c) {
|
||||
// return findBooleanExtension(c, EXT_DEPRECATED);
|
||||
// }
|
||||
// public static boolean hasDeprecated(Element c) {
|
||||
// return findBooleanExtension(c, EXT_DEPRECATED);
|
||||
// }
|
||||
|
||||
public static void addFlyOver(QuestionnaireItemComponent item, String text, String linkId){
|
||||
if (!StringUtils.isBlank(text)) {
|
||||
QuestionnaireItemComponent display = item.addItem();
|
||||
display.setType(QuestionnaireItemType.DISPLAY);
|
||||
display.setText(text);
|
||||
display.setLinkId(linkId);
|
||||
display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true));
|
||||
QuestionnaireItemComponent display = item.addItem();
|
||||
display.setType(QuestionnaireItemType.DISPLAY);
|
||||
display.setText(text);
|
||||
display.setLinkId(linkId);
|
||||
display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMin(QuestionnaireItemComponent item, int min) {
|
||||
item.getExtension().add(Factory.newExtension(EXT_MINOCCURS, Factory.newInteger(min), true));
|
||||
}
|
||||
|
||||
|
||||
public static void addMax(QuestionnaireItemComponent item, int max) {
|
||||
item.getExtension().add(Factory.newExtension(EXT_MAXOCCURS, Factory.newInteger(max), true));
|
||||
}
|
||||
|
||||
|
||||
public static void addFhirType(QuestionnaireItemComponent group, String value) {
|
||||
group.getExtension().add(Factory.newExtension(EXT_FHIRTYPE, Factory.newString_(value), true));
|
||||
}
|
||||
|
@ -524,9 +534,9 @@ public class ToolingExtensions {
|
|||
group.getExtension().add(Factory.newExtension(EXT_REFERENCEFILTER, Factory.newString_(value), true));
|
||||
}
|
||||
|
||||
public static void addIdentifier(Element element, Identifier value) {
|
||||
element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true));
|
||||
}
|
||||
// public static void addIdentifier(Element element, Identifier value) {
|
||||
// element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true));
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param name the identity of the extension of interest
|
||||
|
@ -559,7 +569,7 @@ public class ToolingExtensions {
|
|||
public static void setStringExtension(DomainResource resource, String uri, String value) {
|
||||
if (Utilities.noString(value))
|
||||
return;
|
||||
Extension ext = getExtension(resource, uri);
|
||||
Extension ext = getExtension(resource, uri);
|
||||
if (ext != null)
|
||||
ext.setValue(new StringType(value));
|
||||
else
|
||||
|
@ -569,7 +579,7 @@ public class ToolingExtensions {
|
|||
public static void setStringExtension(Element resource, String uri, String value) {
|
||||
if (Utilities.noString(value))
|
||||
return;
|
||||
Extension ext = getExtension(resource, uri);
|
||||
Extension ext = getExtension(resource, uri);
|
||||
if (ext != null)
|
||||
ext.setValue(new StringType(value));
|
||||
else
|
||||
|
@ -579,7 +589,7 @@ public class ToolingExtensions {
|
|||
public static void setCodeExtension(DomainResource resource, String uri, String value) {
|
||||
if (Utilities.noString(value))
|
||||
return;
|
||||
|
||||
|
||||
Extension ext = getExtension(resource, uri);
|
||||
if (ext != null)
|
||||
ext.setValue(new CodeType(value));
|
||||
|
@ -590,7 +600,7 @@ public class ToolingExtensions {
|
|||
public static void setCodeExtension(Element element, String uri, String value) {
|
||||
if (Utilities.noString(value))
|
||||
return;
|
||||
|
||||
|
||||
Extension ext = getExtension(element, uri);
|
||||
if (ext != null)
|
||||
ext.setValue(new CodeType(value));
|
||||
|
@ -606,34 +616,34 @@ public class ToolingExtensions {
|
|||
resource.getExtension().add(new Extension(uri).setValue(new IntegerType(value)));
|
||||
}
|
||||
|
||||
// public static String getOID(CodeSystem define) {
|
||||
// return readStringExtension(define, EXT_OID);
|
||||
// }
|
||||
//
|
||||
// public static String getOID(ValueSet vs) {
|
||||
// return readStringExtension(vs, EXT_OID);
|
||||
// }
|
||||
//
|
||||
// public static void setOID(CodeSystem define, String oid) throws FHIRFormatError, URISyntaxException {
|
||||
// if (!oid.startsWith("urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (oid.startsWith("urn:oid:urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (!hasExtension(define, EXT_OID))
|
||||
// define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
|
||||
// else if (!oid.equals(readStringExtension(define, EXT_OID)))
|
||||
// throw new Error("Attempt to assign multiple OIDs to a code system");
|
||||
// }
|
||||
// public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
|
||||
// if (!oid.startsWith("urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (oid.startsWith("urn:oid:urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (!hasExtension(vs, EXT_OID))
|
||||
// vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
|
||||
// else if (!oid.equals(readStringExtension(vs, EXT_OID)))
|
||||
// throw new Error("Attempt to assign multiple OIDs to value set "+vs.getName()+" ("+vs.getUrl()+"). Has "+readStringExtension(vs, EXT_OID)+", trying to add "+oid);
|
||||
// }
|
||||
// public static String getOID(CodeSystem define) {
|
||||
// return readStringExtension(define, EXT_OID);
|
||||
// }
|
||||
//
|
||||
// public static String getOID(ValueSet vs) {
|
||||
// return readStringExtension(vs, EXT_OID);
|
||||
// }
|
||||
//
|
||||
// public static void setOID(CodeSystem define, String oid) throws FHIRFormatError, URISyntaxException {
|
||||
// if (!oid.startsWith("urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (oid.startsWith("urn:oid:urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (!hasExtension(define, EXT_OID))
|
||||
// define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
|
||||
// else if (!oid.equals(readStringExtension(define, EXT_OID)))
|
||||
// throw new Error("Attempt to assign multiple OIDs to a code system");
|
||||
// }
|
||||
// public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
|
||||
// if (!oid.startsWith("urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (oid.startsWith("urn:oid:urn:oid:"))
|
||||
// throw new FHIRFormatError("Error in OID format");
|
||||
// if (!hasExtension(vs, EXT_OID))
|
||||
// vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
|
||||
// else if (!oid.equals(readStringExtension(vs, EXT_OID)))
|
||||
// throw new Error("Attempt to assign multiple OIDs to value set "+vs.getName()+" ("+vs.getUrl()+"). Has "+readStringExtension(vs, EXT_OID)+", trying to add "+oid);
|
||||
// }
|
||||
|
||||
public static boolean hasLanguageTranslation(Element element, String lang) {
|
||||
for (Extension e : element.getExtension()) {
|
||||
|
@ -664,7 +674,7 @@ public class ToolingExtensions {
|
|||
public static void addLanguageTranslation(Element element, String lang, String value) {
|
||||
if (Utilities.noString(lang) || Utilities.noString(value))
|
||||
return;
|
||||
|
||||
|
||||
Extension extension = new Extension().setUrl(EXT_TRANSLATION);
|
||||
extension.addExtension().setUrl("lang").setValue(new CodeType(lang));
|
||||
extension.addExtension().setUrl("content").setValue(new StringType(value));
|
||||
|
@ -703,23 +713,23 @@ public class ToolingExtensions {
|
|||
return results;
|
||||
}
|
||||
|
||||
// public static void addDEReference(DataElement de, String value) {
|
||||
// for (Extension e : de.getExtension())
|
||||
// if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
|
||||
// e.setValue(new UriType(value));
|
||||
// return;
|
||||
// }
|
||||
// de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
|
||||
// }
|
||||
// public static void addDEReference(DataElement de, String value) {
|
||||
// for (Extension e : de.getExtension())
|
||||
// if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
|
||||
// e.setValue(new UriType(value));
|
||||
// return;
|
||||
// }
|
||||
// de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
|
||||
// }
|
||||
|
||||
// public static void setDeprecated(Element nc) {
|
||||
// for (Extension e : nc.getExtension())
|
||||
// if (e.getUrl().equals(EXT_DEPRECATED)) {
|
||||
// e.setValue(new BooleanType(true));
|
||||
// return;
|
||||
// }
|
||||
// nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
|
||||
// }
|
||||
// public static void setDeprecated(Element nc) {
|
||||
// for (Extension e : nc.getExtension())
|
||||
// if (e.getUrl().equals(EXT_DEPRECATED)) {
|
||||
// e.setValue(new BooleanType(true));
|
||||
// return;
|
||||
// }
|
||||
// nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
|
||||
// }
|
||||
|
||||
public static void setExtension(Element focus, String url, Coding c) {
|
||||
for (Extension e : focus.getExtension())
|
||||
|
@ -739,7 +749,7 @@ public class ToolingExtensions {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void removeExtension(Element focus, String url) {
|
||||
Iterator<Extension> i = focus.getExtension().iterator();
|
||||
while (i.hasNext()) {
|
||||
|
@ -876,7 +886,7 @@ public class ToolingExtensions {
|
|||
return readStringExtension(type, EXT_RENDERED_VALUE);
|
||||
return type.primitiveValue();
|
||||
}
|
||||
|
||||
|
||||
public static String getPresentation(Element holder, PrimitiveType<?> type) {
|
||||
if (holder.hasExtension(EXT_RENDERED_VALUE))
|
||||
return readStringExtension(holder, EXT_RENDERED_VALUE);
|
||||
|
@ -884,15 +894,15 @@ public class ToolingExtensions {
|
|||
return readStringExtension(type, EXT_RENDERED_VALUE);
|
||||
return type.primitiveValue();
|
||||
}
|
||||
|
||||
// public static boolean hasOID(ValueSet vs) {
|
||||
// return hasExtension(vs, EXT_OID);
|
||||
// }
|
||||
//
|
||||
// public static boolean hasOID(CodeSystem cs) {
|
||||
// return hasExtension(cs, EXT_OID);
|
||||
// }
|
||||
//
|
||||
|
||||
// public static boolean hasOID(ValueSet vs) {
|
||||
// return hasExtension(vs, EXT_OID);
|
||||
// }
|
||||
//
|
||||
// public static boolean hasOID(CodeSystem cs) {
|
||||
// return hasExtension(cs, EXT_OID);
|
||||
// }
|
||||
//
|
||||
public static void addUrlExtension(Element e, String url, String content) {
|
||||
if (!StringUtils.isBlank(content)) {
|
||||
Extension ex = getExtension(e, url);
|
||||
|
@ -938,7 +948,7 @@ public class ToolingExtensions {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (Property p : base.children() ) {
|
||||
for (Base v : p.getValues()) {
|
||||
if (usesExtension(url, v)) {
|
||||
|
@ -965,5 +975,5 @@ public class ToolingExtensions {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -99,6 +99,9 @@ public interface IResourceValidator {
|
|||
boolean isNoUnicodeBiDiControlChars();
|
||||
void setNoUnicodeBiDiControlChars(boolean noUnicodeBiDiControlChars);
|
||||
|
||||
boolean isForPublication();
|
||||
void setForPublication(boolean forPublication);
|
||||
|
||||
/**
|
||||
* Whether being unable to resolve a profile in found in Resource.meta.profile or ElementDefinition.type.profile or targetProfile is an error or just a warning
|
||||
*/
|
||||
|
|
|
@ -73,7 +73,7 @@ public class MarkDownProcessor {
|
|||
Set<Extension> extensions = Collections.singleton(TablesExtension.create());
|
||||
Parser parser = Parser.builder().extensions(extensions).build();
|
||||
Node document = parser.parse(source);
|
||||
HtmlRenderer renderer = HtmlRenderer.builder().extensions(extensions).build();
|
||||
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).extensions(extensions).build();
|
||||
String html = renderer.render(document);
|
||||
html = html.replace("<table>", "<table class=\"grid\">");
|
||||
return html;
|
||||
|
|
|
@ -252,6 +252,10 @@ public class Utilities {
|
|||
return new Inflector().camelCase(value.trim().replace(" ", "_"), false);
|
||||
}
|
||||
|
||||
public static String upperCamelCase(String value) {
|
||||
return new Inflector().upperCamelCase(value.trim().replace(" ", "_"));
|
||||
}
|
||||
|
||||
public static String escapeXml(String doco) {
|
||||
if (doco == null)
|
||||
return "";
|
||||
|
|
|
@ -627,6 +627,10 @@ public class I18nConstants {
|
|||
public static final String VALUESET_NO_SYSTEM_WARNING = "VALUESET_NO_SYSTEM_WARNING";
|
||||
public static final String VALUESET_REFERENCE_INVALID_TYPE = "VALUESET_REFERENCE_INVALID_TYPE";
|
||||
public static final String VALUESET_REFERENCE_UNKNOWN = "VALUESET_REFERENCE_UNKNOWN";
|
||||
public static final String VALUESET_SHAREABLE_MISSING = "VALUESET_SHAREABLE_MISSING";
|
||||
public static final String VALUESET_SHAREABLE_MISSING_HL7 = "VALUESET_SHAREABLE_MISSING_HL7";
|
||||
public static final String VALUESET_SHAREABLE_EXTRA_MISSING_HL7 = "VALUESET_SHAREABLE_EXTRA_MISSING_HL7";
|
||||
public static final String VALUESET_SHAREABLE_EXTRA_MISSING = "VALUESET_SHAREABLE_EXTRA_MISSING";
|
||||
public static final String VALUESET_UNC_SYSTEM_WARNING = "VALUESET_UNC_SYSTEM_WARNING";
|
||||
public static final String VALUESET_UNC_SYSTEM_WARNING_VER = "VALUESET_UNC_SYSTEM_WARNING_VER";
|
||||
public static final String VALUESET_IMPORT_UNION_INTERSECTION = "VALUESET_IMPORT_UNION_INTERSECTION";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.hl7.fhir.utilities.json;
|
||||
|
||||
import static org.junit.jupiter.api.DynamicContainer.dynamicContainer;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/*
|
||||
|
@ -375,6 +377,10 @@ public class JsonTrackingParser {
|
|||
return parse(TextFile.bytesToString(stream), null);
|
||||
}
|
||||
|
||||
public static JsonArray parseJsonArray(byte[] stream) throws IOException {
|
||||
return parseArray(TextFile.bytesToString(stream), null);
|
||||
}
|
||||
|
||||
public static JsonObject parseJson(byte[] stream, boolean allowDuplicates) throws IOException {
|
||||
return parse(TextFile.bytesToString(stream), null, allowDuplicates);
|
||||
}
|
||||
|
@ -391,17 +397,34 @@ public class JsonTrackingParser {
|
|||
return parse(source, map, false);
|
||||
}
|
||||
|
||||
public static JsonArray parseArray(String source, Map<JsonElement, LocationData> map) throws IOException {
|
||||
return parseArray(source, map, false);
|
||||
}
|
||||
|
||||
|
||||
public static JsonObject parse(String source, Map<JsonElement, LocationData> map, boolean allowDuplicates) throws IOException {
|
||||
return parse(source, map, allowDuplicates, false);
|
||||
}
|
||||
|
||||
public static JsonArray parseArray(String source, Map<JsonElement, LocationData> map, boolean allowDuplicates) throws IOException {
|
||||
return parseArray(source, map, allowDuplicates, false);
|
||||
}
|
||||
|
||||
public static JsonObject parse(String source, Map<JsonElement, LocationData> map, boolean allowDuplicates, boolean allowComments) throws IOException {
|
||||
JsonTrackingParser self = new JsonTrackingParser();
|
||||
self.map = map;
|
||||
self.setErrorOnDuplicates(!allowDuplicates);
|
||||
self.setAllowComments(allowComments);
|
||||
JsonTrackingParser self = new JsonTrackingParser();
|
||||
self.map = map;
|
||||
self.setErrorOnDuplicates(!allowDuplicates);
|
||||
self.setAllowComments(allowComments);
|
||||
return self.parse(Utilities.stripBOM(source));
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonArray parseArray(String source, Map<JsonElement, LocationData> map, boolean allowDuplicates, boolean allowComments) throws IOException {
|
||||
JsonTrackingParser self = new JsonTrackingParser();
|
||||
self.map = map;
|
||||
self.setErrorOnDuplicates(!allowDuplicates);
|
||||
self.setAllowComments(allowComments);
|
||||
return self.parseArray(Utilities.stripBOM(source));
|
||||
}
|
||||
|
||||
private JsonObject parse(String source) throws IOException {
|
||||
lexer = new Lexer(source);
|
||||
|
@ -421,6 +444,10 @@ public class JsonTrackingParser {
|
|||
return result;
|
||||
}
|
||||
|
||||
private JsonArray parseArray(String source) throws IOException {
|
||||
return new Gson().fromJson(source, JsonArray.class);
|
||||
}
|
||||
|
||||
private void readObject(JsonObject obj, boolean root) throws IOException {
|
||||
if (map != null)
|
||||
map.put(obj, lexer.location.copy());
|
||||
|
@ -703,5 +730,11 @@ public class JsonTrackingParser {
|
|||
return parseJson(res.getContent());
|
||||
}
|
||||
|
||||
public static JsonArray fetchJsonArray(String source) throws IOException {
|
||||
SimpleHTTPClient fetcher = new SimpleHTTPClient();
|
||||
HTTPResult res = fetcher.get(source+"?nocache=" + System.currentTimeMillis());
|
||||
res.checkThrowException();
|
||||
return parseJsonArray(res.getContent());
|
||||
}
|
||||
|
||||
}
|
|
@ -722,3 +722,7 @@ BUNDLE_BUNDLE_POSSIBLE_MATCH_NO_FU = Entry {0} matches the reference {1} by type
|
|||
BUNDLE_BUNDLE_POSSIBLE_MATCH_WRONG_FU = Entry {0} matches the reference {1} by type and id but it''s fullUrl {2} does not match the full target URL {3} by Bundle resolution rules
|
||||
SD_ILLEGAL_CHARACTERISTICS = This element has a {0} but the types {1} to do not make this kind of constraint relevant
|
||||
SD_VALUE_COMPLEX_FIXED = For the complex type {0}, consider using a pattern rather than a fixed value to avoid over-constraining the instance
|
||||
VALUESET_SHAREABLE_MISSING = The ShareableValueSet profile says that the {0} element is mandatory, but it is not present. Published value sets SHOULD conform to the ShareableValueSet profile
|
||||
VALUESET_SHAREABLE_EXTRA_MISSING = The ShareableValueSet profile recommends that the {0} element is populated, but it is not present. Published value sets SHOULD conform to the ShareableValueSet profile
|
||||
VALUESET_SHAREABLE_MISSING_HL7 = The ShareableValueSet profile says that the {0} element is mandatory, but it is not found. HL7 Published value sets SHALL conform to the ShareableValueSet profile
|
||||
VALUESET_SHAREABLE_EXTRA_MISSING_HL7 = The ShareableValueSet profile recommends that the {0} element is populated, but it is not found. HL7 Published value sets SHALL conform to the ShareableValueSet profile
|
||||
|
|
|
@ -1152,5 +1152,8 @@ public class BaseValidator implements IValidationContextResourceLoader {
|
|||
return level;
|
||||
}
|
||||
|
||||
|
||||
protected boolean isHL7(Element cr) {
|
||||
String url = cr.getChildValue("url");
|
||||
return url != null && url.contains("hl7");
|
||||
}
|
||||
}
|
|
@ -426,6 +426,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
private ValidationOptions baseOptions = new ValidationOptions();
|
||||
private Map<String, CanonicalResourceLookupResult> crLookups = new HashMap<>();
|
||||
private boolean logProgress;
|
||||
private boolean forPublication;
|
||||
|
||||
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices, XVerExtensionManager xverManager) {
|
||||
super(theContext, xverManager);
|
||||
|
@ -1111,8 +1112,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESET, describeValueSet(binding.getValueSet()));
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESETMAX, describeReference(ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")), valueset.getUrl());
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESETMAX, describeReference(ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET)), valueset.getUrl());
|
||||
else
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESET_EXT, describeValueSet(binding.getValueSet()));
|
||||
}
|
||||
|
@ -1141,7 +1142,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (!vr.isOk()) {
|
||||
bindingsOk = false;
|
||||
if (vr.getErrorClass() != null && vr.getErrorClass() == TerminologyServiceErrorClass.NOSERVICE) {
|
||||
if (binding.getStrength() == BindingStrength.REQUIRED || (binding.getStrength() == BindingStrength.EXTENSIBLE && binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))) {
|
||||
if (binding.getStrength() == BindingStrength.REQUIRED || (binding.getStrength() == BindingStrength.EXTENSIBLE && binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))) {
|
||||
hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOSVC_BOUND_REQ, describeReference(binding.getValueSet()));
|
||||
} else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOSVC_BOUND_EXT, describeReference(binding.getValueSet()));
|
||||
|
@ -1150,8 +1151,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_1_CC, describeReference(binding.getValueSet()), vr.getErrorClass().toString());
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), cc, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), cc, stack);
|
||||
else if (!noExtensibleWarnings)
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_2_CC, describeReference(binding.getValueSet()), vr.getErrorClass().toString());
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1163,8 +1164,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED) {
|
||||
txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_1_CC, describeValueSet(binding.getValueSet()), ccSummary(cc));
|
||||
} else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), cc, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), cc, stack);
|
||||
if (!noExtensibleWarnings)
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_2_CC, describeValueSet(binding.getValueSet()), ccSummary(cc));
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1243,8 +1244,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl());
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESETMAX, describeReference(ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")), valueset.getUrl());
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESETMAX, describeReference(ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET)), valueset.getUrl());
|
||||
else
|
||||
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CODE_VALUESET_EXT, describeValueSet(binding.getValueSet()));
|
||||
}
|
||||
|
@ -1277,8 +1278,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_1_CC, describeReference(binding.getValueSet()), vr.getErrorClass().toString());
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), cc, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), cc, stack);
|
||||
else if (!noExtensibleWarnings)
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_2_CC, describeReference(binding.getValueSet()), vr.getErrorClass().toString());
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1290,8 +1291,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_1_CC, describeValueSet(binding.getValueSet()), ccSummary(cc));
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), cc, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), cc, stack);
|
||||
if (!noExtensibleWarnings)
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_2_CC, describeValueSet(binding.getValueSet()), ccSummary(cc));
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1385,8 +1386,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_4a, describeReference(binding.getValueSet(), valueset), vr.getMessage(), system+"#"+code);
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), c, stack);
|
||||
else if (!noExtensibleWarnings)
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_5, describeReference(binding.getValueSet(), valueset));
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1397,8 +1398,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
} else if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_4, describeReference(binding.getValueSet(), valueset), (vr.getMessage() != null ? " (error message = " + vr.getMessage() + ")" : ""), system+"#"+code);
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), c, stack);
|
||||
else
|
||||
txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_5, describeReference(binding.getValueSet(), valueset), (vr.getMessage() != null ? " (error message = " + vr.getMessage() + ")" : ""), system+"#"+code);
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1643,8 +1644,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_4a, describeReference(binding.getValueSet(), valueset), vr.getMessage(), theSystem+"#"+theCode);
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), c, stack);
|
||||
else if (!noExtensibleWarnings)
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_CONFIRM_5, describeReference(binding.getValueSet(), valueset));
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -1655,8 +1656,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
} else if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_12, describeReference(binding.getValueSet(), valueset), getErrorMessage(vr.getMessage()), theSystem+"#"+theCode);
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), c, stack);
|
||||
else if (!noExtensibleWarnings) {
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_13, describeReference(binding.getValueSet(), valueset), getErrorMessage(vr.getMessage()), c.getSystem()+"#"+c.getCode());
|
||||
}
|
||||
|
@ -2243,9 +2244,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
warning(errors, IssueType.INVALID, e.line(), e.col(), path, wsok, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_BASE64_NO_WS_WARNING);
|
||||
}
|
||||
}
|
||||
if (ok && context.hasExtension("http://hl7.org/fhir/StructureDefinition/maxSize")) {
|
||||
if (ok && context.hasExtension(ToolingExtensions.EXT_MAX_SIZE)) {
|
||||
int size = countBase64DecodedBytes(encoded);
|
||||
long def = Long.parseLong(ToolingExtensions.readStringExtension(context, "http://hl7.org/fhir/StructureDefinition/maxSize"));
|
||||
long def = Long.parseLong(ToolingExtensions.readStringExtension(context, ToolingExtensions.EXT_MAX_SIZE));
|
||||
rule(errors, IssueType.STRUCTURE, e.line(), e.col(), path, size <= def, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG, size, def);
|
||||
}
|
||||
|
||||
|
@ -2289,9 +2290,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
}
|
||||
}
|
||||
if (context.hasExtension("http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces")) {
|
||||
if (context.hasExtension(ToolingExtensions.EXT_MAX_DECIMALS)) {
|
||||
int dp = e.primitiveValue().contains(".") ? e.primitiveValue().substring(e.primitiveValue().indexOf(".")+1).length() : 0;
|
||||
int def = Integer.parseInt(ToolingExtensions.readStringExtension(context, "http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces"));
|
||||
int def = Integer.parseInt(ToolingExtensions.readStringExtension(context, ToolingExtensions.EXT_MAX_DECIMALS));
|
||||
rule(errors, IssueType.STRUCTURE, e.line(), e.col(), path, dp <= def, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS, dp, def);
|
||||
}
|
||||
}
|
||||
|
@ -2731,8 +2732,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
else if (binding.getStrength() == BindingStrength.REQUIRED)
|
||||
txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_16, value, describeValueSet(binding.getValueSet()), getErrorMessage(vr.getMessage()));
|
||||
else if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), value, stack);
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||
checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), value, stack);
|
||||
else if (!noExtensibleWarnings && !isOkExtension(value, vs))
|
||||
txWarningForLaterRemoval(element, errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_NOVALID_17, value, describeValueSet(binding.getValueSet()), getErrorMessage(vr.getMessage()));
|
||||
} else if (binding.getStrength() == BindingStrength.PREFERRED) {
|
||||
|
@ -2771,9 +2772,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
// todo: allowedUnits http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits - codeableConcept, or canonical(ValueSet)
|
||||
// todo: http://hl7.org/fhir/StructureDefinition/iso21090-PQ-translation
|
||||
|
||||
if (!Utilities.noString(value) && definition.hasExtension("http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces")) {
|
||||
if (!Utilities.noString(value) && definition.hasExtension(ToolingExtensions.EXT_MAX_DECIMALS)) {
|
||||
int dp = value.contains(".") ? value.substring(value.indexOf(".")+1).length() : 0;
|
||||
int def = Integer.parseInt(ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces"));
|
||||
int def = Integer.parseInt(ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_MAX_DECIMALS));
|
||||
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, dp <= def, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS, dp, def);
|
||||
}
|
||||
|
||||
|
@ -2911,7 +2912,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
} else if (element.hasChild("url")) {
|
||||
String url = element.getChildValue("url");
|
||||
if (definition.hasExtension("http://hl7.org/fhir/StructureDefinition/maxSize")) {
|
||||
if (definition.hasExtension(ToolingExtensions.EXT_MAX_SIZE)) {
|
||||
try {
|
||||
if (url.startsWith("http://") || url.startsWith("https://")) {
|
||||
if (fetcher == null) {
|
||||
|
@ -2930,9 +2931,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
}
|
||||
}
|
||||
if (definition.hasExtension("http://hl7.org/fhir/StructureDefinition/maxSize")) {
|
||||
if (definition.hasExtension(ToolingExtensions.EXT_MAX_SIZE)) {
|
||||
if (warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, size >= 0, fetchError)) {
|
||||
long def = Long.parseLong(ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/maxSize"));
|
||||
long def = Long.parseLong(ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_MAX_SIZE));
|
||||
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, size <= def, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG, size, def);
|
||||
}
|
||||
}
|
||||
|
@ -4643,7 +4644,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
} else if (element.getType().equals("CapabilityStatement")) {
|
||||
validateCapabilityStatement(errors, element, stack);
|
||||
} else if (element.getType().equals("CodeSystem")) {
|
||||
new CodeSystemValidator(context, timeTracker, xverManager, jurisdiction).validateCodeSystem(errors, element, stack, baseOptions.setLanguage(stack.getWorkingLang()));
|
||||
new CodeSystemValidator(context, timeTracker, this, xverManager, jurisdiction).validateCodeSystem(errors, element, stack, baseOptions.setLanguage(stack.getWorkingLang()));
|
||||
} else if (element.getType().equals("SearchParameter")) {
|
||||
new SearchParameterValidator(context, timeTracker, fpe, xverManager, jurisdiction).validateSearchParameter(errors, element, stack);
|
||||
} else if (element.getType().equals("StructureDefinition")) {
|
||||
|
@ -5693,8 +5694,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
msg = context.formatMessage(I18nConstants.INV_FAILED, inv.getKey() + ": '" + inv.getHuman()+"'")+msg;
|
||||
|
||||
if (inv.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice") &&
|
||||
ToolingExtensions.readBooleanExtension(inv, "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice")) {
|
||||
if (inv.hasExtension(ToolingExtensions.EXT_BEST_PRACTICE) &&
|
||||
ToolingExtensions.readBooleanExtension(inv, ToolingExtensions.EXT_BEST_PRACTICE)) {
|
||||
if (bpWarnings == BestPracticeWarningLevel.Hint)
|
||||
hint(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, msg);
|
||||
else if (bpWarnings == BestPracticeWarningLevel.Warning)
|
||||
|
@ -6041,4 +6042,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
this.logProgress = logProgress;
|
||||
}
|
||||
|
||||
public boolean isForPublication() {
|
||||
return forPublication;
|
||||
}
|
||||
|
||||
public void setForPublication(boolean forPublication) {
|
||||
this.forPublication = forPublication;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -17,17 +17,21 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
|||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.hl7.fhir.validation.BaseValidator;
|
||||
import org.hl7.fhir.validation.TimeTracker;
|
||||
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||
import org.hl7.fhir.validation.instance.utils.NodeStack;
|
||||
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
|
||||
public class CodeSystemValidator extends BaseValidator {
|
||||
|
||||
public CodeSystemValidator(IWorkerContext context, TimeTracker timeTracker, XVerExtensionManager xverManager, Coding jurisdiction) {
|
||||
private InstanceValidator parent;
|
||||
|
||||
public CodeSystemValidator(IWorkerContext context, TimeTracker timeTracker, InstanceValidator parent, XVerExtensionManager xverManager, Coding jurisdiction) {
|
||||
super(context, xverManager);
|
||||
source = Source.InstanceValidator;
|
||||
this.timeTracker = timeTracker;
|
||||
this.jurisdiction = jurisdiction;
|
||||
this.parent = parent;
|
||||
|
||||
}
|
||||
|
||||
|
@ -79,8 +83,41 @@ public class CodeSystemValidator extends BaseValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkShareableCodeSystem(errors, cs, stack);
|
||||
}
|
||||
|
||||
|
||||
private void checkShareableCodeSystem(List<ValidationMessage> errors, Element cs, NodeStack stack) {
|
||||
if (parent.isForPublication()) {
|
||||
if (isHL7(cs)) {
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("url"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "url");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("version"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "version");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("title"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "title");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("name"), I18nConstants.VALUESET_SHAREABLE_EXTRA_MISSING_HL7, "name");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("status"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "status");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("experimental"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "experimental");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("description"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "description");
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("content"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "content");
|
||||
if (!"supplement".equals(cs.getChildValue("content"))) {
|
||||
rule(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("caseSensitive"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "caseSensitive");
|
||||
}
|
||||
} else {
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("url"), I18nConstants.VALUESET_SHAREABLE_MISSING, "url");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("version"), I18nConstants.VALUESET_SHAREABLE_MISSING, "version");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("title"), I18nConstants.VALUESET_SHAREABLE_MISSING, "title");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("name"), I18nConstants.VALUESET_SHAREABLE_EXTRA_MISSING, "name");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("status"), I18nConstants.VALUESET_SHAREABLE_MISSING, "status");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("experimental"), I18nConstants.VALUESET_SHAREABLE_MISSING, "experimental");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("description"), I18nConstants.VALUESET_SHAREABLE_MISSING, "description");
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("content"), I18nConstants.VALUESET_SHAREABLE_MISSING, "content");
|
||||
if (!"supplement".equals(cs.getChildValue("content"))) {
|
||||
warning(errors, IssueType.REQUIRED, cs.line(), cs.col(), stack.getLiteralPath(), cs.hasChild("caseSensitive"), I18nConstants.VALUESET_SHAREABLE_MISSING, "caseSensitive");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void metaChecks(List<ValidationMessage> errors, Element cs, NodeStack stack, String url, String content, String caseSensitive, String hierarchyMeaning, boolean isSupplement) {
|
||||
if (isSupplement) {
|
||||
if (!"supplement".equals(content)) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent;
|
|||
import org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.renderers.DataRenderer;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -338,7 +339,7 @@ public class MeasureValidator extends BaseValidator {
|
|||
// ratio - score is a number with no value constraints, and maybe with a unit (perhaps constrained by extension)
|
||||
if (rule(errors, IssueType.REQUIRED, ms.line(), ms.col(), ns.getLiteralPath(), v != null, I18nConstants.MEASURE_MR_SCORE_VALUE_REQUIRED, "ratio")) {
|
||||
Element unit = ms.getNamedChild("code");
|
||||
Coding c = m.measure().hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-unit") ? (Coding) m.measure().getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-unit").getValue() : null;
|
||||
Coding c = m.measure().hasExtension(ToolingExtensions.EXT_Q_UNIT) ? (Coding) m.measure().getExtensionByUrl(ToolingExtensions.EXT_Q_UNIT).getValue() : null;
|
||||
if (unit != null) {
|
||||
if (c != null) {
|
||||
NodeStack nsc = ns.push(unit, -1, unit.getProperty().getDefinition(), unit.getProperty().getDefinition());
|
||||
|
@ -361,7 +362,7 @@ public class MeasureValidator extends BaseValidator {
|
|||
// continuous-variable - score is a quantity with a unit per the extension
|
||||
if (rule(errors, IssueType.REQUIRED, ms.line(), ms.col(), ns.getLiteralPath(), v != null, I18nConstants.MEASURE_MR_SCORE_VALUE_REQUIRED, "continuous-variable")) {
|
||||
Element unit = ms.getNamedChild("code");
|
||||
Coding c = m.measure().hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-unit") ? (Coding) m.measure().getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-unit").getValue() : null;
|
||||
Coding c = m.measure().hasExtension(ToolingExtensions.EXT_Q_UNIT) ? (Coding) m.measure().getExtensionByUrl(ToolingExtensions.EXT_Q_UNIT).getValue() : null;
|
||||
if (unit != null) {
|
||||
if (c != null) {
|
||||
NodeStack nsc = ns.push(unit, -1, unit.getProperty().getDefinition(), unit.getProperty().getDefinition());
|
||||
|
|
|
@ -140,9 +140,10 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
tc = type.getExtensionValue(ToolingExtensions.EXT_FHIR_TYPE).primitiveValue();
|
||||
}
|
||||
if (Utilities.noString(tc) && type.hasChild("code")) {
|
||||
if (type.getNamedChild("code").hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type")) {
|
||||
tc = "*";
|
||||
}
|
||||
throw new Error("WTF?");
|
||||
// if (type.getNamedChild("code").hasExtension(" http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type")) {
|
||||
// tc = "*";
|
||||
// }
|
||||
}
|
||||
typeCodes.add(tc);
|
||||
Set<String> tcharacteristics = new HashSet<>();
|
||||
|
@ -338,7 +339,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
|||
}
|
||||
StructureDefinition sd = context.fetchTypeDefinition(tc);
|
||||
if (sd != null) {
|
||||
if (sd.hasExtension(ToolingExtensions.EXT_BINDING_METHOD)) {
|
||||
if (sd.hasExtension(ToolingExtensions.EXT_BINDING_STYLE)) {
|
||||
return tc;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,32 @@ public class ValueSetValidator extends BaseValidator {
|
|||
cc++;
|
||||
}
|
||||
}
|
||||
checkShareableValueSet(errors, vs, stack);
|
||||
}
|
||||
|
||||
private void checkShareableValueSet(List<ValidationMessage> errors, Element vs, NodeStack stack) {
|
||||
if (parent.isForPublication()) {
|
||||
if (isHL7(vs)) {
|
||||
rule(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("url"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "url");
|
||||
rule(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("version"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "version");
|
||||
rule(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("title"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "title");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("name"), I18nConstants.VALUESET_SHAREABLE_EXTRA_MISSING_HL7, "name");
|
||||
rule(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("status"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "status");
|
||||
rule(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("experimental"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "experimental");
|
||||
rule(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("description"), I18nConstants.VALUESET_SHAREABLE_MISSING_HL7, "description");
|
||||
} else {
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("url"), I18nConstants.VALUESET_SHAREABLE_MISSING, "url");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("version"), I18nConstants.VALUESET_SHAREABLE_MISSING, "version");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("title"), I18nConstants.VALUESET_SHAREABLE_MISSING, "title");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("name"), I18nConstants.VALUESET_SHAREABLE_EXTRA_MISSING, "name");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("status"), I18nConstants.VALUESET_SHAREABLE_MISSING, "status");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("experimental"), I18nConstants.VALUESET_SHAREABLE_MISSING, "experimental");
|
||||
warning(errors, IssueType.REQUIRED, vs.line(), vs.col(), stack.getLiteralPath(), vs.hasChild("description"), I18nConstants.VALUESET_SHAREABLE_MISSING, "description");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void validateValueSetCompose(List<ValidationMessage> errors, Element compose, NodeStack stack, String vsid, boolean retired) {
|
||||
List<Element> includes = compose.getChildrenByName("include");
|
||||
int ci = 0;
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -19,7 +19,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.4.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.111</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.112-SNAPSHOT</validator_test_case_version>
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||
|
@ -111,12 +111,12 @@
|
|||
<dependency>
|
||||
<groupId>com.atlassian.commonmark</groupId>
|
||||
<artifactId>commonmark</artifactId>
|
||||
<version>0.12.1</version>
|
||||
<version>0.17.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.atlassian.commonmark</groupId>
|
||||
<artifactId>commonmark-ext-gfm-tables</artifactId>
|
||||
<version>0.12.1</version>
|
||||
<version>0.17.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.rjeschke</groupId>
|
||||
|
|
Loading…
Reference in New Issue