Merge pull request #942 from hapifhir/gg-202210-additional-bindings

rendering improvements
This commit is contained in:
Grahame Grieve 2022-10-06 15:51:55 +11:00 committed by GitHub
commit 231636ae11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 5 deletions

View File

@ -30,6 +30,7 @@ public class AdditionalBindingsRenderer {
private String purpose;
private String valueSet;
private String doco;
private String docoShort;
private UsageContext usage;
private boolean any;
private boolean unchanged;
@ -74,6 +75,7 @@ public class AdditionalBindingsRenderer {
abr.purpose = ext.getExtensionString("purpose");
abr.valueSet = ext.getExtensionString("valueSet");
abr.doco = ext.getExtensionString("documentation");
abr.docoShort = ext.getExtensionString("shortDoco");
abr.usage = (ext.hasExtension("usage")) && ext.getExtensionByUrl("usage").hasValueUsageContext() ? ext.getExtensionByUrl("usage").getValueUsageContext() : null;
abr.any = "any".equals(ext.getExtensionString("scope"));
abr.unchanged = ext.hasUserData(ProfileUtilities.DERIVATION_EQUALS);
@ -102,12 +104,12 @@ public class AdditionalBindingsRenderer {
}
}
private void render(List<XhtmlNode> children, boolean doDoco) throws FHIRFormatError, DefinitionException, IOException {
public void render(List<XhtmlNode> children, boolean fullDoco) throws FHIRFormatError, DefinitionException, IOException {
boolean doco = false;
boolean usage = false;
boolean any = false;
for (AdditionalBindingDetail binding : bindings) {
doco = doco || (doDoco && binding.doco != null);
doco = doco || (fullDoco && binding.doco != null) || (!fullDoco && binding.docoShort != null) ;
usage = usage || binding.usage != null;
any = any || binding.any;
}
@ -155,8 +157,9 @@ public class AdditionalBindingsRenderer {
}
}
if (doco) {
if (binding.doco != null) {
String d = md.processMarkdown("Binding.description", binding.doco);
String ds = fullDoco ? binding.doco : binding.docoShort;
if (ds != null) {
String d = fullDoco ? md.processMarkdown("Binding.description", ds) : ds;
tr.td().style("font-size: 11px").innerHTML(d);
} else {
tr.td().style("font-size: 11px");
@ -174,7 +177,10 @@ public class AdditionalBindingsRenderer {
td.ah(corePath+"extension-elementdefinition-minvalueset.html", "The minimum allowable value set - any conformant system SHALL support all these codes").tx("Min Binding");
break;
case "conformance" :
td.ah(corePath+"terminologies.html#strength", "Validators will check this binding (strength = required)").tx("Validation Criteria");
td.ah(corePath+"terminologies.html#strength", "Validators will check this binding (strength = required)").tx("Validation Binding");
break;
case "candidate" :
td.ah(corePath+"terminologies.html#strength", "This is a candidate binding that constraints on this profile may consider (see doco)").tx("Candidate Validation Binding");
break;
case "current" :
td.span(null, "New records are required to use this value set, but legacy records may use other codes").tx("Required");
@ -203,5 +209,9 @@ public class AdditionalBindingsRenderer {
return br;
}
public boolean hasBindings() {
return !bindings.isEmpty();
}
}

View File

@ -4982,6 +4982,8 @@ public class ProfileUtilities extends TranslatingUtilities {
b.setDescription(o.getDescription());
b.getDescriptionElement().setUserData(DERIVATION_EQUALS, o.getDescriptionElement());
}
// todo: derivation?
b.getExtension().addAll(binding.getExtension());
return b;
}

View File

@ -1853,3 +1853,14 @@ v: {
"error" : "Unable to find code 56248011000036107 in http://snomed.info/sct (version http://snomed.info/sct/900000000000207008/version/20220731); The code \"56248011000036107\" is not valid in the system http://snomed.info/sct; The code provided (http://snomed.info/sct#56248011000036107) is not valid in the value set 'All codes known to the system' (from http://tx.fhir.org/r4)"
}
-------------------------------------------------------------------------------------
{"code" : {
"system" : "http://snomed.info/sct",
"code" : "361055000",
"display" : "Misuses drugs (finding)"
}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}####
v: {
"display" : "Misuses drugs",
"code" : "361055000",
"system" : "http://snomed.info/sct"
}
-------------------------------------------------------------------------------------