Merge branch 'master' into tx-server-cache-analysis

This commit is contained in:
dotasek 2022-01-13 09:46:45 -05:00
commit 6e0b14b0b6
28 changed files with 278 additions and 311 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -60,8 +60,8 @@ public class Bundle10_30 {
tgt.addLink(convertBundleLinkComponent(t));
if (src.hasFullUrlElement())
tgt.setFullUrlElement(Uri10_30.convertUri(src.getFullUrlElement()));
org.hl7.fhir.dstu2.model.Resource res = ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertResource(src.getResource());
tgt.setResource(res);
if (src.hasResource())
tgt.setResource(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())

View File

@ -78,8 +78,8 @@ public class Bundle10_40 {
for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
if (src.hasFullUrlElement())
tgt.setFullUrlElement(Uri10_40.convertUri(src.getFullUrlElement()));
org.hl7.fhir.dstu2.model.Resource res = ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertResource(src.getResource());
tgt.setResource(res);
if (src.hasResource())
tgt.setResource(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())

View File

@ -78,8 +78,8 @@ public class Bundle10_50 {
for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
if (src.hasFullUrlElement())
tgt.setFullUrlElement(Uri10_50.convertUri(src.getFullUrlElement()));
org.hl7.fhir.dstu2.model.Resource res = ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertResource(src.getResource());
tgt.setResource(res);
if (src.hasResource())
tgt.setResource(ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())

View File

@ -0,0 +1,35 @@
package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
public class Bundle10_30Test {
@Test
@DisplayName("Test 10_30 bundle conversion when resource is null")
public void testNoResourceBundleConversion() throws IOException {
org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent bec = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent()
.setRequest(
new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent()
.setMethod(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE)
.setUrl("Patient?identifier=123456")
);
org.hl7.fhir.dstu3.model.Bundle stu3Bundle = new org.hl7.fhir.dstu3.model.Bundle()
.addEntry(bec);
org.hl7.fhir.dstu2.model.Resource dstu2Resource = VersionConvertorFactory_10_30.convertResource(stu3Bundle);
Assertions.assertNotNull(dstu2Resource);
Assertions.assertTrue(dstu2Resource instanceof org.hl7.fhir.dstu2.model.Bundle);
org.hl7.fhir.dstu2.model.Bundle dstu2Bundle = (org.hl7.fhir.dstu2.model.Bundle) dstu2Resource;
Assertions.assertEquals(1, dstu2Bundle.getEntry().size());
Assertions.assertNull(dstu2Bundle.getEntry().get(0).getResource());
}
}

View File

@ -0,0 +1,34 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
public class Bundle10_40Test {
@Test
@DisplayName("Test 10_40 bundle conversion when resource is null")
public void testNoResourceBundleConversion() throws IOException {
org.hl7.fhir.r4.model.Bundle.BundleEntryComponent bec = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent()
.setRequest(
new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent()
.setMethod(org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE)
.setUrl("Patient?identifier=123456")
);
org.hl7.fhir.r4.model.Bundle r4Bundle = new org.hl7.fhir.r4.model.Bundle()
.addEntry(bec);
org.hl7.fhir.dstu2.model.Resource dstu2Resource = VersionConvertorFactory_10_40.convertResource(r4Bundle);
Assertions.assertNotNull(dstu2Resource);
Assertions.assertTrue(dstu2Resource instanceof org.hl7.fhir.dstu2.model.Bundle);
org.hl7.fhir.dstu2.model.Bundle dstu2Bundle = (org.hl7.fhir.dstu2.model.Bundle) dstu2Resource;
Assertions.assertEquals(1, dstu2Bundle.getEntry().size());
Assertions.assertNull(dstu2Bundle.getEntry().get(0).getResource());
}
}

View File

@ -0,0 +1,34 @@
package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
public class Bundle10_50Test {
@Test
@DisplayName("Test 10_50 bundle conversion when resource is null")
public void testNoResourceBundleConversion() throws IOException {
org.hl7.fhir.r5.model.Bundle.BundleEntryComponent bec = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent()
.setRequest(
new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent()
.setMethod(org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE)
.setUrl("Patient?identifier=123456")
);
org.hl7.fhir.r5.model.Bundle r5Bundle = new org.hl7.fhir.r5.model.Bundle()
.addEntry(bec);
org.hl7.fhir.dstu2.model.Resource dstu2Resource = VersionConvertorFactory_10_50.convertResource(r5Bundle);
Assertions.assertNotNull(dstu2Resource);
Assertions.assertTrue(dstu2Resource instanceof org.hl7.fhir.dstu2.model.Bundle);
org.hl7.fhir.dstu2.model.Bundle dstu2Bundle = (org.hl7.fhir.dstu2.model.Bundle) dstu2Resource;
Assertions.assertEquals(1, dstu2Bundle.getEntry().size());
Assertions.assertNull(dstu2Bundle.getEntry().get(0).getResource());
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -106,7 +106,7 @@ public class NarrativeGenerationTests {
}
public static Stream<Arguments> data() throws ParserConfigurationException, IOException, FHIRFormatError, SAXException {
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "narrative", "manifest.xml"));
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r4b", "narrative", "manifest.xml"));
Element test = XMLUtil.getFirstChild(tests.getDocumentElement());
List<Arguments> objects = new ArrayList<>();
while (test != null && test.getNodeName().equals("test")) {

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -2087,6 +2087,8 @@ public class ProfileUtilities extends TranslatingUtilities {
private void removeStatusExtensions(ElementDefinition outcome) {
outcome.removeExtension(ToolingExtensions.EXT_FMM_LEVEL);
outcome.removeExtension(ToolingExtensions.EXT_FMM_SUPPORT);
outcome.removeExtension(ToolingExtensions.EXT_FMM_DERIVED);
outcome.removeExtension(ToolingExtensions.EXT_STANDARDS_STATUS);
outcome.removeExtension(ToolingExtensions.EXT_NORMATIVE_VERSION);
outcome.removeExtension(ToolingExtensions.EXT_WORKGROUP);

View File

@ -59,7 +59,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
p.addText(Utilities.capitalize(cm.getStatus().toString())+" (not intended for production usage). ");
else
p.addText(Utilities.capitalize(cm.getStatus().toString())+". ");
p.tx("Published on "+(cm.hasDate() ? cm.getDateElement().toHumanDisplay() : "?ngen-10?")+" by "+cm.getPublisher());
p.tx("Published on "+(cm.hasDate() ? display(cm.getDateElement()) : "?ngen-10?")+" by "+cm.getPublisher());
if (!cm.getContact().isEmpty()) {
p.tx(" (");
boolean firsti = true;
@ -132,11 +132,25 @@ public class ConceptMapRenderer extends TerminologyRenderer {
tr.td().b().tx("Destination 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();
XhtmlNode td = tr.td();
td = tr.td();
td.addText(ccl.getCode());
display = getDisplayForConcept(systemFromCanonical(grp.getSource()), versionFromCanonical(grp.getSource()), 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);
@ -152,7 +166,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
}
td = tr.td();
td.addText(ccm.getCode());
display = getDisplayForConcept(systemFromCanonical(grp.getTarget()), versionFromCanonical(grp.getTarget()), 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)

View File

@ -1139,9 +1139,11 @@ public class DataRenderer extends Renderer {
protected String displayQuantity(Quantity q) {
StringBuilder s = new StringBuilder();
s.append("(system = '").append(TerminologyRenderer.describeSystem(q.getSystem()))
.append("' code ").append(q.getCode())
.append(" = '").append(lookupCode(q.getSystem(), null, q.getCode())).append("')");
s.append(q.hasValue() ? q.getValue() : "?");
if (q.hasUnit())
s.append(" ").append(q.getUnit());
else if (q.hasCode())
s.append(" ").append(q.getCode());
return s.toString();
}
@ -1158,26 +1160,33 @@ public class DataRenderer extends Renderer {
}
if (q.hasUnit())
x.tx(" "+q.getUnit());
else if (q.hasCode())
else if (q.hasCode() && q.hasSystem()) {
// if there's a code there *shall* be a system, so if we've got one and not the other, things are invalid and we won't bother trying to render
if (q.hasSystem() && q.getSystem().equals("http://unitsofmeasure.org"))
x.tx(" "+q.getCode());
else
x.tx("(unit "+q.getCode()+" from "+q.getSystem()+")");
}
if (showCodeDetails && q.hasCode()) {
x.span("background: LightGoldenRodYellow", null).tx(" (Details: "+TerminologyRenderer.describeSystem(q.getSystem())+" code "+q.getCode()+" = '"+lookupCode(q.getSystem(), null, q.getCode())+"')");
}
}
public String displayRange(Range q) {
if (!q.hasLow() && !q.hasHigh())
return "?";
StringBuilder b = new StringBuilder();
if (q.hasLow())
b.append(q.getLow().getValue().toString());
else
b.append("?");
b.append("-");
if (q.hasHigh())
b.append(q.getHigh().getValue().toString());
else
b.append("?");
if (q.getLow().hasUnit())
b.append(" "+q.getLow().getUnit());
boolean sameUnits = (q.getLow().hasUnit() && q.getHigh().hasUnit() && q.getLow().getUnit().equals(q.getHigh().getUnit()))
|| (q.getLow().hasCode() && q.getHigh().hasCode() && q.getLow().getCode().equals(q.getHigh().getCode()));
String low = "?";
if (q.hasLow() && q.getLow().hasValue())
low = sameUnits ? q.getLow().getValue().toString() : displayQuantity(q.getLow());
String high = displayQuantity(q.getHigh());
if (high.isEmpty())
high = "?";
b.append(low).append("\u00A0to\u00A0").append(high);
return b.toString();
}

View File

@ -158,9 +158,8 @@ public abstract class ResourceRenderer extends DataRenderer {
if (target.hasUserData("path")) {
x.ah(target.getUserString("path")).tx(cr.present());
} else {
url = url.substring(0, url.indexOf("|"));
x.code().tx(url);
x.tx(": "+cr.present());
x.tx(" ("+cr.present()+")");
}
}
}

View File

@ -173,7 +173,8 @@ public class ElementWrappers {
s = s + " " + family.getValues().get(0).primitiveValue().toUpperCase();
return s;
} else {
throw new Error("Now what? ("+b.fhirType()+")");
// well, we couldn't get a name from that
return null;
}
}
return null;

View File

@ -142,6 +142,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
}
}
}
Coding foundCoding = null;
if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) {
Boolean result = false;
for (Coding c : code.getCoding()) {
@ -150,6 +151,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
result = null;
} else if (ok) {
result = true;
foundCoding = c;
}
}
if (result == null) {
@ -163,7 +165,9 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
} else if (warnings.size() > 0) {
return new ValidationResult(IssueSeverity.WARNING, warnings.toString());
} else {
return new ValidationResult(IssueSeverity.INFORMATION, null);
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
cd.setDisplay(foundCoding.getDisplay());
return new ValidationResult(foundCoding.getSystem(), cd);
}
}

View File

@ -0,0 +1,66 @@
package org.hl7.fhir.r5.utils;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* This clas smaps between the jurisdictions defined for CanonicalResource.jurisdiction
* and Java Locale
* @author graha
*
*/
public class JurisdictionLocales {
private Map<String, String> map = new HashMap<>();
public JurisdictionLocales() {
super();
register();
}
private void register() {
register("USA", "US", "en-US");
register("AUS", "AU", "en-AU");
register("NZL", "NZ", "en-NZ");
register("GBR", "GB", "en-GB");
register("IND", "IN", "en-IN");
register("AUT", "AT", "de-AT");
register("CHE", "CH", "de-CH");
register("DEU", "DE", "de-DE");
register("NOR", "NO", "no-NO");
register("SWE", "SE", "sv-SE");
register("FIN", "FI", "fi-FI");
register("DNK", "DK", "da-DK");
register("NLD", "NL", "nl-NL");
register("BEL", "BE", "nl-BE"); // but will be fr-BE if lang is specified
register("FRA", "FR", "fr-FR");
register("ITA", "IT", "it-IT");
register("RUS", "RU", "ru-RU");
register("ESP", "ES", "es-ES");
register("ARG", "AR", "es-AR");
register("UGY", "UY", "es-UY");
register("PRT", "PT", "pt-PT");
register("BRA", "BR", "pt-BR");
register("CHN", "CN", "zh-CN");
register("TWN", "TW", "zh-TW");
register("JPN", "JP", "ja-JP");
register("KOR", "KR", "ko-KR");
register("VNM", "VN", "vn-VN");
}
private void register(String code3, String code2, String locale) {
map.put(code3, locale);
map.put(code2, locale);
}
public String get(String c) {
return map.get(c.toUpperCase());
}
}

View File

@ -31,10 +31,13 @@ package org.hl7.fhir.r5.utils;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleLinkComponent;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.ContactPoint;
@ -61,6 +64,7 @@ import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
public class ResourceUtilities {
public final static String FHIR_LANGUAGE = "urn:ietf:bcp:47";
private static JurisdictionLocales jl = new JurisdictionLocales();
public static boolean isAnError(OperationOutcome error) {
for (OperationOutcomeIssueComponent t : error.getIssue())
@ -121,274 +125,36 @@ public class ResourceUtilities {
return resource.getMeta();
}
// public static String representDataElementCollection(IWorkerContext context, Bundle bundle, boolean profileLink, String linkBase) {
// StringBuilder b = new StringBuilder();
// DataElement common = showDECHeader(b, bundle);
// b.append("<table class=\"grid\">\r\n");
// List<String> cols = chooseColumns(bundle, common, b, profileLink);
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// renderDE(de, cols, b, profileLink, linkBase);
// }
// b.append("</table>\r\n");
// return b.toString();
// }
//
//
// private static void renderDE(DataElement de, List<String> cols, StringBuilder b, boolean profileLink, String linkBase) {
// b.append("<tr>");
// for (String col : cols) {
// String v;
// ElementDefinition dee = de.getElement().get(0);
// if (col.equals("DataElement.name")) {
// v = de.hasName() ? Utilities.escapeXml(de.getName()) : "";
// } else if (col.equals("DataElement.status")) {
// v = de.hasStatusElement() ? de.getStatusElement().asStringValue() : "";
// } else if (col.equals("DataElement.code")) {
// v = renderCoding(dee.getCode());
// } else if (col.equals("DataElement.type")) {
// v = dee.hasType() ? Utilities.escapeXml(dee.getType().get(0).getCode()) : "";
// } else if (col.equals("DataElement.units")) {
// v = renderDEUnits(ToolingExtensions.getAllowedUnits(dee));
// } else if (col.equals("DataElement.binding")) {
// v = renderBinding(dee.getBinding());
// } else if (col.equals("DataElement.minValue")) {
// v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/minValue") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/minValue").asStringValue()) : "";
// } else if (col.equals("DataElement.maxValue")) {
// v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/maxValue") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/maxValue").asStringValue()) : "";
// } else if (col.equals("DataElement.maxLength")) {
// v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/maxLength") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/maxLength").asStringValue()) : "";
// } else if (col.equals("DataElement.mask")) {
// v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/mask") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/mask").asStringValue()) : "";
// } else
// throw new Error("Unknown column name: "+col);
//
// b.append("<td>"+v+"</td>");
// }
// if (profileLink) {
// b.append("<td><a href=\""+linkBase+"-"+de.getId()+".html\">Profile</a>, <a href=\"http://www.opencem.org/#/20140917/Intermountain/"+de.getId()+"\">CEM</a>");
// if (ToolingExtensions.hasExtension(de, ToolingExtensions.EXT_CIMI_REFERENCE))
// b.append(", <a href=\""+ToolingExtensions.readStringExtension(de, ToolingExtensions.EXT_CIMI_REFERENCE)+"\">CIMI</a>");
// b.append("</td>");
// }
// b.append("</tr>\r\n");
// }
public static Locale getLocale(CanonicalResource cr) {
return getLocale(cr.getLanguage(), cr.getJurisdiction());
}
private static String renderBinding(ElementDefinitionBindingComponent binding) {
// TODO Auto-generated method stub
public static Locale getLocale(String lang, List<CodeableConcept> jurisdictions) {
if (lang != null && lang.contains("-")) {
return new Locale(lang);
}
for (CodeableConcept cc : jurisdictions) {
Locale locale = getLocale(lang, cc);
if (locale != null) {
return locale;
}
}
return null;
}
private static String renderDEUnits(DataType units) {
if (units == null || units.isEmpty())
return "";
if (units instanceof CodeableConcept)
return renderCodeable((CodeableConcept) units);
else
return "<a href=\""+Utilities.escapeXml(((Reference) units).getReference())+"\">"+Utilities.escapeXml(((Reference) units).getReference())+"</a>";
private static Locale getLocale(String lang, CodeableConcept cc) {
if (cc.hasCoding("http://unstats.un.org/unsd/methods/m49/m49.htm", "001")) {
return new Locale("en-US");
}
private static String renderCodeable(CodeableConcept units) {
if (units == null || units.isEmpty())
return "";
String v = renderCoding(units.getCoding());
if (units.hasText())
v = v + " " +Utilities.escapeXml(units.getText());
return v;
}
private static String renderCoding(List<Coding> codes) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (Coding c : codes)
b.append(renderCoding(c));
return b.toString();
}
private static String renderCoding(Coding code) {
if (code == null || code.isEmpty())
return "";
else
return "<span title=\""+Utilities.escapeXml(code.getSystem())+"\">"+Utilities.escapeXml(code.getCode())+"</span>";
}
// private static List<String> chooseColumns(Bundle bundle, DataElement common, StringBuilder b, boolean profileLink) {
// b.append("<tr>");
// List<String> results = new ArrayList<String>();
// results.add("DataElement.name");
// b.append("<td width=\"250\"><b>Name</b></td>");
// if (!common.hasStatus()) {
// results.add("DataElement.status");
// b.append("<td><b>Status</b></td>");
// }
// if (hasCode(bundle)) {
// results.add("DataElement.code");
// b.append("<td><b>Code</b></td>");
// }
// if (!common.getElement().get(0).hasType() && hasType(bundle)) {
// results.add("DataElement.type");
// b.append("<td><b>Type</b></td>");
// }
// if (hasUnits(bundle)) {
// results.add("DataElement.units");
// b.append("<td><b>Units</b></td>");
// }
// if (hasBinding(bundle)) {
// results.add("DataElement.binding");
// b.append("<td><b>Binding</b></td>");
// }
// if (hasExtension(bundle, "http://hl7.org/fhir/StructureDefinition/minValue")) {
// results.add("DataElement.minValue");
// b.append("<td><b>Min Value</b></td>");
// }
// if (hasExtension(bundle, "http://hl7.org/fhir/StructureDefinition/maxValue")) {
// results.add("DataElement.maxValue");
// b.append("<td><b>Max Value</b></td>");
// }
// if (hasExtension(bundle, "http://hl7.org/fhir/StructureDefinition/maxLength")) {
// results.add("DataElement.maxLength");
// b.append("<td><b>Max Length</b></td>");
// }
// if (hasExtension(bundle, "http://hl7.org/fhir/StructureDefinition/mask")) {
// results.add("DataElement.mask");
// b.append("<td><b>Mask</b></td>");
// }
// if (profileLink)
// b.append("<td><b>Links</b></td>");
// b.append("</tr>\r\n");
// return results;
// }
//
// private static boolean hasExtension(Bundle bundle, String url) {
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// if (ToolingExtensions.hasExtension(de, url))
// return true;
// }
// return false;
// }
//
// private static boolean hasBinding(Bundle bundle) {
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// if (de.getElement().get(0).hasBinding())
// return true;
// }
// return false;
// }
//
// private static boolean hasCode(Bundle bundle) {
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// if (de.getElement().get(0).hasCode())
// return true;
// }
// return false;
// }
//
// private static boolean hasType(Bundle bundle) {
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// if (de.getElement().get(0).hasType())
// return true;
// }
// return false;
// }
//
// private static boolean hasUnits(Bundle bundle) {
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// if (ToolingExtensions.getAllowedUnits(de.getElement().get(0)) != null)
// return true;
// }
// return false;
// }
//
// private static DataElement showDECHeader(StringBuilder b, Bundle bundle) {
// DataElement meta = new DataElement();
// DataElement prototype = (DataElement) bundle.getEntry().get(0).getResource();
// meta.setPublisher(prototype.getPublisher());
// meta.getContact().addAll(prototype.getContact());
// meta.setStatus(prototype.getStatus());
// meta.setDate(prototype.getDate());
// meta.addElement().getType().addAll(prototype.getElement().get(0).getType());
//
// for (BundleEntryComponent e : bundle.getEntry()) {
// DataElement de = (DataElement) e.getResource();
// if (!Base.compareDeep(de.getPublisherElement(), meta.getPublisherElement(), false))
// meta.setPublisherElement(null);
// if (!Base.compareDeep(de.getContact(), meta.getContact(), false))
// meta.getContact().clear();
// if (!Base.compareDeep(de.getStatusElement(), meta.getStatusElement(), false))
// meta.setStatusElement(null);
// if (!Base.compareDeep(de.getDateElement(), meta.getDateElement(), false))
// meta.setDateElement(null);
// if (!Base.compareDeep(de.getElement().get(0).getType(), meta.getElement().get(0).getType(), false))
// meta.getElement().get(0).getType().clear();
// }
// if (meta.hasPublisher() || meta.hasContact() || meta.hasStatus() || meta.hasDate() /* || meta.hasType() */) {
// b.append("<table class=\"grid\">\r\n");
// if (meta.hasPublisher())
// b.append("<tr><td>Publisher:</td><td>"+meta.getPublisher()+"</td></tr>\r\n");
// if (meta.hasContact()) {
// b.append("<tr><td>Contacts:</td><td>");
// boolean firsti = true;
// for (ContactDetail c : meta.getContact()) {
// if (firsti)
// firsti = false;
// else
// b.append("<br/>");
// if (c.hasName())
// b.append(Utilities.escapeXml(c.getName())+": ");
// boolean first = true;
// for (ContactPoint cp : c.getTelecom()) {
// if (first)
// first = false;
// else
// b.append(", ");
// renderContactPoint(b, cp);
// }
// }
// b.append("</td></tr>\r\n");
// }
// if (meta.hasStatus())
// b.append("<tr><td>Status:</td><td>"+meta.getStatus().toString()+"</td></tr>\r\n");
// if (meta.hasDate())
// b.append("<tr><td>Date:</td><td>"+meta.getDateElement().asStringValue()+"</td></tr>\r\n");
// if (meta.getElement().get(0).hasType())
// b.append("<tr><td>Type:</td><td>"+renderType(meta.getElement().get(0).getType())+"</td></tr>\r\n");
// b.append("</table>\r\n");
// }
// return meta;
// }
private static String renderType(List<TypeRefComponent> type) {
if (type == null || type.isEmpty())
return "";
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (TypeRefComponent c : type)
b.append(renderType(c));
return b.toString();
}
private static String renderType(TypeRefComponent type) {
if (type == null || type.isEmpty())
return "";
return type.getWorkingCode();
}
public static void renderContactPoint(StringBuilder b, ContactPoint cp) {
if (cp != null && !cp.isEmpty()) {
if (cp.getSystem() == ContactPointSystem.EMAIL)
b.append("<a href=\"mailto:"+cp.getValue()+"\">"+cp.getValue()+"</a>");
else if (cp.getSystem() == ContactPointSystem.FAX)
b.append("Fax: "+cp.getValue());
else if (cp.getSystem() == ContactPointSystem.OTHER)
b.append("<a href=\""+cp.getValue()+"\">"+cp.getValue()+"</a>");
else
b.append(cp.getValue());
String c = cc.getCode("urn:iso:std:iso:3166:-2");
String l = jl.get(c);
if (l == null) {
return null;
} else if (lang != null) {
return new Locale(lang+"-"+l.substring(l.indexOf("-")+1));
} else {
return new Locale(l);
}
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4656,7 +4656,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
timeTracker.sd(t);
trackUsage(profile, hostContext, element);
if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(),
profile != null, I18nConstants.BUNDLE_BUNDLE_ENTRY_NOPROFILE_TYPE, special.toHuman(), resourceName)) {
profile != null, I18nConstants.BUNDLE_BUNDLE_ENTRY_NOPROFILE_TYPE, special == null ? "??" : special.toHuman(), resourceName)) {
validateResource(hc, errors, resource, element, profile, idstatus, stack);
}
} else {

View File

@ -14,12 +14,12 @@
HAPI FHIR
-->
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.22-SNAPSHOT</version>
<version>5.6.23-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<hapi_fhir_version>5.1.0</hapi_fhir_version>
<validator_test_case_version>1.1.84-SNAPSHOT</validator_test_case_version>
<validator_test_case_version>1.1.86</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version>
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
@ -398,6 +398,9 @@
Surefire testing run. This may appear as an error in some IDEs, but it will run regardless.
-->
<argLine>${argLine} -Xmx4096m</argLine>
<systemPropertyVariables>
<java.locale.providers>COMPAT</java.locale.providers>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude>