This commit is contained in:
Grahame Grieve 2020-03-31 10:16:04 +11:00
commit 51952c26c1
8 changed files with 104 additions and 77 deletions

View File

@ -646,7 +646,7 @@ public class ExpressionNode {
} }
private String location() { private String location() {
return Integer.toString(start.line)+", "+Integer.toString(start.column); return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
} }
public TypeDetails getTypes() { public TypeDetails getTypes() {

View File

@ -630,7 +630,7 @@ public class ExpressionNode {
} }
private String location() { private String location() {
return Integer.toString(start.line)+", "+Integer.toString(start.column); return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
} }
public TypeDetails getTypes() { public TypeDetails getTypes() {

View File

@ -554,7 +554,7 @@ public class ExpressionNode {
} }
private String location() { private String location() {
return Integer.toString(start.line)+", "+Integer.toString(start.column); return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
} }
public TypeDetails getTypes() { public TypeDetails getTypes() {

View File

@ -2727,38 +2727,47 @@ 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>();
boolean firstVersion = true;
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 (parts.length == 2) if (parts.length == 2)
versions.put(parts[0], parts[1]); versions.put(parts[0], parts[1]);
} if (!versions.isEmpty()) {
} StringBuilder b = new StringBuilder();
if (!versions.isEmpty()) { if (firstVersion) {
StringBuilder b = new StringBuilder(); // the first version
b.append("Expansion based on "); // set the <p> tag and style attribute
boolean first = true; x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px");
for (String s : versions.keySet()) { firstVersion = false;
if (first) } else {
first = false; // the second (or greater) version
else x.br(); // add line break before the version text
b.append(", "); }
if (!s.equals("http://snomed.info/sct")) b.append("Expansion based on ");
b.append(describeSystem(s)+" version "+versions.get(s)); boolean firstPart = true;
else { for (String s : versions.keySet()) {
String[] parts = versions.get(s).split("\\/"); if (firstPart)
if (parts.length >= 5) { firstPart = false;
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.addText(b.toString()); // add the version text
} }
} }
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
} }
} }

View File

@ -633,7 +633,7 @@ public class ExpressionNode {
} }
private String location() { private String location() {
return Integer.toString(start.line)+", "+Integer.toString(start.column); return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
} }
public TypeDetails getTypes() { public TypeDetails getTypes() {

View File

@ -2882,38 +2882,47 @@ 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>();
boolean firstVersion = true;
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 (parts.length == 2) if (parts.length == 2)
versions.put(parts[0], parts[1]); versions.put(parts[0], parts[1]);
} if (!versions.isEmpty()) {
} StringBuilder b = new StringBuilder();
if (!versions.isEmpty()) { if (firstVersion) {
StringBuilder b = new StringBuilder(); // the first version
b.append("Expansion based on "); // set the <p> tag and style attribute
boolean first = true; x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px");
for (String s : versions.keySet()) { firstVersion = false;
if (first) } else {
first = false; // the second (or greater) version
else x.br(); // add line break before the version text
b.append(", "); }
if (!s.equals("http://snomed.info/sct")) b.append("Expansion based on ");
b.append(describeSystem(s)+" version "+versions.get(s)); boolean firstPart = true;
else { for (String s : versions.keySet()) {
String[] parts = versions.get(s).split("\\/"); if (firstPart)
if (parts.length >= 5) { firstPart = false;
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.addText(b.toString()); // add the version text
} }
} }
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
} }
} }

View File

@ -634,7 +634,7 @@ public class ExpressionNode {
} }
private String location() { private String location() {
return Integer.toString(start.line)+", "+Integer.toString(start.column); return Integer.toString(start.getLine())+", "+Integer.toString(start.getColumn());
} }
public TypeDetails getTypes() { public TypeDetails getTypes() {

View File

@ -3213,38 +3213,47 @@ 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>();
boolean firstVersion = true;
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 (parts.length == 2) if (parts.length == 2)
versions.put(parts[0], parts[1]); versions.put(parts[0], parts[1]);
} if (!versions.isEmpty()) {
} StringBuilder b = new StringBuilder();
if (!versions.isEmpty()) { if (firstVersion) {
StringBuilder b = new StringBuilder(); // the first version
b.append("Expansion based on "); // set the <p> tag and style attribute
boolean first = true; x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px");
for (String s : versions.keySet()) { firstVersion = false;
if (first) } else {
first = false; // the second (or greater) version
else x.br(); // add line break before the version text
b.append(", "); }
if (!s.equals("http://snomed.info/sct")) b.append("Expansion based on ");
b.append(describeSystem(s)+" version "+versions.get(s)); boolean firstPart = true;
else { for (String s : versions.keySet()) {
String[] parts = versions.get(s).split("\\/"); if (firstPart)
if (parts.length >= 5) { firstPart = false;
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.addText(b.toString()); // add the version text
} }
} }
x.para().setAttribute("style", "border: black 1px dotted; background-color: #EEEEEE; padding: 8px").addText(b.toString());
} }
} }