diff options
author | smuir | 2019-04-08 21:49:52 +0000 |
---|---|---|
committer | smuir | 2019-04-08 21:49:52 +0000 |
commit | 14deab53e99664900a86b1895b294e160c31a345 (patch) | |
tree | 5b41438f1d6483045c333519042bdf0af885e180 | |
parent | d7ab84346d6ebaa169b3b688c7e1c4c64b801e77 (diff) | |
download | org.eclipse.mdht-14deab53e99664900a86b1895b294e160c31a345.tar.gz org.eclipse.mdht-14deab53e99664900a86b1895b294e160c31a345.tar.xz org.eclipse.mdht-14deab53e99664900a86b1895b294e160c31a345.zip |
Update to CDA processing
Added validation to spreadsheet
5 files changed, 61 insertions, 7 deletions
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/DeidentifyCDAHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/DeidentifyCDAHandler.java index da3e4589..7b4982f9 100644 --- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/DeidentifyCDAHandler.java +++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/DeidentifyCDAHandler.java @@ -583,7 +583,7 @@ public class DeidentifyCDAHandler extends AbstractHandler { int i = file.getName().lastIndexOf(file.getFileExtension()); - IFile df = f.getFile(file.getName().substring(0, i - 1) + "_D" + ".xml"); + IFile df = f.getFile(file.getName().substring(0, i - 1) + "_DeIdentified.xml"); try (OutputStream fileOut = Files.newOutputStream(Paths.get(df.getLocation().toOSString()))) { CDAUtil.save(clinicalDocument, fileOut); 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 bb572f33..aa356c0a 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 @@ -268,6 +268,8 @@ public class GenerateCDADataHandler extends GenerateCDABaseHandler { static boolean omitUnits = false; + static boolean omitValidation = false; + static HashMap<String, String> organizations = new HashMap<String, String>(); static String preferenceFilters; @@ -350,6 +352,9 @@ public class GenerateCDADataHandler extends GenerateCDABaseHandler { preferenceFilters = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getString( MDHTPreferences.CDA_REPORT_DEFAULT_FILTER); + omitValidation = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getBoolean( + MDHTPreferences.OMIT_VALIDATION_STORE_VALUE); + final HashSet<EClass> theSections = new HashSet<EClass>(); final HashMap<EClass, HashSet<EClass>> theSectionCache = new HashMap<EClass, HashSet<EClass>>(); 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 d0e0afd7..7883c284 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 @@ -25,6 +25,7 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.streaming.SXSSFSheet; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.Diagnostician; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.mdht.cda.xml.ui.handlers.CDAValueUtil.DocumentMetadata; @@ -125,7 +126,9 @@ public class SpreadsheetSerializer { Row row = sheet.createRow(sheet.getPhysicalNumberOfRows()); int offset = serializePatient(row, 0, documentMetadata, patientRole); offset = serializeEncounter(row, offset, encounter); - serializeSectionAndFileName(row, offset, encounter.getSection(), fileName); + offset = serializeSectionAndFileName(row, offset, encounter.getSection(), fileName); + offset = appendValidation(row, offset, encounter); + } } @@ -781,7 +784,9 @@ public class SpreadsheetSerializer { offset = serializeProcedureActivityProcedure(row, offset, sa); - serializeSectionAndFileName(row, offset, sa.getSection(), fileName); + offset = serializeSectionAndFileName(row, offset, sa.getSection(), fileName); + + offset = appendValidation(row, offset, sa); } @@ -802,6 +807,7 @@ public class SpreadsheetSerializer { int offset = serializePatient(row, 0, organizationAndSoftware, patientRole); offset = serializeEncounter(row, offset, encoutner); serializeSectionAndFileName(row, offset, encoutner.getSection(), fileName); + offset = appendValidation(row, offset, encoutner); } } } @@ -948,7 +954,8 @@ public class SpreadsheetSerializer { offset = SpreadsheetSerializer.serializeEnounterID(row, offset, sa, encounters); offset = serializeOrganizer(row, offset, sa, true, false); offset = serializeObservation(row, offset, resultObservation); - serializeSectionAndFileName(row, offset, sa.getSection(), fileName); + offset = serializeSectionAndFileName(row, offset, sa.getSection(), fileName); + offset = appendValidation(row, offset, sa); } } } @@ -969,7 +976,8 @@ public class SpreadsheetSerializer { offset = serializePatient(row, offset, organizationAndSoftware, patientRole); offset = SpreadsheetSerializer.serializeEnounterID(row, offset, sa, encounters); offset = serializeSubstanceAdministration(row, offset, sa); - serializeSectionAndFileName(row, offset, sa.getSection(), fileName); + offset = serializeSectionAndFileName(row, offset, sa.getSection(), fileName); + offset = appendValidation(row, offset, sa); } } @@ -995,6 +1003,7 @@ public class SpreadsheetSerializer { offset = serializeOrganizer(row, offset, organizer, false, false); offset = serializeObservation(row, offset, observation); serializeSectionAndFileName(row, offset, observation.getSection(), fileName); + offset = appendValidation(row, offset, observation); } } @@ -2002,4 +2011,29 @@ public class SpreadsheetSerializer { return offset; } + public static int appendValidation(Row row, int offset, EObject target) { + + if (!GenerateCDADataHandler.omitValidation) { + + Diagnostic diagnostic = Diagnostician.INSTANCE.validate(target); + + ValidationResult vr = new ValidationResult(); + + if (diagnostic.getChildren().size() > 0) { + processDiagnostic(diagnostic, vr); + } + + StringBuffer sb = new StringBuffer(); + + for (Diagnostic dq : vr.getErrorDiagnostics()) { + + sb.append(dq.getMessage()).append("\r"); + + } + row.createCell(offset++).setCellValue(sb.toString()); + } + + return offset; + } + } diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/StripCDANarrativeHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/StripCDANarrativeHandler.java index 0545a5ab..5663ee54 100644 --- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/StripCDANarrativeHandler.java +++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/StripCDANarrativeHandler.java @@ -213,7 +213,7 @@ public class StripCDANarrativeHandler extends AbstractHandler { int i = file.getName().lastIndexOf(file.getFileExtension()); - IFile df = f.getFile(file.getName().substring(0, i - 1) + "_D" + ".xml"); + IFile df = f.getFile(file.getName().substring(0, i - 1) + "_NoNarrative.xml"); try (OutputStream fileOut = Files.newOutputStream(Paths.get(df.getLocation().toOSString()))) { CDAUtil.save(clinicalDocument, fileOut); diff --git a/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java b/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java index 72ced605..8fdd1074 100644 --- a/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java +++ b/cda/plugins/org.eclipse.mdht.uml.cda.ui/src/org/eclipse/mdht/uml/cda/ui/editors/MDHTPreferences.java @@ -84,6 +84,8 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere public static String OMIT_UNITS_STORE_VALUE = "OmitUnitsCheckValue"; + public static String OMIT_VALIDATION_STORE_VALUE = "OmitValidationStoreValue"; + public static String CDA_REPORT_DEFAULT_FILTER = "CDAReportDefaultFilter"; private static String OMIT_DOB_CHECK_BOX_LABEL = "Omit DOB and Patient Name from XLS Reports"; @@ -94,10 +96,14 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere private static String OMIT_UNITS_CHECK_BOX_LABEL = "Omit Quantity Units from XLS Reports"; + private static String OMIT_VALIDATION_CHECK_BOX_LABEL = "Omit CDA Validation from XLS Reports"; + + private static String OMIT_VALIDATION_CHECK_BOX_TOOLTIP = "Do not include DCDA Validation in reports"; + /** * FilterListSelectionDialog * The dialog buttons were not easily accessible to change the text for OK and Cancel - * + * * @TODO This might not be the correct way to do this * @author seanmuir * @@ -141,6 +147,8 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere private Text cdaReportFilterText; + private Button omitValidationCheckBox; + final ArrayList<String> cdaReportfilters = new ArrayList<String>(); /** @@ -324,6 +332,10 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere Composite dob_composite_textField = createComposite(parent, 2); omitDOBCheckBox = createCheckBox(dob_composite_textField, OMIT_DOB_CHECK_BOX_LABEL, OMIT_DOB_CHECK_BOX_TOOLTIP); + Composite validateion_composite_textField = createComposite(parent, 2); + omitValidationCheckBox = createCheckBox( + validateion_composite_textField, OMIT_VALIDATION_CHECK_BOX_LABEL, OMIT_VALIDATION_CHECK_BOX_TOOLTIP); + Composite units_composite_textField = createComposite(parent, 2); omitUnitsCheckBox = createCheckBox( units_composite_textField, OMIT_UNITS_CHECK_BOX_LABEL, OMIT_UNITS_CHECK_BOX_TOOLTIP); @@ -372,6 +384,7 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere disablePdfGenerationCheckBox.setSelection(store.getBoolean(PDF_GEN_STORE_VALUE)); omitDOBCheckBox.setSelection(store.getBoolean(OMIT_DOB_STORE_VALUE)); omitUnitsCheckBox.setSelection(store.getBoolean(OMIT_UNITS_STORE_VALUE)); + omitValidationCheckBox.setSelection(store.getBoolean(OMIT_VALIDATION_STORE_VALUE)); cdaReportFilterText.setText(NONE); } @@ -384,6 +397,7 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere disablePdfGenerationCheckBox.setSelection(store.getBoolean(PDF_GEN_STORE_VALUE)); omitDOBCheckBox.setSelection(store.getBoolean(OMIT_DOB_STORE_VALUE)); omitUnitsCheckBox.setSelection(store.getBoolean(OMIT_UNITS_STORE_VALUE)); + omitValidationCheckBox.setSelection(store.getBoolean(OMIT_VALIDATION_STORE_VALUE)); String preferenceFilters = store.getString(CDA_REPORT_DEFAULT_FILTER); cdaReportFilterText.setText(formatFilterNames(Arrays.asList(preferenceFilters.split("\\s*,\\s*")))); } @@ -409,6 +423,7 @@ public class MDHTPreferences extends PreferencePage implements IWorkbenchPrefere store.setValue(PDF_GEN_STORE_VALUE, disablePdfGenerationCheckBox.getSelection()); store.setValue(OMIT_DOB_STORE_VALUE, omitDOBCheckBox.getSelection()); store.setValue(OMIT_UNITS_STORE_VALUE, omitUnitsCheckBox.getSelection()); + store.setValue(OMIT_VALIDATION_STORE_VALUE, omitValidationCheckBox.getSelection()); StringBuilder sb = new StringBuilder(); for (String filter : cdaReportfilters) { if (sb.length() > 0) { |