Fix NPE rendering terminology resources

This commit is contained in:
Grahame Grieve 2022-09-20 04:50:07 -04:00
parent 049d8a1197
commit eca93b0a76
3 changed files with 19 additions and 4 deletions

View File

@ -34,6 +34,9 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public abstract class TerminologyRenderer extends ResourceRenderer { public abstract class TerminologyRenderer extends ResourceRenderer {
private static final boolean DEBUG = false;
public TerminologyRenderer(RenderingContext context) { public TerminologyRenderer(RenderingContext context) {
super(context); super(context);
} }
@ -309,8 +312,11 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
a.tx("SNOMED-CT"); a.tx("SNOMED-CT");
} }
else { else {
if (value.startsWith("http://hl7.org") && !Utilities.existsInList(value, "http://hl7.org/fhir/sid/icd-10-us")) if (value.startsWith("http://hl7.org") && !Utilities.existsInList(value, "http://hl7.org/fhir/sid/icd-10-us")) {
if (DEBUG) {
System.out.println("Unable to resolve value set "+value); System.out.println("Unable to resolve value set "+value);
}
}
li.addText(value); li.addText(value);
} }
} }

View File

@ -1292,7 +1292,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
for (ConceptReferenceComponent cc : inc.getConcept()) { for (ConceptReferenceComponent cc : inc.getConcept()) {
String code = cc.getCode(); String code = cc.getCode();
ConceptDefinitionComponent v = null; ConceptDefinitionComponent v = null;
if (e != null) { if (e != null && code != null) {
v = getConceptForCode(e.getConcept(), code); v = getConceptForCode(e.getConcept(), code);
} }
if (v == null && vse != null) { if (v == null && vse != null) {

View File

@ -134,6 +134,7 @@ public class RenderingContext {
private DateTimeFormatter dateYearFormat; private DateTimeFormatter dateYearFormat;
private DateTimeFormatter dateYearMonthFormat; private DateTimeFormatter dateYearMonthFormat;
private boolean copyButton; private boolean copyButton;
private ProfileKnowledgeProvider pkp;
/** /**
* *
@ -194,6 +195,7 @@ public class RenderingContext {
res.locale = locale; res.locale = locale;
res.showComments = showComments; res.showComments = showComments;
res.copyButton = copyButton; res.copyButton = copyButton;
res.pkp = pkp;
res.terminologyServiceOptions = terminologyServiceOptions.copy(); res.terminologyServiceOptions = terminologyServiceOptions.copy();
return res; return res;
@ -210,7 +212,7 @@ public class RenderingContext {
public ProfileUtilities getProfileUtilities() { public ProfileUtilities getProfileUtilities() {
if (profileUtilitiesR == null) { if (profileUtilitiesR == null) {
profileUtilitiesR = new ProfileUtilities(worker, null, null); profileUtilitiesR = new ProfileUtilities(worker, null, pkp);
} }
return profileUtilitiesR; return profileUtilitiesR;
} }
@ -608,5 +610,12 @@ public class RenderingContext {
return this; return this;
} }
public void setPkp(ProfileKnowledgeProvider pkp) {
this.pkp = pkp;
}
public ProfileKnowledgeProvider getPkp() {
return pkp;
}
} }