Updates to generate

Modified preferences to suport DOD
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 1a1bbc1..0ddc6a7 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
@@ -21,9 +21,6 @@
 import javax.swing.text.html.parser.ParserDelegator;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.CreationHelper;
-import org.apache.poi.ss.usermodel.Workbook;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.mdht.uml.cda.AssignedAuthor;
 import org.eclipse.mdht.uml.cda.Author;
@@ -193,6 +190,8 @@
 
 	static final SimpleDateFormat DATE_PRETTY = new SimpleDateFormat("MM/dd/yyyy");
 
+	static final SimpleDateFormat DATETIME_PRETTY = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss Z");
+
 	/**
 	 * @param section
 	 * @param any
@@ -290,16 +289,6 @@
 
 	}
 
-	static CellStyle getDocumentDateStylezzz(Workbook workbook) {
-		if (!GenerateCDADataHandler.documentDateStyles.containsKey(workbook)) {
-			CellStyle documentDateStyle = workbook.createCellStyle();
-			CreationHelper createHelper = workbook.getCreationHelper();
-			documentDateStyle.setDataFormat(createHelper.createDataFormat().getFormat("mm/dd/yyyy hh:mm AM/PM"));
-			GenerateCDADataHandler.documentDateStyles.put(workbook, documentDateStyle);
-		}
-		return GenerateCDADataHandler.documentDateStyles.get(workbook);
-	}
-
 	static String getKey(II ii) {
 		if (ii.getRoot() != null) {
 			if (ii.getExtension() != 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 07100d1..9184d91 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
@@ -54,15 +54,11 @@
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.poi.openxml4j.util.ZipSecureFile;
 import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.streaming.SXSSFRow;
 import org.apache.poi.xssf.streaming.SXSSFSheet;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.xmlbeans.ThreadLocalUtil;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -285,8 +281,6 @@
 	 */
 	private static final String DIVIDER_PATTERN = "(?<=[^\\p{Lu}])(?=\\p{Lu})" + "|(?<=[\\p{Ll}])(?=\\d)";
 
-	static HashMap<Workbook, CellStyle> documentDateStyles = new HashMap<Workbook, CellStyle>();
-
 	static ExtractText extractText = new ExtractText();
 
 	private static final String FILTER = "org.eclipse.mdht.cda.xml.ui.filter";
@@ -297,6 +291,8 @@
 
 	static boolean omitDOB = false;
 
+	static boolean omitDOD = false;
+
 	static boolean omitUnits = false;
 
 	static boolean omitValidation = false;
@@ -486,6 +482,9 @@
 		omitDOB = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getBoolean(
 			MDHTPreferences.OMIT_DOB_STORE_VALUE);
 
+		omitDOD = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getBoolean(
+			MDHTPreferences.OMIT_DOD_STORE_VALUE);
+
 		omitUnits = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getBoolean(
 			MDHTPreferences.OMIT_UNITS_STORE_VALUE);
 
@@ -917,55 +916,6 @@
 		return cdaMetrics;
 	}
 
-	void formatxxx(String fileLocation, IProgressMonitor monitor) throws IOException {
-
-		// FileInputStream fis = new FileInputStream(fileLocation);
-
-		try (InputStream fis = Files.newInputStream(Paths.get(fileLocation))) {
-
-			monitor.subTask(
-				"ReOpening  " + CDAValueUtil.DATE_FORMAT3.format(new Date()) + "_" + fileLocation.toUpperCase() +
-						"_SA.xlsx");
-			XSSFWorkbook wb = new XSSFWorkbook(fis);
-			monitor.subTask(
-				"Opened  " + CDAValueUtil.DATE_FORMAT3.format(new Date()) + "_" + fileLocation.toUpperCase() +
-						"_SA.xlsx");
-			// CellStyle boldstyle = wb.createCellStyle();
-			// Font boldFont = wb.createFont();
-			// boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
-			// boldstyle.setFont(boldFont);
-
-			for (int sheetCtr = 0; sheetCtr < wb.getNumberOfSheets(); sheetCtr++) {
-
-				Sheet aSheet = wb.getSheetAt(sheetCtr);
-				Row topRow = aSheet.getRow(0);
-				if (topRow != null) {
-					monitor.subTask("Formating Sheet  " + aSheet.getSheetName());
-					int lastcell = topRow.getLastCellNum();
-					for (int columnCtr = 0; columnCtr < lastcell; columnCtr++) {
-						aSheet.autoSizeColumn(columnCtr);
-						if (aSheet.getColumnWidth(columnCtr) > 9999) {
-							aSheet.setColumnWidth(columnCtr, 9999);
-						}
-						// skip section sheet - different formatting
-						if (sheetCtr != 1 && topRow.getCell(columnCtr) != null) {
-							// topRow.getCell(columnCtr).setCellStyle(boldstyle);
-						}
-
-					}
-
-				}
-
-			}
-
-			try (OutputStream fileOut = Files.newOutputStream(Paths.get(fileLocation))) {
-				wb.write(fileOut);
-				fileOut.close();
-				wb.close();
-			}
-		}
-	}
-
 	HashMap<IFile, DocumentMetadata> getDMHash(int document, String splitOption) {
 		int documentIndex;
 
@@ -1499,16 +1449,6 @@
 		ConsolPackage.eINSTANCE.getContinuityOfCareDocument();
 		HITSPPackage.eINSTANCE.getPatientSummary();
 
-		/*
-		 * There is a limitation on the number of cell styles you can create
-		 * We create a global instance of the documentDateStyle for use in the getDocumentDateStyle()
-		 * Set it to null on start up because it is bound to a particular workbook
-		 *
-		 * Not optimal but did not want to send the documentDateStyle as an argument to all the serialization methods
-		 */
-		// documentDateStyle = null;
-
-		documentDateStyles.clear();
 		sheets.clear();
 
 		// sectionbyfileByDocument.clear();
@@ -2086,16 +2026,6 @@
 			List<String> sortedKeys = new ArrayList<String>(sectionbyfile.keySet());
 			Collections.sort(sortedKeys);
 
-			// Font boldFont = wb.createFont();
-			// boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
-			// CellStyle sectionstyle = null;
-			if (sectionsSheet.getWorkbook().getNumCellStyles() < 100) {
-				// sectionstyle = sectionsSheet.getWorkbook().createCellStyle();
-				// sectionstyle.setFillForegroundColor(IndexedColors.BLUE.getIndex());
-				// sectionstyle.setRotation((short) -90);
-				// sectionstyle.setFont(boldFont);
-			}
-
 			SXSSFRow row1 = sectionsSheet.createRow(sectionsSheet.getPhysicalNumberOfRows());
 
 			offset = 0;
@@ -2108,9 +2038,6 @@
 			for (String sectionclass : sortedKeys) {
 				Cell cell = row1.createCell(offset++);
 				cell.setCellValue(sectionclass);
-				// if (sectionstyle != null) {
-				// cell.setCellStyle(sectionstyle);
-				// }
 			}
 
 			row1 = sectionsSheet.createRow(sectionsSheet.getPhysicalNumberOfRows());
@@ -2124,18 +2051,6 @@
 				cell.setCellFormula(strFormula);
 			}
 
-			// CellStyle style = null;
-			if (sectionsSheet.getWorkbook().getNumCellStyles() < 100) {
-				// style = sectionsSheet.getWorkbook().createCellStyle();
-				// style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
-				// style.setFillPattern(CellStyle.SOLID_FOREGROUND);
-				// style.setAlignment(CellStyle.ALIGN_CENTER);
-			}
-
-			// style.setFont(font);
-
-			// CellStyle boldstyle = wb.createCellStyle();
-
 			for (IFile file : files) {
 				if (getDMHash(eClass, splitOption).containsKey(file)) {
 					offset = 0;
@@ -2148,9 +2063,6 @@
 						if (sectionbyfile.get(sectionclass).contains(file)) {
 							Cell cell = row1.createCell(offset++);
 							cell.setCellValue("X");
-							// if (style != null) {
-							// cell.setCellStyle(style);
-							// }
 						} else {
 							row1.createCell(offset++).setCellValue("");
 						}
@@ -3391,8 +3303,6 @@
 			HashSet<EClass> sectionFilter, IFolder folder, String folderName, int documentCounter)
 			throws Exception, Exception {
 
-		// Clear the section cache
-		documentDateStyles.clear();
 		sheets.clear();
 
 		for (Integer eClass : workbooks.keySet()) {
@@ -3409,16 +3319,6 @@
 			List<String> sortedKeys = new ArrayList<String>(sectionbyfile.keySet());
 			Collections.sort(sortedKeys);
 
-			// Font boldFont = wb.createFont();
-			// boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
-			// CellStyle sectionstyle = null;
-			if (sectionsSheet.getWorkbook().getNumCellStyles() < 100) {
-				// sectionstyle = sectionsSheet.getWorkbook().createCellStyle();
-				// sectionstyle.setFillForegroundColor(IndexedColors.BLUE.getIndex());
-				// sectionstyle.setRotation((short) -90);
-				// sectionstyle.setFont(boldFont);
-			}
-
 			SXSSFRow row1 = sectionsSheet.createRow(sectionsSheet.getPhysicalNumberOfRows());
 
 			int offset = 0;
@@ -3431,9 +3331,6 @@
 			for (String sectionclass : sortedKeys) {
 				Cell cell = row1.createCell(offset++);
 				cell.setCellValue(sectionclass);
-				// if (sectionstyle != null) {
-				// cell.setCellStyle(sectionstyle);
-				// }
 			}
 
 			row1 = sectionsSheet.createRow(sectionsSheet.getPhysicalNumberOfRows());
@@ -3443,22 +3340,9 @@
 				Cell cell = row1.createCell(metadataoffset++);
 				String columnLetter = CellReference.convertNumToColString(cell.getColumnIndex());
 				String strFormula = "COUNTIF(" + columnLetter + "3:" + columnLetter + (files.size() + 2) + ",\"X\")";
-				// cell.setCellType(Cell.CELL_TYPE_FORMULA);
 				cell.setCellFormula(strFormula);
 			}
 
-			// CellStyle style = null;
-			if (sectionsSheet.getWorkbook().getNumCellStyles() < 100) {
-				// style = sectionsSheet.getWorkbook().createCellStyle();
-				// style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
-				// style.setFillPattern(CellStyle.SOLID_FOREGROUND);
-				// style.setAlignment(CellStyle.ALIGN_CENTER);
-			}
-
-			// style.setFont(font);
-
-			// CellStyle boldstyle = wb.createCellStyle();
-
 			for (IFile file : files) {
 				if (getDMHash(eClass, splitOption).containsKey(file)) {
 					offset = 0;
@@ -3471,9 +3355,6 @@
 						if (sectionbyfile.get(sectionclass).contains(file)) {
 							Cell cell = row1.createCell(offset++);
 							cell.setCellValue("X");
-							// if (style != null) {
-							// cell.setCellStyle(style);
-							// }
 						} else {
 							row1.createCell(offset++).setCellValue("");
 						}
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 0ce322a..9ec37ae 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
@@ -136,6 +136,10 @@
 			}
 			row2.createCell(offset++).setCellValue(replaceSpace("DOB"));
 		}
+
+		if (!GenerateCDADataHandler.omitDOD) {
+			row2.createCell(offset++).setCellValue(replaceSpace("DOD"));
+		}
 		offset = createDocumentMedadataHeadder(row2, offset, false);
 		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 d3b403f..7ed8d35 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
@@ -1171,8 +1171,7 @@
 
 		if (documentMetadata.documentDate != null) {
 			cell = row.createCell(offset++);
-			// cell.setCellStyle(CDAValueUtil.getDocumentDateStyle(row.getSheet().getWorkbook()));
-			cell.setCellValue(documentMetadata.documentDate);
+			cell.setCellValue(CDAValueUtil.DATE_PRETTY.format(documentMetadata.documentDate));
 		} else {
 			row.createCell(offset++);
 		}
@@ -1568,7 +1567,13 @@
 						? patientRole.getPatient()
 						: null));
 		}
-		;
+		if (!GenerateCDADataHandler.omitDOD) {
+			cell = row.createCell(offset++);
+			if (patientRole.getPatient().getSDTCDeceasedTime() != null) {
+				Date dodDate = CDAValueUtil.getDate(patientRole.getPatient().getSDTCDeceasedTime().getValue());
+				cell.setCellValue(CDAValueUtil.DATETIME_PRETTY.format(dodDate));
+			}
+		}
 
 		if (documentMetadata != null) {
 			offset = SpreadsheetSerializer.serializeDocumentMetadata(row, offset, documentMetadata, false);
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 ab7b5c6..4768aab 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
@@ -92,6 +92,8 @@
 	 */
 	public static String OMIT_DOB_STORE_VALUE = "OmitDOBCheckValue";
 
+	public static String OMIT_DOD_STORE_VALUE = "OmitDODCheckValue";
+
 	public static String OMIT_UNITS_STORE_VALUE = "OmitUnitsCheckValue";
 
 	public static String OMIT_VALIDATION_STORE_VALUE = "OmitValidationStoreValue";
@@ -108,9 +110,13 @@
 
 	public static final String CDA_REPORT_FILE_NAME_FILTERS = "fileNameFilter";
 
-	private static String OMIT_DOB_CHECK_BOX_LABEL = "Omit DOB and Patient Name from XLS Reports";
+	private static String OMIT_DOB_CHECK_BOX_LABEL = "Omit Patient DOB and Name from XLS Reports";
 
-	private static String OMIT_DOB_CHECK_BOX_TOOLTIP = "Do not include DOB and Patient Name in reports";
+	private static String OMIT_DOB_CHECK_BOX_TOOLTIP = "Do not include Patient DOB and Name in reports";
+
+	private static String OMIT_DOD_CHECK_BOX_LABEL = "Omit Patient DOD from XLS Reports";
+
+	private static String OMIT_DOD_CHECK_BOX_TOOLTIP = "Do not include Patient DOD in reports";
 
 	private static String OMIT_UNITS_CHECK_BOX_TOOLTIP = "Do not include Units of Measure in reports";
 
@@ -124,7 +130,6 @@
 
 	private static String COMBINE_SHEETS_CHECK_BOX_TOOLTIP = "Combine Sheets based on template hierachy so all versions of template go to same sheet in spreadsheet";
 
-	// org.eclipse.ui.dialogs.EditorSelectionDialog
 	/**
 	 * FilterListSelectionDialog
 	 * The dialog buttons were not easily accessible to change the text for OK and Cancel
@@ -167,6 +172,8 @@
 
 	private Button omitDOBCheckBox;
 
+	private Button omitDODCheckBox;
+
 	private Button omitUnitsCheckBox;
 
 	private Text cdaReportFilterText;
@@ -419,6 +426,9 @@
 		Composite dob_composite_textField = createComposite(parent, 2);
 		omitDOBCheckBox = createCheckBox(dob_composite_textField, OMIT_DOB_CHECK_BOX_LABEL, OMIT_DOB_CHECK_BOX_TOOLTIP);
 
+		Composite doD_composite_textField = createComposite(parent, 2);
+		omitDODCheckBox = createCheckBox(doD_composite_textField, OMIT_DOD_CHECK_BOX_LABEL, OMIT_DOD_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);
@@ -576,6 +586,7 @@
 		cardinalityCheckBox.setSelection(store.getDefaultBoolean(CARDINALITY_STORE_VALUE));
 		disablePdfGenerationCheckBox.setSelection(store.getBoolean(PDF_GEN_STORE_VALUE));
 		omitDOBCheckBox.setSelection(store.getBoolean(OMIT_DOB_STORE_VALUE));
+		omitDODCheckBox.setSelection(store.getBoolean(OMIT_DOD_STORE_VALUE));
 		omitUnitsCheckBox.setSelection(store.getBoolean(OMIT_UNITS_STORE_VALUE));
 		omitValidationCheckBox.setSelection(store.getBoolean(OMIT_VALIDATION_STORE_VALUE));
 		combineSheetsCheckBox.setSelection(store.getBoolean(COMBINE_SHEETS_VALUE));
@@ -594,6 +605,7 @@
 		cardinalityCheckBox.setSelection(store.getBoolean(CARDINALITY_STORE_VALUE));
 		disablePdfGenerationCheckBox.setSelection(store.getBoolean(PDF_GEN_STORE_VALUE));
 		omitDOBCheckBox.setSelection(store.getBoolean(OMIT_DOB_STORE_VALUE));
+		omitDODCheckBox.setSelection(store.getBoolean(OMIT_DOD_STORE_VALUE));
 		omitUnitsCheckBox.setSelection(store.getBoolean(OMIT_UNITS_STORE_VALUE));
 		omitValidationCheckBox.setSelection(store.getBoolean(OMIT_VALIDATION_STORE_VALUE));
 
@@ -637,6 +649,7 @@
 		store.setValue(CARDINALITY_STORE_VALUE, cardinalityCheckBox.getSelection());
 		store.setValue(PDF_GEN_STORE_VALUE, disablePdfGenerationCheckBox.getSelection());
 		store.setValue(OMIT_DOB_STORE_VALUE, omitDOBCheckBox.getSelection());
+		store.setValue(OMIT_DOD_STORE_VALUE, omitDODCheckBox.getSelection());
 		store.setValue(OMIT_UNITS_STORE_VALUE, omitUnitsCheckBox.getSelection());
 		store.setValue(OMIT_VALIDATION_STORE_VALUE, omitValidationCheckBox.getSelection());
 		store.setValue(COMBINE_SHEETS_VALUE, combineSheetsCheckBox.getSelection());
diff --git a/cda/plugins/org.eclipse.mdht.uml.cda/src/org/eclipse/mdht/uml/cda/tests/TestSTDC.java b/cda/plugins/org.eclipse.mdht.uml.cda/src/org/eclipse/mdht/uml/cda/tests/TestSTDC.java
index 757a0e7..39cbb2a 100644
--- a/cda/plugins/org.eclipse.mdht.uml.cda/src/org/eclipse/mdht/uml/cda/tests/TestSTDC.java
+++ b/cda/plugins/org.eclipse.mdht.uml.cda/src/org/eclipse/mdht/uml/cda/tests/TestSTDC.java
@@ -24,10 +24,13 @@
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.ecore.util.FeatureMapUtil;
 import org.eclipse.mdht.uml.cda.CDAFactory;
-import org.eclipse.mdht.uml.cda.Observation;
+import org.eclipse.mdht.uml.cda.Patient;
+import org.eclipse.mdht.uml.cda.Person;
+import org.eclipse.mdht.uml.cda.Subject;
+import org.eclipse.mdht.uml.cda.SubjectPerson;
 import org.eclipse.mdht.uml.cda.util.CDAUtil;
 import org.eclipse.mdht.uml.hl7.datatypes.DatatypesFactory;
-import org.eclipse.mdht.uml.hl7.datatypes.IVL_REAL;
+import org.eclipse.mdht.uml.hl7.datatypes.INT;
 import org.eclipse.mdht.uml.hl7.datatypes.ST;
 
 /**
@@ -134,38 +137,58 @@
 	 * @throws Exception
 	 */
 	public static void main(String[] args) throws Exception {
-		// Patient p = CDAFactory.eINSTANCE.createPatient();
-		//
+		Patient p = CDAFactory.eINSTANCE.createPatient();
+
 		// p.setEthnicGroupCode(DatatypesFactory.eINSTANCE.createCE("11a", "22"));
-		// p.getSDTCEthnicGroupCodes().add(DatatypesFactory.eINSTANCE.createCE("11b", "22"));
+		p.getSDTCEthnicGroupCodes().add(
+			DatatypesFactory.eINSTANCE.createCE("EthnicGroupCode", "EthnicGroupCodeSystem"));
+		p.getSDTCRaceCodes().add(DatatypesFactory.eINSTANCE.createCE("RaceCode", "RaceCodeSystem"));
+		p.setSDTCDeceasedInd(DatatypesFactory.eINSTANCE.createBL(false));
+		p.setSDTCDeceasedTime(DatatypesFactory.eINSTANCE.createTS("1900"));
+		p.setSDTCDesc(DatatypesFactory.eINSTANCE.createED("Description"));
+		p.setSDTCMultipleBirthInd(DatatypesFactory.eINSTANCE.createBL(false));
+		INT i = DatatypesFactory.eINSTANCE.createINT();
+		i.setValue(Integer.valueOf(3));
+		p.setSDTCMultipleBirthOrderNumber(i);
 		// p.getSDTCEthnicGroupCodes().add(DatatypesFactory.eINSTANCE.createCE("11c", "22"));
-		//
+
 		// p.getSDTCEthnicGroupCodes().add(DatatypesFactory.eINSTANCE.createCE("11d", "22"));
-		//
+
 		// p.getGuardians().add(CDAFactory.eINSTANCE.createGuardian());
 		// p.getGuardians().add(CDAFactory.eINSTANCE.createGuardian());
 		// p.getGuardians().add(CDAFactory.eINSTANCE.createGuardian());
-		// CDAUtil.saveSnippet(p, System.out);
-		//
-		// SubjectPerson sp = CDAFactory.eINSTANCE.createSubjectPerson();
-		// populate(sp, 4);
-		// CDAUtil.saveSnippet(sp, System.out);
+		CDAUtil.saveSnippet(p, System.out);
+
+		SubjectPerson sp = CDAFactory.eINSTANCE.createSubjectPerson();
+
+		populate(sp, 4);
+		CDAUtil.saveSnippet(sp, System.out);
+
+		Person person = CDAFactory.eINSTANCE.createPerson();
+
+		populate(person, 4);
+		CDAUtil.saveSnippet(person, System.out);
+
+		Subject subject = CDAFactory.eINSTANCE.createSubject();
+		populate(subject, 4);
+		CDAUtil.saveSnippet(subject, System.out);
+
 		//
 		// System.out.println("asdfasdf");
 		// Performer2 performer2 = CDAFactory.eINSTANCE.createPerformer2();
 		// populate(performer2, 4);
 		// CDAUtil.saveSnippet(performer2, System.out);
 
-		Observation observation = CDAFactory.eINSTANCE.createObservation();
-		IVL_REAL real = DatatypesFactory.eINSTANCE.createIVL_REAL();
-		real.setLow(DatatypesFactory.eINSTANCE.createIVXB_REAL());
-		real.getLow().setValue(9.0);
-		real.setHigh(DatatypesFactory.eINSTANCE.createIVXB_REAL());
-		real.getHigh().setValue(9.0);
-		real.setCenter(DatatypesFactory.eINSTANCE.createIVXB_REAL());
-
-		observation.getValues().add(real);
-		CDAUtil.saveSnippet(observation, System.out);
+		// Observation observation = CDAFactory.eINSTANCE.createObservation();
+		// IVL_REAL real = DatatypesFactory.eINSTANCE.createIVL_REAL();
+		// real.setLow(DatatypesFactory.eINSTANCE.createIVXB_REAL());
+		// real.getLow().setValue(9.0);
+		// real.setHigh(DatatypesFactory.eINSTANCE.createIVXB_REAL());
+		// real.getHigh().setValue(9.0);
+		// real.setCenter(DatatypesFactory.eINSTANCE.createIVXB_REAL());
+		//
+		// observation.getValues().add(real);
+		// CDAUtil.saveSnippet(observation, System.out);
 
 		// sp.setAdministrativeGenderCode(DatatypesFactory.eINSTANCE);