Merge branch 'master' into do-20240122-base-engine

This commit is contained in:
dotasek 2024-06-26 19:07:43 -04:00
commit 687500c80b
9 changed files with 73 additions and 19 deletions

View File

@ -1,7 +1,24 @@
## Validator Changes
* no changes
* Change how count is calculated when expanding value sets
* Fix value set expansion bugs
* Fix for fhirpath issue on command line (#1650)
* Add IG dependency validator
* work around bad r4 extension definitions
* don't reload different sub-version of extensions pack
## Other code changes
* no changes
* Rework rendering library from ground up
* Merge Fix: Fix split logic of canonical into url and version in several places (#1663)
* Suppress spurious message when code system is unknown
* don't raise needless and wrong exceptions about extension definitions when rendering
* fix duplicate link creation
* Stop recursive rendering crash
* Obligation rendering improvements
* Handle extra profiles on resources in an IG when converting between versions
* Fixed issue with actor title not rendering in obligations
* Test and adaption for dateOp #1655
* Use assertj instead of hamcrest (#1662)
* More transifex work
* Add support for local packages during testing

View File

@ -2735,7 +2735,7 @@ public class FHIRPathEngine {
if (right.size() > 1) {
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE, "+");
}
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || left.get(0).hasType("Date") || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || left.get(0).hasType("date", "dateTime", "instant") || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "+", right.get(0).fhirType());
}
@ -2748,8 +2748,8 @@ public class FHIRPathEngine {
result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
} else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
} else if ((l.isDateTime() || l.hasType("Date")) && r.hasType("Quantity")) {
if (l.hasType("Date")) {
} else if ((l.isDateTime() || l.hasType("date")) && r.hasType("Quantity")) {
if (l.hasType("date")) {
BaseDateTimeType dt = l instanceof BaseDateTimeType ? (BaseDateTimeType) l : TypeConvertor.castToDateTime(l);
Quantity qty = r instanceof Quantity ? (Quantity) r : TypeConvertor.castToQuantity(r);
result.add(dateAdd(dt, qty, false, expr));
@ -3001,7 +3001,7 @@ public class FHIRPathEngine {
if (right.size() > 1) {
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE, "-");
}
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || left.get(0).hasType("Date") || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || left.get(0).hasType("date", "dateTime") || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "-", right.get(0).fhirType());
}
@ -3019,8 +3019,8 @@ public class FHIRPathEngine {
Quantity qty = (Quantity) r;
result.add(qty.copy().setValue(qty.getValue().abs()));
}
} else if ((l.isDateTime() || l.hasType("Date")) && r.hasType("Quantity")) {
if (l.hasType("Date")) {
} else if ((l.isDateTime() || l.hasType("date", "dateTime", "instant")) && r.hasType("Quantity")) {
if (l.hasType("date")) {
BaseDateTimeType dt = l instanceof BaseDateTimeType ? (BaseDateTimeType) l : TypeConvertor.castToDateTime(l);
Quantity qty = r instanceof Quantity ? (Quantity) r : TypeConvertor.castToQuantity(r);
result.add(dateAdd(dt, qty, true, expr));

View File

@ -33,6 +33,8 @@ package org.hl7.fhir.r5.model;
import java.net.URI;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
@ -87,6 +89,16 @@ public class CanonicalType extends UriType {
var s = primitiveValue();
return s == null || !s.contains("|") ? null : s.substring(s.indexOf("|")+1);
}
public String getCanonical() {
if (hasPrimitiveValue()) {
return primitiveValue();
}
if (hasExtension(ToolingExtensions.EXT_ALTERNATE_CANONICAL)) {
return getExtensionString(ToolingExtensions.EXT_ALTERNATE_CANONICAL);
}
return null;
}
}

View File

@ -801,6 +801,9 @@ public class DataRenderer extends Renderer implements CodeResolver {
case "Ratio":
renderRatio(status, x, type);
break;
case "Attachment":
renderAttachment(status, x, type);
break;
case "CodeableReference":
if (type.has("concept")) {
renderCodeableConcept(status, x, type.child("concept"));
@ -847,6 +850,15 @@ public class DataRenderer extends Renderer implements CodeResolver {
renderQuantity(status, x, type.child("denominator"));
}
private void renderAttachment(RenderingStatus status, XhtmlNode x, ResourceWrapper att) {
String ct = att.primitiveValue("contentType");
if (att.has("url")) {
x.tx(context.formatMessage(RenderingContext.DATA_REND_ATT_URL, ct, att.primitiveValue("url")));
} else if (att.has("data")) {
x.tx(context.formatMessage(RenderingContext.DATA_REND_ATT_DATA, ct, displayDataType(att.child("data"))));
}
}
private void renderContactDetail(RenderingStatus status, XhtmlNode x, ResourceWrapper cd) {
if (cd.has("name")) {
x.tx(cd.primitiveValue("name")+": ");

View File

@ -406,7 +406,7 @@ public class ObligationsRenderer extends Renderer {
if (!ob.actors.isEmpty() || ob.compare.actors.isEmpty()) {
boolean firstActor = true;
for (CanonicalType anActor : ob.actors) {
ActorDefinition ad = context.getContext().fetchResource(ActorDefinition.class, anActor.getValue());
ActorDefinition ad = context.getContext().fetchResource(ActorDefinition.class, anActor.getCanonical());
boolean existingActor = ob.compare != null && ob.compare.actors.contains(anActor);
if (!firstActor) {
@ -416,7 +416,11 @@ public class ObligationsRenderer extends Renderer {
if (!existingActor)
actorId.style(STYLE_UNCHANGED);
actorId.addText(ad.getTitle());
if (ad == null) {
actorId.addText(anActor.getCanonical());
} else {
actorId.ah(ad.getWebPath()).tx(ad.getTitle());
}
}
if (ob.compare != null) {
@ -428,7 +432,9 @@ public class ObligationsRenderer extends Renderer {
firstActor = true;
}
actorId = actorId.span(STYLE_REMOVED, null);
if (compAd.hasWebPath()) {
if (compAd == null) {
actorId.ah(context.prefixLocalHref(compActor.toString()), compActor.toString()).tx(compActor.toString());
} else if (compAd.hasWebPath()) {
actorId.ah(context.prefixLocalHref(compAd.getWebPath()), compActor.toString()).tx(compAd.present());
} else {
actorId.span(null, compActor.toString()).tx(compAd.present());
@ -446,13 +452,15 @@ public class ObligationsRenderer extends Renderer {
for (String eid : ob.elementIds) {
elementIds.sep(", ");
ElementDefinition ed = profile.getSnapshot().getElementById(eid);
boolean inScope = inScopePaths.contains(ed.getPath());
String name = eid.substring(eid.indexOf(".") + 1);
if (ed != null && inScope) {
String link = defPath + "#" + anchorPrefix + eid;
elementIds.ah(context.prefixLocalHref(link)).tx(name);
} else {
elementIds.code().tx(name);
if (ed != null) {
boolean inScope = inScopePaths.contains(ed.getPath());
String name = eid.substring(eid.indexOf(".") + 1);
if (ed != null && inScope) {
String link = defPath + "#" + anchorPrefix + eid;
elementIds.ah(context.prefixLocalHref(link)).tx(name);
} else {
elementIds.code().tx(name);
}
}
}

View File

@ -274,6 +274,7 @@ public class ToolingExtensions {
public static final String EXT_IG_URL = "http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-uri";
public static final String EXT_VS_CS_SUPPL_NEEDED = "http://hl7.org/fhir/StructureDefinition/valueset-supplement";
public static final String EXT_TYPE_PARAMETER = "http://hl7.org/fhir/tools/StructureDefinition/type-parameter";
public static final String EXT_ALTERNATE_CANONICAL = "http://hl7.org/fhir/StructureDefinition/alternate-canonical";
// specific extension helpers

View File

@ -911,6 +911,8 @@ public class RenderingI18nContext extends I18nBase {
public static final String PROF_DRIV_SUMM_NONE = "PROF_DRIV_SUMM_NONE";
public static final String PROF_DRIV_SUMM = "PROF_DRIV_SUMM";
public static final String DOCUMENT_SUMMARY = "DOCUMENT_SUMMARY";
public static final String DATA_REND_ATT_URL = "DATA_REND_ATT_URL";
public static final String DATA_REND_ATT_DATA = "DATA_REND_ATT_DATA";
protected String getMessagesSourceFileName() {
return "rendering-phrases";

View File

@ -915,3 +915,5 @@ PROF_DRIV_SUMM_NONE = {0}
PROF_DRIV_SUMM = {0}: {1}
BUNDLE_HEADER_DOCUMENT_CONTENTS = Additional Resources Included in Document
DOCUMENT_SUMMARY = <param name="status"/> Document at <param name="date"/> by <param name="author"/> for <param name="subject"/> <if test="has-encounter = true"> in encounter <param name="encounter"/></if>
DATA_REND_ATT_URL = {0} @ {1}
DATA_REND_ATT_DATA = {0}: {1}

View File

@ -21,7 +21,7 @@
<commons_compress_version>1.26.0</commons_compress_version>
<guava_version>32.0.1-jre</guava_version>
<hapi_fhir_version>6.4.1</hapi_fhir_version>
<validator_test_case_version>1.5.12-SNAPSHOT</validator_test_case_version>
<validator_test_case_version>1.5.12</validator_test_case_version>
<jackson_version>2.17.0</jackson_version>
<junit_jupiter_version>5.9.2</junit_jupiter_version>
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>