From 974ce280aa52b6f0f84424136ebea7d5e22a4251 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Mon, 3 Jun 2024 08:20:16 -0500 Subject: [PATCH 01/10] adding system-level operations --- .../hl7/fhir/r5/renderers/CapabilityStatementRenderer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index 35ab9c5c8..493a0d7f4 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -347,6 +347,11 @@ public class CapabilityStatementRenderer extends ResourceRenderer { resCount++; } } + if (rest.getOperation().size() > 0) { + //TODO Figure out what should come out of this + x.h(nextLevel,"operationsCap" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.OP_DEF_NAME)); + x.h(nextLevel+1,"operationsSummary" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.OP_DEF_USE)); + } count++; } } From 36f7236aad3e3e9e402d82e8853dfefad25b7240 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Tue, 4 Jun 2024 12:33:44 -0500 Subject: [PATCH 02/10] First part fixes to CP rendering --- .../CapabilityStatementRenderer.java | 92 +++++++++++++++---- .../OperationDefinitionRenderer.java | 6 +- .../utilities/i18n/RenderingI18nContext.java | 2 + .../resources/rendering-phrases.properties | 2 + 4 files changed, 84 insertions(+), 18 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index f5d5802d8..dd6166e64 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -266,6 +266,28 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } + private class ResourceInteraction { + private String codeString; + private String documentation; + public ResourceInteraction(String code, String markdown) { + codeString = code; + if (!Utilities.noString(markdown)) { + documentation = markdown; + } + else { + documentation = null; + } + } + + public String getDocumentation() { + return documentation; + } + + public String getInteraction() { + return codeString; + } + } + //Constructors public CapabilityStatementRenderer(RenderingContext context) { super(context); @@ -349,7 +371,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } if (rest.getOperation().size() > 0) { //TODO Figure out what should come out of this - x.h(nextLevel,"operationsCap" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.OP_DEF_NAME)); + x.h(nextLevel,"operationsCap" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.CAPABILITY_OP)); x.h(nextLevel+1,"operationsSummary" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.OP_DEF_USE)); } count++; @@ -357,7 +379,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } if (multExpectationsPresent) { - addWarningPanel(x,"⹋⹋ - this mark indicates that there are more than one expectation extensions present"); + addWarningPanel(x,"⹋⹋ - " + context.formatPhrase(RenderingContext.CAPABILITY_MULT_EXT)); } return true; @@ -688,7 +710,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } } - private void addInteractionSummaryList(XhtmlNode uList, String verb, List interactions) { + private void addInteractionSummaryList(XhtmlNode uList, String verb, List interactions) { if (interactions.size() == 0) return; XhtmlNode item = uList.li(); if (Utilities.noString(verb)) { @@ -698,8 +720,8 @@ public class CapabilityStatementRenderer extends ResourceRenderer { item.addTag("strong").addText(verb); item.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " "); } - addSeparatedListOfCodes(item, interactions, ","); - item.addText("."); + + applyInteractionsList(item, interactions); } private void addSummaryIntro(XhtmlNode x) { @@ -958,10 +980,44 @@ public class CapabilityStatementRenderer extends ResourceRenderer { result.add("$"+op.getName()); } } + else { + result.add("$"+op.getName()); + } } return result; } + private void applyInteractionsList(XhtmlNode item, List list) { + List noDocList = new ArrayList(); + List docList = new ArrayList(); + for (ResourceInteraction inter : list) { + if (Utilities.noString(inter.getDocumentation())) { + noDocList.add(inter.getInteraction()); + } + else { + docList.add(inter); + } + } + if (noDocList.size() > 0) { + addSeparatedListOfCodes(item,noDocList, ","); + } + if (docList.size() > 0) { + item.br(); + for (ResourceInteraction inter : docList) { + item.code().addText(inter.getInteraction()); + try { + addMarkdown(item, inter.getDocumentation()); + } + catch(IOException e) { + e.printStackTrace(); + } + } + } + else { + item.addText("."); + } + } + private void addResourceConfigPanel(XhtmlNode x, CapabilityStatementRestResourceComponent r, int nextLevel, int count, int resCount, boolean igRenderingMode) throws FHIRFormatError, DefinitionException, IOException { XhtmlNode panel= null; XhtmlNode body = null; @@ -1109,28 +1165,32 @@ public class CapabilityStatementRenderer extends ResourceRenderer { private void addInteractions(XhtmlNode row, CapabilityStatementRestResourceComponent r, int width) { String capExpectation; String widthString = "col-lg-" + Integer.toString(width); - List shalls = new ArrayList(); - List shoulds = new ArrayList(); - List mays = new ArrayList(); - List shouldnots = new ArrayList(); - List supporteds = new ArrayList(); + //Need to build a different structure + List shalls = new ArrayList(); + List shoulds = new ArrayList(); + List mays = new ArrayList(); + List shouldnots = new ArrayList(); + List supporteds = new ArrayList(); + + ResourceInteraction tempInteraction = null; for (ResourceInteractionComponent op : r.getInteraction()) { capExpectation = expectationForDisplay(op,EXPECTATION); + tempInteraction = new ResourceInteraction(op.getCode().toCode(), op.getDocumentation()); if (!Utilities.noString(capExpectation)) { switch(capExpectation) { - case "SHALL" : shalls.add(op.getCode().toCode()); + case "SHALL" : shalls.add(tempInteraction); break; - case "SHOULD" : shoulds.add(op.getCode().toCode()); + case "SHOULD" : shoulds.add(tempInteraction); break; - case "MAY" : mays.add(op.getCode().toCode()); + case "MAY" : mays.add(tempInteraction); break; - case "SHOULD-NOT" : shouldnots.add(op.getCode().toCode()); + case "SHOULD-NOT" : shouldnots.add(tempInteraction); break; } } else { - supporteds.add(op.getCode().toCode()); + supporteds.add(tempInteraction); } } XhtmlNode cell = row.div().attribute("class", widthString); @@ -1528,7 +1588,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { private void addWarningPanel(XhtmlNode node, String text) { XhtmlNode panel = node.addTag("div").attribute("class","panel panel-danger").addTag("div").attribute("class","panel-body"); - panel.addTag("span").attribute("class","label label-danger").addText("Error detected"); + panel.addTag("span").attribute("class","label label-danger").addText(context.formatPhrase(RenderingContext.CAPABILITY_ERR_DET)); panel.addText(" " + text); } } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java index 947e44c67..33200efb3 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java @@ -76,8 +76,10 @@ public class OperationDefinitionRenderer extends TerminologyRenderer { } else { p.ah(sd.getWebPath()).tx(sd.present()); } - } - x.para().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); + } + + x.h(3, context.formatPhrase(RenderingContext.GENERAL_PARS)); + //x.para().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); XhtmlNode tbl = x.table( "grid"); XhtmlNode tr = tbl.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.OP_DEF_USE)); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java index eff5b94ab..67881a418 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java @@ -83,6 +83,7 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_CREATE_INT = "CAPABILITY_CREATE_INT"; public static final String GENERAL_CRIT = "GENERAL_CRIT"; public static final String CAPABILITY_DELETE_INT = "CAPABILITY_DELETE_INT"; + public static final String CAPABILITY_ERR_DET = "CAPABILITY_ERR_DET"; public static final String CAPABILITY_EXT_OP = "CAPABILITY_EXT_OP"; public static final String CAPABILITY_FHIR = "CAPABILITY_FHIR"; public static final String CAPABILITY_FHIR_VER = "CAPABILITY_FHIR_VER"; @@ -93,6 +94,7 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_INTER_SUPP = "CAPABILITY_INTER_SUPP"; public static final String CAPABILITY_INT_DESC = "CAPABILITY_INT_DESC"; public static final String CAPABILITY_INT_SUMM = "CAPABILITY_INT_SUMM"; + public static final String CAPABILITY_MULT_EXT = "CAPABILITY_MULT_EXT"; public static final String CAPABILITY_NOTE_CAP = "CAPABILITY_NOTE_CAP"; public static final String CAPABILITY_OP = "CAPABILITY_OP"; public static final String CAPABILITY_OPER = "CAPABILITY_OPER"; diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties index 4d957579f..0aa5bed7e 100644 --- a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties @@ -80,6 +80,7 @@ CAPABILITY_CORS_YES = Enable CORS: yes CAPABILITY_CREATE_INT = POST a new resource (create interaction) GENERAL_CRIT = Criteria CAPABILITY_DELETE_INT = DELETE a resource (delete interaction) +CAPABILITY_ERR_DET = Error detected CAPABILITY_EXT_OP = Extended Operations CAPABILITY_FHIR = Core FHIR Resource CAPABILITY_FHIR_VER = FHIR Version: {0} @@ -90,6 +91,7 @@ CAPABILITY_INT = interaction. CAPABILITY_INTER_SUPP = The interactions supported by each resource ( CAPABILITY_INT_DESC = interaction described as follows: CAPABILITY_INT_SUMM = Interaction summary +CAPABILITY_MULT_EXT = this mark indicates that there are more than one expectation extensions present CAPABILITY_NOTE_CAP = Note to Implementers: FHIR Capabilities CAPABILITY_OP = Operations CAPABILITY_OPER = Operation From f5a9e2b2423ca796984d78cec3650db27d79ad00 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Thu, 1 Aug 2024 14:13:02 -0500 Subject: [PATCH 03/10] Updating to the current version --- .../fhir/r5/renderers/CapabilityStatementRenderer.java | 10 +++++----- .../fhir/r5/renderers/OperationDefinitionRenderer.java | 4 ++-- .../hl7/fhir/utilities/i18n/RenderingI18nContext.java | 2 ++ .../src/main/resources/rendering-phrases.properties | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index dd6166e64..457c7284e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -525,7 +525,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } } if (igMays.size() > 0) { - x.h(3,"shouldIGs").addText(context.formatPhrase(RenderingContext.CAPABILITY_SHOULD_SUPP)); + x.h(3,"mayIGs").addText(context.formatPhrase(RenderingContext.CAPABILITY_MAY_SUPP)); ul = x.ul(); for (String url : igMays) { addResourceLink(ul.li(), url, url); @@ -563,7 +563,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { capExpectation = getExtValueCode(c.getExtensionByUrl(EXPECTATION)); if (!Utilities.noString(capExpectation)) { lItem.addTag("strong").addText(capExpectation); - lItem.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " "); + lItem.addText(context.formatPhrase(" " + RenderingContext.CAPABILITY_SUPP) + " "); } lItem.code().addText(c.getCode()); first = false; @@ -680,10 +680,10 @@ public class CapabilityStatementRenderer extends ResourceRenderer { for (Map interactionMap : interactions) { item = uList.li(); if (Utilities.noString(verb)) { - item.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP_THE) + " "); + item.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPPS_THE) + " "); } else { - item.addTag("strong").addText(verb); + item.addTag("strong").addText(verb + " "); item.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP_THE) + " "); } interaction = interactionMap.keySet().toArray()[0].toString(); @@ -718,7 +718,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } else { item.addTag("strong").addText(verb); - item.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " "); + item.addText(" " + context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " "); } applyInteractionsList(item, interactions); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java index 33200efb3..4d2563c99 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java @@ -77,8 +77,8 @@ public class OperationDefinitionRenderer extends TerminologyRenderer { p.ah(sd.getWebPath()).tx(sd.present()); } } - - x.h(3, context.formatPhrase(RenderingContext.GENERAL_PARS)); + + x.h3().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); //x.para().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); XhtmlNode tbl = x.table( "grid"); XhtmlNode tr = tbl.tr(); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java index 67881a418..6f38342f7 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java @@ -94,6 +94,7 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_INTER_SUPP = "CAPABILITY_INTER_SUPP"; public static final String CAPABILITY_INT_DESC = "CAPABILITY_INT_DESC"; public static final String CAPABILITY_INT_SUMM = "CAPABILITY_INT_SUMM"; + public static final String CAPABILITY_MAY_SUPP = "CAPABILITY_MAY_SUPP"; public static final String CAPABILITY_MULT_EXT = "CAPABILITY_MULT_EXT"; public static final String CAPABILITY_NOTE_CAP = "CAPABILITY_NOTE_CAP"; public static final String CAPABILITY_OP = "CAPABILITY_OP"; @@ -132,6 +133,7 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_SUPP_PATCH_FORM = "CAPABILITY_SUPP_PATCH_FORM"; public static final String CAPABILITY_SUPP_PROFS = "CAPABILITY_SUPP_PROFS"; public static final String CAPABILITY_SUPP_THE = "CAPABILITY_SUPP_THE"; + public static final String CAPABILITY_SUPPS_THE = "CAPABILITY_SUPPS_THE"; public static final String GENERAL_TYPE = "GENERAL_TYPE"; public static final String CAPABILITY_TYPS = "CAPABILITY_TYPS"; public static final String CAPABILITY_TYP_PRES = "CAPABILITY_TYP_PRES"; diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties index 0aa5bed7e..417298940 100644 --- a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties @@ -91,6 +91,7 @@ CAPABILITY_INT = interaction. CAPABILITY_INTER_SUPP = The interactions supported by each resource ( CAPABILITY_INT_DESC = interaction described as follows: CAPABILITY_INT_SUMM = Interaction summary +CAPABILITY_MAY_SUPP = MAY Support the Following Implementation Guides CAPABILITY_MULT_EXT = this mark indicates that there are more than one expectation extensions present CAPABILITY_NOTE_CAP = Note to Implementers: FHIR Capabilities CAPABILITY_OP = Operations @@ -128,7 +129,8 @@ CAPABILITY_SUPPS = Supports CAPABILITY_SUPP_FORM = Supported Formats: CAPABILITY_SUPP_PATCH_FORM = Supported Patch Formats: CAPABILITY_SUPP_PROFS = Supported Profiles -CAPABILITY_SUPP_THE = Supports the +CAPABILITY_SUPP_THE = support the +CAPABILITY_SUPPS_THE = Supports the GENERAL_TYPE = Type CAPABILITY_TYPS = Types CAPABILITY_TYP_PRES = ype are only present if at least one of the resources has support for them. From 4281b0fa484af78616d7470ddd4b54bc3548d30e Mon Sep 17 00:00:00 2001 From: caspears Date: Thu, 1 Aug 2024 22:23:29 -0700 Subject: [PATCH 04/10] Render resource profile and supportedProfile title when available --- .../fhir/r5/renderers/CapabilityStatementRenderer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index 2c13e6a89..a8098e280 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -369,7 +369,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { //Third time for individual resources int resCount = 1; for (CapabilityStatementRestResourceComponent r : rest.getResource()) { - addResourceConfigPanel(x, r, nextLevel+1, count, resCount, igRenderingMode); + addResourceConfigPanel(status, res, x, r, nextLevel+1, count, resCount, igRenderingMode); resCount++; } } @@ -1000,7 +1000,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } } - private void addResourceConfigPanel(XhtmlNode x, CapabilityStatementRestResourceComponent r, int nextLevel, int count, int resCount, boolean igRenderingMode) throws FHIRFormatError, DefinitionException, IOException { + private void addResourceConfigPanel(RenderingStatus status, ResourceWrapper res, XhtmlNode x, CapabilityStatementRestResourceComponent r, int nextLevel, int count, int resCount, boolean igRenderingMode) throws FHIRFormatError, DefinitionException, IOException { XhtmlNode panel= null; XhtmlNode body = null; XhtmlNode panelHead = null; @@ -1035,7 +1035,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { cell = row.div().attribute("class", "col-lg-6"); addLead(cell,context.formatPhrase(RenderingContext.CAPABILITY_BASE_SYS)); cell.br(); - addResourceLink(cell, text, text); + renderCanonical(status, res, cell, StructureDefinition.class, r.getProfileElement()); cell=row.div().attribute("class", "col-lg-3"); addLead(cell, context.formatPhrase(RenderingContext.CAPABILITY_PROF_CONF)); cell.br(); @@ -1070,7 +1070,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { para.br(); } first=false; - addResourceLink(para, c.asStringValue(), c.asStringValue()); + renderCanonical(status, res, para, StructureDefinition.class, c); //para.ah(c.asStringValue()).addText(c.asStringValue()); } } From 2d5049c93872b1b8b2345827c06a91445e5e319b Mon Sep 17 00:00:00 2001 From: caspears Date: Thu, 1 Aug 2024 23:05:49 -0700 Subject: [PATCH 05/10] CapabilityStatement Message and Document rendering --- .../CapabilityStatementRenderer.java | 124 ++++++++++++++++++ .../utilities/i18n/RenderingI18nContext.java | 6 + .../resources/rendering-phrases.properties | 6 + 3 files changed, 136 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index a8098e280..1bf676bc0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -18,6 +18,10 @@ import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponen import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent; import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent; import org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy; import org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent; import org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent; @@ -382,6 +386,25 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } } + int messagingNum = conf.getMessaging().size(); + nextLevel = 3; + if (messagingNum > 0) { + x.h(2,"messaging").addText((context.formatPhrase(RenderingContext.CAPABILITY_MESSAGING_CAPS))); + int count=1; + for (CapabilityStatementMessagingComponent msg : conf.getMessaging()) + { + addMessagingPanel(status, res, x, msg, nextLevel, count, messagingNum); + count++; + } + + } + + int documentNum = conf.getDocument().size(); + nextLevel = 3; + if (documentNum > 0) { + x.h(2,"document").addText((context.formatPhrase(RenderingContext.CAPABILITY_DOCUMENT_CAPS))); + addDocumentTable(status, res, x, conf, nextLevel); + } if (multExpectationsPresent) { addWarningPanel(x,"⹋⹋ - " + context.formatPhrase(RenderingContext.CAPABILITY_MULT_EXT)); } @@ -592,6 +615,107 @@ public class CapabilityStatementRenderer extends ResourceRenderer { } + private void addMessagingPanel(RenderingStatus status, ResourceWrapper res, XhtmlNode x, CapabilityStatementMessagingComponent msg, int nextLevel, int index, int total) throws FHIRFormatError, DefinitionException, IOException { + XhtmlNode panel= null; + XhtmlNode body = null; + XhtmlNode row = null; + XhtmlNode heading = null; + + XhtmlNode table; + XhtmlNode tbody; + XhtmlNode tr; + + panel = x.div().attribute("class", "panel panel-default"); + heading = panel.div().attribute("class", "panel-heading").h(nextLevel,"messaging_" + Integer.toString(index)).attribute("class", "panel-title"); + if(total == 1) + { + heading.addText(context.formatPhrase(RenderingContext.CAPABILITY_MESSAGING_CAP)); + } + else + { + heading.addText(context.formatPhrase(RenderingContext.CAPABILITY_MESSAGING_CAP) + " " + String.valueOf(index)); + } + + body = panel.div().attribute("class", "panel-body"); + + if(msg.hasReliableCache()) + { + addLead(body, "Reliable Cache Length"); + body.br(); + body.addText(String.valueOf(msg.getReliableCache()) + " Minute(s)"); + body.br(); + } + + if(msg.hasEndpoint()) + { + body.h(nextLevel+1,"msg_end_"+Integer.toString(index)).addText(context.formatPhrase(RenderingContext.CAPABILITY_ENDPOINTS)); + table = body.table("table table-condensed table-hover"); + tr = table.addTag("thead").tr(); + tr.th().addText("Protocol"); + tr.th().addText("Address"); + + tbody = table.addTag("tbody"); + for (CapabilityStatementMessagingEndpointComponent end : msg.getEndpoint()) + { + tr = tbody.tr(); + renderDataType(status, tr.td(), wrapNC(end.getProtocol())); + renderUri(status, tr.td(), wrapNC(end.getAddressElement())); + } + body.br(); + } + + if(msg.hasSupportedMessage()) + { + body.h(nextLevel+1,"msg_end_"+Integer.toString(index)).addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP_MSGS)); + table = body.table("table table-condensed table-hover"); + tr = table.addTag("thead").tr(); + tr.th().addText("Mode"); + tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_DEFINITION)); + + tbody = table.addTag("tbody"); + for (CapabilityStatementMessagingSupportedMessageComponent sup : msg.getSupportedMessage()) + { + tr = tbody.tr(); + tr.td().addText(sup.getMode().toCode()); + renderCanonical(status, res, tr.td(), StructureDefinition.class, sup.getDefinitionElement()); + } + if(msg.hasDocumentation()) + { + addLead(body, context.formatPhrase(RenderingContext.GENERAL_DOCUMENTATION)); + addMarkdown(body.blockquote(), msg.getDocumentation()); + } + body.br(); + } + } + + + private void addDocumentTable(RenderingStatus status, ResourceWrapper res, XhtmlNode x, CapabilityStatement conf, int nextLevel) throws FHIRFormatError, DefinitionException, IOException { + XhtmlNode table; + XhtmlNode tbody; + XhtmlNode tr; + + table = x.table("table table-condensed table-hover"); + tr = table.addTag("thead").tr(); + tr.th().addText("Mode"); + tr.th().addText(context.formatPhrase(RenderingContext.CAPABILITY_PROF_RES_DOC)); + tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_DOCUMENTATION)); + + tbody = table.addTag("tbody"); + for (CapabilityStatementDocumentComponent document : conf.getDocument()) { + tr = tbody.tr(); + tr.td().addText(document.getMode().toCode()); + renderCanonical(status, res, tr.td(), StructureDefinition.class, document.getProfileElement()); + if(document.hasDocumentation()) + { + addMarkdown(tr.td(), document.getDocumentation()); + } + else + { + tr.td().nbsp(); + } + } + } + private String getCorsText(boolean on) { if (on) { return context.formatPhrase(RenderingContext.CAPABILITY_CORS_YES); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java index 2ba09280f..fe6c4cdca 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java @@ -102,6 +102,7 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_PATCH_INT = "CAPABILITY_PATCH_INT"; public static final String GENERAL_PROF = "GENERAL_PROF"; public static final String CAPABILITY_PROF_CONF = "CAPABILITY_PROF_CONF"; + public static final String CAPABILITY_PROF_RES_DOC = "CAPABILITY_PROF_RES_DOC"; public static final String CAPABILITY_PROF_MAP = "CAPABILITY_PROF_MAP"; public static final String CAPABILITY_PUB_BY = "CAPABILITY_PUB_BY"; public static final String CAPABILITY_PUB_ON = "CAPABILITY_PUB_ON"; @@ -109,6 +110,9 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_REF_PROF = "CAPABILITY_REF_PROF"; public static final String CAPABILITY_REQ_RECOM = "CAPABILITY_REQ_RECOM"; public static final String CAPABILITY_REST_CAPS = "CAPABILITY_REST_CAPS"; + public static final String CAPABILITY_DOCUMENT_CAPS = "CAPABILITY_DOCUMENT_CAPS"; + public static final String CAPABILITY_MESSAGING_CAPS = "CAPABILITY_MESSAGING_CAPS"; + public static final String CAPABILITY_MESSAGING_CAP = "CAPABILITY_MESSAGING_CAP"; public static final String CAPABILITY_REST_CONFIG = "CAPABILITY_REST_CONFIG"; public static final String CAPABILITY_RES_CONF = "CAPABILITY_RES_CONF"; public static final String CAPABILITY_RES_ENB = "CAPABILITY_RES_ENB"; @@ -129,6 +133,8 @@ public class RenderingI18nContext extends I18nBase { public static final String CAPABILITY_SUPP_FORM = "CAPABILITY_SUPP_FORM"; public static final String CAPABILITY_SUPP_PATCH_FORM = "CAPABILITY_SUPP_PATCH_FORM"; public static final String CAPABILITY_SUPP_PROFS = "CAPABILITY_SUPP_PROFS"; + public static final String CAPABILITY_SUPP_MSGS = "CAPABILITY_SUPP_MSGS"; + public static final String CAPABILITY_ENDPOINTS = "CAPABILITY_ENDPOINTS"; public static final String CAPABILITY_SUPP_THE = "CAPABILITY_SUPP_THE"; public static final String CAPABILITY_SUPPS_THE = "CAPABILITY_SUPPS_THE"; public static final String GENERAL_TYPE = "GENERAL_TYPE"; diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties index 02dc06208..25fbdbe88 100644 --- a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties @@ -98,6 +98,7 @@ PARS_SUMMARY_LIST = Parameters: {0} CAPABILITY_PATCH_INT = PATCH a new resource version (patch interaction) GENERAL_PROF = Profile CAPABILITY_PROF_CONF = Profile Conformance +CAPABILITY_PROF_RES_DOC = Document Resource Profile CAPABILITY_PROF_MAP = Profile Mapping CAPABILITY_PUB_BY = Published by: {0} CAPABILITY_PUB_ON = Published on: {0} @@ -105,6 +106,9 @@ CAPABILITY_READ_INT = GET a resource (read interaction) CAPABILITY_REF_PROF = Reference Policy CAPABILITY_REQ_RECOM = Required and recommended search parameters CAPABILITY_REST_CAPS = FHIR RESTful Capabilities +CAPABILITY_DOCUMENT_CAPS = FHIR Document Capabilities +CAPABILITY_MESSAGING_CAPS = FHIR Messaging Capabilities +CAPABILITY_MESSAGING_CAP = Messaging Capability CAPABILITY_REST_CONFIG = REST Configuration: {0} CAPABILITY_RES_CONF = Resource Conformance: {0} CAPABILITY_RES_ENB = The linked resources enabled for @@ -125,6 +129,8 @@ CAPABILITY_SUPPS = Supports CAPABILITY_SUPP_FORM = Supported Formats: CAPABILITY_SUPP_PATCH_FORM = Supported Patch Formats: CAPABILITY_SUPP_PROFS = Supported Profiles +CAPABILITY_SUPP_MSGS = Supported Message(s) +CAPABILITY_ENDPOINTS = Endpoint(s) CAPABILITY_SUPP_THE = support the CAPABILITY_SUPPS_THE = Supports the GENERAL_TYPE = Type From f432416ac81e6ac7b18ed8045073a337e472b89e Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Thu, 8 Aug 2024 11:50:49 -0500 Subject: [PATCH 06/10] minor cleanup --- .../org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index 3b29ca121..f2c579fa4 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -932,7 +932,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { renderSupportedProfiles(status, res, profCell, r); } //Show capabilities - tr.td().addText(showOp(r, TypeRestfulInteraction.READ)); + tr.td().attribute("class", "text-center").addText(showOp(r, TypeRestfulInteraction.READ)); if (hasVRead) tr.td().attribute("class", "text-center").addText(showOp(r, TypeRestfulInteraction.VREAD)); tr.td().attribute("class", "text-center").addText(showOp(r, TypeRestfulInteraction.SEARCHTYPE)); From 4275261affed62bacb9b1ab5f191c1cc3579ebe2 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Thu, 15 Aug 2024 14:32:15 -0500 Subject: [PATCH 07/10] Update version --- .../src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java index 72e251336..19aec91c0 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java @@ -690,7 +690,7 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml { public XhtmlNode nbsp() { - addText(NBSP); + addText(" "); return this; } From 07fe018e759ed46ba4e6be17174ff22d9b376581 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Thu, 15 Aug 2024 14:32:53 -0500 Subject: [PATCH 08/10] Update version --- .../org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index f2c579fa4..ef47c9f12 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -406,6 +406,8 @@ public class CapabilityStatementRenderer extends ResourceRenderer { x.h(2,"document").addText((context.formatPhrase(RenderingContext.CAPABILITY_DOCUMENT_CAPS))); addDocumentTable(status, res, x, conf, nextLevel); } + + if (multExpectationsPresent) { addWarningPanel(x,"⹋⹋ - " + context.formatPhrase(RenderingContext.CAPABILITY_MULT_EXT)); } From c60b2bfe1d586fec2ee63cf00463e3f6e0af17a4 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Fri, 16 Aug 2024 16:53:51 -0500 Subject: [PATCH 09/10] fixes on capability statement rendering --- .../fhir/r5/renderers/CapabilityStatementRenderer.java | 2 +- .../java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java | 2 +- pom.xml | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java index ef47c9f12..68148c913 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CapabilityStatementRenderer.java @@ -576,7 +576,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer { capExpectation = getExtValueCode(c.getExtensionByUrl(EXPECTATION)); if (!Utilities.noString(capExpectation)) { lItem.addTag("strong").addText(capExpectation); - lItem.addText(context.formatPhrase(" " + RenderingContext.CAPABILITY_SUPP) + " "); + lItem.addText(" " + context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " "); } lItem.code().addText(c.getCode()); first = false; diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java index 19aec91c0..72e251336 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java @@ -690,7 +690,7 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml { public XhtmlNode nbsp() { - addText(" "); + addText(NBSP); return this; } diff --git a/pom.xml b/pom.xml index c5f5508ca..e8b124cc8 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.26.0 32.0.1-jre 6.4.1 - 1.5.19 + 1.5.20-SNAPSHOT 2.17.0 5.9.2 1.8.2 @@ -73,13 +73,18 @@ false + + local2 + file:///home/vassil/.m2/repository + + From 0276499f240832d36952c4e07879ba9e65d2f2c0 Mon Sep 17 00:00:00 2001 From: Vassil Peytchev Date: Fri, 16 Aug 2024 17:01:10 -0500 Subject: [PATCH 10/10] Making sure pom.xml remains unchanged --- pom.xml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index e8b124cc8..c5f5508ca 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.26.0 32.0.1-jre 6.4.1 - 1.5.20-SNAPSHOT + 1.5.19 2.17.0 5.9.2 1.8.2 @@ -73,18 +73,13 @@ false - - local2 - file:///home/vassil/.m2/repository - - +