From 3f34fc1d91d648dc96a5251e4a3e53cdf26b6a8c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sun, 11 Aug 2024 22:30:34 +0800 Subject: [PATCH] Fix up conceptMap rendering (remove spurious summary table) --- .../fhir/r5/renderers/ConceptMapRenderer.java | 43 ++++--------------- .../fhir/r5/renderers/ResourceRenderer.java | 11 ++++- .../fhir/r5/renderers/ValueSetRenderer.java | 8 ++++ 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ConceptMapRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ConceptMapRenderer.java index 2fd20b25a..5cecde33a 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ConceptMapRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ConceptMapRenderer.java @@ -325,10 +325,15 @@ public class ConceptMapRenderer extends TerminologyRenderer { public void render(RenderingStatus status, ResourceWrapper res, XhtmlNode x, ConceptMap cm, boolean header) throws FHIRFormatError, DefinitionException, IOException { - if (header) { - x.h2().addText(cm.getName()+" ("+cm.getUrl()+")"); - } + if (context.isShowSummaryTable()) { + XhtmlNode h = x.h2(); + h.addText(cm.hasTitle() ? cm.getTitle() : cm.getName()); + addMarkdown(x, cm.getDescription()); + if (cm.hasCopyright()) + generateCopyright(x, res); + } + XhtmlNode p = x.para(); p.tx(context.formatPhrase(RenderingContext.CONC_MAP_FROM) + " "); if (cm.hasSourceScope()) @@ -341,38 +346,6 @@ public class ConceptMapRenderer extends TerminologyRenderer { else p.tx(context.formatPhrase(RenderingContext.CONC_MAP_NOT_SPEC)); - p = x.para(); - if (cm.getExperimental()) - p.addText(Utilities.capitalize(cm.getStatus().toString())+" "+ (context.formatPhrase(RenderingContext.CONC_MAP_NO_PROD_USE) + " ")); - else - p.addText(Utilities.capitalize(cm.getStatus().toString())+". "); - p.tx(context.formatPhrase(RenderingContext.CONC_MAP_PUB_ON, (cm.hasDate() ? displayDataType(cm.getDateElement()) : "?ngen-10?")+" by "+cm.getPublisher()) + " "); - if (!cm.getContact().isEmpty()) { - p.tx(" ("); - boolean firsti = true; - for (ContactDetail ci : cm.getContact()) { - if (firsti) - firsti = false; - else - p.tx(", "); - if (ci.hasName()) - p.addText(ci.getName()+": "); - boolean first = true; - for (ContactPoint c : ci.getTelecom()) { - if (first) - first = false; - else - p.tx(", "); - addTelecom(p, wrapWC(res, c)); - } - } - p.tx(")"); - } - p.tx(". "); - p.addText(cm.getCopyright()); - if (!Utilities.noString(cm.getDescription())) - addMarkdown(x, cm.getDescription()); - x.br(); int gc = 0; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java index 033f42145..6830a1302 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java @@ -36,7 +36,7 @@ import org.hl7.fhir.r5.utils.EOperationOutcome; import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.XVerExtensionManager; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; - +import org.hl7.fhir.utilities.DebugUtilities; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece; @@ -339,10 +339,17 @@ public abstract class ResourceRenderer extends DataRenderer { actual = type; } if (actual != null && actual.hasPrimitiveValue()) { + if (actual.primitiveValue().equals("Patient/1")) { + DebugUtilities.breakpoint(); + } ResourceWithReference rr = resolveReference(actual); if (rr == null) { String disp = display != null && display.hasPrimitiveValue() ? displayDataType(display) : actual.primitiveValue(); - x.ah(context.prefixLocalHref(actual.primitiveValue())).tx(disp); + if (Utilities.isAbsoluteUrl(actual.primitiveValue())) { + x.ah(context.prefixLocalHref(actual.primitiveValue())).tx(disp); + } else { + x.code().tx(disp); + } } else if (rr.getResource() == null) { String disp = display != null && display.hasPrimitiveValue() ? displayDataType(display) : "??"; x.ah(context.prefixLocalHref(rr.getWebPath())).tx(disp); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java index f4d0277bd..9b04cd9ca 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java @@ -81,6 +81,14 @@ public class ValueSetRenderer extends TerminologyRenderer { genSummaryTable(status, x, vs); List maps = findReleventMaps(vs); + if (context.isShowSummaryTable()) { + XhtmlNode h = x.h2(); + h.addText(vs.hasTitle() ? vs.getTitle() : vs.getName()); + addMarkdown(x, vs.getDescription()); + if (vs.hasCopyright()) + generateCopyright(x, r); + } + if (vs.hasExpansion()) { // for now, we just accept an expansion if there is one generateExpansion(status, r, x, vs, false, maps);