change to used-xxx parameters instead of version

This commit is contained in:
Grahame Grieve 2023-08-16 22:37:48 +10:00
parent bf5a2ba768
commit 3cb9c195a0
2 changed files with 21 additions and 17 deletions

View File

@ -447,17 +447,18 @@ public class ValueSetRenderer extends TerminologyRenderer {
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion, Resource vs) { private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion, Resource vs) {
Multimap<String, String> versions = HashMultimap.create(); Multimap<String, String> versions = HashMultimap.create();
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) { for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
if (p.getName().equals("version")) { if (p.getName().startsWith("used-") || p.getName().equals("version")) {
String name = p.getName().equals("version") ? "system" : p.getName().substring(5);
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|"); String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
if (parts.length == 2 && !Utilities.noString(parts[0])) if (parts.length == 2 && !Utilities.noString(parts[0]))
versions.put(parts[0], parts[1]); versions.put(name+"|"+parts[0], parts[1]);
} }
} }
if (versions.size() > 0) { if (versions.size() > 0) {
XhtmlNode div = null; XhtmlNode div = null;
XhtmlNode ul = null; XhtmlNode ul = null;
boolean first = true; boolean first = true;
for (String s : versions.keySet()) { for (String s : Utilities.sorted(versions.keySet())) {
if (versions.size() == 1 && versions.get(s).size() == 1) { if (versions.size() == 1 && versions.get(s).size() == 1) {
for (String v : versions.get(s)) { // though there'll only be one for (String v : versions.get(s)) { // though there'll only be one
XhtmlNode p = x.para().style("border: black 1px dotted; background-color: #EEEEEE; padding: 8px; margin-bottom: 8px"); XhtmlNode p = x.para().style("border: black 1px dotted; background-color: #EEEEEE; padding: 8px; margin-bottom: 8px");
@ -480,6 +481,8 @@ public class ValueSetRenderer extends TerminologyRenderer {
} }
private void expRef(XhtmlNode x, String u, String v, Resource source) { private void expRef(XhtmlNode x, String u, String v, Resource source) {
String t = u.substring(0, u.indexOf("|"));
u = u.substring(u.indexOf("|")+1);
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (u.equals("http://snomed.info/sct")) { if (u.equals("http://snomed.info/sct")) {
String[] parts = v.split("\\/"); String[] parts = v.split("\\/");
@ -504,23 +507,23 @@ public class ValueSetRenderer extends TerminologyRenderer {
CanonicalResource cr = (CanonicalResource) getContext().getWorker().fetchResource(Resource.class, u, source); CanonicalResource cr = (CanonicalResource) getContext().getWorker().fetchResource(Resource.class, u, source);
if (cr != null) { if (cr != null) {
if (cr.hasWebPath()) { if (cr.hasWebPath()) {
x.ah(cr.getWebPath()).tx(cr.present()+" (no version) ("+cr.fhirType()+")"); x.ah(cr.getWebPath()).tx(t+" "+cr.present()+" (no version) ("+cr.fhirType()+")");
} else { } else {
x.tx(describeSystem(u)+" (no version) ("+cr.fhirType()+")"); x.tx(t+" "+describeSystem(u)+" (no version) ("+cr.fhirType()+")");
} }
} else { } else {
x.tx(describeSystem(u)+" (no version)"); x.tx(t+" "+describeSystem(u)+" (no version)");
} }
} else { } else {
CanonicalResource cr = (CanonicalResource) getContext().getWorker().fetchResource(Resource.class, u+"|"+v, source); CanonicalResource cr = (CanonicalResource) getContext().getWorker().fetchResource(Resource.class, u+"|"+v, source);
if (cr != null) { if (cr != null) {
if (cr.hasWebPath()) { if (cr.hasWebPath()) {
x.ah(cr.getWebPath()).tx(cr.present()+" v"+v+" ("+cr.fhirType()+")"); x.ah(cr.getWebPath()).tx(t+" "+cr.present()+" v"+v+" ("+cr.fhirType()+")");
} else { } else {
x.tx(describeSystem(u)+" v"+v+" ("+cr.fhirType()+")"); x.tx(t+" "+describeSystem(u)+" v"+v+" ("+cr.fhirType()+")");
} }
} else { } else {
x.tx(describeSystem(u)+" version "+v); x.tx(t+" "+describeSystem(u)+" version "+v);
} }
} }
} }

View File

@ -663,8 +663,8 @@ public class ValueSetExpander extends ValueSetProcessBase {
} }
if (vs.hasVersion() || REPORT_VERSION_ANYWAY) { if (vs.hasVersion() || REPORT_VERSION_ANYWAY) {
UriType u = new UriType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : "")); UriType u = new UriType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : ""));
if (!existsInParams(exp.getParameter(), "version", u)) if (!existsInParams(exp.getParameter(), "used-valueset", u))
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u)); exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("used-valueset").setValue(u));
} }
for (Extension ex : vso.getValueset().getExpansion().getExtension()) { for (Extension ex : vso.getValueset().getExpansion().getExtension()) {
if (ex.getUrl().equals(ToolingExtensions.EXT_EXP_TOOCOSTLY)) { if (ex.getUrl().equals(ToolingExtensions.EXT_EXP_TOOCOSTLY)) {
@ -777,8 +777,8 @@ public class ValueSetExpander extends ValueSetProcessBase {
ValueSet vs = vso.getValueset(); ValueSet vs = vso.getValueset();
if (vs.hasVersion() || REPORT_VERSION_ANYWAY) { if (vs.hasVersion() || REPORT_VERSION_ANYWAY) {
UriType u = new UriType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : "")); UriType u = new UriType(vs.getUrl() + (vs.hasVersion() ? "|"+vs.getVersion() : ""));
if (!existsInParams(exp.getParameter(), "version", u)) { if (!existsInParams(exp.getParameter(), "used-valueset", u)) {
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u)); exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("used-valueset").setValue(u));
} }
} }
for (ValueSetExpansionParameterComponent p : vso.getValueset().getExpansion().getParameter()) { for (ValueSetExpansionParameterComponent p : vso.getValueset().getExpansion().getParameter()) {
@ -812,13 +812,14 @@ public class ValueSetExpander extends ValueSetProcessBase {
throw failTSE("Code system " + inc.getSystem().toString() + " is incomplete"); throw failTSE("Code system " + inc.getSystem().toString() + " is incomplete");
if (cs.hasVersion() || REPORT_VERSION_ANYWAY) { if (cs.hasVersion() || REPORT_VERSION_ANYWAY) {
UriType u = new UriType(cs.getUrl() + (cs.hasVersion() ? "|"+cs.getVersion() : "")); UriType u = new UriType(cs.getUrl() + (cs.hasVersion() ? "|"+cs.getVersion() : ""));
if (!existsInParams(exp.getParameter(), "version", u)) if (!existsInParams(exp.getParameter(), "used-codesystem", u))
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u)); exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("used-codesystem").setValue(u));
if (cs.hasUserData("supplements.installed")) { if (cs.hasUserData("supplements.installed")) {
for (String s : cs.getUserString("supplements.installed").split("\\,")) { for (String s : cs.getUserString("supplements.installed").split("\\,")) {
u = new UriType(s); u = new UriType(s);
if (!existsInParams(exp.getParameter(), "version", u)) if (!existsInParams(exp.getParameter(), "used-supplement", u)) {
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(u)); exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("used-supplement").setValue(u));
}
} }
} }
} }