use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project org.hl7.fhir.core by hapifhir.
the class ConceptMapSpreadsheetGenerator method renderGroup.
private void renderGroup(ConceptMapGroupComponent grp, int i) {
Sheet sheet = makeSheet("Mapping Table " + Integer.toString(i));
addHeaders(sheet, "Source", "Display", "Relationship", "Target", "Display");
addRow(sheet, grp.getSource(), "", "", grp.getTarget(), "");
for (SourceElementComponent s : grp.getElement()) {
for (TargetElementComponent t : s.getTarget()) {
addRow(sheet, s.getCode(), s.getDisplay(), t.getEquivalenceElement().asStringValue(), t.getCode(), t.getDisplay());
}
}
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project org.hl7.fhir.core by hapifhir.
the class StructureDefinitionSpreadsheetGenerator method processElement.
public void processElement(Sheet sheet, StructureDefinition sd, ElementDefinition ed) throws Exception {
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
int i = 0;
addCell(row, i++, ed.getPath(), styles.get("body"));
addCell(row, i++, ed.getSliceName());
addCell(row, i++, itemList(ed.getAlias()));
addCell(row, i++, ed.getLabel());
addCell(row, i++, ed.getMin());
addCell(row, i++, ed.getMax());
addCell(row, i++, ed.getMustSupport() ? "Y" : "");
addCell(row, i++, ed.getIsModifier() ? "Y" : "");
addCell(row, i++, ed.getIsSummary() ? "Y" : "");
addCell(row, i++, itemList(ed.getType()));
addCell(row, i++, ed.getShort());
addCell(row, i++, ed.getDefinition());
addCell(row, i++, ed.getComment());
addCell(row, i++, ed.getRequirements());
addCell(row, i++, ed.getDefaultValue() != null ? renderType(ed.getDefaultValue()) : "");
addCell(row, i++, ed.getMeaningWhenMissing());
addCell(row, i++, ed.hasFixed() ? renderType(ed.getFixed()) : "");
addCell(row, i++, ed.hasPattern() ? renderType(ed.getPattern()) : "");
// todo...?
addCell(row, i++, ed.hasExample() ? renderType(ed.getExample().get(0).getValue()) : "");
addCell(row, i++, ed.hasMinValue() ? renderType(ed.getMinValue()) : "");
addCell(row, i++, ed.hasMaxValue() ? renderType(ed.getMaxValue()) : "");
addCell(row, i++, (ed.hasMaxLength() ? Integer.toString(ed.getMaxLength()) : ""));
if (ed.hasBinding()) {
addCell(row, i++, ed.getBinding().getStrength() != null ? ed.getBinding().getStrength().toCode() : "");
addCell(row, i++, ed.getBinding().getDescription());
if (ed.getBinding().getValueSet() == null)
addCell(row, i++, "");
else
addCell(row, i++, ed.getBinding().getValueSet());
} else {
addCell(row, i++, "");
addCell(row, i++, "");
addCell(row, i++, "");
}
addCell(row, i++, itemList(ed.getCode()));
if (ed.hasSlicing()) {
addCell(row, i++, itemList(ed.getSlicing().getDiscriminator()));
addCell(row, i++, ed.getSlicing().getDescription());
addCell(row, i++, ed.getSlicing().getOrdered());
addCell(row, i++, ed.getSlicing().getRules() != null ? ed.getSlicing().getRules().toCode() : "");
} else {
addCell(row, i++, "");
addCell(row, i++, "");
addCell(row, i++, "");
addCell(row, i++, "");
}
if (ed.getBase() != null) {
addCell(row, i++, ed.getBase().getPath());
addCell(row, i++, ed.getBase().getMin());
addCell(row, i++, ed.getBase().getMax());
} else {
addCell(row, i++, "");
addCell(row, i++, "");
addCell(row, i++, "");
}
addCell(row, i++, itemList(ed.getCondition()));
addCell(row, i++, itemList(ed.getConstraint()));
for (StructureDefinitionMappingComponent mapKey : sd.getMapping()) {
String mapString = "";
for (ElementDefinitionMappingComponent map : ed.getMapping()) {
if (map.getIdentity().equals(mapKey.getIdentity()))
mapString = map.getMap();
}
addCell(row, i++, mapString);
}
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project org.hl7.fhir.core by hapifhir.
the class StructureDefinitionSpreadsheetGenerator method configureSheet.
public void configureSheet(Sheet sheet, StructureDefinition sd) throws IOException {
for (int i = 0; i < 34; i++) {
sheet.autoSizeColumn(i);
}
sheet.setColumnHidden(2, true);
sheet.setColumnHidden(3, true);
sheet.setColumnHidden(30, true);
sheet.setColumnHidden(31, true);
sheet.setColumnHidden(32, true);
sheet.setColumnWidth(9, columnPixels(20));
sheet.setColumnWidth(11, columnPixels(100));
sheet.setColumnWidth(12, columnPixels(100));
sheet.setColumnWidth(13, columnPixels(100));
sheet.setColumnWidth(15, columnPixels(20));
sheet.setColumnWidth(16, columnPixels(20));
sheet.setColumnWidth(17, columnPixels(20));
sheet.setColumnWidth(18, columnPixels(20));
sheet.setColumnWidth(34, columnPixels(100));
int i = titles.length - 1;
for (StructureDefinitionMappingComponent map : sd.getMapping()) {
i++;
sheet.setColumnWidth(i, columnPixels(50));
sheet.autoSizeColumn(i);
// sheet.setColumnHidden(i, true);
}
sheet.createFreezePane(2, 1);
if (hideMustSupportFalse) {
SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();
String address = "A2:AI" + Math.max(Integer.valueOf(sheet.getLastRowNum()), 2);
CellRangeAddress[] regions = { CellRangeAddress.valueOf(address) };
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule("$G2<>\"Y\"");
PatternFormatting fill1 = rule1.createPatternFormatting();
fill1.setFillBackgroundColor(IndexedColors.GREY_25_PERCENT.index);
fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule("$Q2<>\"\"");
FontFormatting font = rule2.createFontFormatting();
font.setFontColorIndex(IndexedColors.GREY_25_PERCENT.index);
font.setFontStyle(true, false);
sheetCF.addConditionalFormatting(regions, rule1, rule2);
sheet.setAutoFilter(new CellRangeAddress(0, sheet.getLastRowNum(), 0, titles.length + sd.getMapping().size() - 1));
XSSFSheet xSheet = (XSSFSheet) sheet;
CTAutoFilter sheetFilter = xSheet.getCTWorksheet().getAutoFilter();
CTFilterColumn filterColumn1 = sheetFilter.addNewFilterColumn();
filterColumn1.setColId(6);
CTCustomFilters filters = filterColumn1.addNewCustomFilters();
CTCustomFilter filter1 = filters.addNewCustomFilter();
filter1.setOperator(STFilterOperator.NOT_EQUAL);
filter1.setVal(" ");
CTFilterColumn filterColumn2 = sheetFilter.addNewFilterColumn();
filterColumn2.setColId(26);
CTFilters filters2 = filterColumn2.addNewFilters();
filters2.setBlank(true);
// We have to apply the filter ourselves by hiding the rows:
for (Row row : sheet) {
if (row.getRowNum() > 0 && (!row.getCell(6).getStringCellValue().equals("Y") || !row.getCell(26).getStringCellValue().isEmpty())) {
((XSSFRow) row).getCTRow().setHidden(true);
}
}
}
sheet.setActiveCell(new CellAddress(sheet.getRow(1).getCell(0)));
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project org.hl7.fhir.core by hapifhir.
the class StructureDefinitionSpreadsheetGenerator method addStructureDefinitionMetadata.
private void addStructureDefinitionMetadata(Sheet sheet, StructureDefinition sd) {
for (Coding k : sd.getKeyword()) {
addMetadataRow(sheet, "Keyword", dr.display(k));
}
addMetadataRow(sheet, "FHIR Version", sd.getFhirVersionElement().asStringValue());
addMetadataRow(sheet, "Kind", sd.getKindElement().asStringValue());
addMetadataRow(sheet, "Type", sd.getType());
addMetadataRow(sheet, "Base Definition", sd.getBaseDefinition());
addMetadataRow(sheet, "Abstract", sd.getAbstractElement().asStringValue());
addMetadataRow(sheet, "Derivation", sd.getDerivationElement().asStringValue());
for (StructureDefinitionContextComponent k : sd.getContext()) {
addMetadataRow(sheet, "Context", k.getTypeElement().asStringValue() + ":" + k.getExpression());
}
for (StringType k : sd.getContextInvariant()) {
addMetadataRow(sheet, "Context Inv.", k.getValue());
}
}
use of org.hl7.fhir.utilities.xls.XLSXmlParser.Sheet in project org.hl7.fhir.core by hapifhir.
the class ValueSetSpreadsheetGenerator method genExpansionParams.
private void genExpansionParams(List<ValueSetExpansionParameterComponent> params) {
Sheet sheet = makeSheet("Expansion Parameters");
addHeaders(sheet, "Parameter", "Value");
for (ValueSetExpansionParameterComponent p : params) {
addRow(sheet, p.getName(), dr.display(p.getValue()));
}
}
Aggregations