Skip to content
Snippets Groups Projects
Commit 8a51e260 authored by adityab3's avatar adityab3
Browse files

[formatting] fixed indentation errors in various files

parent 8c575f7c
No related branches found
No related tags found
1 merge request!26UC14
......@@ -19,11 +19,11 @@ public class DiagnosisStatisticsBean {
/** The diagnosis count for the zip code */
long zipStats;
/** The diagnosis count for the region */
long regionStats;
/** The diagnosis count for the state */
long stateStats;
/** The diagnosis count for everywhere */
long allStats;
long regionStats;
/** The diagnosis count for the state */
long stateStats;
/** The diagnosis count for everywhere */
long allStats;
/** The beginning of the time period covered */
Date startDate;
/** The end of the time period covered */
......@@ -45,7 +45,7 @@ public class DiagnosisStatisticsBean {
this.zipCode = zipCode;
this.zipStats = zipStats;
this.regionStats = regionStats;
}
}
/**
* Constructor for the bean. Accepts region and zip stats, zip code and start date
......@@ -75,41 +75,41 @@ public class DiagnosisStatisticsBean {
this.regionStats = regionStats;
this.startDate = (Date) startDate.clone();
this.endDate = (Date) endDate.clone();
}
/**
}
/**
* Constructor for the bean. Accepts all stats and zip code
* @param zipCode The zip code analyzed
* @param zipStats The count of diagnoses for the zip code
* @param regionStats The count of diagnoses for the region
* @param stateStats The count of diagnoses for the state
* @param stateStats The count of diagnoses for the state
*/
public DiagnosisStatisticsBean(String zipCode, long zipStats, long regionStats, long stateStats, long allStats) {
this.zipCode = zipCode;
public DiagnosisStatisticsBean(String zipCode, long zipStats, long regionStats, long stateStats, long allStats) {
this.zipCode = zipCode;
this.zipStats = zipStats;
this.regionStats = regionStats;
this.stateStats = stateStats;
this.allStats = allStats;
}
this.stateStats = stateStats;
this.allStats = allStats;
}
/**
/**
* Constructor for the bean. Accepts region and zip stats, zip code and date range
* @param zipCode The zip code analyzed
* @param zipStats The count of diagnoses for the zip code
* @param regionStats The count of diagnoses for the region
* @param stateStats The count of diagnoses for the state
* @param stateStats The count of diagnoses for the state
* @param startDate The beginning of the data's time period
* @param endDate The end of the data's time period
*/
public DiagnosisStatisticsBean(String zipCode, long zipStats, long regionStats, long stateStats, long allStats, Date startDate, Date endDate) {
public DiagnosisStatisticsBean(String zipCode, long zipStats, long regionStats, long stateStats, long allStats, Date startDate, Date endDate) {
this.zipCode = zipCode;
this.zipStats = zipStats;
this.regionStats = regionStats;
this.stateStats = stateStats;
this.allStats = allStats;
this.stateStats = stateStats;
this.allStats = allStats;
this.startDate = (Date) startDate.clone();
this.endDate = (Date) endDate.clone();
}
}
/**
* Getter for Zip code
......@@ -157,9 +157,9 @@ public class DiagnosisStatisticsBean {
*/
public void setRegionStats(long regionStats) {
this.regionStats = regionStats;
}
/**
}
/**
* Getter for State count
* @return The count of diagnoses for the region
*/
......@@ -173,9 +173,9 @@ public class DiagnosisStatisticsBean {
*/
public void setStateStats(long stateStats) {
this.stateStats = stateStats;
}
/**
}
/**
* Getter for State count
* @return The count of diagnoses for the region
*/
......
......@@ -31,29 +31,29 @@ public class DiagnosisTrendData implements DatasetProducer, Externalizable, Cate
private String[] seriesName;
// Names for bars in bar chart
private String[] seriesNames = {"Region", "State", "All"};
private String[] seriesNames = {"Region", "State", "All"};
// Initialize the values for each week to 0
private int[] values;
private DiagnosisStatisticsBean dsBean = new DiagnosisStatisticsBean();
// List of the beans for the diagnosis statistics
private List<DiagnosisStatisticsBean> dsBeans;
// List of the beans for the diagnosis statistics
private List<DiagnosisStatisticsBean> dsBeans;
@SuppressWarnings("unused")
private DiagnosisStatisticsBean avgBean = new DiagnosisStatisticsBean();
// Name of the diagnosis being searched for
private String diagnosisName;
private Boolean epidemic = false;
// Flag for parameter being dsBeans (true) or dsBean (false)
private Boolean isDsList = false;
private Boolean isDsList = false;
// Weeks preceding start date
private String weeks[];
// Weeks preceding start date
private String weeks[];
/**
* hasData
......@@ -63,57 +63,57 @@ public class DiagnosisTrendData implements DatasetProducer, Externalizable, Cate
if ( dsBean != null ) {
return true;
}
return true;
}
return false;
}
/**
* Called from the JSP to initialize the list of HealthRecords needed
* to produce the desired chart.
*
* @param DiagnosisBean DiagnosisBean
* @param name Type of data that is being graphed (originally Height, Weight, and BMI).
*/
* Called from the JSP to initialize the list of HealthRecords needed
* to produce the desired chart.
*
* @param DiagnosisBean DiagnosisBean
* @param name Type of data that is being graphed (originally Height, Weight, and BMI).
*/
public void initializeDiagnosisStatistics ( DiagnosisStatisticsBean DiagnosisBean, String name ) {
this.dsBean = DiagnosisBean;
this.diagnosisName = name;
values = new int[2];
values[0] = (int) dsBean.getZipStats();
values[1] = (int) dsBean.getRegionStats();
this.diagnosisName = name;
values = new int[2];
values[0] = (int) dsBean.getZipStats();
values[1] = (int) dsBean.getRegionStats();
}
/**
* Called from the JSP to initialize the list of HealthRecords needed
* to produce the chart with cases in region, cases in state, and all cases in database.
*
* @param DiagnosisBeans List of DiagnosisBean
* @param name Type of data that is being graphed (originally Height, Weight, and BMI).
*/
public void initializeDiagnosisStatistics ( List<DiagnosisStatisticsBean> DiagnosisBeans, String name ) {
this.dsBeans = DiagnosisBeans;
this.diagnosisName = name;
this.weeks = initializeTrendWeeks(DiagnosisBeans);
this.isDsList = true;
Iterator<DiagnosisStatisticsBean> iterator = dsBeans.iterator();
while(iterator.hasNext()) {
dsBean = iterator.next();
values = new int[3];
values[0] = (int) dsBean.getRegionStats();
values[1] = (int) dsBean.getStateStats();
values[2] = (int) dsBean.getAllStats();
}
}
/**
* Called from the JSP to initialize the list of HealthRecords needed
* to produce the chart with cases in region, cases in state, and all cases in database.
*
* @param DiagnosisBeans List of DiagnosisBean
* @param name Type of data that is being graphed (originally Height, Weight, and BMI).
*/
public void initializeDiagnosisStatistics ( List<DiagnosisStatisticsBean> DiagnosisBeans, String name ) {
this.dsBeans = DiagnosisBeans;
this.diagnosisName = name;
this.weeks = initializeTrendWeeks(DiagnosisBeans);
this.isDsList = true;
Iterator<DiagnosisStatisticsBean> iterator = dsBeans.iterator();
while(iterator.hasNext()) {
dsBean = iterator.next();
values = new int[3];
values[0] = (int) dsBean.getRegionStats();
values[1] = (int) dsBean.getStateStats();
values[2] = (int) dsBean.getAllStats();
}
}
/**
* initializeAvgDiagnosisStatistics
......@@ -136,71 +136,71 @@ public class DiagnosisTrendData implements DatasetProducer, Externalizable, Cate
}
/**
* This method parses the list of DiagnosisStatistics Beans to initialize the
* chart data set.
* @param params params
* @return A data set containing information to be graphed
* @throws DatasetProduceException
*/
/**
* This method parses the list of DiagnosisStatistics Beans to initialize the
* chart data set.
* @param params params
* @return A data set containing information to be graphed
* @throws DatasetProduceException
*/
public Object produceDataset(@SuppressWarnings("rawtypes") Map params) throws DatasetProduceException {
// The DefaultCategoryDataset is used for bar charts.
// This data set class may change based on the type of chart you wish to produce.
DefaultCategoryDataset dataset = new DefaultCategoryDataset(){
// The DefaultCategoryDataset is used for bar charts.
// This data set class may change based on the type of chart you wish to produce.
DefaultCategoryDataset dataset = new DefaultCategoryDataset(){
/**
*
*/
private static final long serialVersionUID = 1L;
};
if ( epidemic == false ) {
if(isDsList == true) {
for(int i = 0; i < weeks.length; i++) {
dsBean = dsBeans.get(i);
dataset.addValue(dsBean.getRegionStats(), seriesNames[0], weeks[i]);
dataset.addValue(dsBean.getStateStats(), seriesNames[1], weeks[i]);
dataset.addValue(dsBean.getAllStats(), seriesNames[2], weeks[i]);
}
} else {
seriesName = new String[2];
dataset.addValue(values[0], diagnosisName, "Zipcode Cases");
dataset.addValue(values[1], diagnosisName, "Region Cases");
seriesName[0] = "Zipcode Case";
seriesName[1] = "Region Cases";
}
} else if ( epidemic == true ) {
seriesName = new String[4];
dataset.addValue(values[0], diagnosisName, "Current Week Zipcode Cases");
dataset.addValue(values[1], diagnosisName, "Average Prior Zipcode Cases");
dataset.addValue(values[2], diagnosisName, "Current Week Region Cases");
dataset.addValue(values[3], diagnosisName, "Average Prior Region Cases");
seriesName[0] = "Current Week Zipcode Cases";
seriesName[1] = "Average Prior Zipcode Cases";
seriesName[2] = "Current Week Region Cases";
seriesName[3] = "Average Prior Region Cases";
}
return dataset;
}
/**
* This producer's data is invalidated after 5 seconds. By this method the
* producer can influence Cewolf's caching behavior the way it wants to.
* @param params params
* @param since date since
* @return time
*/
};
if ( epidemic == false ) {
if(isDsList == true) {
for(int i = 0; i < weeks.length; i++) {
dsBean = dsBeans.get(i);
dataset.addValue(dsBean.getRegionStats(), seriesNames[0], weeks[i]);
dataset.addValue(dsBean.getStateStats(), seriesNames[1], weeks[i]);
dataset.addValue(dsBean.getAllStats(), seriesNames[2], weeks[i]);
}
} else {
seriesName = new String[2];
dataset.addValue(values[0], diagnosisName, "Zipcode Cases");
dataset.addValue(values[1], diagnosisName, "Region Cases");
seriesName[0] = "Zipcode Case";
seriesName[1] = "Region Cases";
}
} else if ( epidemic == true ) {
seriesName = new String[4];
dataset.addValue(values[0], diagnosisName, "Current Week Zipcode Cases");
dataset.addValue(values[1], diagnosisName, "Average Prior Zipcode Cases");
dataset.addValue(values[2], diagnosisName, "Current Week Region Cases");
dataset.addValue(values[3], diagnosisName, "Average Prior Region Cases");
seriesName[0] = "Current Week Zipcode Cases";
seriesName[1] = "Average Prior Zipcode Cases";
seriesName[2] = "Current Week Region Cases";
seriesName[3] = "Average Prior Region Cases";
}
return dataset;
}
/**
* This producer's data is invalidated after 5 seconds. By this method the
* producer can influence Cewolf's caching behavior the way it wants to.
* @param params params
* @param since date since
* @return time
*/
@SuppressWarnings("rawtypes")
public boolean hasExpired(Map params, Date since) {
return (System.currentTimeMillis() - since.getTime()) > 5000;
......@@ -214,17 +214,17 @@ public class DiagnosisTrendData implements DatasetProducer, Externalizable, Cate
return "DiagnosisTrendData DatasetProducer";
}
/**
* generateLink
* @param data data
* @param series series
* @param category category
* @return A link target for a special data item.
*/
public String generateLink(Object data, int series, Object category) {
return seriesName[series];
}
/**
* generateLink
* @param data data
* @param series series
* @param category category
* @return A link target for a special data item.
*/
public String generateLink(Object data, int series, Object category) {
return seriesName[series];
}
/**
......@@ -260,16 +260,16 @@ public class DiagnosisTrendData implements DatasetProducer, Externalizable, Cate
}
private String[] initializeTrendWeeks(List<DiagnosisStatisticsBean> DiagnosisBeans) {
private String[] initializeTrendWeeks(List<DiagnosisStatisticsBean> DiagnosisBeans) {
String[] weeks = new String[DiagnosisBeans.size()];
SimpleDateFormat stringDate = new SimpleDateFormat("MM/dd");
String[] weeks = new String[DiagnosisBeans.size()];
SimpleDateFormat stringDate = new SimpleDateFormat("MM/dd");
for(int i = 0; i < DiagnosisBeans.size(); i++){
weeks[i] = stringDate.format(DiagnosisBeans.get(i).getStartDate());
}
return weeks;
}
for(int i = 0; i < DiagnosisBeans.size(); i++){
weeks[i] = stringDate.format(DiagnosisBeans.get(i).getStartDate());
}
return weeks;
}
}
......
......@@ -34,8 +34,8 @@ import edu.ncsu.csc.itrust.exception.DBException;
*/
public class DiagnosesDAO {
private DAOFactory factory;
private DiagnosisBeanLoader loader = new DiagnosisBeanLoader(true);
private DAOFactory factory;
private DiagnosisBeanLoader loader = new DiagnosisBeanLoader(true);
/**
* @param factory
......@@ -69,12 +69,12 @@ public class DiagnosesDAO {
} finally {
DBUtil.closeConnection(conn, ps);
}
}
}
// Use default value of 3 for zipSFs
public DiagnosisStatisticsBean getDiagnosisCounts(String icdCode, String zipCode, java.util.Date lower, java.util.Date upper) throws DBException{
return getDiagnosisCounts(icdCode, zipCode, lower, upper, 3);
}
// Use default value of 3 for zipSFs
public DiagnosisStatisticsBean getDiagnosisCounts(String icdCode, String zipCode, java.util.Date lower, java.util.Date upper) throws DBException{
return getDiagnosisCounts(icdCode, zipCode, lower, upper, 3);
}
/**
* Gets a local zip code count and regional count of a specified diagnosis code
......@@ -83,17 +83,17 @@ public class DiagnosesDAO {
* @param zipCode The zip code to evaluate
* @param lower The starting date
* @param upper The ending date
* @param zipSFs The number of significant figures (maximum 5)
* @param zipSFs The number of significant figures (maximum 5)
* @return A bean containing the local and regional counts
* @throws DBException
*/
public DiagnosisStatisticsBean getDiagnosisCounts(String icdCode, String zipCode, java.util.Date lower, java.util.Date upper, int zipSFs) throws DBException {
// Make sure user is not asking for more than 5 sig figs in zip
if (zipSFs < 0 || zipSFs > 5) {
throw new IllegalArgumentException("Invalid zip code significant figures.");
}
Connection conn = null;
// Make sure user is not asking for more than 5 sig figs in zip
if (zipSFs < 0 || zipSFs > 5) {
throw new IllegalArgumentException("Invalid zip code significant figures.");
}
Connection conn = null;
PreparedStatement ps = null;
DiagnosisStatisticsBean dsBean = null;
try {
......@@ -103,41 +103,41 @@ public class DiagnosesDAO {
ps.setString(2, zipCode);
ps.setTimestamp(3, new Timestamp(lower.getTime()));
// add 1 day's worth to include the upper
ps.setTimestamp(4, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
ps.setTimestamp(4, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
ResultSet rs = ps.executeQuery();
rs.last();
int local = rs.getRow();
ps.close();
ps.close();
ps = conn.prepareStatement("SELECT * FROM ovdiagnosis INNER JOIN officevisits ON ovdiagnosis.VisitID=officevisits.ID INNER JOIN patients ON officevisits.PatientID=patients.MID WHERE ICDCode=? AND zip LIKE ? AND visitDate >= ? AND visitDate <= ? ");
ps.setString(1, icdCode);
ps.setString(2, zipCode.substring(0, zipSFs) + "%");
ps.setTimestamp(3, new Timestamp(lower.getTime()));
// add 1 day's worth to include the upper
ps.setTimestamp(4, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
ps.setTimestamp(4, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
rs = ps.executeQuery();
rs.last();
int region = rs.getRow();
ps = conn.prepareStatement("SELECT * FROM ovdiagnosis INNER JOIN officevisits ON ovdiagnosis.VisitID=officevisits.ID INNER JOIN patients ON officevisits.PatientID=patients.MID WHERE ICDCode=? AND zip LIKE ? AND visitDate >= ? AND visitDate <= ? ");
int region = rs.getRow();
ps = conn.prepareStatement("SELECT * FROM ovdiagnosis INNER JOIN officevisits ON ovdiagnosis.VisitID=officevisits.ID INNER JOIN patients ON officevisits.PatientID=patients.MID WHERE ICDCode=? AND zip LIKE ? AND visitDate >= ? AND visitDate <= ? ");
ps.setString(1, icdCode);
ps.setString(2, zipCode.substring(0, 2) + "%");
ps.setTimestamp(3, new Timestamp(lower.getTime()));
// add 1 day's worth to include the upper
ps.setTimestamp(4, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
ps.setTimestamp(4, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
rs = ps.executeQuery();
rs.last();
int state = rs.getRow();
ps = conn.prepareStatement("SELECT * FROM ovdiagnosis INNER JOIN officevisits ON ovdiagnosis.VisitID=officevisits.ID INNER JOIN patients ON officevisits.PatientID=patients.MID WHERE ICDCode=? AND visitDate >= ? AND visitDate <= ? ");
int state = rs.getRow();
ps = conn.prepareStatement("SELECT * FROM ovdiagnosis INNER JOIN officevisits ON ovdiagnosis.VisitID=officevisits.ID INNER JOIN patients ON officevisits.PatientID=patients.MID WHERE ICDCode=? AND visitDate >= ? AND visitDate <= ? ");
ps.setString(1, icdCode);
ps.setTimestamp(2, new Timestamp(lower.getTime()));
// add 1 day's worth to include the upper
ps.setTimestamp(3, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
ps.setTimestamp(3, new Timestamp(upper.getTime() + 1000L * 60L * 60 * 24L - 1000));
rs = ps.executeQuery();
rs.last();
int all = rs.getRow();
......@@ -153,27 +153,27 @@ public class DiagnosesDAO {
DBUtil.closeConnection(conn, ps);
}
}
public DiagnosisStatisticsBean getCountForWeekBefore(String icdCode, String zipCode, java.util.Date next) throws DBException {
return getCountForWeekBefore(icdCode, zipCode, next, 3);
}
}
public DiagnosisStatisticsBean getCountForWeekBefore(String icdCode, String zipCode, java.util.Date next) throws DBException {
return getCountForWeekBefore(icdCode, zipCode, next, 3);
}
public DiagnosisStatisticsBean getCountForWeekBefore(String icdCode, String zipCode, java.util.Date next, int zipSFs) throws DBException {
Calendar cal = Calendar.getInstance();
cal.setTime(next);
cal.add(Calendar.HOUR, -7*24);
Date start = cal.getTime();
cal.add(Calendar.HOUR, 6*24);
Date end = cal.getTime();
Calendar cal = Calendar.getInstance();
cal.setTime(next);
cal.add(Calendar.HOUR, -7*24);
Date start = cal.getTime();
cal.add(Calendar.HOUR, 6*24);
Date end = cal.getTime();
return getDiagnosisCounts(icdCode, zipCode, start, end);
}
public DiagnosisStatisticsBean getCountForWeekOf(String icdCode, String zipCode, java.util.Date lower) throws DBException {
return getCountForWeekOf(icdCode, zipCode, lower, 3);
}
return getDiagnosisCounts(icdCode, zipCode, start, end);
}
public DiagnosisStatisticsBean getCountForWeekOf(String icdCode, String zipCode, java.util.Date lower) throws DBException {
return getCountForWeekOf(icdCode, zipCode, lower, 3);
}
public DiagnosisStatisticsBean getCountForWeekOf(String icdCode, String zipCode, java.util.Date lower, int zipSFs) throws DBException {
Calendar cal = Calendar.getInstance();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment