From a53ece85f19b7259167c5ae95f0afd29e935a700 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 7 Jan 2025 14:08:01 +1100 Subject: [PATCH 1/4] Accessibility - role=presentation on appropriate tables --- .../hl7/fhir/r5/comparison/ResourceComparer.java | 2 +- .../java/org/hl7/fhir/r5/ips/IPSBuilder.java | 4 ++-- .../java/org/hl7/fhir/r5/ips/IPSRenderer.java | 2 +- .../r5/renderers/ActorDefinitionRenderer.java | 2 +- .../renderers/CapabilityStatementRenderer.java | 16 ++++++++-------- .../fhir/r5/renderers/CodeSystemRenderer.java | 8 ++++---- .../fhir/r5/renderers/ConceptMapRenderer.java | 6 +++--- .../r5/renderers/DiagnosticReportRenderer.java | 4 ++-- .../r5/renderers/ExampleScenarioRenderer.java | 6 +++--- .../r5/renderers/FeatureDefinitionRenderer.java | 4 ++-- .../hl7/fhir/r5/renderers/LibraryRenderer.java | 6 +++--- .../org/hl7/fhir/r5/renderers/ListRenderer.java | 4 ++-- .../fhir/r5/renderers/NamingSystemRenderer.java | 4 ++-- .../renderers/OperationDefinitionRenderer.java | 2 +- .../r5/renderers/OperationOutcomeRenderer.java | 2 +- .../fhir/r5/renderers/ParametersRenderer.java | 2 +- .../hl7/fhir/r5/renderers/PatientRenderer.java | 6 +++--- .../fhir/r5/renderers/ProvenanceRenderer.java | 4 ++-- .../fhir/r5/renderers/QuestionnaireRenderer.java | 2 +- .../fhir/r5/renderers/RequirementsRenderer.java | 2 +- .../hl7/fhir/r5/renderers/ResourceRenderer.java | 6 +++--- .../r5/renderers/SearchParameterRenderer.java | 4 ++-- .../r5/renderers/SubscriptionTopicRenderer.java | 2 +- .../hl7/fhir/r5/renderers/TestPlanRenderer.java | 10 +++++----- .../r5/renderers/ViewDefinitionRenderer.java | 4 ++-- .../xhtml/HierarchicalTableGenerator.java | 2 +- .../hl7/fhir/utilities/xhtml/XhtmlFluent.java | 9 ++++++++- 27 files changed, 66 insertions(+), 59 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ResourceComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ResourceComparer.java index 2a323a142b..015642549c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ResourceComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ResourceComparer.java @@ -252,7 +252,7 @@ public Cell missingCell(HierarchicalTableGenerator gen, String color) { public XhtmlNode renderErrors(ResourceComparison csc) { XhtmlNode div = new XhtmlNode(NodeType.Element, "div"); - XhtmlNode tbl = div.table("grid"); + XhtmlNode tbl = div.table("grid", false); for (ValidationMessage vm : csc.messages) { XhtmlNode tr = tbl.tr(); tr.style("background-color: "+colorForLevel(vm.getLevel())); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSBuilder.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSBuilder.java index 67ff07ac68..d8515d82f4 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSBuilder.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSBuilder.java @@ -102,7 +102,7 @@ private static void addMedications(Bundle bnd, Composition cmp, FHIRToolingClien sct.getCode().addCoding().setSystem("http://loinc.org").setCode("10160-0"); sct.getText().setStatus(NarrativeStatus.GENERATED); var x = sct.getText().getDiv(); - var tbl = x.table("grid"); + var tbl = x.table("grid", false); var tr = tbl.tr(); tr.th().tx("Medication"); tr.th().tx("Category"); @@ -229,7 +229,7 @@ private static void addConditions(Bundle bnd, Composition cmp, FHIRToolingClient sct.getCode().addCoding().setSystem("http://loinc.org").setCode("11450-4"); sct.getText().setStatus(NarrativeStatus.GENERATED); var x = sct.getText().getDiv(); - var tbl = x.table("grid"); + var tbl = x.table("grid", false); var tr = tbl.tr(); tr.th().tx("Code"); tr.th().tx("Category"); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSRenderer.java index 823ae39992..ffbbbfeed2 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/ips/IPSRenderer.java @@ -63,7 +63,7 @@ public String render(Bundle document) throws IOException { private void generate(XhtmlNode x, Bundle document) { Composition cmp = (Composition) document.getEntryFirstRep().getResource(); int sectionDepth = findSectionDepth(cmp.getSection()); - XhtmlNode table = x.table("grid"); + XhtmlNode table = x.table("grid", false); // row 1: header XhtmlNode tr = table.tr(); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ActorDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ActorDefinitionRenderer.java index 4745b81aea..3120e75661 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ActorDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ActorDefinitionRenderer.java @@ -35,7 +35,7 @@ public String buildSummary(ResourceWrapper r) throws UnsupportedEncodingExceptio } public void render(RenderingStatus status, XhtmlNode x, ResourceWrapper acd) throws FHIRFormatError, DefinitionException, IOException { - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.ACTOR_DEF_ACT, context.getTranslated(acd.child("name"))) + " "); tr.td().tx(context.getTranslated(acd.child("title"))); 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 68148c9139..c1de54e435 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 @@ -652,7 +652,7 @@ private void addMessagingPanel(RenderingStatus status, ResourceWrapper res, Xhtm 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"); + table = body.table("table table-condensed table-hover", false); tr = table.addTag("thead").tr(); tr.th().addText("Protocol"); tr.th().addText("Address"); @@ -670,7 +670,7 @@ private void addMessagingPanel(RenderingStatus status, ResourceWrapper res, Xhtm 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"); + table = body.table("table table-condensed table-hover", false); tr = table.addTag("thead").tr(); tr.th().addText("Mode"); tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_DEFINITION)); @@ -697,7 +697,7 @@ private void addDocumentTable(RenderingStatus status, ResourceWrapper res, Xhtml XhtmlNode tbody; XhtmlNode tr; - table = x.table("table table-condensed table-hover"); + table = x.table("table table-condensed table-hover", false); tr = table.addTag("thead").tr(); tr.th().addText("Mode"); tr.th().addText(context.formatPhrase(RenderingContext.CAPABILITY_PROF_RES_DOC)); @@ -879,7 +879,7 @@ private void addSummaryIntro(XhtmlNode x) { } private void addSummaryTable(RenderingStatus status, ResourceWrapper res, XhtmlNode x, CapabilityStatement.CapabilityStatementRestComponent rest, boolean hasVRead, boolean hasPatch, boolean hasDelete, boolean hasHistory, boolean hasUpdates, int count) throws IOException { - XhtmlNode t = x.div().attribute("class","table-responsive").table("table table-condensed table-hover"); + XhtmlNode t = x.div().attribute("class","table-responsive").table("table table-condensed table-hover", false); XhtmlNode tr = t.addTag("thead").tr(); tr.th().b().tx(context.formatPhrase(RenderingContext.CAPABILITY_RES_TYP)); tr.th().b().tx(context.formatPhrase(RenderingContext.GENERAL_PROF)); @@ -986,7 +986,7 @@ private void renderSupportedProfiles(RenderingStatus status, ResourceWrapper res if (r.hasExtension(ToolingExtensions.EXT_PROFILE_MAPPING)) { profCell.br(); profCell.b().tx(context.formatPhrase(RenderingContext.CAPABILITY_PROF_MAP)); - XhtmlNode tbl = profCell.table("grid"); + XhtmlNode tbl = profCell.table("grid", false); boolean doco = false; for (Extension ext : r.getExtensionsByUrl(ToolingExtensions.EXT_PROFILE_MAPPING)) { doco = doco || ext.hasExtension("documentation"); @@ -1239,7 +1239,7 @@ private void addExtendedOperations(XhtmlNode body, ResourceOperations ops) { row = body.div().attribute("class", "row"); cell = row.div().attribute("class", "col-12"); addLead(cell, context.formatPhrase(RenderingContext.CAPABILITY_EXT_OP)); - table = cell.table("table table-condensed table-hover"); + table = cell.table("table table-condensed table-hover", false); tr = table.addTag("thead").tr(); tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_CONFORMANCE)); tr.th().addText(context.formatPhrase(RenderingContext.CAPABILITY_OPER)); @@ -1369,7 +1369,7 @@ private void addSearchParams(XhtmlNode body, ResourceSearchParams sParams) { row = body.div().attribute("class", "row"); cell = row.div().attribute("class", "col-lg-7"); addLead(cell, context.formatPhrase(RenderingContext.CAPABILITY_SEARCH_PARS)); - table = cell.table("table table-condensed table-hover"); + table = cell.table("table table-condensed table-hover", false); tr = table.addTag("thead").tr(); tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_CONFORMANCE)); tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_PAR)); @@ -1385,7 +1385,7 @@ private void addSearchParams(XhtmlNode body, ResourceSearchParams sParams) { cell = row.div().attribute("class", "col-lg-5"); if (!isCombinedEmpty(comboMap)) { addLead(cell, context.formatPhrase(RenderingContext.CAPABILITY_COMB_SEARCH_PAR)); - table = cell.table("table table-condensed table-hover"); + table = cell.table("table table-condensed table-hover", false); tr = table.addTag("thead").tr(); tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_CONFORMANCE)); tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_PARS)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java index 42e852683a..7decca4894 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java @@ -114,7 +114,7 @@ public String display(CodeSystem cs) { private void generateFilters(XhtmlNode x, CodeSystem cs) { if (cs.hasFilter()) { x.para().b().tx(formatPhrase(RenderingContext.CODESYSTEM_FILTERS)); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); tr.td().b().tx(formatPhrase(RenderingContext.GENERAL_CODE)); tr.td().b().tx(formatPhrase(RenderingContext.GENERAL_DESC)); @@ -145,7 +145,7 @@ private boolean generateProperties(XhtmlNode x, CodeSystem cs) { x.para().b().tx(formatPhrase(RenderingContext.GENERAL_PROPS)); x.para().b().tx(formatPhrase(RenderingContext.CODESYSTEM_PROPS_DESC)); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); if (hasRendered) { tr.td().b().tx(formatPhrase(RenderingContext.GENERAL_NAME)); @@ -224,7 +224,7 @@ private void generateCodeSystemContent(RenderingStatus status, XhtmlNode x, Code return; } - XhtmlNode t = x.table( "codes"); + XhtmlNode t = x.table( "codes", false); boolean definitions = false; boolean commentS = false; boolean deprecated = false; @@ -272,7 +272,7 @@ private void generateCodeSystemContent(RenderingStatus status, XhtmlNode x, Code if (langs.size() >= 2) { Collections.sort(langs); x.para().b().tx(context.formatPhrase(RenderingContext.GENERAL_ADD_LANG)); - t = x.table("codes"); + t = x.table("codes", false); XhtmlNode tr = t.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_CODE)); for (String lang : langs) 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 7faafba35e..078225dd77 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 @@ -406,7 +406,7 @@ public void render(RenderingStatus status, ResourceWrapper res, XhtmlNode x, Con String display; if (ok) { // simple - XhtmlNode tbl = x.table( "grid"); + XhtmlNode tbl = x.table( "grid", false); XhtmlNode tr = tbl.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.CONC_MAP_SOURCE)); tr.td().b().tx(context.formatPhrase(RenderingContext.CONC_MAP_REL)); @@ -456,7 +456,7 @@ public void render(RenderingStatus status, ResourceWrapper res, XhtmlNode x, Con } } - XhtmlNode tbl = x.table( "grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); XhtmlNode td; tr.td().colspan(Integer.toString(1+sources.size())).b().tx(context.formatPhrase(RenderingContext.CONC_MAP_SRC_DET)); @@ -743,7 +743,7 @@ public static XhtmlNode renderMultipleMaps(String start, List maps, Collections.sort(rowSets, new MultipleMappingRowSorter(advisor.sortPolicy(rmmContext) == RenderMultiRowSortPolicy.FIRST_COL)); } XhtmlNode div = new XhtmlNode(NodeType.Element, "div"); - XhtmlNode tbl = div.table("none").style("text-align: left; border-spacing: 0; padding: 5px"); + XhtmlNode tbl = div.table("none", false).style("text-align: left; border-spacing: 0; padding: 5px"); XhtmlNode tr = tbl.tr(); styleCell(tr.td(), false, true, 5).b().tx(start); for (ConceptMap map : maps) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java index c5a26bda6d..69a4fc42c5 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DiagnosticReportRenderer.java @@ -48,7 +48,7 @@ public void renderDiagnosticReport(RenderingStatus status, XhtmlNode x, Resource } h2.tx(") "); } - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr; if (dr.has("subject")) { tr = tbl.tr(); @@ -178,7 +178,7 @@ private List fetchObservations(List list) thro } private void buildObservationsTable(RenderingStatus status, XhtmlNode root, List observations, ResourceWrapper eff, ResourceWrapper iss) throws UnsupportedEncodingException, FHIRException, IOException { - XhtmlNode tbl = root.table("grid"); + XhtmlNode tbl = root.table("grid", false); boolean refRange = scanObsForRefRange(observations); boolean flags = scanObsForFlags(observations); boolean note = scanObsForNote(observations); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ExampleScenarioRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ExampleScenarioRenderer.java index e09d322fc0..55d1f05c7e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ExampleScenarioRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ExampleScenarioRenderer.java @@ -250,7 +250,7 @@ private String creolLink(String text, String url, String flyover) { } public boolean renderActors(RenderingStatus status, ResourceWrapper res, XhtmlNode x, ExampleScenario scen) throws IOException { - XhtmlNode tbl = x.table("table-striped table-bordered"); + XhtmlNode tbl = x.table("table-striped table-bordered", false); XhtmlNode thead = tbl.tr(); thead.th().addText(context.formatPhrase(RenderingContext.GENERAL_NAME)); thead.th().addText(context.formatPhrase(RenderingContext.GENERAL_TYPE)); @@ -267,7 +267,7 @@ public boolean renderActors(RenderingStatus status, ResourceWrapper res, XhtmlNo } public boolean renderInstances(RenderingStatus status, ResourceWrapper res, XhtmlNode x, ExampleScenario scen) throws IOException { - XhtmlNode tbl = x.table("table-striped table-bordered"); + XhtmlNode tbl = x.table("table-striped table-bordered", false); XhtmlNode thead = tbl.tr(); thead.th().addText(context.formatPhrase(RenderingContext.GENERAL_NAME)); thead.th().addText(context.formatPhrase(RenderingContext.GENERAL_TYPE)); @@ -398,7 +398,7 @@ public void renderProcess(RenderingStatus status, XhtmlNode x, ExampleScenarioPr div.para().b().i().tx(context.formatPhrase(RenderingContext.EX_SCEN_POSTCON)); addMarkdown(div, process.getPostConditions()); } - XhtmlNode tbl = div.table("table-striped table-bordered").style("width:100%"); + XhtmlNode tbl = div.table("table-striped table-bordered", false).style("width:100%"); XhtmlNode thead = tbl.tr(); thead.th().addText(context.formatPhrase(RenderingContext.EX_SCEN_STEP)); thead.th().addText(context.formatPhrase(RenderingContext.GENERAL_NAME)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/FeatureDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/FeatureDefinitionRenderer.java index 1e02e50840..807294ae76 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/FeatureDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/FeatureDefinitionRenderer.java @@ -54,7 +54,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper renderResourceTechDetails(fd, x); genSummaryTable(status, x, fd); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode td = tbl.tr().td(); td.tx("Feature "); @@ -93,7 +93,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper if (fd.has("qualifier")) { td.b().tx("Qualifiers"); - XhtmlNode tbl2 = td.table("lines"); + XhtmlNode tbl2 = td.table("lines", false); XhtmlNode tr = tbl2.tr(); tr.td().b().tx("Name"); tr.td().b().tx("Type"); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java index 1e0b027013..b235ee77c2 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java @@ -42,7 +42,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper boolean phone = hasCT(authors, "phone") || hasCT(editors, "phone") || hasCT(reviewers, "phone") || hasCT(endorsers, "phone"); boolean url = hasCT(authors, "url") || hasCT(editors, "url") || hasCT(reviewers, "url") || hasCT(endorsers, "url"); x.h2().tx(context.formatPhrase(RenderingContext.LIB_REND_PAR)); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); for (ResourceWrapper cd : authors) { participantRow(status, t, (context.formatPhrase(RenderingContext.LIB_REND_AUT)), cd, email, phone, url); } @@ -60,7 +60,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper List artifacts = lib.children("relatedArtifact"); if (!artifacts.isEmpty()) { x.h2().tx(context.formatPhrase(RenderingContext.LIB_REND_ART)); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); boolean label = false; boolean display = false; boolean citation = false; @@ -76,7 +76,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper List parameters = lib.children("parameter"); if (!parameters.isEmpty()) { x.h2().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); boolean doco = false; for (ResourceWrapper p : parameters) { doco = doco || p.has("documentation"); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ListRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ListRenderer.java index c957b99225..34a790523a 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ListRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ListRenderer.java @@ -33,7 +33,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper if (list.has("title")) { x.h2().tx(list.primitiveValue("title")); } - XhtmlNode t = x.table("clstu"); + XhtmlNode t = x.table("clstu", false); XhtmlNode tr = t.tr(); if (list.has("date")) { tr.td().tx(context.formatPhrase(RenderingContext.LIST_REND_DATE, displayDateTime(list.child("date")))+" "); @@ -75,7 +75,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper deleted = deleted || e.has("deleted"); date = date || e.has("date"); } - t = x.table("grid"); + t = x.table("grid", false); tr = t.tr().style("backgound-color: #eeeeee"); tr.td().b().tx(context.formatPhrase(RenderingContext.LIST_REND_ITEM)); if (date) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/NamingSystemRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/NamingSystemRenderer.java index 444a60ac98..318e2e81f4 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/NamingSystemRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/NamingSystemRenderer.java @@ -45,7 +45,7 @@ public String buildSummary(ResourceWrapper r) throws UnsupportedEncodingExceptio public void render(RenderingStatus status, XhtmlNode x, NamingSystem ns) throws FHIRFormatError, DefinitionException, IOException { x.h3().tx(context.formatPhrase(RenderingContext.GENERAL_SUMM)); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); row(tbl, (context.formatPhrase(RenderingContext.GENERAL_DEFINING_URL)), ns.getUrl()); if (ns.hasVersion()) { row(tbl, (context.formatPhrase(RenderingContext.GENERAL_VER)), ns.getVersion()); @@ -90,7 +90,7 @@ public void renderList(XhtmlNode x, List nsl) { } } x.h3().tx(context.formatPhrase(RenderingContext.NAME_SYS_IDEN)); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); tr.td().b().tx((context.formatPhrase(RenderingContext.GENERAL_TYPE))); tr.td().b().tx((context.formatPhrase(RenderingContext.GENERAL_VALUE))); 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 6d7a1563cd..b78db380f8 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 @@ -90,7 +90,7 @@ public void render(RenderingStatus status, XhtmlNode x, OperationDefinition opd) x.h3().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); //x.para().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); - XhtmlNode tbl = x.table( "grid"); + XhtmlNode tbl = x.table( "grid", false); XhtmlNode tr = tbl.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.OP_DEF_USE)); tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_NAME)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationOutcomeRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationOutcomeRenderer.java index 8e9e8ef6ba..b93665bf3b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationOutcomeRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationOutcomeRenderer.java @@ -66,7 +66,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper x.para().tx(context.formatPhrase(RenderingContext.OP_OUT_OK)); } if (op.has("issue")) { - XhtmlNode tbl = x.table("grid"); // on the basis that we'll most likely be rendered using the standard fhir css, but it doesn't really matter + XhtmlNode tbl = x.table("grid", false); // on the basis that we'll most likely be rendered using the standard fhir css, but it doesn't really matter XhtmlNode tr = tbl.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.OP_OUT_SEV)); tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_LOCATION)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java index 2d77121416..c8d1404a16 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java @@ -43,7 +43,7 @@ public ParametersRenderer setMultiLangMode(boolean multiLangMode) { public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome { renderResourceTechDetails(r, x); x.h2().tx(context.formatPhrase(RenderingContext.GENERAL_PARS)); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); params(status, tbl, r.children("parameter"), 0); } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java index 6d6e5b565a..b18aff4141 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java @@ -144,12 +144,12 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper x.hr(); XhtmlNode tbl; if (hasRenderablePhoto(pat)) { - tbl = x.table("none"); + tbl = x.table("none", true); XhtmlNode tr = tbl.tr(); - tbl = tr.td().table("grid"); + tbl = tr.td().table("grid", false); renderPhoto(tr.td(), pat); } else { - tbl = x.table("grid"); + tbl = x.table("grid", false); } // the table has 4 columns diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProvenanceRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProvenanceRenderer.java index 57b0074046..c75d6eb882 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProvenanceRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProvenanceRenderer.java @@ -43,7 +43,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper } // summary table x.para().tx(context.formatPhrase(RenderingContext.GENERAL_SUMM)); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); XhtmlNode tr; if (prv.has("occurred")) { tr = t.tr(); @@ -88,7 +88,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper hasOnBehalfOf = hasOnBehalfOf || a.has("onBehalfOf"); } x.para().b().tx(context.formatPhrase(RenderingContext.PROV_AGE)); - t = x.table("grid"); + t = x.table("grid", false); tr = t.tr(); if (hasType) { tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_TYPE)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java index 158f91ca77..64237da186 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java @@ -940,7 +940,7 @@ private void renderLinks(RenderingStatus status, XhtmlNode x, ResourceWrapper q) } private void renderDefns(RenderingStatus status, XhtmlNode x, ResourceWrapper q) throws IOException { - XhtmlNode tbl = x.table("dict"); + XhtmlNode tbl = x.table("dict", false); renderRootDefinition(status, tbl, q, new ArrayList<>()); for (ResourceWrapper qi : q.children("item")) { renderDefinition(status, tbl, q, qi, new ArrayList<>()); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RequirementsRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RequirementsRenderer.java index 0dfed74f5b..e7c8ddb50a 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RequirementsRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RequirementsRenderer.java @@ -80,7 +80,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper p.ah(context.prefixLocalHref(c.primitiveValue())).tx(url); } } - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); for (ResourceWrapper stmt : req.children("statement")) { XhtmlNode tr = tbl.tr(); 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 baeb6c4c7b..b4838142b0 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 @@ -1076,7 +1076,7 @@ public void renderTable(RenderingStatus status, TableData provider, XhtmlNode x) } } if (columns.size() > 0) { - XhtmlNode table = x.table("grid"); + XhtmlNode table = x.table("grid", false); if (provider.getTitle() != null) { table.tr().td().colspan(columns.size()).b().tx(provider.getTitle()); @@ -1115,7 +1115,7 @@ public void renderOrError(ResourceWrapper dr) throws IOException { public void genSummaryTable(RenderingStatus status, XhtmlNode x, ResourceWrapper cr) throws IOException { if (context.isShowSummaryTable() && cr != null) { - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); genSummaryTableContent(status, tbl, cr); } } @@ -1207,7 +1207,7 @@ protected void genSummaryTableContent(RenderingStatus status, XhtmlNode tbl, Res public void genSummaryTable(RenderingStatus status, XhtmlNode x, CanonicalResource cr) throws IOException { if (context.isShowSummaryTable() && cr != null) { - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); genSummaryTableContent(status, tbl, cr); } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java index 698f627600..95b069233e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java @@ -66,7 +66,7 @@ public void render(RenderingStatus status, XhtmlNode x, SearchParameter spd) thr p.code().tx(spd.getType().toCode()); addMarkdown(x, spd.getDescription()); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); tr.td().tx(Utilities.pluralize(context.formatPhrase(RenderingContext.GENERAL_RESOURCE), spd.getBase().size())); XhtmlNode td = tr.td(); @@ -162,7 +162,7 @@ public void render(RenderingStatus status, XhtmlNode x, SearchParameter spd) thr if (spd.hasComponent()) { x.para().b().tx(context.formatPhrase(RenderingContext.GENERAL_COMPARATORS)); - tbl = x.table("grid"); + tbl = x.table("grid", false); for (SearchParameterComponentComponent t : spd.getComponent()) { tr = tbl.tr(); SearchParameter tsp = context.getWorker().fetchResource(SearchParameter.class, t.getDefinition(), spd); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SubscriptionTopicRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SubscriptionTopicRenderer.java index 73d9265ad2..fd386f2a97 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SubscriptionTopicRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SubscriptionTopicRenderer.java @@ -29,7 +29,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper renderResourceTechDetails(st, x); genSummaryTable(status, x, (CanonicalResource) st.getResourceNative()); - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode ttr = tbl.tr(); ttr.td().b().tx("SubscriptionTopic"); ttr.td().tx(context.getTranslated(st.has("title") ? st.child("title") : st.child("name"))); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TestPlanRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TestPlanRenderer.java index 4a348a7986..ea94986270 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TestPlanRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TestPlanRenderer.java @@ -89,7 +89,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper ResourceWrapper dep = deps.get(0); p = x.para(); p.b().tx(context.formatPhrase(RenderingContext.TEST_PLAN_DEP)+" "); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); XhtmlNode tr = t.tr(); if (!Utilities.noString(dep.primitiveValue("description"))) { addMarkdown(tr.td(), dep.primitiveValue("description")); @@ -144,7 +144,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper if (deps.size() == 1) { ResourceWrapper dep = deps.get(0); x.h3().addText(context.formatPhrase(RenderingContext.TEST_PLAN_DEP)); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); XhtmlNode tr = t.tr(); if (!Utilities.noString(dep.primitiveValue("description"))) { addMarkdown(tr.td(), dep.primitiveValue("description")); @@ -230,7 +230,7 @@ private void renderTestRun(RenderingStatus status, XhtmlNode x, ResourceWrapper if (trun.has("script")) { ResourceWrapper script = trun.child("script"); - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); XhtmlNode tr = t.tr(); tr.td().b().addText(context.formatPhrase(RenderingContext.TEST_PLAN_LANG)); tr.td().b().addText(context.formatPhrase(RenderingContext.TEST_PLAN_SOURCE)); @@ -249,7 +249,7 @@ private void renderTestRun(RenderingStatus status, XhtmlNode x, ResourceWrapper } private void renderTestData(RenderingStatus status, XhtmlNode x, ResourceWrapper tp, ResourceWrapper tdata) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome { - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); XhtmlNode tr = t.tr(); tr.td().b().addText(context.formatPhrase(RenderingContext.GENERAL_TYPE)); tr.td().b().addText(context.formatPhrase(RenderingContext.GENERAL_CONTENT)); @@ -275,7 +275,7 @@ private void renderTestData(RenderingStatus status, XhtmlNode x, ResourceWrapper } private void renderAssertion(RenderingStatus status, XhtmlNode x, ResourceWrapper tp, ResourceWrapper as) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome { - XhtmlNode t = x.table("grid"); + XhtmlNode t = x.table("grid", false); XhtmlNode tr = t.tr(); tr.td().b().addText(context.formatPhrase(RenderingContext.GENERAL_TYPE)); tr.td().b().addText(context.formatPhrase(RenderingContext.GENERAL_CONTENT)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ViewDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ViewDefinitionRenderer.java index 2d00a815ec..64daee50a9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ViewDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ViewDefinitionRenderer.java @@ -109,7 +109,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper hasNotes = hasNotes || !Utilities.noString(col.getNotes()); } - XhtmlNode t2 = x.table("grid"); + XhtmlNode t2 = x.table("grid", false); XhtmlNode tr = t2.tr(); tr.th().tx("Name"); tr.th().tx("Fhir Type"); @@ -133,7 +133,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper if (vd.has("constant")) { x.para().tx("Constants:"); - XhtmlNode t2 = x.table("grid"); + XhtmlNode t2 = x.table("grid", false); XhtmlNode tr = t2.tr(); tr.th().tx("Name"); tr.th().tx("Value"); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java index 944de16a96..0fd71a041e 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java @@ -932,7 +932,7 @@ private XhtmlNode renderCell(XhtmlNode tr, Cell c, String name, String icon, Str XhtmlNode itc = tc; XhtmlNode itr = null; if (c.innerTable) { - itr = tc.table("none").tr(); + itr = tc.table("none", true).tr(); itc = itr.td(); } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlFluent.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlFluent.java index 30a5b036e1..e61cbff99b 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlFluent.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlFluent.java @@ -51,11 +51,18 @@ public XhtmlNode h3() { public XhtmlNode h4() { return addTag("h4"); } - + public XhtmlNode table(String clss) { + return table(clss, false); + } + + public XhtmlNode table(String clss, boolean forPresentation) { XhtmlNode res = addTag("table"); if (!Utilities.noString(clss)) res.setAttribute("class", clss); + if (forPresentation) { + res.setAttribute("role", "presentation"); + } return res; } From c36038cd3f4b816601c4a6d4dbaf8615036f105b Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 7 Jan 2025 14:08:35 +1100 Subject: [PATCH 2/4] Update SNOMED editions related routines (add more editions) --- .../hl7/fhir/r5/renderers/DataRenderer.java | 26 +++++++-- .../fhir/r5/renderers/ValueSetRenderer.java | 55 ++++++++++++------- .../utilities/SnomedUtilities.java | 7 ++- 3 files changed, 60 insertions(+), 28 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java index e86f381a93..f06ffb851e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java @@ -220,13 +220,29 @@ public static String describeVersion(String version) { case "900000000000207008": return "Intl"+dt; case "731000124108": return "US"+dt; case "32506021000036107": return "AU"+dt; - case "449081005": return "ES"+dt; + case "449081005": return "ES/Intl"+dt; case "554471000005108": return "DK"+dt; case "11000146104": return "NL"+dt; case "45991000052106": return "SE"+dt; - case "999000041000000102": return "UK"+dt; - case "20611000087101": return "CA"+dt; + case "83821000000107": return "UK"+dt; case "11000172109": return "BE"+dt; + case "11000221109" : return "AR"+dt; + case "11000234105" : return "AT"+dt; + case "20621000087109" : return "CA-EN"+dt; + case "20611000087101" : return "CA-FR"+dt; + case "11000181102 " : return "EE"+dt; + case "11000229106" : return "FI"+dt; + case "11000274103" : return "DE"+dt; + case "1121000189102" : return "IN"+dt; + case "11000220105" : return "IE"+dt; + case "21000210109" : return "NZ"+dt; + case "51000202101 " : return "NO"+dt; + case "11000267109" : return "KR"+dt; + case "900000001000122104" : return "ES-ES"+dt; + case "2011000195101" : return "CH"+dt; + case "999000021000000109" : return "UK+Clinical"+dt; + case "5631000179106" : return "UY"+dt; + case "5991000124107" : return "US+ICD10CM"+dt; default: return "??"+dt; } } else { @@ -1946,7 +1962,7 @@ public void renderTriggerDefinition(RenderingStatus status, XhtmlNode x, Resourc renderExpression(status, x, td.child("condition")); } } else { - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_TYPE)); @@ -1976,7 +1992,7 @@ public void renderTriggerDefinition(RenderingStatus status, XhtmlNode x, Resourc } public void renderDataRequirement(RenderingStatus status, XhtmlNode x, ResourceWrapper dr) throws FHIRFormatError, DefinitionException, IOException { - XhtmlNode tbl = x.table("grid"); + XhtmlNode tbl = x.table("grid", false); XhtmlNode tr = tbl.tr(); XhtmlNode td = tr.td().colspan("2"); td.b().tx(context.formatPhrase(RenderingContext.GENERAL_TYPE)); 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 05d5b912da..e525538f0f 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 @@ -254,7 +254,7 @@ private void generateExpansion(RenderingStatus status, ResourceWrapper res, Xhtm boolean doInactive = checkDoInactive(vs.getExpansion().getContains()); boolean doDefinition = checkDoDefinition(vs.getExpansion().getContains()); - XhtmlNode t = x.table( "codes"); + XhtmlNode t = x.table("codes", false); XhtmlNode tr = t.tr(); if (doLevel) tr.td().b().tx(context.formatPhrase(RenderingContext.VALUE_SET_LEVEL)); @@ -313,7 +313,7 @@ private void generateExpansion(RenderingStatus status, ResourceWrapper res, Xhtm } else { x.para().b().tx(context.formatPhrase(RenderingContext.VALUE_SET_ADD_DESIG)); } - t = x.table("codes"); + t = x.table("codes", false); tr = t.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_CODE)); for (String url : designations.keySet()) { @@ -630,23 +630,36 @@ private String formatSCTDate(String ds) { } private String describeModule(String module) { - if ("900000000000207008".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_INT); - if ("731000124108".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_US); - if ("32506021000036107".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_AUS); - if ("449081005".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_SPAN); - if ("554471000005108".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_DANISH); - if ("11000146104".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_DUTCH); - if ("45991000052106".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_SWEDISH); - if ("999000041000000102".equals(module)) - return context.formatPhrase(RenderingContext.VALUE_SET_UK); - return module; + switch (module) { + case "900000000000207008" : context.formatPhrase(RenderingContext.VALUE_SET_INT); + case "449081005" : context.formatPhrase(RenderingContext.VALUE_SET_SPAN); + case "11000221109" : context.formatPhrase(RenderingContext.VALUE_SET_AR); + case "32506021000036107" : context.formatPhrase(RenderingContext.VALUE_SET_AUS); + case "11000234105" : context.formatPhrase(RenderingContext.VALUE_SET_AT); + case "11000172109" : context.formatPhrase(RenderingContext.VALUE_SET_BE); + case "20621000087109" : context.formatPhrase(RenderingContext.VALUE_SET_CA_EN); + case "20611000087101" : context.formatPhrase(RenderingContext.VALUE_SET_CA_FR); + case "554471000005108" : context.formatPhrase(RenderingContext.VALUE_SET_DANISH); + case "11000181102 " : context.formatPhrase(RenderingContext.VALUE_SET_EE); + case "11000229106" : context.formatPhrase(RenderingContext.VALUE_SET_FI); + case "11000274103" : context.formatPhrase(RenderingContext.VALUE_SET_DE); + case "1121000189102" : context.formatPhrase(RenderingContext.VALUE_SET_IN); + case "11000220105" : context.formatPhrase(RenderingContext.VALUE_SET_IE); + case "11000146104" : context.formatPhrase(RenderingContext.VALUE_SET_DUTCH); + case "21000210109" : context.formatPhrase(RenderingContext.VALUE_SET_NZ); + case "51000202101 " : context.formatPhrase(RenderingContext.VALUE_SET_NO); + case "11000267109" : context.formatPhrase(RenderingContext.VALUE_SET_KR); + case "900000001000122104" : context.formatPhrase(RenderingContext.VALUE_ES_ES); + case "45991000052106" : context.formatPhrase(RenderingContext.VALUE_SET_SWEDISH); + case "2011000195101" : context.formatPhrase(RenderingContext.VALUE_SET_CH); + case "83821000000107" : context.formatPhrase(RenderingContext.VALUE_SET_UK); + case "999000021000000109" : context.formatPhrase(RenderingContext.VALUE_SET_UK_CLIN); + case "5631000179106" : context.formatPhrase(RenderingContext.VALUE_SET_UY); + case "731000124108" : context.formatPhrase(RenderingContext.VALUE_SET_US); + case "5991000124107" : context.formatPhrase(RenderingContext.VALUE_SET_US_ICD10CM); + default: + return module; + } } private boolean hasVersionParameter(ValueSetExpansionComponent expansion) { @@ -1001,7 +1014,7 @@ private void generateComposition(RenderingStatus status, ResourceWrapper res, Xh } else { x.para().b().tx(context.formatPhrase(RenderingContext.VALUE_SET_ADD_DESIG)); } - XhtmlNode t = x.table("codes"); + XhtmlNode t = x.table("codes", false); XhtmlNode tr = t.tr(); tr.td().b().tx(context.formatPhrase(RenderingContext.GENERAL_CODE)); for (String url : designations.keySet()) { @@ -1194,7 +1207,7 @@ private void genInclude(RenderingStatus status, XhtmlNode ul, ConceptSetComponen definitions = getConceptsForCodes(e, inc, vsRes, index); - XhtmlNode t = li.table("none"); + XhtmlNode t = li.table("none", false); boolean hasComments = false; boolean hasDefinition = false; for (ConceptReferenceComponent c : inc.getConcept()) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/utilities/SnomedUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/utilities/SnomedUtilities.java index 07f009626c..f71b556c41 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/utilities/SnomedUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/utilities/SnomedUtilities.java @@ -45,8 +45,11 @@ public static String getEditionFromVersion(String version) { if (version.contains("/")) { version = version.substring(0, version.indexOf("/")); } - if (Utilities.existsInList(version, "900000000000207008", "731000124108", "32506021000036107", "11000172109", "20611000087101", - "449081005", "554471000005108", "11000146104", "45991000052106", "2011000195101", "83821000000107", "827022005")) { + if (Utilities.existsInList(version, "900000000000207008", "449081005", "11000221109", "32506021000036107", "11000234105", "11000172109", + "20621000087109", "20611000087101", "554471000005108", "11000181102", "11000229106", + "11000274103", "1121000189102", "11000220105", "11000146104", "21000210109", "51000202101", + "11000267109", "900000001000122104", "45991000052106", "2011000195101", "83821000000107", + "999000021000000109", "5631000179106", "731000124108", "599100012410")) { return version; } else { return null; From 4ccaae1571e14f61c8b5955cf2160e47a0736a94 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 7 Jan 2025 14:09:52 +1100 Subject: [PATCH 3/4] Lookup compliesWithProfile target from link-only dependencies --- .../StructureDefinitionRenderer.java | 17 ++++++++----- .../r5/renderers/utils/RenderingContext.java | 25 +++++++++++++++++++ .../utilities/i18n/RenderingI18nContext.java | 17 +++++++++++++ .../resources/rendering-phrases.properties | 22 ++++++++++++++++ .../fhir/validation/cli/model/CliContext.java | 24 ++++++++++++++++-- 5 files changed, 97 insertions(+), 8 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java index f273cfe528..76a69e7f0a 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java @@ -126,7 +126,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper StructureDefinition sd = (StructureDefinition) r.getBase(); genSummaryTable(status, x, sd); if (context.getStructureMode() == StructureDefinitionRendererMode.DATA_DICT) { - renderDict(status, sd, sd.getDifferential().getElement(), x.table("dict"), false, GEN_MODE_DIFF, "", r); + renderDict(status, sd, sd.getDifferential().getElement(), x.table("dict", false), false, GEN_MODE_DIFF, "", r); } else { x.addChildNode(generateTable(status, context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false, context.getLink(KnownLinkType.SPEC), "", sd.getKind() == StructureDefinitionKind.LOGICAL, false, null, false, context.withUniqueLocalPrefix(null), "r", r)); @@ -1851,7 +1851,7 @@ private void getAncestorElements(StructureDefinition profile, List list, String start, boolean bold) { + private void addCanonicalListExt(HierarchicalTableGenerator gen, Cell c, List list, String start, boolean bold) throws IOException { List clist = new ArrayList<>(); for (Extension ext : list) { if (ext.hasValueCanonicalType()) { @@ -1861,7 +1861,7 @@ private void addCanonicalListExt(HierarchicalTableGenerator gen, Cell c, List list, String start, boolean bold) { + private void addCanonicalList(HierarchicalTableGenerator gen, Cell c, List list, String start, boolean bold) throws IOException { if (!list.isEmpty()) { if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } @@ -1880,6 +1880,9 @@ private void addCanonicalList(HierarchicalTableGenerator gen, Cell c, List T findLinkableResource(Class class_, String uri) throws IOException; + } + public static class RenderingContextLangs { private RenderingContext defLangRC; @@ -297,6 +303,7 @@ public enum MultiLanguagePolicy { private String uniqueLocalPrefix; private Set anchors = new HashSet<>(); private boolean unknownLocalReferencesNotLinks; + private IResourceLinkResolver resolveLinkResolver; /** * @@ -366,6 +373,7 @@ public RenderingContext copy(boolean copyAnchors) { res.anchors = anchors; } res.unknownLocalReferencesNotLinks = unknownLocalReferencesNotLinks; + res.resolveLinkResolver = resolveLinkResolver; return res; } @@ -1058,4 +1066,21 @@ public boolean isUnknownLocalReferencesNotLinks() { public void setUnknownLocalReferencesNotLinks(boolean unknownLocalReferencesNotLinks) { this.unknownLocalReferencesNotLinks = unknownLocalReferencesNotLinks; } + + public T findLinkableResource(Class class_, String uri) throws IOException { + if (resolveLinkResolver == null) { + return null; + } else { + return resolveLinkResolver.findLinkableResource(class_, uri); + } + } + + public IResourceLinkResolver getResolveLinkResolver() { + return resolveLinkResolver; + } + + public void setResolveLinkResolver(IResourceLinkResolver resolveLinkResolver) { + this.resolveLinkResolver = resolveLinkResolver; + } + } \ No newline at end of file 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 4b054001dd..8d6c27d382 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 @@ -906,6 +906,23 @@ public class RenderingI18nContext extends I18nBase { public static final String VALUE_SET_USED_ELSEWHERE = "VALUE_SET_USED_ELSEWHERE"; public static final String VALUE_SET_WHERE = "VALUE_SET_WHERE"; public static final String VALUE_SET_WHERE_CODES = "VALUE_SET_WHERE_CODES"; + public static final String VALUE_SET_AR = "VALUE_SET_AR"; + public static final String VALUE_SET_AT = "VALUE_SET_AT"; + public static final String VALUE_SET_BE = "VALUE_SET_BE"; + public static final String VALUE_SET_CA_EN = "VALUE_SET_CA_EN"; + public static final String VALUE_SET_CA_FR = "VALUE_SET_CA_FR"; + public static final String VALUE_SET_EE = "VALUE_SET_EE"; + public static final String VALUE_SET_FI = "VALUE_SET_FI"; + public static final String VALUE_SET_DE = "VALUE_SET_DE"; + public static final String VALUE_SET_IE = "VALUE_SET_IE"; + public static final String VALUE_SET_NZ = "VALUE_SET_NZ"; + public static final String VALUE_SET_NO = "VALUE_SET_NO"; + public static final String VALUE_SET_KR = "VALUE_SET_KR"; + public static final String VALUE_ES_ES = "VALUE_ES_ES"; + public static final String VALUE_SET_CH = "VALUE_SET_CH"; + public static final String VALUE_SET_UK_CLIN = "VALUE_SET_UK_CLIN"; + public static final String VALUE_SET_UY = "VALUE_SET_UY"; + public static final String VALUE_SET_US_ICD10CM = "VALUE_SET_US_ICD10CM"; public static final String VS_ABSTRACT_CODE_HINT = "VS_ABSTRACT_CODE_HINT"; public static final String GENERAL_CODE = "GENERAL_CODE"; public static final String GENERAL_DESC = "GENERAL_DESC"; 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 cfb7839b17..decd77d61c 100644 --- a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties @@ -947,3 +947,25 @@ DATA_REND_EVENING_LATE = Late Evening DATA_REND_NIGHT = Night DATA_REND_AFTER_SLEEP = After Sleep DATA_REND_IMMEDIATE = Immediate +VALUE_SET_AR = Argentinian Edition +VALUE_SET_AT = Austrian Edition +VALUE_SET_BE = Belgian Edition +VALUE_SET_CA_EN = Canadian English Edition +VALUE_SET_CA_FR = Canadian Canadian French Edition +VALUE_SET_EE = Estonian Edition +VALUE_SET_FI = Finnish Edition +VALUE_SET_DE = German Edition +VALUE_SET_IE = Irish Edition +VALUE_SET_NZ = New Zealand Edition +VALUE_SET_NO = Norwegian Edition +VALUE_SET_KR = Republic of Korea Edition (South Korea) +VALUE_ES_ES = Spanish National Edition +VALUE_SET_CH = Swiss Edition +VALUE_SET_UK_CLIN = UK Clinical Edition +VALUE_SET_UY = Uruguay Edition +VALUE_SET_US_ICD10CM = US Edition (with ICD-10-CM maps) + + + + + \ No newline at end of file diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java index f583ea17e7..57100e9578 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java @@ -878,13 +878,33 @@ public CliContext setFhirpath(String fhirpath) { public String getSnomedCTCode() { if ("intl".equals(snomedCT)) return "900000000000207008"; if ("us".equals(snomedCT)) return "731000124108"; - if ("uk".equals(snomedCT)) return "999000041000000102"; + if ("us+icd10cm".equals(snomedCT)) return "5991000124107"; + if ("uk/clinical".equals(snomedCT)) return "999000021000000109"; + if ("uk".equals(snomedCT)) return "83821000000107"; if ("au".equals(snomedCT)) return "32506021000036107"; - if ("ca".equals(snomedCT)) return "20611000087101"; + if ("at".equals(snomedCT)) return "11000234105"; + if ("ca".equals(snomedCT)) return "20621000087109"; + if ("ca-en".equals(snomedCT)) return "20621000087109"; + if ("ca-fr".equals(snomedCT)) return "20611000087101"; if ("nl".equals(snomedCT)) return "11000146104"; if ("se".equals(snomedCT)) return "45991000052106"; if ("es".equals(snomedCT)) return "449081005"; + if ("es-ES".equals(snomedCT)) return "900000001000122104"; + if ("ar".equals(snomedCT)) return "11000221109"; if ("dk".equals(snomedCT)) return "554471000005108"; + if ("be".equals(snomedCT)) return "11000172109"; + if ("ee".equals(snomedCT)) return "11000181102"; + if ("fi".equals(snomedCT)) return "11000229106"; + if ("de".equals(snomedCT)) return "11000274103"; + if ("in".equals(snomedCT)) return "1121000189102"; + if ("ie".equals(snomedCT)) return "11000220105"; + if ("nl".equals(snomedCT)) return "11000146104"; + if ("nz".equals(snomedCT)) return "21000210109"; + if ("no".equals(snomedCT)) return "51000202101"; + if ("kr".equals(snomedCT)) return "11000267109"; + if ("se".equals(snomedCT)) return "45991000052106"; + if ("ch".equals(snomedCT)) return "2011000195101"; + if ("uy".equals(snomedCT)) return "5631000179106"; return snomedCT; } From 63e2ca36da674d759755d92915560dcd84a88127 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 7 Jan 2025 14:10:27 +1100 Subject: [PATCH 4/4] Validate earliestAllowed and latestAllowed FHIRVersion for extensions --- .../org/hl7/fhir/r5/utils/ToolingExtensions.java | 2 ++ .../org/hl7/fhir/utilities/VersionUtilities.java | 4 +++- .../hl7/fhir/utilities/i18n/I18nConstants.java | 2 ++ .../src/main/resources/Messages.properties | 5 +++-- .../validation/instance/InstanceValidator.java | 14 ++++++++++++++ .../fhir/validation/tests/ValidationTests.java | 16 ++++++++++++++++ 6 files changed, 40 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java index 377e1a4bd7..4411048752 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java @@ -281,6 +281,8 @@ public class ToolingExtensions { public static final String EXT_SUPPRESS_RESOURCE_TYPE = "http://hl7.org/fhir/tools/StructureDefinition/json-suppress-resourcetype"; public static final String EXT_PROFILE_VIEW_HINT = "http://hl7.org/fhir/tools/StructureDefinition/view-hint"; public static final String EXT_SNAPSHOT_BEHAVIOR = "http://hl7.org/fhir/tools/StructureDefinition/snapshot-behavior"; + public static final String EXT_EARLIEST_FHIR_VERSION = "http://hl7.org/fhir/StructureDefinition/earliestAllowedFHIRVersion"; + public static final String EXT_LATEST_FHIR_VERSION = "http://hl7.org/fhir/StructureDefinition/latestAllowedFHIRVersion"; // specific extension helpers diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java index c30e0674bf..aa013aa0a6 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java @@ -87,6 +87,8 @@ private int compareString(String s1, String s2) { private int compareInteger(String s1, String s2) { if (s1 == null) { return s2 == null ? 0 : 1; + } else if (s2 == null) { + return -1; } else { return Integer.compare(Integer.parseInt(s1), Integer.parseInt(s2)); } @@ -329,7 +331,7 @@ public static boolean isSemVer(String version) { if (Utilities.noString(version)) { return false; } - return version.matches("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-\\+]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-\\+][0-9a-zA-Z-\\+]*))*))?$"); + return version.matches("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-\\+]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-\\+][0-9a-zA-Z-\\+]*))*))?)?$"); } /** diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java index 894a4638c0..7b00f01d4b 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java @@ -1165,4 +1165,6 @@ public class I18nConstants { public static final String NO_VALID_DISPLAY_FOUND_NONE_FOR_LANG_ERR = "NO_VALID_DISPLAY_FOUND_NONE_FOR_LANG_ERR"; public static final String CONCEPTMAP_VS_NOT_A_VS = "CONCEPTMAP_VS_NOT_A_VS"; public static final String SD_DERIVATION_NO_CONCRETE = "SD_DERIVATION_NO_CONCRETE"; + public static final String EXTENSION_FHIR_VERSION_EARLIEST = "EXTENSION_FHIR_VERSION_EARLIEST"; + public static final String EXTENSION_FHIR_VERSION_LATEST = "EXTENSION_FHIR_VERSION_LATEST"; } diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index e350e1a4bb..36402fd834 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -1197,5 +1197,6 @@ VS_EXP_IMPORT_ERROR_X = Unable to expand excluded value set ''{0}'', but no erro VS_EXP_IMPORT_ERROR_TOO_COSTLY = Unable to expand excluded value set ''{0}'': too costly VS_EXP_FILTER_UNK = ValueSet ''{0}'' Filter by property ''{1}'' and op ''{2}'' is not supported yet CONCEPTMAP_VS_NOT_A_VS = Reference must be to a ValueSet, but found a {0} instead -SD_DERIVATION_NO_CONCRETE = {0} is labeled as an abstract type, but no concrete descendents were found (check definitions - this is usually an error unless concrete definitions are in some other package) - \ No newline at end of file +SD_DERIVATION_NO_CONCRETE = {0} is labeled as an abstract type, but no concrete descendants were found (check definitions - this is usually an error unless concrete definitions are in some other package) +EXTENSION_FHIR_VERSION_EARLIEST = The definition of the extension ''{0}'' specifies that the earliest version it can be used with is {1} (v{2}), but this context of use is version {3} (v{4}) +EXTENSION_FHIR_VERSION_LATEST = The definition of the extension ''{0}'' specifies that the latest version it can be used with is {1} (v{2}), but this context of use is version {3} (v{4}) \ No newline at end of file diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index f84957a41a..92df9b87ae 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -2536,6 +2536,20 @@ private boolean checkExtensionContext(Object appContext, List } Collections.sort(plist); // logical paths are a set, but we want a predictable order for error messages + if (definition.hasExtension(ToolingExtensions.EXT_EARLIEST_FHIR_VERSION) || definition.hasExtension(ToolingExtensions.EXT_LATEST_FHIR_VERSION)) { + if (definition.hasExtension(ToolingExtensions.EXT_EARLIEST_FHIR_VERSION)) { + String v = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_EARLIEST_FHIR_VERSION); + ok = rule(errors, "2025-01-07", IssueType.BUSINESSRULE, container.line(), container.col(), stack.getLiteralPath(), + VersionUtilities.compareVersions(VersionUtilities.getMajMin(context.getVersion()), v) >= 0, + I18nConstants.EXTENSION_FHIR_VERSION_EARLIEST, extUrl, VersionUtilities.getNameForVersion(v), v, VersionUtilities.getNameForVersion(context.getVersion()), context.getVersion()) && ok; + } + if (definition.hasExtension(ToolingExtensions.EXT_LATEST_FHIR_VERSION)) { + String v = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_LATEST_FHIR_VERSION); + ok = rule(errors, "2025-01-07", IssueType.BUSINESSRULE, container.line(), container.col(), stack.getLiteralPath(), + VersionUtilities.compareVersions(VersionUtilities.getMajMin(context.getVersion()), v) <= 0, + I18nConstants.EXTENSION_FHIR_VERSION_LATEST, extUrl, VersionUtilities.getNameForVersion(v), v, VersionUtilities.getNameForVersion(context.getVersion()), context.getVersion()) && ok; + } + } for (StructureDefinitionContextComponent ctxt : fixContexts(extUrl, definition.getContext())) { if (ok) { break; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java index 1ba16e3e08..2ff1884ab7 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java @@ -298,6 +298,18 @@ public void test() throws Exception { } } } + if (content.has("supporting5")) { + for (JsonElement e : content.getAsJsonArray("supporting5")) { + String filename = e.getAsString(); + String contents = TestingUtilities.loadTestResource("validator", filename); + CanonicalResource mr = (CanonicalResource) loadResource(filename, contents, "5.0.0"); + logOutput("load resource "+mr.getUrl()); + val.getContext().cacheResource(mr); + if (mr instanceof ImplementationGuide) { + val.getImplementationGuides().add((ImplementationGuide) mr); + } + } + } val.getBundleValidationRules().clear(); if (content.has("bundle-param")) { val.getBundleValidationRules().add(new BundleValidationRule().setRule(content.getAsJsonObject("bundle-param").get("rule").getAsString()).setProfile( content.getAsJsonObject("bundle-param").get("profile").getAsString())); @@ -520,6 +532,10 @@ public StructureDefinition loadProfile(String filename, String contents, List