Merge pull request #1134 from hapifhir/gg-202302-conceptmap-hack

Gg 202302 conceptmap hack
This commit is contained in:
Grahame Grieve 2023-02-24 10:41:18 +11:00 committed by GitHub
commit b12dbe2dfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 13 deletions

View File

@ -80,7 +80,11 @@ public abstract class FormatUtilities {
public static final String XHTML_NS = "http://www.w3.org/1999/xhtml";
public static final String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
private static final int MAX_SCAN_LENGTH = 1000; // how many characters to scan into content when autodetermining format
public static final String MAP_ATTRIBUTE_NAME = "mapAttribute";
public static final String PROPERTY_NAME = "property";
public static String WORKING_CM_PROP_NAME = PROPERTY_NAME;
protected String toString(String value) {
return value;
}

View File

@ -9418,10 +9418,10 @@ public class JsonParser extends JsonParserBase {
protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
parseBackboneElementProperties(json, res);
if (json.has("property"))
res.setPropertyElement(parseUri(json.get("property").getAsString()));
if (json.has("_property"))
parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
if (json.has(FormatUtilities.WORKING_CM_PROP_NAME))
res.setPropertyElement(parseUri(json.get(FormatUtilities.WORKING_CM_PROP_NAME).getAsString()));
if (json.has("_"+FormatUtilities.WORKING_CM_PROP_NAME))
parseElementProperties(getJObject(json, "_"+FormatUtilities.WORKING_CM_PROP_NAME), res.getPropertyElement());
DataType value = parseType("value", json);
if (value != null)
res.setValue(value);
@ -44920,8 +44920,8 @@ public class JsonParser extends JsonParserBase {
protected void composeOtherElementComponentProperties(ConceptMap.OtherElementComponent element) throws IOException {
composeBackboneElementProperties(element);
if (element.hasPropertyElement()) {
composeUriCore("property", element.getPropertyElement(), false);
composeUriExtras("property", element.getPropertyElement(), false);
composeUriCore(FormatUtilities.WORKING_CM_PROP_NAME, element.getPropertyElement(), false);
composeUriExtras(FormatUtilities.WORKING_CM_PROP_NAME, element.getPropertyElement(), false);
}
if (element.hasValue()) {
composeType("value", element.getValue());

View File

@ -8204,7 +8204,7 @@ public class XmlParser extends XmlParserBase {
}
protected boolean parseConceptMapOtherElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap.OtherElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
if (eventType == XmlPullParser.START_TAG && xpp.getName().equals(FormatUtilities.WORKING_CM_PROP_NAME)) {
res.setPropertyElement(parseUri(xpp));
} else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
res.setValue(parseType("value", xpp));
@ -38972,7 +38972,7 @@ public class XmlParser extends XmlParserBase {
protected void composeConceptMapOtherElementComponentElements(ConceptMap.OtherElementComponent element) throws IOException {
composeBackboneElementElements(element);
if (element.hasPropertyElement()) {
composeUri("property", element.getPropertyElement());
composeUri(FormatUtilities.WORKING_CM_PROP_NAME, element.getPropertyElement());
}
if (element.hasValue()) {
composeType("value", element.getValue());

View File

@ -212,7 +212,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
} else
tr.td().b().tx("Code");
for (String s : sources.keySet()) {
if (!s.equals("code")) {
if (s != null && !s.equals("code")) {
if (sources.get(s).size() == 1) {
String url = sources.get(s).iterator().next();
renderCSDetailsLink(tr, url, false);
@ -229,7 +229,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
} else
tr.td().b().tx("Code");
for (String s : targets.keySet()) {
if (!s.equals("code")) {
if (s != null && !s.equals("code")) {
if (targets.get(s).size() == 1) {
String url = targets.get(s).iterator().next();
renderCSDetailsLink(tr, url, false);
@ -291,7 +291,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
td.style("border-top-style: none; border-left-width: 0px");
}
for (String s : sources.keySet()) {
if (!s.equals("code")) {
if (s != null && !s.equals("code")) {
td = tr.td();
if (first) {
td.addText(getValue(ccm.getDependsOn(), s, sources.get(s).size() != 1));
@ -323,7 +323,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
tr.td().style("border-left-width: 0px").tx(display == null ? "" : display);
for (String s : targets.keySet()) {
if (!s.equals("code")) {
if (s != null && !s.equals("code")) {
td = tr.td();
td.addText(getValue(ccm.getProduct(), s, targets.get(s).size() != 1));
display = getDisplay(ccm.getProduct(), s);