add missing code + track prohibited / required elements (improve rendering of IGs)

This commit is contained in:
Grahame Grieve 2021-09-29 16:20:52 +10:00
parent f4da357769
commit d17cb39e44
2 changed files with 47 additions and 0 deletions

View File

@ -105,6 +105,8 @@ public class Element extends Base {
private boolean hasParentForValidator; private boolean hasParentForValidator;
private String path; private String path;
private List<ValidationMessage> messages; private List<ValidationMessage> messages;
private boolean prohibited;
private boolean required;
public Element(String name) { public Element(String name) {
super(); super();
@ -979,4 +981,22 @@ public class Element extends Base {
public void removeChild(String name) { public void removeChild(String name) {
children.removeIf(n -> name.equals(n.getName())); children.removeIf(n -> name.equals(n.getName()));
} }
public boolean isProhibited() {
return prohibited;
}
public void setProhibited(boolean prohibited) {
this.prohibited = prohibited;
}
public boolean isRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
} }

View File

@ -0,0 +1,27 @@
package org.hl7.fhir.r5.utils;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.model.ServiceRequest;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.utilities.Utilities;
public class PublicationHacker {
// this routine fixes up broken binding descriptions from past FHIR publications. All of them will be or are fixed in a later version,
// but fixing old versions is procedurally very difficult. Hence, these work around fixes here
public static StringType fixBindingDescriptions(IWorkerContext context, StringType s) {
StringType res = s.copy();
// ServiceRequest.code
if (res.getValue().contains("LOINC is (preferred)[http://build.fhir.org/terminologies.html#preferred]")) {
res.setValue(res.getValue().replace("LOINC is (preferred)[http://build.fhir.org/terminologies.html#preferred]", "LOINC is [preferred]("+Utilities.pathURL(context.getSpecUrl(), "terminologies.html#preferred)")));
}
if (res.getValue().contains("[here](valueset-diagnostic-requests.html)")) {
res.setValue(res.getValue().replace("[here](valueset-diagnostic-requests.html)", "here"));
}
return res;
}
}