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;
|
||||
}
|
||||
XhtmlNode t = x.table( "codes");
|
||||
boolean definitions = false;
|
||||
boolean commentS = false;
|
||||
boolean deprecated = false;
|
||||
boolean display = false;
|
||||
|
@ -161,14 +162,15 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
display = display || conceptsHaveDisplay(c);
|
||||
version = version || conceptsHaveVersion(c);
|
||||
hierarchy = hierarchy || c.hasConcept();
|
||||
definitions = definitions || conceptsHaveDefinition(c);
|
||||
}
|
||||
CodeSystemNavigator csNav = new CodeSystemNavigator(cs);
|
||||
hierarchy = hierarchy || csNav.isRestructure();
|
||||
|
||||
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)) {
|
||||
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) {
|
||||
Collections.sort(langs);
|
||||
|
@ -185,6 +187,23 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
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) {
|
||||
if (CodeSystemUtilities.hasProperty(c, cp.getCode()))
|
||||
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;
|
||||
XhtmlNode tr = t.tr();
|
||||
XhtmlNode td = tr.td();
|
||||
|
@ -298,6 +317,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
td = tr.td();
|
||||
renderDisplayName(c, cs, td);
|
||||
}
|
||||
if (hasDefinitions) {
|
||||
td = tr.td();
|
||||
if (c != null &&
|
||||
c.hasDefinitionElement()) {
|
||||
|
@ -328,6 +348,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deprecated) {
|
||||
td = tr.td();
|
||||
Boolean b = CodeSystemUtilities.isDeprecated(cs, c, false);
|
||||
|
@ -427,7 +448,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
}
|
||||
List<ConceptDefinitionComponent> ocl = csNav.getOtherChildren(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) {
|
||||
tr = t.tr();
|
||||
|
|
Loading…
Reference in New Issue