Merge pull request #160 from rhausam/multiple-expansion-version-notice
Support listing multiple "Expansion based on" versions.
This commit is contained in:
commit
afb0453e7b
|
@ -2727,39 +2727,41 @@ public class NarrativeGenerator implements INarrativeGenerator {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
|
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
|
||||||
Map<String, String> versions = new HashMap<String, String>();
|
Map<String, String> versions = new HashMap<String, String>();
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
|
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
|
||||||
if (p.getName().equals("version")) {
|
if (p.getName().equals("version")) {
|
||||||
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
|
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
|
||||||
|
if (b.length() > 0)
|
||||||
|
b.append("<br>");
|
||||||
if (parts.length == 2)
|
if (parts.length == 2)
|
||||||
versions.put(parts[0], parts[1]);
|
versions.put(parts[0], parts[1]);
|
||||||
}
|
if (!versions.isEmpty()) {
|
||||||
}
|
b.append("Expansion based on ");
|
||||||
if (!versions.isEmpty()) {
|
boolean first = true;
|
||||||
StringBuilder b = new StringBuilder();
|
for (String s : versions.keySet()) {
|
||||||
b.append("Expansion based on ");
|
if (first)
|
||||||
boolean first = true;
|
first = false;
|
||||||
for (String s : versions.keySet()) {
|
|
||||||
if (first)
|
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
b.append(", ");
|
|
||||||
if (!s.equals("http://snomed.info/sct"))
|
|
||||||
b.append(describeSystem(s)+" version "+versions.get(s));
|
|
||||||
else {
|
|
||||||
String[] parts = versions.get(s).split("\\/");
|
|
||||||
if (parts.length >= 5) {
|
|
||||||
String m = describeModule(parts[4]);
|
|
||||||
if (parts.length == 7)
|
|
||||||
b.append("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
|
|
||||||
else
|
else
|
||||||
b.append("SNOMED CT "+m+" edition");
|
b.append(", ");
|
||||||
} else
|
if (!s.equals("http://snomed.info/sct"))
|
||||||
b.append(describeSystem(s)+" version "+versions.get(s));
|
b.append(describeSystem(s)+" version "+versions.get(s));
|
||||||
|
else {
|
||||||
|
parts = versions.get(s).split("\\/");
|
||||||
|
if (parts.length >= 5) {
|
||||||
|
String m = describeModule(parts[4]);
|
||||||
|
if (parts.length == 7)
|
||||||
|
b.append("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
|
||||||
|
else
|
||||||
|
b.append("SNOMED CT "+m+" edition");
|
||||||
|
} else
|
||||||
|
b.append(describeSystem(s)+" version "+versions.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
|
|
||||||
}
|
}
|
||||||
|
if (b.length() > 0)
|
||||||
|
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatSCTDate(String ds) {
|
private String formatSCTDate(String ds) {
|
||||||
|
|
|
@ -2882,39 +2882,41 @@ public class NarrativeGenerator implements INarrativeGenerator {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
|
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
|
||||||
Map<String, String> versions = new HashMap<String, String>();
|
Map<String, String> versions = new HashMap<String, String>();
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
|
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
|
||||||
if (p.getName().equals("version")) {
|
if (p.getName().equals("version")) {
|
||||||
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
|
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
|
||||||
|
if (b.length() > 0)
|
||||||
|
b.append("<br>");
|
||||||
if (parts.length == 2)
|
if (parts.length == 2)
|
||||||
versions.put(parts[0], parts[1]);
|
versions.put(parts[0], parts[1]);
|
||||||
}
|
if (!versions.isEmpty()) {
|
||||||
}
|
b.append("Expansion based on ");
|
||||||
if (!versions.isEmpty()) {
|
boolean first = true;
|
||||||
StringBuilder b = new StringBuilder();
|
for (String s : versions.keySet()) {
|
||||||
b.append("Expansion based on ");
|
if (first)
|
||||||
boolean first = true;
|
first = false;
|
||||||
for (String s : versions.keySet()) {
|
|
||||||
if (first)
|
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
b.append(", ");
|
|
||||||
if (!s.equals("http://snomed.info/sct"))
|
|
||||||
b.append(describeSystem(s)+" version "+versions.get(s));
|
|
||||||
else {
|
|
||||||
String[] parts = versions.get(s).split("\\/");
|
|
||||||
if (parts.length >= 5) {
|
|
||||||
String m = describeModule(parts[4]);
|
|
||||||
if (parts.length == 7)
|
|
||||||
b.append("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
|
|
||||||
else
|
else
|
||||||
b.append("SNOMED CT "+m+" edition");
|
b.append(", ");
|
||||||
} else
|
if (!s.equals("http://snomed.info/sct"))
|
||||||
b.append(describeSystem(s)+" version "+versions.get(s));
|
b.append(describeSystem(s)+" version "+versions.get(s));
|
||||||
|
else {
|
||||||
|
parts = versions.get(s).split("\\/");
|
||||||
|
if (parts.length >= 5) {
|
||||||
|
String m = describeModule(parts[4]);
|
||||||
|
if (parts.length == 7)
|
||||||
|
b.append("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
|
||||||
|
else
|
||||||
|
b.append("SNOMED CT "+m+" edition");
|
||||||
|
} else
|
||||||
|
b.append(describeSystem(s)+" version "+versions.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
|
|
||||||
}
|
}
|
||||||
|
if (b.length() > 0)
|
||||||
|
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatSCTDate(String ds) {
|
private String formatSCTDate(String ds) {
|
||||||
|
|
|
@ -3213,39 +3213,41 @@ public class NarrativeGenerator implements INarrativeGenerator {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
|
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
|
||||||
Map<String, String> versions = new HashMap<String, String>();
|
Map<String, String> versions = new HashMap<String, String>();
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
|
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
|
||||||
if (p.getName().equals("version")) {
|
if (p.getName().equals("version")) {
|
||||||
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
|
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
|
||||||
|
if (b.length() > 0)
|
||||||
|
b.append("<br>");
|
||||||
if (parts.length == 2)
|
if (parts.length == 2)
|
||||||
versions.put(parts[0], parts[1]);
|
versions.put(parts[0], parts[1]);
|
||||||
}
|
if (!versions.isEmpty()) {
|
||||||
}
|
b.append("Expansion based on ");
|
||||||
if (!versions.isEmpty()) {
|
boolean first = true;
|
||||||
StringBuilder b = new StringBuilder();
|
for (String s : versions.keySet()) {
|
||||||
b.append("Expansion based on ");
|
if (first)
|
||||||
boolean first = true;
|
first = false;
|
||||||
for (String s : versions.keySet()) {
|
|
||||||
if (first)
|
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
b.append(", ");
|
|
||||||
if (!s.equals("http://snomed.info/sct"))
|
|
||||||
b.append(describeSystem(s)+" version "+versions.get(s));
|
|
||||||
else {
|
|
||||||
String[] parts = versions.get(s).split("\\/");
|
|
||||||
if (parts.length >= 5) {
|
|
||||||
String m = describeModule(parts[4]);
|
|
||||||
if (parts.length == 7)
|
|
||||||
b.append("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
|
|
||||||
else
|
else
|
||||||
b.append("SNOMED CT "+m+" edition");
|
b.append(", ");
|
||||||
} else
|
if (!s.equals("http://snomed.info/sct"))
|
||||||
b.append(describeSystem(s)+" version "+versions.get(s));
|
b.append(describeSystem(s)+" version "+versions.get(s));
|
||||||
|
else {
|
||||||
|
parts = versions.get(s).split("\\/");
|
||||||
|
if (parts.length >= 5) {
|
||||||
|
String m = describeModule(parts[4]);
|
||||||
|
if (parts.length == 7)
|
||||||
|
b.append("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
|
||||||
|
else
|
||||||
|
b.append("SNOMED CT "+m+" edition");
|
||||||
|
} else
|
||||||
|
b.append(describeSystem(s)+" version "+versions.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
|
|
||||||
}
|
}
|
||||||
|
if (b.length() > 0)
|
||||||
|
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatSCTDate(String ds) {
|
private String formatSCTDate(String ds) {
|
||||||
|
|
Loading…
Reference in New Issue