Search in sources :

Example 21 with ElementDefinition

use of org.hl7.fhir.r4.model.ElementDefinition 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 22 with ElementDefinition

use of org.hl7.fhir.r4.model.ElementDefinition in project kindling by HL7.

the class SpreadSheetCreator method type.

private String type(ElementDefinition ed) {
    if (ed.hasContentReference()) {
        return ed.getContentReference();
    }
    List<String> tl = new ArrayList<>();
    for (TypeRefComponent tr : ed.getType()) {
        String s;
        if (tr.getCode().equals("canonical") && tr.hasExtension(BuildExtensions.EXT_PATTERN)) {
            s = "canonical(" + tr.getExtensionString(BuildExtensions.EXT_PATTERN).substring(40) + ")";
        } else {
            s = summary(tr);
            if (s == null) {
                return null;
            }
        }
        tl.add(s);
    }
    return String.join(" | ", tl);
}
Also used : TypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent) ArrayList(java.util.ArrayList)

Example 23 with ElementDefinition

use of org.hl7.fhir.r4.model.ElementDefinition in project kindling by HL7.

the class SpreadSheetCreator method addResourceSheets.

private XSSFSheet addResourceSheets(XSSFWorkbook excel) throws FHIRFormatError, FileNotFoundException, IOException {
    StructureDefinition sd = (StructureDefinition) parseXml(fnSD());
    sd.setText(null);
    XSSFSheet resource = excel.createSheet(SpreadSheetCreator.SN_RESOURCE);
    XSSFSheet bindings = excel.createSheet(SpreadSheetCreator.SN_BINDINGS);
    XSSFSheet invariants = excel.createSheet(SpreadSheetCreator.SN_INVARIANTS);
    addResourceColumns(resource, sd);
    addBindingColumns(bindings, sd);
    addInvariantColumns(invariants, sd);
    int rowCount = 0;
    invRowCount = 1;
    bindingRowCount = 1;
    for (ElementDefinition ed : sd.getDifferential().getElement()) {
        rowCount++;
        addElements(resource, bindings, invariants, ed, rowCount);
    }
    return bindings;
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition)

Example 24 with ElementDefinition

use of org.hl7.fhir.r4.model.ElementDefinition in project kindling by HL7.

the class CDAGenerator method addEDElements.

private void addEDElements(List<ElementDefinition> list) {
    ElementDefinition ed = new ElementDefinition();
    ed.setPath("ED.representation");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.addType().setCode("code");
    ed.addRepresentation(PropertyRepresentation.XMLATTR);
    list.add(ed);
    ed = new ElementDefinition();
    ed.setPath("ED.text");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.addType().setCode("string");
    ed.addRepresentation(PropertyRepresentation.XMLTEXT);
    list.add(ed);
    ed = new ElementDefinition();
    ed.setPath("ED.data");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.addType().setCode("base64Binary");
    ed.addRepresentation(PropertyRepresentation.XMLTEXT);
    list.add(ed);
}
Also used : ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition)

Example 25 with ElementDefinition

use of org.hl7.fhir.r4.model.ElementDefinition in project kindling by HL7.

the class CDAGenerator method addParts.

private void addParts(List<ElementDefinition> list, String n, String... parts) {
    for (String p : parts) {
        ElementDefinition ed = new ElementDefinition();
        ed.setPath(n + "." + p);
        seePath(ed);
        ed.setMin(0);
        ed.setMax("*");
        ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/ST");
        list.add(ed);
    }
}
Also used : ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition)

Aggregations

ArrayList (java.util.ArrayList)226 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)199 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)120 FHIRException (org.hl7.fhir.exceptions.FHIRException)116 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)92 ElementDefinition (org.hl7.fhir.r4b.model.ElementDefinition)91 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)85 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)82 ElementDefinition (org.hl7.fhir.r4.model.ElementDefinition)68 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)60 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)57 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)51 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)50 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)46 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)44 ElementDefinition (org.hl7.fhir.dstu2016may.model.ElementDefinition)42 ElementDefinition (org.hl7.fhir.dstu2.model.ElementDefinition)41 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)41 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)38 List (java.util.List)37