update to generation
modified file name processing
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java
index 584b18f..4d0e273 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java
@@ -74,6 +74,8 @@
public String pcpName;
+ public String completePath;
+
}
protected static class GetValue extends DatatypesSwitch<String> {
@@ -218,7 +220,7 @@
}
}
} catch (Exception ex) {
- System.out.println("boom" + value + " " + format.toPattern());
+ // System.out.println("boom" + value + " " + format.toPattern());
}
return null;
}
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
index 0c54c80..9f61ac1 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
@@ -89,6 +89,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentDescription;
@@ -1240,7 +1241,7 @@
}
}
- boolean walkZipFile() {
+ boolean walkZipFile(String prefix) {
while (!zipInputStreams.isEmpty()) {
@@ -1262,13 +1263,15 @@
// zipInputStream is now the input stream for the xml document
byte[] buffer = ByteStreams.toByteArray(zipInputStream);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(buffer);
- wrapper = new WrapperForZipEnty(fileName, entry, byteArrayInputStream);
+ wrapper = new WrapperForZipEnty(prefix, entry, byteArrayInputStream);
return true;
}
if ("ZIP".equalsIgnoreCase(FilenameUtils.getExtension(entry.getName()))) {
ZipInputStream embeddedZipInputStream = new ZipInputStream(zipInputStream);
zipInputStreams.push(embeddedZipInputStream);
- walkZipFile();
+ if (walkZipFile(prefix + "/" + FilenameUtils.getBaseName(entry.getName()))) {
+ return true;
+ }
}
}
} else {
@@ -1291,7 +1294,7 @@
*/
@Override
public boolean hasNext() {
- return walkZipFile();
+ return walkZipFile(FilenameUtils.getBaseName(fileName));
}
/*
@@ -1574,12 +1577,12 @@
InFulfillmentOf iffo = query.getEObject(InFulfillmentOf.class);
String fileName = file.getName();
- if (file instanceof WrapperForZipEnty) {
- fileName = fileName.substring(fileName.indexOf(" ") + 1);
- }
+ // if (file instanceof WrapperForZipEnty) {
+ // fileName = fileName.substring(fileName.indexOf(" ") + 1);
+ // }
DocumentMetadata documentMetadata = SpreadsheetSerializer.appendToPatientSheet(
- query, documentsSheet, patientRole, ir, iffo, fileName);
+ query, documentsSheet, patientRole, ir, iffo, file);
SpreadsheetSerializer.appendToDemographicsSheet(
query, demographicsSheet, documentMetadata, patientRole);
@@ -1947,7 +1950,7 @@
* @author seanmuir
*
*/
- private static class WrapperForZipEnty implements IFile {
+ public static class WrapperForZipEnty implements IFile {
ZipFile zipFile;
@@ -1966,7 +1969,7 @@
}
public WrapperForZipEnty(String prefix, ZipEntry zipEntry, InputStream inputStream) {
- this.prefix = FilenameUtils.getBaseName(prefix);
+ this.prefix = prefix;
this.zipEntry = zipEntry;
this.inputStream = inputStream;
}
@@ -2967,8 +2970,8 @@
*/
@Override
public IPath getFullPath() {
-
- return null;
+ IPath path = new Path(prefix);
+ return path;
}
/*
@@ -2978,7 +2981,7 @@
*/
@Override
public String getName() {
- return prefix + " " + FilenameUtils.getName(zipEntry.getName());
+ return FilenameUtils.getName(zipEntry.getName());
}
/*
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
index 7ca1384..7925784 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
@@ -12,9 +12,6 @@
static String replaceSpace(String input) {
String t = input.replaceAll(" ", "_");
- if (t.contains("__")) {
- System.out.println("t" + t);
- }
return t;
}
@@ -168,7 +165,7 @@
row2.createCell(offset++).setCellValue(replaceSpace("Location"));
row2.getSheet().setColumnHidden(offset - 1, hideColumns);
row2.createCell(offset++).setCellValue(replaceSpace("Section Title"));
- row2.createCell(offset++).setCellValue(replaceSpace("File Name"));
+ row2.createCell(offset++).setCellValue(replaceSpace("File Location"));
return offset;
}
@@ -258,7 +255,7 @@
static int addSectionHeader(Row row1, int offset) {
row1.createCell(offset++).setCellValue(replaceSpace("Section Title"));
- row1.createCell(offset++).setCellValue(replaceSpace("File Name"));
+ row1.createCell(offset++).setCellValue(replaceSpace("File Location"));
row1.createCell(offset++).setCellValue(replaceSpace("Narrative"));
return offset;
@@ -304,7 +301,7 @@
row2.createCell(offset++).setCellValue(replaceSpace("Performer"));
row2.createCell(offset++).setCellValue(replaceSpace("Organization"));
row2.createCell(offset++).setCellValue(replaceSpace("Section Title"));
- row2.createCell(offset++).setCellValue(replaceSpace("File Name"));
+ row2.createCell(offset++).setCellValue(replaceSpace("File Location"));
return offset;
}
@@ -407,7 +404,7 @@
row2.createCell(offset++).setCellValue(replaceSpace("Performer"));
row2.createCell(offset++).setCellValue(replaceSpace("Organization"));
row2.createCell(offset++).setCellValue(replaceSpace("Section Title"));
- row2.createCell(offset++).setCellValue(replaceSpace("File Name"));
+ row2.createCell(offset++).setCellValue(replaceSpace("File Location"));
return offset;
}
@@ -420,7 +417,7 @@
public static int createNarrativeHeader(Row row1, Row row2, int offset) {
row2.createCell(offset++).setCellValue(replaceSpace("Narrative"));
row2.createCell(offset++).setCellValue(replaceSpace("Section Title"));
- row2.createCell(offset++).setCellValue(replaceSpace("File Name"));
+ row2.createCell(offset++).setCellValue(replaceSpace("File Location"));
return offset;
}
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
index ab87694..73e77ad 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
@@ -22,6 +22,7 @@
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFSheet;
+import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
@@ -29,6 +30,7 @@
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.mdht.cda.xml.ui.handlers.AnalyzeCDAHandler.CDAAnalaysisInput.CDAMetrics;
import org.eclipse.mdht.cda.xml.ui.handlers.CDAValueUtil.DocumentMetadata;
+import org.eclipse.mdht.cda.xml.ui.handlers.GenerateCDADataHandler.WrapperForZipEnty;
import org.eclipse.mdht.uml.cda.Act;
import org.eclipse.mdht.uml.cda.AssignedAuthor;
import org.eclipse.mdht.uml.cda.Author;
@@ -106,7 +108,7 @@
* language
* phone #
*/
- serializeSectionAndFileName(row, offset, null, documentMetadata.fileName);
+ serializeSectionAndFileName(row, offset, null, documentMetadata.completePath);
}
@@ -128,7 +130,7 @@
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
int offset = serializePatient(row, 0, documentMetadata, patientRole);
offset = serializeEncounter(row, offset, encounter);
- offset = serializeSectionAndFileName(row, offset, encounter.getSection(), fileName);
+ offset = serializeSectionAndFileName(row, offset, encounter.getSection(), documentMetadata.completePath);
offset = appendValidation(row, offset, encounter);
}
@@ -794,7 +796,7 @@
offset = serializeProcedureActivityProcedure(row, offset, sa);
- offset = serializeSectionAndFileName(row, offset, sa.getSection(), fileName);
+ offset = serializeSectionAndFileName(row, offset, sa.getSection(), organizationAndSoftware.completePath);
offset = appendValidation(row, offset, sa);
@@ -816,14 +818,15 @@
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
int offset = serializePatient(row, 0, organizationAndSoftware, patientRole);
offset = serializeEncounter(row, offset, encoutner);
- serializeSectionAndFileName(row, offset, encoutner.getSection(), fileName);
+ serializeSectionAndFileName(row, offset, encoutner.getSection(), organizationAndSoftware.completePath);
offset = appendValidation(row, offset, encoutner);
}
}
}
static DocumentMetadata appendToPatientSheet(Query query, Sheet sheet, PatientRole patientRole,
- InformationRecipient ir, InFulfillmentOf iffo, String fileName) {
+ InformationRecipient ir, InFulfillmentOf iffo, IFile theFile) {
+ String fileName = theFile.getName();
DocumentMetadata documentMetadata = new DocumentMetadata();
@@ -854,6 +857,13 @@
documentMetadata.fileName = fileName;
+ if (theFile instanceof WrapperForZipEnty) {
+ WrapperForZipEnty wrapperForZipEnty = (WrapperForZipEnty) theFile;
+ documentMetadata.completePath = wrapperForZipEnty.getFullPath().toOSString();
+ } else {
+ documentMetadata.completePath = fileName;
+ }
+
// String documentOrganization = "";
// String documentSoftware = "";
if (!cd.getAuthors().isEmpty()) {
@@ -953,6 +963,13 @@
return documentMetadata;
}
+ /**
+ * @param row
+ * @param offset
+ * @param object
+ * @param fileName
+ */
+
static void appendToResultsSheet(Query query, Sheet sheet, DocumentMetadata organizationAndSoftware,
PatientRole patientRole, ServiceEvent serviceEvent, List<? extends Organizer> results,
List<Encounter> encounters, String fileName) {
@@ -964,7 +981,8 @@
offset = SpreadsheetSerializer.serializeEnounterID(row, offset, sa, encounters);
offset = serializeOrganizer(row, offset, sa, true, false);
offset = serializeObservation(row, offset, resultObservation);
- offset = serializeSectionAndFileName(row, offset, sa.getSection(), fileName);
+ offset = serializeSectionAndFileName(
+ row, offset, sa.getSection(), organizationAndSoftware.completePath);
offset = appendValidation(row, offset, sa);
}
}
@@ -986,7 +1004,7 @@
offset = serializePatient(row, offset, organizationAndSoftware, patientRole);
offset = SpreadsheetSerializer.serializeEnounterID(row, offset, sa, encounters);
offset = serializeSubstanceAdministration(row, offset, sa);
- offset = serializeSectionAndFileName(row, offset, sa.getSection(), fileName);
+ offset = serializeSectionAndFileName(row, offset, sa.getSection(), organizationAndSoftware.completePath);
offset = appendValidation(row, offset, sa);
}
}
@@ -1012,7 +1030,8 @@
offset = SpreadsheetSerializer.serializeEnounterID(row, offset, organizer, encounters);
offset = serializeOrganizer(row, offset, organizer, false, false);
offset = serializeObservation(row, offset, observation);
- serializeSectionAndFileName(row, offset, observation.getSection(), fileName);
+ serializeSectionAndFileName(
+ row, offset, observation.getSection(), organizationAndSoftware.completePath);
offset = appendValidation(row, offset, observation);
}
@@ -1810,7 +1829,7 @@
* @param section
* @param encoutner
*/
- static int serializeSectionAndFileName(Row row, int offset, Section section, String fileName) {
+ static int serializeSectionAndFileName(Row row, int offset, Section section, String fileLocation) {
String narrativeText = "";
@@ -1842,7 +1861,7 @@
// row.createCell(offset++).setCellValue("");
// }
Cell cell = row.createCell(offset++);
- cell.setCellValue(fileName);
+ cell.setCellValue(fileLocation);
if (!StringUtils.isEmpty(narrativeText)) {
row.createCell(offset++).setCellValue(narrativeText);