Improve conceptmap rendering
This commit is contained in:
parent
5bbf98fe27
commit
b387b6c268
|
@ -87,6 +87,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
||||||
addMarkdown(x, cm.getDescription());
|
addMarkdown(x, cm.getDescription());
|
||||||
|
|
||||||
x.br();
|
x.br();
|
||||||
|
int gc = 0;
|
||||||
|
|
||||||
CodeSystem cs = getContext().getWorker().fetchCodeSystem("http://hl7.org/fhir/concept-map-relationship");
|
CodeSystem cs = getContext().getWorker().fetchCodeSystem("http://hl7.org/fhir/concept-map-relationship");
|
||||||
if (cs == null)
|
if (cs == null)
|
||||||
|
@ -106,7 +107,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
||||||
sources.get("code").add(grp.getSource());
|
sources.get("code").add(grp.getSource());
|
||||||
targets.get("code").add(grp.getTarget());
|
targets.get("code").add(grp.getTarget());
|
||||||
for (SourceElementComponent ccl : grp.getElement()) {
|
for (SourceElementComponent ccl : grp.getElement()) {
|
||||||
ok = ok && ccl.getTarget().size() == 1 && ccl.getTarget().get(0).getDependsOn().isEmpty() && ccl.getTarget().get(0).getProduct().isEmpty();
|
ok = ok && (ccl.getNoMap() || (ccl.getTarget().size() == 1 && ccl.getTarget().get(0).getDependsOn().isEmpty() && ccl.getTarget().get(0).getProduct().isEmpty()));
|
||||||
for (TargetElementComponent ccm : ccl.getTarget()) {
|
for (TargetElementComponent ccm : ccl.getTarget()) {
|
||||||
comment = comment || !Utilities.noString(ccm.getComment());
|
comment = comment || !Utilities.noString(ccm.getComment());
|
||||||
for (OtherElementComponent d : ccm.getDependsOn()) {
|
for (OtherElementComponent d : ccm.getDependsOn()) {
|
||||||
|
@ -122,6 +123,25 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gc++;
|
||||||
|
if (gc > 1) {
|
||||||
|
x.hr();
|
||||||
|
}
|
||||||
|
XhtmlNode pp = x.para();
|
||||||
|
pp.b().tx("Group "+gc);
|
||||||
|
pp.tx("Mapping from ");
|
||||||
|
if (grp.hasSource()) {
|
||||||
|
renderCanonical(cm, pp, grp.getSource());
|
||||||
|
} else {
|
||||||
|
pp.code("unspecified code system");
|
||||||
|
}
|
||||||
|
pp.tx(" to ");
|
||||||
|
if (grp.hasTarget()) {
|
||||||
|
renderCanonical(cm, pp, grp.getTarget());
|
||||||
|
} else {
|
||||||
|
pp.code("unspecified code system");
|
||||||
|
}
|
||||||
|
|
||||||
String display;
|
String display;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// simple
|
// simple
|
||||||
|
@ -132,45 +152,35 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
||||||
tr.td().b().tx("Target Code");
|
tr.td().b().tx("Target Code");
|
||||||
if (comment)
|
if (comment)
|
||||||
tr.td().b().tx("Comment");
|
tr.td().b().tx("Comment");
|
||||||
tr = tbl.tr();
|
|
||||||
XhtmlNode td = tr.td().colspan(comment ? "4" : "3");
|
|
||||||
td.tx("Mapping from ");
|
|
||||||
if (grp.hasSource()) {
|
|
||||||
renderCanonical(cm, td, grp.getSource());
|
|
||||||
} else {
|
|
||||||
td.code("unspecified code system");
|
|
||||||
}
|
|
||||||
td.tx(" to ");
|
|
||||||
if (grp.hasTarget()) {
|
|
||||||
renderCanonical(cm, td, grp.getTarget());
|
|
||||||
} else {
|
|
||||||
td.code("unspecified code system");
|
|
||||||
}
|
|
||||||
for (SourceElementComponent ccl : grp.getElement()) {
|
for (SourceElementComponent ccl : grp.getElement()) {
|
||||||
tr = tbl.tr();
|
tr = tbl.tr();
|
||||||
td = tr.td();
|
XhtmlNode td = tr.td();
|
||||||
td.addText(ccl.getCode());
|
td.addText(ccl.getCode());
|
||||||
display = ccl.hasDisplay() ? ccl.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getSource()), versionFromCanonical(grp.getSource()), ccl.getCode());
|
display = ccl.hasDisplay() ? ccl.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getSource()), versionFromCanonical(grp.getSource()), ccl.getCode());
|
||||||
if (display != null && !isSameCodeAndDisplay(ccl.getCode(), display))
|
if (display != null && !isSameCodeAndDisplay(ccl.getCode(), display))
|
||||||
td.tx(" ("+display+")");
|
td.tx(" ("+display+")");
|
||||||
TargetElementComponent ccm = ccl.getTarget().get(0);
|
if (ccl.getNoMap()) {
|
||||||
if (!ccm.hasRelationship())
|
tr.td().colspan(comment ? "3" : "2").style("background-color: #efefef").tx("(not mapped)");
|
||||||
tr.td().tx(":"+"("+ConceptMapRelationship.EQUIVALENT.toCode()+")");
|
} else {
|
||||||
else {
|
TargetElementComponent ccm = ccl.getTarget().get(0);
|
||||||
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
|
if (!ccm.hasRelationship())
|
||||||
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
|
tr.td().tx(":"+"("+ConceptMapRelationship.EQUIVALENT.toCode()+")");
|
||||||
tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
|
else {
|
||||||
} else {
|
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
|
||||||
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));
|
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
|
||||||
|
tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
|
||||||
|
} else {
|
||||||
|
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
td = tr.td();
|
||||||
|
td.addText(ccm.getCode());
|
||||||
|
display = ccm.hasDisplay() ? ccm.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getTarget()), versionFromCanonical(grp.getTarget()), ccm.getCode());
|
||||||
|
if (display != null && !isSameCodeAndDisplay(ccm.getCode(), display))
|
||||||
|
td.tx(" ("+display+")");
|
||||||
|
if (comment)
|
||||||
|
tr.td().addText(ccm.getComment());
|
||||||
}
|
}
|
||||||
td = tr.td();
|
|
||||||
td.addText(ccm.getCode());
|
|
||||||
display = ccm.hasDisplay() ? ccm.getDisplay() : getDisplayForConcept(systemFromCanonical(grp.getTarget()), versionFromCanonical(grp.getTarget()), ccm.getCode());
|
|
||||||
if (display != null && !isSameCodeAndDisplay(ccm.getCode(), display))
|
|
||||||
td.tx(" ("+display+")");
|
|
||||||
if (comment)
|
|
||||||
tr.td().addText(ccm.getComment());
|
|
||||||
addUnmapped(tbl, grp);
|
addUnmapped(tbl, grp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -398,7 +408,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
||||||
if (span2) {
|
if (span2) {
|
||||||
td.colspan("2");
|
td.colspan("2");
|
||||||
}
|
}
|
||||||
td.b().tx("Code");
|
td.b().tx("Codes");
|
||||||
td.tx(" from ");
|
td.tx(" from ");
|
||||||
if (cs == null)
|
if (cs == null)
|
||||||
td.tx(url);
|
td.tx(url);
|
||||||
|
|
Loading…
Reference in New Issue