Search in sources :

Example 16 with Sheet

use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.

the class OldSpreadsheetParser method readEvents.

private void readEvents(Sheet sheet, ResourceDefn root) throws Exception {
    if (sheet != null) {
        for (int row = 0; row < sheet.rows.size(); row++) {
            String code = sheet.getColumn(row, "Event Code");
            if (code != null && !code.equals("") && !code.startsWith("!")) {
                System.out.print("!!Lloyd Look at me! - event " + code + " on resource " + root.getName());
                EventDefn e = new EventDefn();
                events.add(e);
                e.setCode(code);
                e.setTitle(sheet.getColumn(row, "Title"));
                e.setDefinition(Utilities.appendPeriod(sheet.getColumn(row, "Description")));
                e.setCategory(readCategory(sheet.getColumn(row, "Category")));
                EventUsage u = new EventUsage();
                e.getUsages().add(u);
                u.setNotes(sheet.getColumn(row, "Notes"));
                for (String s : sheet.getColumn(row, "Request Resources").split(",")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getRequestResources().add(s);
                }
                for (String s : sheet.getColumn(row, "Request Aggregations").split("\n")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getRequestAggregations().add(s);
                }
                for (String s : sheet.getColumn(row, "Response Resources").split(",")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getResponseResources().add(s);
                }
                for (String s : sheet.getColumn(row, "Response Aggregations").split("\n")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        u.getResponseAggregations().add(s);
                }
                for (String s : sheet.getColumn(row, "Follow Ups").split(",")) {
                    s = s.trim();
                    if (!s.isEmpty())
                        e.getFollowUps().add(s);
                }
            }
        }
    }
}
Also used : EventUsage(org.hl7.fhir.definitions.model.EventUsage) EventDefn(org.hl7.fhir.definitions.model.EventDefn)

Example 17 with Sheet

use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.

the class SpreadSheetCreator method addPacks.

private void addPacks(XSSFWorkbook excel) throws FHIRFormatError, FileNotFoundException, IOException {
    ListResource list = (ListResource) parseXml(fnPacks());
    list.setText(null);
    for (ListResourceEntryComponent li : list.getEntry()) {
        String ref = li.getItem().getReference();
        ref = ref.substring(ref.indexOf("/") + 1);
        String id = ref.contains("-") ? ref.substring(ref.indexOf("-") + 1) : ref;
        XSSFSheet sheet = excel.createSheet("Pack " + id);
        addPackColumns(sheet);
        addPack(sheet, ref);
    }
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) ListResource(org.hl7.fhir.r5.model.ListResource)

Example 18 with Sheet

use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.

the class SpreadSheetCreator method addSearchParams.

private void addSearchParams(XSSFWorkbook excel) throws FHIRFormatError, FileNotFoundException, IOException {
    Bundle bnd = (Bundle) parseXml(fnSP());
    XSSFSheet sheet = excel.createSheet(SN_SEARCH);
    addSearchColumns(sheet);
    int rowCount = 0;
    for (BundleEntryComponent be : bnd.getEntry()) {
        rowCount++;
        addSearchParam(sheet, (SearchParameter) be.getResource(), rowCount);
    }
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) BundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent) Bundle(org.hl7.fhir.r5.model.Bundle)

Example 19 with Sheet

use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.

the class SpreadSheetCreator method addOperations.

private void addOperations(XSSFWorkbook excel, XSSFSheet bindings) throws FHIRFormatError, FileNotFoundException, IOException {
    ListResource list = (ListResource) parseXml(fnOperations());
    list.setText(null);
    XSSFSheet sheet = excel.createSheet(SN_OPERATIONS);
    addOperationColumns(sheet);
    int rowCount = 1;
    for (ListResourceEntryComponent li : list.getEntry()) {
        String ref = li.getItem().getReference();
        ref = ref.substring(ref.indexOf("/") + 1);
        OperationDefinition opd = (OperationDefinition) parseXml(fnOpDef(ref));
        opd.setText(null);
        rowCount = addOperation(sheet, bindings, opd, rowCount);
    }
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) ListResource(org.hl7.fhir.r5.model.ListResource) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition)

Example 20 with Sheet

use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.

the class SpreadSheetCreator method addOperation.

private int addOperation(XSSFSheet sheet, XSSFSheet bindings, OperationDefinition opd, int rowCount) {
    Row row = sheet.createRow(rowCount++);
    int columnCount = 0;
    addCell(opd.getCode(), row, columnCount++);
    addCell(use(opd), row, columnCount++);
    addCell("", row, columnCount++);
    addCell(type(opd), row, columnCount++);
    addCell("", row, columnCount++);
    addCell(opd.present(), row, columnCount++);
    addCell(opd.getDescription(), row, columnCount++);
    addCell(opd.getComment(), row, columnCount++);
    addCell(ext(opd, BuildExtensions.EXT_FOOTER), row, columnCount++);
    addCell(ext(opd, BuildExtensions.EXT_FOOTER2), row, columnCount++);
    addCell(exlist(opd, false, "1"), row, columnCount++);
    addCell(exlist(opd, true, "1"), row, columnCount++);
    addCell(exlist(opd, false, "2"), row, columnCount++);
    addCell(exlist(opd, true, "2"), row, columnCount++);
    addCell(status(opd), row, columnCount++);
    addCell(ext(opd, BuildExtensions.EXT_COMMITTEE_NOTES), row, columnCount++);
    for (OperationDefinitionParameterComponent param : opd.getParameter()) {
        rowCount = addOpParam(sheet, bindings, opd.getCode(), param, rowCount);
    }
    return rowCount;
}
Also used : Row(org.apache.poi.ss.usermodel.Row) OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)

Aggregations

FHIRException (org.hl7.fhir.exceptions.FHIRException)18 Sheet (org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet)15 Sheet (org.apache.poi.ss.usermodel.Sheet)14 Row (org.apache.poi.ss.usermodel.Row)13 XSSFSheet (org.apache.poi.xssf.usermodel.XSSFSheet)12 ArrayList (java.util.ArrayList)8 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)8 ElementDefn (org.hl7.fhir.definitions.model.ElementDefn)8 Invariant (org.hl7.fhir.definitions.model.Invariant)8 XLSXmlParser (org.hl7.fhir.utilities.xls.XLSXmlParser)8 TypeRef (org.hl7.fhir.definitions.model.TypeRef)7 File (java.io.File)6 BindingSpecification (org.hl7.fhir.definitions.model.BindingSpecification)5 ResourceDefn (org.hl7.fhir.definitions.model.ResourceDefn)5 IniFile (org.hl7.fhir.utilities.IniFile)5 HashMap (java.util.HashMap)4 ConditionalFormattingRule (org.apache.poi.ss.usermodel.ConditionalFormattingRule)4 FontFormatting (org.apache.poi.ss.usermodel.FontFormatting)4 PatternFormatting (org.apache.poi.ss.usermodel.PatternFormatting)4 SheetConditionalFormatting (org.apache.poi.ss.usermodel.SheetConditionalFormatting)4