Merge pull request #1669 from hapifhir/2024-06-gg-render-attachments
release notes + render attachments
This commit is contained in:
commit
3b02eaedec
|
@ -1,7 +1,24 @@
|
||||||
## Validator Changes
|
## 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
|
## 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
|
||||||
|
|
|
@ -33,6 +33,8 @@ package org.hl7.fhir.r5.model;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +89,16 @@ public class CanonicalType extends UriType {
|
||||||
var s = primitiveValue();
|
var s = primitiveValue();
|
||||||
return s == null || !s.contains("|") ? null : s.substring(s.indexOf("|")+1);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -801,6 +801,9 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
||||||
case "Ratio":
|
case "Ratio":
|
||||||
renderRatio(status, x, type);
|
renderRatio(status, x, type);
|
||||||
break;
|
break;
|
||||||
|
case "Attachment":
|
||||||
|
renderAttachment(status, x, type);
|
||||||
|
break;
|
||||||
case "CodeableReference":
|
case "CodeableReference":
|
||||||
if (type.has("concept")) {
|
if (type.has("concept")) {
|
||||||
renderCodeableConcept(status, x, type.child("concept"));
|
renderCodeableConcept(status, x, type.child("concept"));
|
||||||
|
@ -847,6 +850,15 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
||||||
renderQuantity(status, x, type.child("denominator"));
|
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) {
|
private void renderContactDetail(RenderingStatus status, XhtmlNode x, ResourceWrapper cd) {
|
||||||
if (cd.has("name")) {
|
if (cd.has("name")) {
|
||||||
x.tx(cd.primitiveValue("name")+": ");
|
x.tx(cd.primitiveValue("name")+": ");
|
||||||
|
|
|
@ -406,7 +406,7 @@ public class ObligationsRenderer extends Renderer {
|
||||||
if (!ob.actors.isEmpty() || ob.compare.actors.isEmpty()) {
|
if (!ob.actors.isEmpty() || ob.compare.actors.isEmpty()) {
|
||||||
boolean firstActor = true;
|
boolean firstActor = true;
|
||||||
for (CanonicalType anActor : ob.actors) {
|
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);
|
boolean existingActor = ob.compare != null && ob.compare.actors.contains(anActor);
|
||||||
|
|
||||||
if (!firstActor) {
|
if (!firstActor) {
|
||||||
|
@ -416,7 +416,11 @@ public class ObligationsRenderer extends Renderer {
|
||||||
|
|
||||||
if (!existingActor)
|
if (!existingActor)
|
||||||
actorId.style(STYLE_UNCHANGED);
|
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) {
|
if (ob.compare != null) {
|
||||||
|
@ -428,7 +432,9 @@ public class ObligationsRenderer extends Renderer {
|
||||||
firstActor = true;
|
firstActor = true;
|
||||||
}
|
}
|
||||||
actorId = actorId.span(STYLE_REMOVED, null);
|
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());
|
actorId.ah(context.prefixLocalHref(compAd.getWebPath()), compActor.toString()).tx(compAd.present());
|
||||||
} else {
|
} else {
|
||||||
actorId.span(null, compActor.toString()).tx(compAd.present());
|
actorId.span(null, compActor.toString()).tx(compAd.present());
|
||||||
|
@ -446,13 +452,15 @@ public class ObligationsRenderer extends Renderer {
|
||||||
for (String eid : ob.elementIds) {
|
for (String eid : ob.elementIds) {
|
||||||
elementIds.sep(", ");
|
elementIds.sep(", ");
|
||||||
ElementDefinition ed = profile.getSnapshot().getElementById(eid);
|
ElementDefinition ed = profile.getSnapshot().getElementById(eid);
|
||||||
boolean inScope = inScopePaths.contains(ed.getPath());
|
if (ed != null) {
|
||||||
String name = eid.substring(eid.indexOf(".") + 1);
|
boolean inScope = inScopePaths.contains(ed.getPath());
|
||||||
if (ed != null && inScope) {
|
String name = eid.substring(eid.indexOf(".") + 1);
|
||||||
String link = defPath + "#" + anchorPrefix + eid;
|
if (ed != null && inScope) {
|
||||||
elementIds.ah(context.prefixLocalHref(link)).tx(name);
|
String link = defPath + "#" + anchorPrefix + eid;
|
||||||
} else {
|
elementIds.ah(context.prefixLocalHref(link)).tx(name);
|
||||||
elementIds.code().tx(name);
|
} else {
|
||||||
|
elementIds.code().tx(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_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_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_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
|
// specific extension helpers
|
||||||
|
|
||||||
|
|
|
@ -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_NONE = "PROF_DRIV_SUMM_NONE";
|
||||||
public static final String PROF_DRIV_SUMM = "PROF_DRIV_SUMM";
|
public static final String PROF_DRIV_SUMM = "PROF_DRIV_SUMM";
|
||||||
public static final String DOCUMENT_SUMMARY = "DOCUMENT_SUMMARY";
|
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() {
|
protected String getMessagesSourceFileName() {
|
||||||
return "rendering-phrases";
|
return "rendering-phrases";
|
||||||
|
|
|
@ -915,3 +915,5 @@ PROF_DRIV_SUMM_NONE = {0}
|
||||||
PROF_DRIV_SUMM = {0}: {1}
|
PROF_DRIV_SUMM = {0}: {1}
|
||||||
BUNDLE_HEADER_DOCUMENT_CONTENTS = Additional Resources Included in Document
|
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>
|
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}
|
||||||
|
|
Loading…
Reference in New Issue