Don't make a column for definitions in a code system if there are none
This commit is contained in:
parent
25cac32326
commit
54d320bb7b
|
@ -134,6 +134,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
XhtmlNode t = x.table( "codes");
|
XhtmlNode t = x.table( "codes");
|
||||||
|
boolean definitions = false;
|
||||||
boolean commentS = false;
|
boolean commentS = false;
|
||||||
boolean deprecated = false;
|
boolean deprecated = false;
|
||||||
boolean display = false;
|
boolean display = false;
|
||||||
|
@ -161,14 +162,15 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
||||||
display = display || conceptsHaveDisplay(c);
|
display = display || conceptsHaveDisplay(c);
|
||||||
version = version || conceptsHaveVersion(c);
|
version = version || conceptsHaveVersion(c);
|
||||||
hierarchy = hierarchy || c.hasConcept();
|
hierarchy = hierarchy || c.hasConcept();
|
||||||
|
definitions = definitions || conceptsHaveDefinition(c);
|
||||||
}
|
}
|
||||||
CodeSystemNavigator csNav = new CodeSystemNavigator(cs);
|
CodeSystemNavigator csNav = new CodeSystemNavigator(cs);
|
||||||
hierarchy = hierarchy || csNav.isRestructure();
|
hierarchy = hierarchy || csNav.isRestructure();
|
||||||
|
|
||||||
List<String> langs = new ArrayList<>();
|
List<String> langs = new ArrayList<>();
|
||||||
addMapHeaders(addTableHeaderRowStandard(t, hierarchy, display, true, commentS, version, deprecated, properties, null, false), maps);
|
addMapHeaders(addTableHeaderRowStandard(t, hierarchy, display, definitions, commentS, version, deprecated, properties, null, false), maps);
|
||||||
for (ConceptDefinitionComponent c : csNav.getConcepts(null)) {
|
for (ConceptDefinitionComponent c : csNav.getConcepts(null)) {
|
||||||
hasExtensions = addDefineRowToTable(t, c, 0, hierarchy, display, commentS, version, deprecated, maps, cs.getUrl(), cs, properties, csNav, langs) || hasExtensions;
|
hasExtensions = addDefineRowToTable(t, c, 0, hierarchy, display, definitions, commentS, version, deprecated, maps, cs.getUrl(), cs, properties, csNav, langs) || hasExtensions;
|
||||||
}
|
}
|
||||||
if (langs.size() > 0) {
|
if (langs.size() > 0) {
|
||||||
Collections.sort(langs);
|
Collections.sort(langs);
|
||||||
|
@ -185,6 +187,23 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
||||||
return hasExtensions;
|
return hasExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean conceptsHaveDefinition(ConceptDefinitionComponent c) {
|
||||||
|
if (c.hasDefinition()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
|
||||||
|
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ConceptDefinitionComponent g : c.getConcept()) {
|
||||||
|
if (conceptsHaveDefinition(g)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean conceptsHaveProperty(ConceptDefinitionComponent c, PropertyComponent cp) {
|
private boolean conceptsHaveProperty(ConceptDefinitionComponent c, PropertyComponent cp) {
|
||||||
if (CodeSystemUtilities.hasProperty(c, cp.getCode()))
|
if (CodeSystemUtilities.hasProperty(c, cp.getCode()))
|
||||||
return true;
|
return true;
|
||||||
|
@ -271,7 +290,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean addDefineRowToTable(XhtmlNode t, ConceptDefinitionComponent c, int level, boolean hasHierarchy, boolean hasDisplay, boolean comment, boolean version, boolean deprecated, List<UsedConceptMap> maps, String system, CodeSystem cs, List<PropertyComponent> properties, CodeSystemNavigator csNav, List<String> langs) throws FHIRFormatError, DefinitionException, IOException {
|
private boolean addDefineRowToTable(XhtmlNode t, ConceptDefinitionComponent c, int level, boolean hasHierarchy, boolean hasDisplay, boolean hasDefinitions, boolean comment, boolean version, boolean deprecated, List<UsedConceptMap> maps, String system, CodeSystem cs, List<PropertyComponent> properties, CodeSystemNavigator csNav, List<String> langs) throws FHIRFormatError, DefinitionException, IOException {
|
||||||
boolean hasExtensions = false;
|
boolean hasExtensions = false;
|
||||||
XhtmlNode tr = t.tr();
|
XhtmlNode tr = t.tr();
|
||||||
XhtmlNode td = tr.td();
|
XhtmlNode td = tr.td();
|
||||||
|
@ -297,36 +316,38 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
||||||
if (hasDisplay) {
|
if (hasDisplay) {
|
||||||
td = tr.td();
|
td = tr.td();
|
||||||
renderDisplayName(c, cs, td);
|
renderDisplayName(c, cs, td);
|
||||||
}
|
}
|
||||||
td = tr.td();
|
if (hasDefinitions) {
|
||||||
if (c != null &&
|
td = tr.td();
|
||||||
c.hasDefinitionElement()) {
|
if (c != null &&
|
||||||
if (getContext().getLang() == null) {
|
c.hasDefinitionElement()) {
|
||||||
if (hasMarkdownInDefinitions(cs))
|
if (getContext().getLang() == null) {
|
||||||
addMarkdown(td, c.getDefinition());
|
if (hasMarkdownInDefinitions(cs))
|
||||||
else
|
addMarkdown(td, c.getDefinition());
|
||||||
|
else
|
||||||
|
td.addText(c.getDefinition());
|
||||||
|
} else if (getContext().getLang().equals("*")) {
|
||||||
|
boolean sl = false;
|
||||||
|
for (ConceptDefinitionDesignationComponent cd : c.getDesignation())
|
||||||
|
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue()))
|
||||||
|
sl = true;
|
||||||
|
td.addText((sl ? cs.getLanguage("en")+": " : "")+c.getDefinition());
|
||||||
|
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
|
||||||
|
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue())) {
|
||||||
|
td.br();
|
||||||
|
td.addText(cd.getLanguage()+": "+cd.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (getContext().getLang().equals(cs.getLanguage()) || (getContext().getLang().equals("en") && !cs.hasLanguage())) {
|
||||||
td.addText(c.getDefinition());
|
td.addText(c.getDefinition());
|
||||||
} else if (getContext().getLang().equals("*")) {
|
} else {
|
||||||
boolean sl = false;
|
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
|
||||||
for (ConceptDefinitionDesignationComponent cd : c.getDesignation())
|
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && cd.getLanguage().equals(getContext().getLang())) {
|
||||||
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue()))
|
td.addText(cd.getValue());
|
||||||
sl = true;
|
}
|
||||||
td.addText((sl ? cs.getLanguage("en")+": " : "")+c.getDefinition());
|
|
||||||
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
|
|
||||||
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && !c.getDefinition().equalsIgnoreCase(cd.getValue())) {
|
|
||||||
td.br();
|
|
||||||
td.addText(cd.getLanguage()+": "+cd.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (getContext().getLang().equals(cs.getLanguage()) || (getContext().getLang().equals("en") && !cs.hasLanguage())) {
|
}
|
||||||
td.addText(c.getDefinition());
|
|
||||||
} else {
|
|
||||||
for (ConceptDefinitionDesignationComponent cd : c.getDesignation()) {
|
|
||||||
if (cd.getUse().is("http://terminology.hl7.org/CodeSystem/designation-usage", "definition") && cd.hasLanguage() && cd.getLanguage().equals(getContext().getLang())) {
|
|
||||||
td.addText(cd.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (deprecated) {
|
if (deprecated) {
|
||||||
td = tr.td();
|
td = tr.td();
|
||||||
|
@ -427,7 +448,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
||||||
}
|
}
|
||||||
List<ConceptDefinitionComponent> ocl = csNav.getOtherChildren(c);
|
List<ConceptDefinitionComponent> ocl = csNav.getOtherChildren(c);
|
||||||
for (ConceptDefinitionComponent cc : csNav.getConcepts(c)) {
|
for (ConceptDefinitionComponent cc : csNav.getConcepts(c)) {
|
||||||
hasExtensions = addDefineRowToTable(t, cc, level+1, hasHierarchy, hasDisplay, comment, version, deprecated, maps, system, cs, properties, csNav, langs) || hasExtensions;
|
hasExtensions = addDefineRowToTable(t, cc, level+1, hasHierarchy, hasDisplay, hasDefinitions, comment, version, deprecated, maps, system, cs, properties, csNav, langs) || hasExtensions;
|
||||||
}
|
}
|
||||||
for (ConceptDefinitionComponent cc : ocl) {
|
for (ConceptDefinitionComponent cc : ocl) {
|
||||||
tr = t.tr();
|
tr = t.tr();
|
||||||
|
|
Loading…
Reference in New Issue