use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent in project kindling by HL7.
the class PageProcessor method describeReference.
private String describeReference(ElementDefinitionBindingComponent binding) throws FHIRException {
if (binding.hasValueSet()) {
ValueSet vs = workerContext.fetchResource(ValueSet.class, binding.getValueSet());
String disp = vs != null ? vs.present() : "??";
return "<a href=\"" + (vs == null ? binding.getValueSet() : vs.getUserData("filename")) + "\">" + disp + "</a>";
} else
return "??";
}
use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent in project kindling by HL7.
the class PageProcessor method getTerminologyNotes.
private String getTerminologyNotes(StructureDefinition profile, int level) throws FHIRException {
List<String> txlist = new ArrayList<String>();
Map<String, ElementDefinitionBindingComponent> txmap = new HashMap<String, ElementDefinitionBindingComponent>();
for (ElementDefinition ed : profile.getSnapshot().getElement()) {
if (ed.hasBinding() && !"0".equals(ed.getMax())) {
String path = ed.getPath();
if (ed.getType().size() == 1 && ed.getType().get(0).getWorkingCode().equals("Extension"))
path = path + "<br/>" + ed.getType().get(0).getProfile();
txlist.add(path);
txmap.put(path, ed.getBinding());
}
}
if (txlist.isEmpty())
return "";
else {
StringBuilder b = new StringBuilder();
b.append("<h4>Terminology Bindings</h4>\r\n");
b.append("<table class=\"list\">\r\n");
b.append("<tr><td><b>Path</b></td><td><b>Name</b></td><td><b>Conformance</b></td><td><b>ValueSet</b></td></tr>\r\n");
for (String path : txlist) {
txItem(level, txmap, b, path);
}
b.append("</table>\r\n");
return b.toString();
}
}
use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent in project kindling by HL7.
the class SpreadSheetReloader method parseBinding.
private void parseBinding(ElementDefinition ed, String value, XSSFSheet bindings) {
if (Utilities.noString(value)) {
ed.setBinding(null);
} else {
XSSFRow cols = bindings.getRow(0);
XSSFRow row = lookupRow(bindings, cols, CN_BINDING_NAME, value);
if (row == null) {
throw new FHIRException("Unable to find binding " + value + " in " + xlsx);
}
ElementDefinitionBindingComponent bs = ed.getBinding();
bs.removeExtension(BuildExtensions.EXT_NAME);
readExt(bs, row, cols, CN_BINDING_NAME, BuildExtensions.EXT_BINDING_NAME, ExtensionType.String);
readExt(bs, row, cols, CN_DEFINITION, BuildExtensions.EXT_DEFINITION, ExtensionType.String);
bs.setStrength(BindingStrength.fromCode(getValue(row, cols, CN_STRENGTH)));
bs.setValueSet(getValue(row, cols, CN_VALUE_SET));
readExt(bs, row, cols, CN_OID, BuildExtensions.EXT_VS_OID, ExtensionType.String);
readExt(bs, row, cols, CN_URI, BuildExtensions.EXT_URI, ExtensionType.String);
readExt(bs, row, cols, CN_WEBSITE_EMAIL, BuildExtensions.EXT_WEBSITE, ExtensionType.Uri);
readExt(bs, row, cols, CN_V2, BuildExtensions.EXT_V2_MAP, ExtensionType.String);
readExt(bs, row, cols, CN_V3, BuildExtensions.EXT_V3_MAP, ExtensionType.String);
readExt(bs, row, cols, CN_COPYRIGHT, BuildExtensions.EXT_COPYRIGHT, ExtensionType.String);
readExt(bs, row, cols, CN_COMMITTEE_NOTES, BuildExtensions.EXT_COMMITTEE_NOTES, ExtensionType.Markdown);
}
}
use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent in project kindling by HL7.
the class ResourceParser method parseBinding.
public BindingSpecification parseBinding(ElementDefinitionBindingComponent binding) throws IOException {
BindingSpecification bs = new BindingSpecification("core", binding.getExtensionString("http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"), "true".equals(binding.getExtensionString("http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding")));
bs.setStrength(binding.getStrength());
bs.setBindingMethod(BindingMethod.ValueSet);
bs.setDescription(binding.getDescription());
bs.setReference(binding.getValueSet());
if (bs.hasReference()) {
bs.setValueSet(loadValueSet(bs.getReference(), false));
}
if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) {
bs.setMaxReference(binding.getExtensionString("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"));
bs.setMaxValueSet(loadValueSet(bs.getMaxReference(), false));
}
if (binding.hasExtension(BuildExtensions.EXT_V2_MAP)) {
bs.setV2Map(binding.getExtensionString(BuildExtensions.EXT_V2_MAP));
}
if (binding.hasExtension(BuildExtensions.EXT_V3_MAP)) {
bs.setV3Map(binding.getExtensionString(BuildExtensions.EXT_V3_MAP));
}
if (binding.hasExtension(BuildExtensions.EXT_DEFINITION)) {
bs.setDefinition(binding.getExtensionString(BuildExtensions.EXT_DEFINITION));
}
if (binding.hasExtension(BuildExtensions.EXT_URI)) {
bs.setUri(binding.getExtensionString(BuildExtensions.EXT_URI));
}
if (binding.hasExtension(BuildExtensions.EXT_WEBSITE)) {
bs.setWebSite(binding.getExtensionString(BuildExtensions.EXT_WEBSITE));
}
if (binding.hasExtension(BuildExtensions.EXT_EMAIL)) {
bs.setEmail(binding.getExtensionString(BuildExtensions.EXT_EMAIL));
}
if (binding.hasExtension(BuildExtensions.EXT_COPYRIGHT)) {
bs.setCopyright(binding.getExtensionString(BuildExtensions.EXT_COPYRIGHT));
}
if (binding.hasExtension(BuildExtensions.EXT_CS_OID)) {
bs.setCsOid(binding.getExtensionString(BuildExtensions.EXT_CS_OID));
}
if (binding.hasExtension(BuildExtensions.EXT_VS_OID)) {
bs.setVsOid(binding.getExtensionString(BuildExtensions.EXT_VS_OID));
}
if (binding.hasExtension(BuildExtensions.EXT_STATUS)) {
bs.setStatus(PublicationStatus.fromCode(binding.getExtensionString(BuildExtensions.EXT_STATUS)));
}
return bs;
}
use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent in project kindling by HL7.
the class TerminologyNotesGenerator method describeBinding.
public static String describeBinding(String prefix, ElementDefinitionBindingComponent def, PageProcessor page) throws Exception {
if (!def.hasValueSet())
return def.getDescription();
String ref = def.getValueSet();
ValueSet vs = page.getValueSets().get(ref);
if (vs != null) {
String pp = vs.hasUserData("external.url") ? vs.getUserString("external.url") : vs.getUserString("path");
return def.getDescription() + "<br/>" + conf(def) + "<a href=\"" + (Utilities.isAbsoluteUrl(pp) ? "" : prefix) + pp.replace(File.separatorChar, '/') + "\">" + vs.present() + "</a>" + confTail(def);
}
if (ref.startsWith("http:") || ref.startsWith("https:"))
return def.getDescription() + "<br/>" + conf(def) + " <a href=\"" + ref + "\">" + ref + "</a>" + confTail(def);
else
return def.getDescription() + "<br/>" + conf(def) + " ?? Broken Reference to " + ref + " ??" + confTail(def);
}
Aggregations