diff --git a/iTrust/WebRoot/auth/hcp/causeOfDeathTrendsReport.jsp b/iTrust/WebRoot/auth/hcp/causeOfDeathTrendsReport.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..df099bba4e0423a337f0d6cebdf74ef629d045b3
--- /dev/null
+++ b/iTrust/WebRoot/auth/hcp/causeOfDeathTrendsReport.jsp
@@ -0,0 +1,183 @@
+<%@taglib uri="/WEB-INF/tags.tld" prefix="itrust"%>
+<%@page errorPage="/auth/exceptionHandler.jsp"%>
+
+<%@page import="edu.ncsu.csc.itrust.dao.mysql.CauseOfDeathTrendsReportDAO"%>
+<%@page import="edu.ncsu.csc.itrust.beans.CauseOfDeathTrendsReportBean"%>
+<%@page import="java.util.List"%>
+<%@page import="java.util.ArrayList"%>
+<%@page import="java.util.Iterator"%>
+<%@page import="edu.ncsu.csc.itrust.exception.FormValidationException"%>
+
+
+<%@include file="/global.jsp" %>
+
+<%
+pageTitle = "iTrust - View Cause-Of-Death Trends Report";
+
+String view = request.getParameter("viewSelect");
+%>
+
+<%@include file="/header.jsp" %>
+<%
+    //log the page view
+    loggingAction.logEvent(TransactionType.DEATH_TRENDS_VIEW, loggedInMID.longValue(), 0, "View cause-of-death trends report");
+
+	CauseOfDeathTrendsReportDAO report = new CauseOfDeathTrendsReportDAO(prodDAO);
+	List<CauseOfDeathTrendsReportBean> allDeaths = null;
+
+	//get form data
+
+	long mid = Long.valueOf(request.getUserPrincipal().getName());
+
+    String startDate = request.getParameter("startDate");
+    String endDate = request.getParameter("endDate");
+
+	String gender = request.getParameter("gender");
+
+    String patients = request.getParameter("patients");
+    if (patients == null)
+        patients = "";
+
+    //try to get the report. If there's an error, print it. If null is returned, it's the first page load
+    if(patients.equalsIgnoreCase("My Patients")) {
+        try {
+            allDeaths = report.getTopTwoDeathsForHCP(mid, gender, startDate, endDate);
+        } catch(FormValidationException e){
+            e.printHTML(pageContext.getOut());
+        }
+     }
+
+    if(patients.equalsIgnoreCase("All Patients") || patients.equalsIgnoreCase("")) {
+        try {
+            allDeaths = report.getTopTwoDeathsForAll(gender, startDate, endDate);
+        } catch(FormValidationException e){
+            e.printHTML(pageContext.getOut());
+        }
+     }
+
+	if (gender == null)
+        gender = "";
+    if (startDate == null)
+    	startDate = "";
+    if (endDate == null)
+    	endDate = "";
+
+%>
+<br />
+<form action="causeOfDeathTrendsReport.jsp" method="post" id="formMain">
+<input type="hidden" name="viewSelect" />
+<table class="fTable" align="center" id="causeOfDeathTrendsReportTable">
+	<tr>
+		<th colspan="4">Cause of Death Trends Report</th>
+	</tr>
+	<tr class="subHeader">
+    		<td>Patients:</td>
+    		<td>
+    			<select name="patients" style="font-size:10" >
+    			<%
+                    if (patients != null && !patients.equalsIgnoreCase("")) {
+                     if (patients.equalsIgnoreCase("All Patients")) {
+                %>
+                		<option selected="selected" value="All Patients"> All Patients </option>
+                		<option value="My Patients"> My Patients </option>
+                <%
+                     } else if (patients.equalsIgnoreCase("My Patients")) {
+                %>
+                        <option value="All Patients"> All Patients </option>
+                        <option selected="selected" value="My Patients"> My Patients </option>
+                <%
+                        }
+                     } else {
+                %>
+                       <option value="All Patients"> All Patients </option>
+                       <option value="My Patients"> My Patients </option>
+                </select>
+                <%
+                    }
+                %>
+    		</td>
+    		<td>Gender:</td>
+    		<td>
+    			<select name="gender" style="font-size:10" >
+    			<%
+                    if (gender != null && !gender.equalsIgnoreCase("")) {
+                	    if (gender.equalsIgnoreCase("All")) {
+                %>
+                		<option selected="selected" value="All"> All </option>
+                		<option value="Male"> Male </option>
+                		<option value="Female"> Female </option>
+                	<%
+                    	} else if(gender.equalsIgnoreCase("Male")){
+                    %>
+                        <option value="All"> All </option>
+                        <option selected="selected" value="Male"> Male </option>
+                        <option value="Female"> Female </option>
+                    <%
+                        } else if(gender.equalsIgnoreCase("Female")){
+                    %>
+                        <option value="All"> All </option>
+                        <option value="Male"> Male </option>
+                        <option selected="selected" value="Female"> Female </option>
+                    <%
+                            }
+                        } else {
+                    %>
+                        <option value="All"> All </option>
+                        <option value="Male"> Male </option>
+                        <option value="Female"> Female </option>
+                </select>
+                <% } %>
+    		</td>
+    	</tr>
+	<tr class="subHeader">
+		<td>Start Date:</td>
+		<td>
+			<input name="startDate" value="<%= StringEscapeUtils.escapeHtml("" + (startDate)) %>" size="10">
+            <input type=button value="Select Date" onclick="displayDatePicker('startDate');">
+		</td>
+		<td>End Date:</td>
+		<td>
+			<input name="endDate" value="<%= StringEscapeUtils.escapeHtml("" + (endDate)) %>" size="10">
+            <input type=button value="Select Date" onclick="displayDatePicker('endDate');">
+		</td>
+	</tr>
+	<tr>
+		<td colspan="4" style="text-align: center;"><input type="submit" id="view_report" value="View Report"></td>
+	</tr>
+</table>
+
+</form>
+
+<br />
+
+<% if (allDeaths != null) { %>
+
+<table class="fTable" align="center" id="causeOfDeathTrendsTable">
+<tr>
+	<th>ICD-9CM Name</th>
+	<th>ICD-9CM Code</th>
+	<th>Quantity of Deaths</th>
+</tr>
+
+<%
+    Iterator<CauseOfDeathTrendsReportBean> iterator = allDeaths.iterator();
+
+    while(iterator.hasNext()) {
+
+    CauseOfDeathTrendsReportBean reports = iterator.next();
+   %>
+<tr style="text-align:center;">
+	<td><%=reports.getCause()%></td>
+	<td><%=reports.getCode()%></td>
+	<td><%=reports.getDeaths()%></td>
+</tr>
+    <%
+    }
+    %>
+
+</table>
+
+<% } %>
+<br />
+
+<%@include file="/footer.jsp" %>
\ No newline at end of file
diff --git a/iTrust/WebRoot/auth/hcp/menu.jsp b/iTrust/WebRoot/auth/hcp/menu.jsp
index e32b3434d56daa2e73d8b6033f2a77a7881a10d9..cce925e3c8c5df00282bfb8d1eef8f5e41dbcdc5 100644
--- a/iTrust/WebRoot/auth/hcp/menu.jsp
+++ b/iTrust/WebRoot/auth/hcp/menu.jsp
@@ -23,6 +23,8 @@
 			<li><a href="/iTrust/auth/hcp-nutritionist/macronutrients.jsp">Patient Macronutrient Intake</a>
 			<li><a href="/iTrust/auth/hcp-fitness/viewExerciseDiaries.jsp">Patient Exercise Diaries</a>
 			<li><a href="/iTrust/auth/hcp/viewSleepDiaries.jsp">Patient Sleep Diaries</a>
+			<li><a href="/iTrust/auth/hcp/causeOfDeathTrendsReport.jsp">Cause-Of-Death Trends Report</a>
+
 		</ul>
 	</div>
 </div>
diff --git a/iTrust/sql/data/deadPatient1.sql b/iTrust/sql/data/deadPatient1.sql
new file mode 100644
index 0000000000000000000000000000000000000000..4621ff83e43f9c540a5071b5eb2e461b73e7d1b0
--- /dev/null
+++ b/iTrust/sql/data/deadPatient1.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 81;
+DELETE FROM officevisits WHERE PatientID = 81;
+DELETE FROM patients WHERE MID = 81;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (81, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (81,'Male','2019-07-01',84.50) 
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20771,'2019-07-01',9000000000,'died','1',81)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient10.sql b/iTrust/sql/data/deadPatient10.sql
new file mode 100644
index 0000000000000000000000000000000000000000..2f9d356a95d2a721ef2e528027614adbfd51350c
--- /dev/null
+++ b/iTrust/sql/data/deadPatient10.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 90;
+DELETE FROM officevisits WHERE PatientID = 90;
+DELETE FROM patients WHERE MID = 90;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (90, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (90,'Male','2019-01-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20780,'2019-01-01',9000000003,'died','1',90)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient2.sql b/iTrust/sql/data/deadPatient2.sql
new file mode 100644
index 0000000000000000000000000000000000000000..b8986ae5a3774675942d03dd0e4d539dc9696999
--- /dev/null
+++ b/iTrust/sql/data/deadPatient2.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 82;
+DELETE FROM officevisits WHERE PatientID = 82;
+DELETE FROM patients WHERE MID = 82;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (82, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (82,'Male','2018-07-01',11.40)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20772,'2018-07-01',9000000000,'died','1',82)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient3.sql b/iTrust/sql/data/deadPatient3.sql
new file mode 100644
index 0000000000000000000000000000000000000000..e8a44af2992ba3374da12de3e9b224b57dbba832
--- /dev/null
+++ b/iTrust/sql/data/deadPatient3.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 83;
+DELETE FROM officevisits WHERE PatientID = 83;
+DELETE FROM patients WHERE MID = 83;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (83, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (83,'Female','2018-07-01',11.40)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20773,'2018-07-01',9000000000,'died','1',83)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient4.sql b/iTrust/sql/data/deadPatient4.sql
new file mode 100644
index 0000000000000000000000000000000000000000..8eb604ffe14f446a072e299653e55e7524f89459
--- /dev/null
+++ b/iTrust/sql/data/deadPatient4.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 84;
+DELETE FROM officevisits WHERE PatientID = 84;
+DELETE FROM patients WHERE MID = 84;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (84, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (84,'Male','2018-12-01',11.40)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20774,'2018-12-01',9000000000,'died','1',84)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient5.sql b/iTrust/sql/data/deadPatient5.sql
new file mode 100644
index 0000000000000000000000000000000000000000..e8c854eee20afaefb4e4af404dc9d0b6d2fc24be
--- /dev/null
+++ b/iTrust/sql/data/deadPatient5.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 85;
+DELETE FROM officevisits WHERE PatientID = 85;
+DELETE FROM patients WHERE MID = 85;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (85, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (85,'Male','2020-01-01',84.50)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20775,'2020-01-01',9000000000,'died','1',85)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient6.sql b/iTrust/sql/data/deadPatient6.sql
new file mode 100644
index 0000000000000000000000000000000000000000..b773a97e437682d73024a29b6ea39f439e5e7ceb
--- /dev/null
+++ b/iTrust/sql/data/deadPatient6.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 86;
+DELETE FROM officevisits WHERE PatientID = 86;
+DELETE FROM patients WHERE MID = 86;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (86, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (86,'Male','2018-12-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20776,'2018-12-01',9000000000,'died','1',86)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient7.sql b/iTrust/sql/data/deadPatient7.sql
new file mode 100644
index 0000000000000000000000000000000000000000..51217ef67dd0cc3b7e292a77caf22bd3c5074a65
--- /dev/null
+++ b/iTrust/sql/data/deadPatient7.sql
@@ -0,0 +1,16 @@
+DELETE FROM users WHERE MID = 87;
+DELETE FROM officevisits WHERE PatientID = 87;
+DELETE FROM patients WHERE MID = 87;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (87, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (87,'Female','2019-12-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20777,'2019-12-01',9000000003,'died','1',87)
+    ON DUPLICATE KEY UPDATE id = id;
+
diff --git a/iTrust/sql/data/deadPatient8.sql b/iTrust/sql/data/deadPatient8.sql
new file mode 100644
index 0000000000000000000000000000000000000000..0542fb5077aac7ee9d767dda0beb2e468b369917
--- /dev/null
+++ b/iTrust/sql/data/deadPatient8.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 88;
+DELETE FROM officevisits WHERE PatientID = 88;
+DELETE FROM patients WHERE MID = 88;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (88, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (88,'Female','2020-07-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20778,'2020-07-01',9000000003,'died','1',88)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient9.sql b/iTrust/sql/data/deadPatient9.sql
new file mode 100644
index 0000000000000000000000000000000000000000..46f001045ed389149c51f798edb7ab2b9ff19966
--- /dev/null
+++ b/iTrust/sql/data/deadPatient9.sql
@@ -0,0 +1,15 @@
+DELETE FROM users WHERE MID = 89;
+DELETE FROM officevisits WHERE PatientID = 89;
+DELETE FROM patients WHERE MID = 89;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (89, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (89,'Male','2020-01-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20779,'2020-01-01',9000000003,'died','1',89)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/src/edu/ncsu/csc/itrust/beans/CauseOfDeathTrendsReportBean.java b/iTrust/src/edu/ncsu/csc/itrust/beans/CauseOfDeathTrendsReportBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..90dfb451d74931b8bba84b7da29b826a36ad8d27
--- /dev/null
+++ b/iTrust/src/edu/ncsu/csc/itrust/beans/CauseOfDeathTrendsReportBean.java
@@ -0,0 +1,79 @@
+package edu.ncsu.csc.itrust.beans;
+
+
+public class CauseOfDeathTrendsReportBean {
+
+    /** The name of the diagnosis cause of death */
+    String cause;
+    /** The code of the diagnosis cause of death */
+    String code;
+    /** The quantity of the deaths */
+    String deaths;
+
+    /**
+     * Constructor for an empty bean
+     */
+    public CauseOfDeathTrendsReportBean() {
+    }
+
+    /**
+     * Constructor for the bean. Accepts cause of death name, cause of death code, and quantity of deaths
+     * @param cause The cause of death name
+     * @param code The cause of death code
+     * @param deaths The quantity of deaths for the chosen death code
+     */
+    public CauseOfDeathTrendsReportBean(String cause, String code, String deaths) {
+        this.cause = cause;
+        this.code = code;
+        this.deaths = deaths;
+    }
+
+    /**
+     * Getter for cause of death name
+     * @return The stored cause of death name
+     */
+    public String getCause() {
+        return cause;
+    }
+
+    /**
+     * Setter for cause of death name
+     * @param cause The cause of death name to be stored
+     */
+    public void setCause(String cause) {
+        this.cause = cause;
+    }
+
+    /**
+     * Getter for cause of death code
+     * @return The stored cause of death code
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * Setter for cause of death name
+     * @param code The cause of death name to be stored
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * Getter for quantity of deaths
+     * @return The stored quantity of deaths
+     */
+    public String getDeaths() {
+        return deaths;
+    }
+
+    /**
+     * Setter for quantity of deaths
+     * @param deaths The stored quantity of deaths
+     */
+    public void setDeaths(String deaths) {
+        this.deaths = deaths;
+    }
+
+}
diff --git a/iTrust/src/edu/ncsu/csc/itrust/beans/PatientBean.java b/iTrust/src/edu/ncsu/csc/itrust/beans/PatientBean.java
index e2560d391dd7f04ab8c81de541043d592641fb8c..64b8b0f1321272964cf6c18a200b62e18bed5a38 100644
--- a/iTrust/src/edu/ncsu/csc/itrust/beans/PatientBean.java
+++ b/iTrust/src/edu/ncsu/csc/itrust/beans/PatientBean.java
@@ -499,4 +499,4 @@ public class PatientBean implements Serializable, Comparable<PatientBean> {
 		return 42; // any arbitrary constant will do
 	}
 	
-}
+}
\ No newline at end of file
diff --git a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java
new file mode 100644
index 0000000000000000000000000000000000000000..9a000fa3ce02d4a250507e781e1208b892784464
--- /dev/null
+++ b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java
@@ -0,0 +1,277 @@
+package edu.ncsu.csc.itrust.dao.mysql;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Date;
+import java.time.format.DateTimeFormatter;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.ArrayList;
+import edu.ncsu.csc.itrust.DBUtil;
+import edu.ncsu.csc.itrust.beans.CauseOfDeathTrendsReportBean;
+import edu.ncsu.csc.itrust.dao.DAOFactory;
+import edu.ncsu.csc.itrust.exception.DBException;
+import edu.ncsu.csc.itrust.exception.FormValidationException;
+import edu.ncsu.csc.itrust.exception.ITrustException;
+import java.time.format.DateTimeParseException;
+
+public class CauseOfDeathTrendsReportDAO {
+
+	private DAOFactory factory;
+
+	/**
+	 * The typical constructor.
+	 * @param factory The {@link DAOFactory} associated with this DAO, which is used for obtaining SQL connections, etc.
+	 */
+	public CauseOfDeathTrendsReportDAO(DAOFactory factory) {
+		this.factory = factory;
+    }
+
+	/**
+	* Returns a list of patients for a particular HCP
+	*
+	* @param hcpMID The MID of the HCP to look up.
+	* @return A java.util.List of PatientsForHCP.
+	* @throws DBException
+	*/
+    public List<Long> getPatientsForHCP(long hcpMID) throws DBException {
+		Connection conn = null;
+		PreparedStatement stmt = null;
+		List<Long> patients = new ArrayList<Long>();
+
+		try {
+			conn = factory.getConnection();
+			stmt = conn.prepareStatement("SELECT DISTINCT PatientID FROM officevisits WHERE HCPID = ?");
+			stmt.setLong(1, hcpMID);
+			ResultSet rs = stmt.executeQuery();
+			while(rs.next()) {
+				Long patient = rs.getLong("PatientID");
+				patients.add(patient);
+			}
+			rs.close();
+		} catch (SQLException e) {
+			throw new DBException(e);
+		} finally {
+			DBUtil.closeConnection(conn, stmt);
+		}
+		return patients;
+	}
+
+	/**
+	* Returns a list of the top two causes of deaths for a particular HCP
+	*
+	* @param hcpMID The MID of the HCP to look up.
+	* @param gender Gender of the patients - All, Female, Male
+	* @param startingDate Start date of search.
+	* @param endingDate End date of search.
+	* @return A java.util.List of TopTwoDeathsForHCP.
+	* @throws DBException
+	*/
+	public ArrayList<CauseOfDeathTrendsReportBean> getTopTwoDeathsForHCP(long hcpMID, String gender, String startingDate, String endingDate) throws FormValidationException, ITrustException {
+		Connection conn = null;
+		PreparedStatement stmt = null;
+		List<Long> patients = this.getPatientsForHCP(hcpMID);
+		ArrayList<CauseOfDeathTrendsReportBean> causes;
+		String query = null;
+		java.sql.Date startDate;
+		java.sql.Date endDate;
+
+		try {
+
+			if (startingDate == null || endingDate == null)
+				return null;
+
+			causes = new ArrayList<>();
+
+			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+			DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+			String lower = LocalDate.parse(startingDate, formatter).format(formatter2);
+			String upper = LocalDate.parse(endingDate, formatter).format(formatter2);
+
+			startDate = Date.valueOf(lower);
+			endDate = Date.valueOf(upper);
+
+			if (startDate.after(endDate))
+				throw new FormValidationException("Start date must be before end date!");
+
+			conn = factory.getConnection();
+
+			if(gender.equalsIgnoreCase("All")){
+				query = "SELECT DISTINCT CauseOfDeath, COUNT(CauseOfDeath) FROM patients WHERE MID IN (";
+				for(int i = 0; i < patients.size(); i++)
+				{
+					if (i+1 == patients.size()){
+						query += patients.get(i);
+					}
+					else{
+						query += patients.get(i) + ",";
+					}
+
+				}
+				query += ") AND DateOfDeath IS NOT NULL AND YEAR(DateOfDeath) >= YEAR(?) AND YEAR(DateOfDeath) <= YEAR(?)"
+				+ "GROUP BY CauseOfDeath ORDER BY COUNT(CauseOfDeath) DESC";
+				stmt = conn.prepareStatement(query);
+				stmt.setDate(1, startDate);
+				stmt.setDate(2, endDate);
+			}
+
+			else{
+				query = "SELECT DISTINCT CauseOfDeath, COUNT(CauseOfDeath) FROM patients WHERE MID IN (";
+				for(int i = 0; i < patients.size(); i++)
+				{
+					if (i+1 == patients.size()){
+						query += patients.get(i);
+					}
+					else{
+						query += patients.get(i) + ",";
+					}
+				}
+				query += ") AND DateOfDeath IS NOT NULL AND Gender = ? AND YEAR(DateOfDeath) >= YEAR(?) AND YEAR(DateOfDeath) <= YEAR(?)"
+				+ "GROUP BY CauseOfDeath ORDER BY COUNT(CauseOfDeath) DESC";
+				stmt = conn.prepareStatement(query);
+				stmt.setString(1, gender);
+				stmt.setDate(2, startDate);
+				stmt.setDate(3, endDate);
+			}
+			ResultSet rs = stmt.executeQuery();
+			int count = 0;
+			while(rs.next() && count < 2) {
+				String cause = rs.getString("CauseOfDeath");
+				String deaths = rs.getString("COUNT(CauseOfDeath)");
+				String name = this.getCodeName(cause);
+				causes.add(new CauseOfDeathTrendsReportBean(name, cause, deaths));
+				count++;
+			}
+
+			if (causes.isEmpty())
+				throw new FormValidationException("No results returned");
+
+			rs.close();
+			stmt.close();
+		} catch (SQLException e) {
+			throw new DBException(e);
+		} catch (DateTimeParseException e) {
+			throw new FormValidationException("Enter dates in MM/dd/yyyy");
+		} finally {
+			DBUtil.closeConnection(conn, stmt);
+		}
+		return causes;
+	}
+
+	/**
+	* Returns a list of the top two causes of deaths for a all HCPs
+	*
+	* @param gender Gender of the patients - All, Female, Male
+	* @param startingDate Start date of search.
+	* @param endingDate End date of search.
+	* @return A java.util.List of TopTwoDeathsForAll.
+	* @throws DBException
+	*/
+    public ArrayList<CauseOfDeathTrendsReportBean> getTopTwoDeathsForAll(String gender, String startingDate, String endingDate) throws FormValidationException, ITrustException {
+    	Connection conn = null;
+		PreparedStatement stmt = null;
+		ArrayList<CauseOfDeathTrendsReportBean> causes;
+		String query = null;
+		java.sql.Date startDate;
+		java.sql.Date endDate;
+
+		try {
+
+			if (startingDate == null || endingDate == null)
+				return null;
+
+			causes = new ArrayList<>();
+
+			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+			DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+			String lower = LocalDate.parse(startingDate, formatter).format(formatter2);
+			String upper = LocalDate.parse(endingDate, formatter).format(formatter2);
+
+			startDate = Date.valueOf(lower);
+			endDate = Date.valueOf(upper);
+
+			if (startDate.after(endDate))
+				throw new FormValidationException("Start date must be before end date!");
+
+			conn = factory.getConnection();
+
+			if(gender.equalsIgnoreCase("All")){
+				query = "SELECT DISTINCT CauseOfDeath, COUNT(CauseOfDeath) FROM patients"
+				+ " WHERE DateOfDeath IS NOT NULL AND YEAR(DateOfDeath) >= YEAR(?) AND YEAR(DateOfDeath) <= YEAR(?)"
+				+ "GROUP BY CauseOfDeath ORDER BY COUNT(CauseOfDeath) DESC";
+				stmt = conn.prepareStatement(query);
+				stmt.setDate(1, startDate);
+				stmt.setDate(2, endDate);
+			}
+
+			else{
+				query = "SELECT DISTINCT CauseOfDeath, COUNT(CauseOfDeath) FROM patients"
+				+ " WHERE DateOfDeath IS NOT NULL AND Gender = ? AND YEAR(DateOfDeath) >= YEAR(?) AND YEAR(DateOfDeath) <= YEAR(?)"
+				+ "GROUP BY CauseOfDeath ORDER BY COUNT(CauseOfDeath) DESC";
+				stmt = conn.prepareStatement(query);
+				stmt.setString(1, gender);
+				stmt.setDate(2, startDate);
+				stmt.setDate(3, endDate);
+			}
+			ResultSet rs = stmt.executeQuery();
+			int count = 0;
+			while(rs.next() && count < 2) {
+				String cause = rs.getString("CauseOfDeath");
+				String deaths = rs.getString("COUNT(CauseOfDeath)");
+				String name = this.getCodeName(cause);
+				causes.add(new CauseOfDeathTrendsReportBean(name, cause, deaths));
+				count++;
+			}
+
+			if (causes.isEmpty())
+				throw new FormValidationException("No results returned");
+
+			rs.close();
+			stmt.close();
+		} catch (SQLException e) {
+			throw new DBException(e);
+		} catch (DateTimeParseException e) {
+			throw new FormValidationException("Enter dates in MM/dd/yyyy");
+		} finally {
+			DBUtil.closeConnection(conn, stmt);
+		}
+		return causes;
+	}
+
+	/**
+	* Returns the code name for a particular ICD-9CM code.
+	* 
+	* @param code ICD-9CM code.
+	* @return the name of the ICD-9CM code.
+	* @throws DBException
+	*/
+    public String getCodeName(String code) throws DBException {
+		Connection conn = null;
+		PreparedStatement stmt = null;
+		String result = null;
+
+		try {
+			conn = factory.getConnection();
+			stmt = conn.prepareStatement("SELECT Description FROM icdcodes WHERE Code = ?");
+			stmt.setString(1, code);
+			ResultSet rs = stmt.executeQuery();
+			if(rs.next()){
+				result = rs.getString("Description");
+				rs.close();
+				stmt.close();
+			}
+			else{
+				rs.close();
+				stmt.close();
+				return null;
+			}
+		} catch (SQLException e) {
+			throw new DBException(e);
+		} finally {
+			DBUtil.closeConnection(conn, stmt);
+		}
+		return result;
+	}
+}
diff --git a/iTrust/test/edu/ncsu/csc/itrust/selenium/CauseOfDeathTrendsReportSeleniumTest.java b/iTrust/test/edu/ncsu/csc/itrust/selenium/CauseOfDeathTrendsReportSeleniumTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4d91f4ded20ebaed69ae77caba221aa4f03814e3
--- /dev/null
+++ b/iTrust/test/edu/ncsu/csc/itrust/selenium/CauseOfDeathTrendsReportSeleniumTest.java
@@ -0,0 +1,297 @@
+package edu.ncsu.csc.itrust.selenium;
+
+import edu.ncsu.csc.itrust.enums.TransactionType;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.openqa.selenium.support.ui.Select;
+
+public class CauseOfDeathTrendsReportSeleniumTest extends iTrustSeleniumTest {
+
+    private HtmlUnitDriver driver;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        gen.clearAllTables();
+        gen.standardData();
+    }
+
+    public void testViewCODTrendsReports_AllPatientsAllGenders() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000000", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2000");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000000L, 0L,
+                "View cause-of-death trends report");
+
+        WebElement table = driver.findElement(By.id("causeOfDeathTrendsTable"));
+        String cause1 = table.findElements(By.tagName("td")).get(0).getText();
+        double code1 = Double.parseDouble(table.findElements(By.tagName("td")).get(1).getText());
+        int deaths1 = Integer.parseInt(table.findElements(By.tagName("td")).get(2).getText());
+
+        assertEquals(cause1, "Influenza");
+        assertEquals(code1, 487.00);
+        assertEquals(deaths1, 5);
+
+        String cause2 = table.findElements(By.tagName("td")).get(3).getText();
+        double code2 = Double.parseDouble(table.findElements(By.tagName("td")).get(4).getText());
+        int deaths2 = Integer.parseInt(table.findElements(By.tagName("td")).get(5).getText());
+
+        assertEquals(cause2, "Tuberculosis of the lung");
+        assertEquals(code2, 11.40);
+        assertEquals(deaths2, 3);
+    }
+
+    public void testViewCODTrendsReports_AllPatientsOnlyMale() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000000", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        new Select(driver.findElement(By.name("gender"))).selectByVisibleText("Male");
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2000");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000000L, 0L,
+                "View cause-of-death trends report");
+
+        WebElement table = driver.findElement(By.id("causeOfDeathTrendsTable"));
+        String cause1 = table.findElements(By.tagName("td")).get(0).getText();
+        double code1 = Double.parseDouble(table.findElements(By.tagName("td")).get(1).getText());
+        int deaths1 = Integer.parseInt(table.findElements(By.tagName("td")).get(2).getText());
+
+        assertEquals(cause1, "Influenza");
+        assertEquals(code1, 487.00);
+        assertEquals(deaths1, 3);
+
+        String cause2 = table.findElements(By.tagName("td")).get(3).getText();
+        double code2 = Double.parseDouble(table.findElements(By.tagName("td")).get(4).getText());
+        int deaths2 = Integer.parseInt(table.findElements(By.tagName("td")).get(5).getText());
+
+        assertEquals(cause2, "Malaria");
+        assertEquals(code2, 84.50);
+        assertEquals(deaths2, 2);
+    }
+
+    public void testViewCODTrendsReports_AllPatientsOnlyFemale() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        new Select(driver.findElement(By.name("gender"))).selectByVisibleText("Female");
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2000");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        WebElement table = driver.findElement(By.id("causeOfDeathTrendsTable"));
+        String cause1 = table.findElements(By.tagName("td")).get(0).getText();
+        double code1 = Double.parseDouble(table.findElements(By.tagName("td")).get(1).getText());
+        int deaths1 = Integer.parseInt(table.findElements(By.tagName("td")).get(2).getText());
+
+        assertEquals(cause1, "Influenza");
+        assertEquals(code1, 487.00);
+        assertEquals(deaths1, 2);
+
+        String cause2 = table.findElements(By.tagName("td")).get(3).getText();
+        double code2 = Double.parseDouble(table.findElements(By.tagName("td")).get(4).getText());
+        int deaths2 = Integer.parseInt(table.findElements(By.tagName("td")).get(5).getText());
+
+        assertEquals(cause2, "Tuberculosis of the lung");
+        assertEquals(code2, 11.40);
+        assertEquals(deaths2, 1);
+    }
+
+    public void testViewCODTrendsReports_MyPatientsAllGenders() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        new Select(driver.findElement(By.name("patients"))).selectByVisibleText("My Patients");
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2000");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        WebElement table = driver.findElement(By.id("causeOfDeathTrendsTable"));
+        String cause1 = table.findElements(By.tagName("td")).get(0).getText();
+        double code1 = Double.parseDouble(table.findElements(By.tagName("td")).get(1).getText());
+        int deaths1 = Integer.parseInt(table.findElements(By.tagName("td")).get(2).getText());
+
+        assertEquals(cause1, "Influenza");
+        assertEquals(code1, 487.00);
+        assertEquals(deaths1, 4);
+
+        String cause2 = table.findElements(By.tagName("td")).get(3).getText();
+        double code2 = Double.parseDouble(table.findElements(By.tagName("td")).get(4).getText());
+        int deaths2 = Integer.parseInt(table.findElements(By.tagName("td")).get(5).getText());
+
+        assertEquals(cause2, "Diabetes with ketoacidosis");
+        assertEquals(code2, 250.10);
+        assertEquals(deaths2, 1);
+    }
+
+    public void testViewCODTrendsReports_MyPatientsOnlyMale() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        new Select(driver.findElement(By.name("patients"))).selectByVisibleText("My Patients");
+        new Select(driver.findElement(By.name("gender"))).selectByVisibleText("Male");
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2000");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        WebElement table = driver.findElement(By.id("causeOfDeathTrendsTable"));
+        String cause1 = table.findElements(By.tagName("td")).get(0).getText();
+        double code1 = Double.parseDouble(table.findElements(By.tagName("td")).get(1).getText());
+        int deaths1 = Integer.parseInt(table.findElements(By.tagName("td")).get(2).getText());
+
+        assertEquals(cause1, "Influenza");
+        assertEquals(code1, 487.00);
+        assertEquals(deaths1, 2);
+
+        String cause2 = table.findElements(By.tagName("td")).get(3).getText();
+        double code2 = Double.parseDouble(table.findElements(By.tagName("td")).get(4).getText());
+        int deaths2 = Integer.parseInt(table.findElements(By.tagName("td")).get(5).getText());
+
+        assertEquals(cause2, "Diabetes with ketoacidosis");
+        assertEquals(code2, 250.10);
+        assertEquals(deaths2, 1);
+    }
+
+    public void testViewCODTrendsReports_MyPatientsOnlyFemale() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        new Select(driver.findElement(By.name("patients"))).selectByVisibleText("My Patients");
+        new Select(driver.findElement(By.name("gender"))).selectByVisibleText("Female");
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2000");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        WebElement table = driver.findElement(By.id("causeOfDeathTrendsTable"));
+        String cause1 = table.findElements(By.tagName("td")).get(0).getText();
+        double code1 = Double.parseDouble(table.findElements(By.tagName("td")).get(1).getText());
+        int deaths1 = Integer.parseInt(table.findElements(By.tagName("td")).get(2).getText());
+
+        assertEquals(cause1, "Influenza");
+        assertEquals(code1, 487.00);
+        assertEquals(deaths1, 2);
+    }
+
+    public void testViewCODTrendsReports_EmptyDates() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("");
+        driver.findElement(By.name("endDate")).sendKeys("");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        assertTrue(driver.getPageSource().contains("Enter dates in MM/dd/yyyy"));
+    }
+
+    public void testViewCODTrendsReports_InvalidDateFormat() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01-01-2000");
+        driver.findElement(By.name("endDate")).sendKeys("12-31-2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        assertTrue(driver.getPageSource().contains("Enter dates in MM/dd/yyyy"));
+    }
+
+    public void testViewCODTrendsReports_StartDateAfterEndDate() throws Exception {
+        driver = (HtmlUnitDriver)login("9000000003", "pw");
+
+        // Click Diagnosis Trends
+        driver.findElement(By.cssSelector("h2.panel-title")).click();
+        driver.findElement(By.xpath("//div[@class='panel-body']/ul/li[11]")).click();
+        driver.findElement(By.linkText("Cause-Of-Death Trends Report")).click();
+
+        // View Cause of Death Trends Report
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        driver.findElement(By.name("startDate")).clear();
+        driver.findElement(By.name("startDate")).sendKeys("01/01/2021");
+        driver.findElement(By.name("endDate")).sendKeys("12/31/2020");
+        driver.findElement(By.id("view_report")).click();
+        assertTrue(driver.getCurrentUrl().equals(ADDRESS + "auth/hcp/causeOfDeathTrendsReport.jsp"));
+        assertLogged(TransactionType.DEATH_TRENDS_VIEW, 9000000003L, 0L,
+                "View cause-of-death trends report");
+
+        assertTrue(driver.getPageSource().contains("Start date must be before end date!"));
+    }
+}
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java
index c94a1dced7a287baea32ef0b2ea49702dc3a1930..a215b9c7fe22831c6aa4d5bf64e15d03a61364b8 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java
@@ -41,7 +41,7 @@ public class ViewPatientOfficeVisitHistoryActionTest extends TestCase{
 	 */
 	public void testGetPatients() throws Exception {
 		List<PatientVisitBean> list = action.getPatients();
-		assertEquals(57, list.size());
+		assertEquals(67, list.size());
 		assertEquals("31", list.get(21).getLastOVDateD());
 		assertEquals("03", list.get(21).getLastOVDateM());
 	}
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/deaths/CauseOfDeathTrendsReportTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/deaths/CauseOfDeathTrendsReportTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..1362c70dc58dd7958116f7ed0718236bbb37aa44
--- /dev/null
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/deaths/CauseOfDeathTrendsReportTest.java
@@ -0,0 +1,131 @@
+package edu.ncsu.csc.itrust.unit.dao.deaths;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+import edu.ncsu.csc.itrust.dao.mysql.CauseOfDeathTrendsReportDAO;
+import edu.ncsu.csc.itrust.beans.CauseOfDeathTrendsReportBean;
+import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
+import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
+import edu.ncsu.csc.itrust.unit.testutils.EvilDAOFactory;
+import edu.ncsu.csc.itrust.exception.DBException;
+
+
+public class CauseOfDeathTrendsReportTest extends TestCase {
+    
+    private CauseOfDeathTrendsReportDAO cod;
+
+    private CauseOfDeathTrendsReportDAO evilDAO = new CauseOfDeathTrendsReportDAO(EvilDAOFactory.getEvilInstance());
+    
+    @Override
+	protected void setUp() throws Exception {
+		TestDataGenerator gen = new TestDataGenerator();
+		gen.clearAllTables();
+        gen.deadPatient1();
+        gen.deadPatient2();
+        gen.deadPatient3();
+        gen.deadPatient4();
+        gen.deadPatient5();
+        gen.deadPatient6();
+        gen.deadPatient7();
+        gen.deadPatient8();
+        gen.deadPatient9();
+        gen.deadPatient10();
+        gen.icd9cmCodes();
+
+        cod = new CauseOfDeathTrendsReportDAO(TestDAOFactory.getTestInstance());
+    }
+    
+    public void testPatientsForHCPValid() throws Exception {
+        List<Long> deaths = cod.getPatientsForHCP(Long.parseLong("9000000000"));
+        assertEquals(6, deaths.size());
+        assertEquals(Long.valueOf(81), deaths.get(0));
+        assertEquals(Long.valueOf(82), deaths.get(1));
+        assertEquals(Long.valueOf(83), deaths.get(2));
+        assertEquals(Long.valueOf(84), deaths.get(3));
+        assertEquals(Long.valueOf(85), deaths.get(4));
+        assertEquals(Long.valueOf(86), deaths.get(5));
+    }
+
+    public void testPatientsForHCPException() throws Exception {
+		try {
+			evilDAO.getPatientsForHCP(Long.parseLong("0000000000"));
+			fail("DBException should have been thrown");
+		} catch (DBException e) {
+			assertEquals(EvilDAOFactory.MESSAGE, e.getSQLException().getMessage());
+		}
+	}
+
+    public void testCodeNameExists() throws Exception {
+        String deaths = cod.getCodeName("84.50");
+        assertEquals("Malaria", deaths);
+    }
+
+    public void testCodeNameDoesNotExist() throws Exception {
+        String deaths = cod.getCodeName("8450");
+        assertEquals(null, deaths);
+    }
+    
+    public void testTopTwoDeathsForHCPValid() throws Exception {
+        List<CauseOfDeathTrendsReportBean> deaths = cod.getTopTwoDeathsForHCP(Long.parseLong("9000000000"), "All", "01/01/2018", "12/31/2020");
+        assertEquals(2, deaths.size());
+        assertEquals("11.40", deaths.get(0).getCode());
+        assertEquals("Tuberculosis of the lung", deaths.get(0).getCause());
+        assertEquals("3", deaths.get(0).getDeaths());
+        assertEquals("84.50", deaths.get(1).getCode());
+        assertEquals("Malaria", deaths.get(1).getCause());
+        assertEquals("2", deaths.get(1).getDeaths());
+    }
+
+    public void testTopTwoDeathsForHCPMaleValid() throws Exception {
+        List<CauseOfDeathTrendsReportBean> deaths = cod.getTopTwoDeathsForHCP(Long.parseLong("9000000000"), "Male", "01/01/2018", "12/31/2020");
+        assertEquals(2, deaths.size());
+        assertEquals("84.50", deaths.get(0).getCode());
+        assertEquals("Malaria", deaths.get(0).getCause());
+        assertEquals("2", deaths.get(0).getDeaths());
+        assertEquals("11.40", deaths.get(1).getCode());
+        assertEquals("Tuberculosis of the lung", deaths.get(1).getCause());
+        assertEquals("2", deaths.get(1).getDeaths());
+    }
+
+    public void testTopTwoDeathsForHCPException() throws Exception {
+		try {
+			evilDAO.getTopTwoDeathsForHCP(Long.parseLong("0000000000"), "All", "01/01/1990", "12/31/2020");
+			fail("DBException should have been thrown");
+		} catch (DBException e) {
+			assertEquals(EvilDAOFactory.MESSAGE, e.getSQLException().getMessage());
+		}
+    }
+    
+    public void testTopTwoDeathsForHCPNullDate() throws Exception {
+        List<CauseOfDeathTrendsReportBean> deaths = cod.getTopTwoDeathsForHCP(Long.parseLong("9000000000"), "Male", null, "12/31/2020");
+        assertEquals(null, deaths);
+    }
+
+    public void testTopTwoDeathsForAllValid() throws Exception {
+        List<CauseOfDeathTrendsReportBean> deaths = cod.getTopTwoDeathsForAll("All", "01/01/2018", "12/31/2020");
+        assertEquals(2, deaths.size());
+        assertEquals("487.00", deaths.get(0).getCode());
+        assertEquals("Influenza", deaths.get(0).getCause());
+        assertEquals("5", deaths.get(0).getDeaths());
+        assertEquals("11.40", deaths.get(1).getCode());
+        assertEquals("Tuberculosis of the lung", deaths.get(1).getCause());
+        assertEquals("3", deaths.get(1).getDeaths());
+    }
+
+    public void testTopTwoDeathsForAllFemaleValid() throws Exception {
+        List<CauseOfDeathTrendsReportBean> deaths = cod.getTopTwoDeathsForAll("Female", "01/01/2018", "12/31/2020");
+        assertEquals(2, deaths.size());
+        assertEquals("487.00", deaths.get(0).getCode());
+        assertEquals("Influenza", deaths.get(0).getCause());
+        assertEquals("2", deaths.get(0).getDeaths());
+        assertEquals("11.40", deaths.get(1).getCode());
+        assertEquals("Tuberculosis of the lung", deaths.get(1).getCause());
+        assertEquals("1", deaths.get(1).getDeaths());
+    }
+
+    public void testTopTwoDeathsForAllNullDate() throws Exception {
+        List<CauseOfDeathTrendsReportBean> deaths = cod.getTopTwoDeathsForAll("Male", null, "12/31/2020");
+        assertEquals(null, deaths);
+    }
+}
\ No newline at end of file
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java b/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
index 33922fb4d0541e45356e3b06bd55e61891d49ce7..61e7853a3894eed21bc53b6fe00a1d7be91c2f74 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
@@ -121,6 +121,46 @@ public class TestDataGenerator {
 				+ "/deadRecurringPatients.sql");
 	}
 
+	public void deadPatient1() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient1.sql");
+	}
+	
+	public void deadPatient2() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient2.sql");
+	}
+	
+	public void deadPatient3() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient3.sql");
+	}
+	
+	public void deadPatient4() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient4.sql");
+	}
+	
+	public void deadPatient5() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient5.sql");
+	}
+	
+	public void deadPatient6() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient6.sql");
+	}
+	
+	public void deadPatient7() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient7.sql");
+	}
+	
+	public void deadPatient8() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient8.sql");
+	}
+	
+	public void deadPatient9() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient9.sql");
+	}
+	
+	public void deadPatient10() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/deadPatient10.sql");
+	}
+
 	public void diagnosedPatient_OldAndNewVisit() throws SQLException,
 			FileNotFoundException, IOException {
 		new DBBuilder(factory).executeSQLFile(DIR
@@ -1113,6 +1153,18 @@ public class TestDataGenerator {
 		patient28();
 		patient29();
 		patient30();
+
+		//Added for UC 20
+		deadPatient1();
+		deadPatient2();
+		deadPatient3();
+		deadPatient4();
+		deadPatient5();
+		deadPatient6();
+		deadPatient7();
+		deadPatient8();
+		deadPatient9();
+		deadPatient10();
 	}
 
 	public void uc47SetUp() throws FileNotFoundException, SQLException,
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/report/DemographicReportFilterTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/report/DemographicReportFilterTest.java
index 0303c0cafafc3ab6fbc0a03d609ae4cbfbf568f6..42fbfcde61758b05cf323e2b300d7e6a5a3998a9 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/report/DemographicReportFilterTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/report/DemographicReportFilterTest.java
@@ -225,10 +225,11 @@ public class DemographicReportFilterTest extends TestCase {
 		assertTrue(res.isEmpty());
 	}
 	
+	//Updated assertEquals(24, res.size()) to assertEquals(27, res.size()) to reflect the 3 female patients added for UC20
 	public void testFilterByGender() throws Exception {
 		filter = new DemographicReportFilter(DemographicReportFilterType.GENDER, "Female", factory);
 		List<PatientBean> res = filter.filter(allPatients);
-		assertEquals(24, res.size());
+		assertEquals(27, res.size());
 		assertTrue(res.get(0).getMID() == 1L);
 		assertTrue(res.get(1).getMID() == 5L);
 		assertTrue(res.get(2).getMID() == 6L);
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java
index e91b276f42345741daf41494445c018c417422e1..7ae6a6a0e34651a8efe59657f058aea631837c86 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java
@@ -68,7 +68,7 @@ public class MedicalReportFilterTest extends TestCase {
 	public void testFilterByLowerOfficeVisit() throws Exception {
 		filter = new MedicalReportFilter(MedicalReportFilterType.LOWER_OFFICE_VISIT_DATE, "01/01/2012", factory);
 		List<PatientBean> res = filter.filter(allPatients);
-		assertEquals(14, res.size());
+		assertEquals(24, res.size());
 		assertTrue(res.get(0).getMID() == 100L);
 	}