From 9fbf3689a427ce3e5daf56794e1214eea371e80b Mon Sep 17 00:00:00 2001
From: Aditya Bhansali <adityab3@illinois.edu>
Date: Fri, 20 Nov 2020 08:34:45 -0600
Subject: [PATCH] [tests] moved additional test data to a new file for
 compatability

---
 .../data/hcp_additional_diagnosis_data.sql    | 29 +++++++++++++++
 iTrust/sql/data/hcp_diagnosis_data.sql        | 37 +------------------
 .../unit/dao/officevisit/OVDiagnosesTest.java |  2 +
 .../datagenerators/TestDataGenerator.java     |  7 +++-
 4 files changed, 39 insertions(+), 36 deletions(-)
 create mode 100644 iTrust/sql/data/hcp_additional_diagnosis_data.sql

diff --git a/iTrust/sql/data/hcp_additional_diagnosis_data.sql b/iTrust/sql/data/hcp_additional_diagnosis_data.sql
new file mode 100644
index 0000000..29163d9
--- /dev/null
+++ b/iTrust/sql/data/hcp_additional_diagnosis_data.sql
@@ -0,0 +1,29 @@
+INSERT INTO officevisits(ID, visitDate, HCPID, notes, PatientID, HospitalID)
+VALUES
+(125, '2020-11-18', 9000000000, 'Diagnose Cataracts', 1, '1'),   
+(126, '2020-11-18', 9000000000, 'Diagnose Cataracts', 2, '1'),   
+(127, '2020-11-18', 9000000000, 'Diagnose Cataracts', 3, '1'),   
+(128, '2020-11-18', 9000000000, 'Diagnose Cataracts', 4, '1'),   
+(129, '2020-11-18', 9000000000, 'Diagnose Cataracts', 21, '1'),  
+(130, '2020-11-18', 9000000000, 'Diagnose Cataracts', 22, '1'),  
+(131, '2020-11-18', 9000000000, 'Diagnose Cataracts', 23, '1'),  
+(132, '2020-11-18', 9000000000, 'Diagnose Cataracts', 24, '1'),  
+(133, '2020-11-18', 9000000000, 'Diagnose Cataracts', 105, '1'), 
+(134, '2020-11-18', 9000000000, 'Diagnose Cataracts', 107, '1')  
+
+ON DUPLICATE KEY UPDATE id = id;
+
+INSERT INTO ovdiagnosis(ID, VisitID, ICDCode)
+VALUES
+(125, 125, 26.8),
+(126, 126, 26.8),
+(127, 127, 26.8),
+(128, 128, 26.8),
+(129, 129, 26.8),
+(130, 130, 26.8),
+(131, 131, 26.8),
+(132, 132, 26.8),
+(133, 133, 26.8),
+(134, 134, 26.8)
+
+ON DUPLICATE KEY UPDATE VisitID = VALUES(VisitID), ICDCode = VALUES(ICDCode);
diff --git a/iTrust/sql/data/hcp_diagnosis_data.sql b/iTrust/sql/data/hcp_diagnosis_data.sql
index c37c8e8..f0def17 100644
--- a/iTrust/sql/data/hcp_diagnosis_data.sql
+++ b/iTrust/sql/data/hcp_diagnosis_data.sql
@@ -1,14 +1,3 @@
-/*-- 27606
--- 27607
--- 27606
--- 27606
--- 27603
--- 10001
--- 10001
--- 10001
--- 28803
--- 59710*/
-
 INSERT INTO officevisits(ID, visitDate, HCPID, notes, PatientID, HospitalID)
 VALUES
 (107, '2007-03-09', 9000000004, 'Diagnose Echovirus', 2, '1'),
@@ -30,18 +19,7 @@ VALUES
 
 (122, '2011-08-25', 9000000000, 'Diagnose Mumps', 2, '1'),
 (123, '2011-09-09', 9000000000, 'Diagnose Mumps', 3, '1'),
-(124, '2011-09-12', 9000000000, 'Diagnose Mumps', 25, '1'),
-
-(125, '2020-11-18', 9000000000, 'Diagnose Cataracts', 1, '1'),   
-(126, '2020-11-18', 9000000000, 'Diagnose Cataracts', 2, '1'),   
-(127, '2020-11-18', 9000000000, 'Diagnose Cataracts', 3, '1'),   
-(128, '2020-11-18', 9000000000, 'Diagnose Cataracts', 4, '1'),   
-(129, '2020-11-18', 9000000000, 'Diagnose Cataracts', 21, '1'),  
-(130, '2020-11-18', 9000000000, 'Diagnose Cataracts', 22, '1'),  
-(131, '2020-11-18', 9000000000, 'Diagnose Cataracts', 23, '1'),  
-(132, '2020-11-18', 9000000000, 'Diagnose Cataracts', 24, '1'),  
-(133, '2020-11-18', 9000000000, 'Diagnose Cataracts', 105, '1'), 
-(134, '2020-11-18', 9000000000, 'Diagnose Cataracts', 107, '1')  
+(124, '2011-09-12', 9000000000, 'Diagnose Mumps', 25, '1')
 
 ON DUPLICATE KEY UPDATE id = id;
 
@@ -66,18 +44,7 @@ VALUES
 
 (122, 122, 72.00),
 (123, 123, 72.00),
-(124, 124, 72.00),
-
-(125, 125, 26.8),
-(126, 126, 26.8),
-(127, 127, 26.8),
-(128, 128, 26.8),
-(129, 129, 26.8),
-(130, 130, 26.8),
-(131, 131, 26.8),
-(132, 132, 26.8),
-(133, 133, 26.8),
-(134, 134, 26.8)
+(124, 124, 72.00)
 
 ON DUPLICATE KEY UPDATE VisitID = VALUES(VisitID), ICDCode = VALUES(ICDCode);
 
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java
index 85071d5..3e87e10 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java
@@ -116,6 +116,8 @@ public class OVDiagnosesTest extends TestCase {
     }
     
     public void testZipSFs() throws Exception {
+        TestDataGenerator gen = new TestDataGenerator();
+        gen.hcp_additional_diagnosis_data();
         Date lower = new SimpleDateFormat("MM/dd/yyyy").parse("11/18/2020");
 		Date upper = new SimpleDateFormat("MM/dd/yyyy").parse("11/18/2020");
         DiagnosisStatisticsBean bean = diagDAO.getDiagnosisCounts("26.8", "27606-1234", lower, upper, 5);
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 26d0260..33922fb 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
@@ -741,7 +741,12 @@ public class TestDataGenerator {
 	public void hcp_diagnosis_data() throws FileNotFoundException, IOException,
 			SQLException {
 		new DBBuilder(factory).executeSQLFile(DIR + "/hcp_diagnosis_data.sql");
-	}
+    }
+    
+    public void hcp_additional_diagnosis_data() throws FileNotFoundException, 
+        IOException, SQLException {
+            new DBBuilder(factory).executeSQLFile(DIR + "/hcp_additional_diagnosis_data.sql");
+        }
 
 	public void immunization_data() throws FileNotFoundException, IOException,
 			SQLException {
-- 
GitLab