Search in sources :

Example 1 with ElementDefinitionBindingComponent

use of org.hl7.fhir.r4.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 "??";
}
Also used : ValueSet(org.hl7.fhir.r5.model.ValueSet)

Example 2 with ElementDefinitionBindingComponent

use of org.hl7.fhir.r4.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();
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) ElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent)

Example 3 with ElementDefinitionBindingComponent

use of org.hl7.fhir.r4.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);
    }
}
Also used : XSSFRow(org.apache.poi.xssf.usermodel.XSSFRow) FHIRException(org.hl7.fhir.exceptions.FHIRException) ElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent)

Example 4 with ElementDefinitionBindingComponent

use of org.hl7.fhir.r4.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;
}
Also used : BindingSpecification(org.hl7.fhir.definitions.model.BindingSpecification)

Example 5 with ElementDefinitionBindingComponent

use of org.hl7.fhir.r4.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);
}
Also used : ValueSet(org.hl7.fhir.r5.model.ValueSet)

Aggregations

ElementDefinitionBindingComponent (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent)18 ValueSet (org.hl7.fhir.r5.model.ValueSet)12 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)8 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)8 IOException (java.io.IOException)7 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)7 FHIRException (org.hl7.fhir.exceptions.FHIRException)7 ElementDefinitionBindingComponent (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionBindingComponent)6 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)6 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)6 ElementDefinitionBindingComponent (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent)4 ElementDefinitionBindingComponent (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent)4 ValidationResult (org.hl7.fhir.r5.context.IWorkerContext.ValidationResult)4 CodeSystem (org.hl7.fhir.r5.model.CodeSystem)4 ArrayList (java.util.ArrayList)3 NotImplementedException (org.apache.commons.lang3.NotImplementedException)3 ValueSet (org.hl7.fhir.r4b.model.ValueSet)3 StringType (org.hl7.fhir.r5.model.StringType)3 ElementDefinitionBindingComponent (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent)2 Reference (org.hl7.fhir.dstu2.model.Reference)2