Search in sources :

Example 6 with XLSXmlNormaliser

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

the class SourceParser method loadCompartments.

private void loadCompartments() throws FileNotFoundException, Exception {
    XLSXmlParser xml = new XLSXmlParser(new CSFileInputStream(srcDir + "compartments.xml"), "compartments.xml");
    new XLSXmlNormaliser(srcDir + "compartments.xml", exceptionIfExcelNotNormalised).go();
    Sheet sheet = xml.getSheets().get("compartments");
    for (int row = 0; row < sheet.rows.size(); row++) {
        Compartment c = new Compartment();
        c.setName(sheet.getColumn(row, "Name"));
        if (!c.getName().startsWith("!")) {
            c.setTitle(sheet.getColumn(row, "Title"));
            c.setDescription(sheet.getColumn(row, "Description"));
            c.setIdentity(sheet.getColumn(row, "Identification"));
            c.setMembership(sheet.getColumn(row, "Inclusion"));
            definitions.getCompartments().add(c);
        }
    }
    sheet = xml.getSheets().get("resources");
    for (int row = 0; row < sheet.rows.size(); row++) {
        String mn = sheet.getColumn(row, "Resource");
        if (!Utilities.noString(mn) && !mn.startsWith("!")) {
            ResourceDefn r = definitions.getResourceByName(mn);
            for (Compartment c : definitions.getCompartments()) {
                c.getResources().put(r, sheet.getColumn(row, c.getName()));
            }
        }
    }
}
Also used : Compartment(org.hl7.fhir.definitions.model.Compartment) XLSXmlParser(org.hl7.fhir.utilities.xls.XLSXmlParser) XLSXmlNormaliser(org.hl7.fhir.utilities.xls.XLSXmlNormaliser) Sheet(org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream)

Aggregations

XLSXmlNormaliser (org.hl7.fhir.utilities.xls.XLSXmlNormaliser)6 XLSXmlParser (org.hl7.fhir.utilities.xls.XLSXmlParser)5 Sheet (org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet)5 CSFileInputStream (org.hl7.fhir.utilities.CSFileInputStream)4 ArrayList (java.util.ArrayList)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 BindingSpecification (org.hl7.fhir.definitions.model.BindingSpecification)1 Compartment (org.hl7.fhir.definitions.model.Compartment)1 Invariant (org.hl7.fhir.definitions.model.Invariant)1 ProfiledType (org.hl7.fhir.definitions.model.ProfiledType)1 ResourceDefn (org.hl7.fhir.definitions.model.ResourceDefn)1 TypeDefn (org.hl7.fhir.definitions.model.TypeDefn)1 TypeRef (org.hl7.fhir.definitions.model.TypeRef)1 OldSpreadsheetParser (org.hl7.fhir.definitions.parsers.spreadsheets.OldSpreadsheetParser)1 FHIRException (org.hl7.fhir.exceptions.FHIRException)1 CSFile (org.hl7.fhir.utilities.CSFile)1 IniFile (org.hl7.fhir.utilities.IniFile)1