Merge branch 'hapifhir:master' into master
This commit is contained in:
commit
7dac6306a7
|
@ -11,6 +11,7 @@ import java.util.Map;
|
|||
import org.hl7.fhir.utilities.IniFile;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.filesystem.ManagedFileAccess;
|
||||
|
||||
public class Configuration {
|
||||
public static final SimpleDateFormat DATE_FORMAT() {
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.hl7.fhir.core.generator.engine.Definitions;
|
|||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.filesystem.ManagedFileAccess;
|
||||
|
||||
public class JavaExtensionsGenerator {
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
|||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.filesystem.ManagedFileAccess;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
|
||||
|
|
|
@ -62,6 +62,18 @@ public class StructureDefinitionHacker {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (VersionUtilities.isR4Ver(version) && "http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit".equals(sd.getUrl())) {
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||
if (ed.hasBinding() && "http://terminology.hl7.org/CodeSystem/processpriority".equals(ed.getBinding().getValueSet())) {
|
||||
ed.getBinding().setValueSet("http://hl7.org/fhir/ValueSet/process-priority");
|
||||
}
|
||||
}
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement()) {
|
||||
if (ed.hasBinding() && "http://terminology.hl7.org/CodeSystem/processpriority".equals(ed.getBinding().getValueSet())) {
|
||||
ed.getBinding().setValueSet("http://hl7.org/fhir/ValueSet/process-priority");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sd.getUrl().startsWith("http://hl7.org/fhir/uv/subscriptions-backport")) {
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement()) {
|
||||
fixMarkdownR4BURLs(ed);
|
||||
|
|
|
@ -1108,6 +1108,21 @@ public class Element extends Base implements NamedItem {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<Element> getExtensions(String url) {
|
||||
List<Element> list = new ArrayList<>();
|
||||
if (children != null) {
|
||||
for (Element child : children) {
|
||||
if (extensionList.contains(child.getName())) {
|
||||
String u = child.getChildValue("url");
|
||||
if (url.equals(u)) {
|
||||
list.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Base getExtensionValue(String url) {
|
||||
if (children != null) {
|
||||
for (Element child : children) {
|
||||
|
|
|
@ -152,6 +152,12 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
text = v.primitiveValue("code");
|
||||
}
|
||||
}
|
||||
if (value == null) {
|
||||
value = "??";
|
||||
}
|
||||
if (text == null) {
|
||||
text = "??";
|
||||
}
|
||||
boolean selected = "true".equals(opt.primitiveValue("initialSelected"));
|
||||
x.option(value, text, selected);
|
||||
}
|
||||
|
|
|
@ -1032,6 +1032,10 @@ public class Utilities {
|
|||
|
||||
|
||||
public static String escapeJson(String value) {
|
||||
return escapeJson(value, true);
|
||||
}
|
||||
|
||||
public static String escapeJson(String value, boolean escapeUnicodeWhitespace) {
|
||||
if (value == null)
|
||||
return "";
|
||||
|
||||
|
@ -1049,7 +1053,7 @@ public class Utilities {
|
|||
b.append("\\\\");
|
||||
else if (c == ' ')
|
||||
b.append(" ");
|
||||
else if (isWhitespace(c)) {
|
||||
else if ((c == '\r' || c == '\n') || (isWhitespace(c) && escapeUnicodeWhitespace)) {
|
||||
b.append("\\u"+Utilities.padLeft(Integer.toHexString(c), '0', 4));
|
||||
} else if (((int) c) < 32)
|
||||
b.append("\\u" + Utilities.padLeft(Integer.toHexString(c), '0', 4));
|
||||
|
|
|
@ -1107,4 +1107,5 @@ public class I18nConstants {
|
|||
public static final String TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF = "TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF";
|
||||
public static final String SM_TARGET_TYPE_UNKNOWN = "SM_TARGET_TYPE_UNKNOWN";
|
||||
public static final String XHTML_XHTML_ATTRIBUTE_XML_SPACE = "XHTML_XHTML_ATTRIBUTE_XML_SPACE";
|
||||
public static final String VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS = "VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS";
|
||||
}
|
||||
|
|
|
@ -682,7 +682,7 @@ public class JsonParser {
|
|||
break;
|
||||
case STRING:
|
||||
b.append("\"");
|
||||
b.append(Utilities.escapeJson(((JsonString) e).getValue()));
|
||||
b.append(Utilities.escapeJson(((JsonString) e).getValue(), false));
|
||||
b.append("\"");
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1137,4 +1137,5 @@ TYPE_SPECIFIC_CHECKS_DT_XHTML_UNKNOWN_HREF = Hyperlink scheme ''{3}'' in ''{0}''
|
|||
TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF = Hyperlink scheme ''{3}'' in ''{0}'' at ''{1}'' for ''{2}'' is not a valid hyperlinkable scheme
|
||||
SM_TARGET_TYPE_UNKNOWN = The type of the target variable is not known: {0}
|
||||
XHTML_XHTML_ATTRIBUTE_XML_SPACE = The attribute 'xml:space' is legal but has a fixed value of 'preserve'. It''s use is discouraged
|
||||
VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS = This resource has more than workgroup extension (http://hl7.org/fhir/StructureDefinition/structuredefinition-wg)
|
||||
|
|
@ -5730,13 +5730,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
private boolean checkPublisherConsistency(ValidationContext valContext, List<ValidationMessage> errors, Element element, NodeStack stack, boolean contained) {
|
||||
|
||||
boolean ok = true;
|
||||
String pub = element.getNamedChildValue("publisher", false);
|
||||
|
||||
ok = rule(errors, "2024-08-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), element.getExtensions(ToolingExtensions.EXT_WORKGROUP).size() <= 1, I18nConstants.VALIDATION_HL7_PUBLISHER_MULTIPLE_WGS) && ok;
|
||||
Base wgT = element.getExtensionValue(ToolingExtensions.EXT_WORKGROUP);
|
||||
String wg = wgT == null ? null : wgT.primitiveValue();
|
||||
String url = element.getNamedChildValue("url");
|
||||
|
||||
if (contained && wg == null) {
|
||||
boolean ok = true;
|
||||
Element container = valContext.getRootResource();
|
||||
if (element.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
|
||||
// container already specified the HL7 WG, so we don't need to test
|
||||
|
@ -5775,9 +5777,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (rule(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), wgd != null, I18nConstants.VALIDATION_HL7_WG_UNKNOWN, wg)) {
|
||||
String rpub = "HL7 International / "+wgd.getName();
|
||||
if (warning(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), pub != null, I18nConstants.VALIDATION_HL7_PUBLISHER_MISSING, wg, rpub)) {
|
||||
boolean ok = rpub.equals(pub);
|
||||
ok = rpub.equals(pub) && ok;
|
||||
if (!ok && wgd.getName2() != null) {
|
||||
ok = ("HL7 International / "+wgd.getName2()).equals(pub);
|
||||
ok = ("HL7 International / "+wgd.getName2()).equals(pub) && ok;
|
||||
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), ok, I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH2, wg, rpub, "HL7 International / "+wgd.getName2(), pub);
|
||||
} else {
|
||||
warningOrError(pub.contains("/"), errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), ok, I18nConstants.VALIDATION_HL7_PUBLISHER_MISMATCH, wg, rpub, pub);
|
||||
|
@ -5785,14 +5787,14 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
warning(errors, "2023-09-15", IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(),
|
||||
Utilities.startsWithInList( wgd.getLink(), urls), I18nConstants.VALIDATION_HL7_WG_URL, wg, wgd.getLink());
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
} else {
|
||||
return true; // HL7 sid.
|
||||
return ok; // HL7 sid.
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return ok;
|
||||
}
|
||||
|
||||
private boolean statusCodesConsistent(String status, String standardsStatus) {
|
||||
|
|
Loading…
Reference in New Issue