Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs427fa20team22
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
htmoss2
cs427fa20team22
Commits
b31bc61b
Commit
b31bc61b
authored
4 years ago
by
adityab3
Browse files
Options
Downloads
Patches
Plain Diff
[code smell] shortened all lines to 100 chars in ViewDiagnosisStatisticsAction
parent
95c244dd
No related branches found
No related tags found
1 merge request
!24
Code smells iteration 3.1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/src/edu/ncsu/csc/itrust/action/ViewDiagnosisStatisticsAction.java
+27
-12
27 additions, 12 deletions
...ncsu/csc/itrust/action/ViewDiagnosisStatisticsAction.java
with
27 additions
and
12 deletions
iTrust/src/edu/ncsu/csc/itrust/action/ViewDiagnosisStatisticsAction.java
+
27
−
12
View file @
b31bc61b
...
@@ -111,7 +111,8 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -111,7 +111,8 @@ public class ViewDiagnosisStatisticsAction {
* @throws FormValidationException
* @throws FormValidationException
* @throws ITrustException
* @throws ITrustException
*/
*/
public
DiagnosisStatisticsBean
getDiagnosisStatistics
(
String
lowerDate
,
String
upperDate
,
String
icdCode
,
String
zip
)
throws
FormValidationException
,
ITrustException
{
public
DiagnosisStatisticsBean
getDiagnosisStatistics
(
String
lowerDate
,
String
upperDate
,
String
icdCode
,
String
zip
)
throws
FormValidationException
,
ITrustException
{
DiagnosisStatisticsBean
dsBean
;
DiagnosisStatisticsBean
dsBean
;
if
(
lowerDate
==
null
||
upperDate
==
null
||
icdCode
==
null
)
{
if
(
lowerDate
==
null
||
upperDate
==
null
||
icdCode
==
null
)
{
return
null
;
return
null
;
...
@@ -178,7 +179,8 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -178,7 +179,8 @@ public class ViewDiagnosisStatisticsAction {
return
dsBean
;
return
dsBean
;
}
}
public
List
<
DiagnosisStatisticsBean
>
getDiagnosisTrends
(
String
dateString
,
String
icdCode
,
String
zip
)
throws
FormValidationException
,
ITrustException
{
public
List
<
DiagnosisStatisticsBean
>
getDiagnosisTrends
(
String
dateString
,
String
icdCode
,
String
zip
)
throws
FormValidationException
,
ITrustException
{
ArrayList
<
DiagnosisStatisticsBean
>
dsBean
=
null
;
ArrayList
<
DiagnosisStatisticsBean
>
dsBean
=
null
;
if
(
dateString
==
null
||
icdCode
==
null
)
{
if
(
dateString
==
null
||
icdCode
==
null
)
{
return
null
;
return
null
;
...
@@ -212,7 +214,9 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -212,7 +214,9 @@ public class ViewDiagnosisStatisticsAction {
* @throws FormValidationException
* @throws FormValidationException
* @throws DBException
* @throws DBException
*/
*/
public
ArrayList
<
DiagnosisStatisticsBean
>
getEpidemicStatistics
(
String
startDate
,
String
icdCode
,
String
zip
,
String
threshold
)
throws
FormValidationException
,
DBException
{
public
ArrayList
<
DiagnosisStatisticsBean
>
getEpidemicStatistics
(
String
startDate
,
String
icdCode
,
String
zip
,
String
threshold
)
throws
FormValidationException
,
DBException
{
if
(
startDate
==
null
||
icdCode
==
null
)
{
if
(
startDate
==
null
||
icdCode
==
null
)
{
return
null
;
return
null
;
}
}
...
@@ -300,9 +304,11 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -300,9 +304,11 @@ public class ViewDiagnosisStatisticsAction {
int
weekOfYr
=
cal
.
get
(
Calendar
.
WEEK_OF_YEAR
);
int
weekOfYr
=
cal
.
get
(
Calendar
.
WEEK_OF_YEAR
);
double
threshold
=
calcInfluenzaThreshold
(
weekOfYr
);
double
threshold
=
calcInfluenzaThreshold
(
weekOfYr
);
DiagnosisStatisticsBean
prev1
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_INFLUENZA
,
zip
,
cal
.
getTime
());
DiagnosisStatisticsBean
prev1
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_INFLUENZA
,
zip
,
cal
.
getTime
());
cal
.
add
(
Calendar
.
HOUR
,
-
7
*
24
);
cal
.
add
(
Calendar
.
HOUR
,
-
7
*
24
);
DiagnosisStatisticsBean
prev2
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_INFLUENZA
,
zip
,
cal
.
getTime
());
DiagnosisStatisticsBean
prev2
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_INFLUENZA
,
zip
,
cal
.
getTime
());
long
weekL1
=
prev1
.
getRegionStats
();
long
weekL1
=
prev1
.
getRegionStats
();
long
weekL2
=
prev2
.
getRegionStats
();
long
weekL2
=
prev2
.
getRegionStats
();
...
@@ -320,7 +326,10 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -320,7 +326,10 @@ public class ViewDiagnosisStatisticsAction {
* @return the epidemic threshold for flu cases
* @return the epidemic threshold for flu cases
*/
*/
private
double
calcInfluenzaThreshold
(
double
weekNumber
)
{
private
double
calcInfluenzaThreshold
(
double
weekNumber
)
{
return
5.34
+
0.271
*
weekNumber
+
3.45
*
Math
.
sin
(
2
*
Math
.
PI
*
weekNumber
/
52.0
)
+
8.41
*
Math
.
cos
(
2
*
Math
.
PI
*
weekNumber
/
52.0
);
return
5.34
+
0.271
*
weekNumber
+
3.45
*
Math
.
sin
(
2
*
Math
.
PI
*
weekNumber
/
52.0
)
+
8.41
*
Math
.
cos
(
2
*
Math
.
PI
*
weekNumber
/
52.0
);
}
}
/**
/**
...
@@ -334,7 +343,8 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -334,7 +343,8 @@ public class ViewDiagnosisStatisticsAction {
* @throws DBException
* @throws DBException
* @throws ParseException
* @throws ParseException
*/
*/
public
boolean
isMalariaEpidemic
(
String
weekDate
,
String
zip
,
String
thresholdStr
)
throws
DBException
,
ParseException
{
public
boolean
isMalariaEpidemic
(
String
weekDate
,
String
zip
,
String
thresholdStr
)
throws
DBException
,
ParseException
{
Date
wkDate
=
new
SimpleDateFormat
(
"MM/dd/yyyy"
).
parse
(
weekDate
);
Date
wkDate
=
new
SimpleDateFormat
(
"MM/dd/yyyy"
).
parse
(
weekDate
);
ArrayList
<
DiagnosisStatisticsBean
>
historyWkL1
=
new
ArrayList
<
DiagnosisStatisticsBean
>();
ArrayList
<
DiagnosisStatisticsBean
>
historyWkL1
=
new
ArrayList
<
DiagnosisStatisticsBean
>();
...
@@ -345,13 +355,16 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -345,13 +355,16 @@ public class ViewDiagnosisStatisticsAction {
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
wkDate
);
cal
.
setTime
(
wkDate
);
DiagnosisStatisticsBean
current
=
diagnosesDAO
.
getCountForWeekOf
(
ICD_MALARIA
,
zip
,
cal
.
getTime
());
DiagnosisStatisticsBean
current
=
diagnosesDAO
.
getCountForWeekOf
(
ICD_MALARIA
,
zip
,
cal
.
getTime
());
DiagnosisStatisticsBean
prev1
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_MALARIA
,
zip
,
cal
.
getTime
());
DiagnosisStatisticsBean
prev1
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_MALARIA
,
zip
,
cal
.
getTime
());
long
weekTotalL1
=
prev1
.
getRegionStats
();
long
weekTotalL1
=
prev1
.
getRegionStats
();
cal
.
add
(
Calendar
.
HOUR
,
-
7
*
24
);
cal
.
add
(
Calendar
.
HOUR
,
-
7
*
24
);
DiagnosisStatisticsBean
prev2
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_MALARIA
,
zip
,
cal
.
getTime
());
DiagnosisStatisticsBean
prev2
=
diagnosesDAO
.
getCountForWeekBefore
(
ICD_MALARIA
,
zip
,
cal
.
getTime
());
long
weekTotalL2
=
prev2
.
getRegionStats
();
long
weekTotalL2
=
prev2
.
getRegionStats
();
cal
.
setTime
(
wkDate
);
cal
.
setTime
(
wkDate
);
...
@@ -394,8 +407,10 @@ public class ViewDiagnosisStatisticsAction {
...
@@ -394,8 +407,10 @@ public class ViewDiagnosisStatisticsAction {
double
avgL1
=
((
double
)
totalHistL1
)
/
((
double
)
countHistL1
);
double
avgL1
=
((
double
)
totalHistL1
)
/
((
double
)
countHistL1
);
double
avgL2
=
((
double
)
totalHistL2
)
/
((
double
)
countHistL2
);
double
avgL2
=
((
double
)
totalHistL2
)
/
((
double
)
countHistL2
);
boolean
epidemicL1
=
(
weekTotalL1
*
100.0
)
/
threshold
>
avgL1
||
(
countHistL1
==
0
&&
weekTotalL1
!=
0
);
boolean
epidemicL1
=
(
weekTotalL1
*
100.0
)
/
threshold
>
avgL1
boolean
epidemicL2
=
(
weekTotalL2
*
100.0
)
/
threshold
>
avgL2
||
(
countHistL2
==
0
&&
weekTotalL2
!=
0
);
||
(
countHistL1
==
0
&&
weekTotalL1
!=
0
);
boolean
epidemicL2
=
(
weekTotalL2
*
100.0
)
/
threshold
>
avgL2
||
(
countHistL2
==
0
&&
weekTotalL2
!=
0
);
return
epidemicL1
&&
epidemicL2
;
return
epidemicL1
&&
epidemicL2
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment