Skip to content

Commit

Permalink
Merge pull request #1875 from hapifhir/2025-01-gg-more-validation
Browse files Browse the repository at this point in the history
2025 01 gg more validation
  • Loading branch information
grahamegrieve authored Jan 9, 2025
2 parents e5ea0fd + 0f13f50 commit 6ae85ee
Show file tree
Hide file tree
Showing 55 changed files with 669 additions and 237 deletions.
17 changes: 15 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
## Validator Changes

* no changes
* Do not create issue about draft dependency for example bindings
* Beef up validation of CodeSystem properties that are codes
* Make sure all validation messages have a message id
* Validator enforce version-set-specific value for Extension and Extension context
* Specific Error when ValueSet.compose.include.system refers to a ValueSet

## Other code changes

* no changes
* Report count of tests in output from TxTester
* resolve issues with references between IGs to example resources
* Lookup compliesWithProfile target from link-only dependencies
* Update SNOMED editions related routines (add more editions)
* Accessibility - role=presentation on appropriate tables
* Add support for ADL in packages
* Support for Archetype processing in IG publisher
* Lazy load binaries for reduced memory usage


Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1145,12 +1145,12 @@ public List<Element> getExtensions(String url) {
return list;
}

public Base getExtensionValue(String url) {
public Base getExtensionValue(String... url) {
if (children != null) {
for (Element child : children) {
if (Utilities.existsInList(child.getName(), "extension", "modifierExtension")) {
String u = child.getChildValue("url");
if (url.equals(u)) {
if (Utilities.existsInList(u, url)) {
return child.getNamedChild("value", false);
}
}
Expand All @@ -1159,12 +1159,12 @@ public Base getExtensionValue(String url) {
return null;
}

public boolean hasExtension(String url) {
public boolean hasExtension(String... url) {
if (children != null) {
for (Element child : children) {
if (Utilities.existsInList(child.getName(), "extension", "modifierExtension")) {
String u = child.getChildValue("url");
if (url.equals(u)) {
if (Utilities.existsInList(u, url)) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -743,7 +743,7 @@ public static XhtmlNode renderMultipleMaps(String start, List<ConceptMap> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -178,7 +178,7 @@ private List<ObservationNode> fetchObservations(List<ResourceWrapper> list) thro
}

private void buildObservationsTable(RenderingStatus status, XhtmlNode root, List<ObservationNode> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -60,7 +60,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper
List<ResourceWrapper> 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;
Expand All @@ -76,7 +76,7 @@ public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper
List<ResourceWrapper> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")))+" ");
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 6ae85ee

Please sign in to comment.