use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.
the class SourceParser method processStringPattern.
private void processStringPattern(Sheet sheet, int row) throws Exception {
DefinedStringPattern prim = new DefinedStringPattern();
prim.setCode(sheet.getColumn(row, "Data Type"));
prim.setDefinition(sheet.getColumn(row, "Definition"));
prim.setComment(sheet.getColumn(row, "Comments"));
prim.setRegex(sheet.getColumn(row, "RegEx"));
prim.setSchema(sheet.getColumn(row, "Schema"));
prim.setJsonType(sheet.getColumn(row, "Json"));
prim.setBase(sheet.getColumn(row, "Base"));
TypeRef td = new TypeRef();
td.setName(prim.getCode());
definitions.getKnownTypes().add(td);
definitions.getPrimitives().put(prim.getCode(), prim);
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet 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()));
}
}
}
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.
the class SourceParser method processImport.
private void processImport(Sheet sheet, int row) throws Exception {
PrimitiveType prim = new PrimitiveType();
prim.setCode(sheet.getColumn(row, "Data Type"));
prim.setDefinition(sheet.getColumn(row, "Definition"));
prim.setComment(sheet.getColumn(row, "Comments"));
prim.setSchemaType(sheet.getColumn(row, "Schema"));
prim.setJsonType(sheet.getColumn(row, "Json"));
prim.setRegex(sheet.getColumn(row, "RegEx"));
prim.setV2(sheet.getColumn(row, "v2"));
prim.setV3(sheet.getColumn(row, "v3"));
TypeRef td = new TypeRef();
td.setName(prim.getCode());
definitions.getKnownTypes().add(td);
definitions.getPrimitives().put(prim.getCode(), prim);
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.
the class SpreadSheetCreator method addPack.
private void addPack(XSSFSheet sheet, String ref) throws FHIRFormatError, FileNotFoundException, IOException {
ImplementationGuide ig = (ImplementationGuide) parseXml(fnIG(ref));
ig.setText(null);
int rowCount = 1;
sortExtensions(ig);
addPackRow(sheet, CN_ID, ig.getId(), rowCount++);
addPackRow(sheet, CN_CODE, BuildExtensions.readStringExtension(ig, BuildExtensions.EXT_CODE), rowCount++);
addPackRow(sheet, CN_NAME, ig.getName(), rowCount++);
addPackRow(sheet, CN_TITLE, ig.getTitle(), rowCount++);
addPackRow(sheet, CN_VERSION, ig.getVersion(), rowCount++);
addPackRow(sheet, CN_DESCRIPTION, ig.getDescription(), rowCount++);
addPackRow(sheet, CN_PUBLISHER, ig.getPublisher(), rowCount++);
addPackRow(sheet, CN_STATUS, ig.getStatus().toCode(), rowCount++);
addPackRow(sheet, CN_EXPERIMENTAL, ig.getExperimentalElement().primitiveValue(), rowCount++);
addPackRow(sheet, CN_DATE, ig.getDateElement().primitiveValue(), rowCount++);
addPackRow(sheet, CN_FMM, BuildExtensions.readStringExtension(ig, BuildExtensions.EXT_FMM_LEVEL), rowCount++);
addPackRow(sheet, CN_WORK_GROUP, BuildExtensions.readStringExtension(ig, BuildExtensions.EXT_WORKGROUP), rowCount++);
addPackRow(sheet, CN_INTRODUCTION, BuildExtensions.readStringExtension(ig, BuildExtensions.EXT_INTRODUCTION), rowCount++);
addPackRow(sheet, CN_NOTES, BuildExtensions.readStringExtension(ig, BuildExtensions.EXT_NOTES), rowCount++);
for (ImplementationGuideDefinitionResourceComponent res : ig.getDefinition().getResource()) {
String r = res.getReference().getReference();
String id = r.substring(r.indexOf("/") + 1);
if (r.startsWith("SearchParameter/")) {
addPackRow(sheet, CN_SEARCH_PARAMETER, id, rowCount++);
} else if (r.startsWith("StructureDefinition/")) {
String fn = fnExt(id);
if (new File(fn).exists()) {
addPackRow(sheet, CN_EXTENSION, id, rowCount++);
} else {
addPackRow(sheet, CN_PROFILE, id, rowCount++);
}
} else {
addPackRow(sheet, CN_EXAMPLE, r, rowCount++);
}
}
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project kindling by HL7.
the class SpreadSheetCreator method addExamples.
private void addExamples(XSSFWorkbook excel) throws FHIRFormatError, FileNotFoundException, IOException {
ListResource list = (ListResource) parseXml(fnExamples());
list.setText(null);
XSSFSheet sheet = excel.createSheet(SN_EXAMPLES);
addExampleColumns(sheet);
int rowCount = 0;
for (ListResourceEntryComponent li : list.getEntry()) {
rowCount++;
addExample(sheet, li, rowCount);
}
}
Aggregations