Skip to content

Commit

Permalink
Fix API & Add Hospitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
davidteather committed Dec 6, 2020
1 parent 96c6820 commit 68bb763
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="container">
<div class="row" style="width:100%;margin-top:20px;">
<div class="row" style="width:100%;margin-top:60px;">
<div class="mx-auto">
<div>
<h1 class="text-center">&nbsp;&nbsp;On Campus<sup data-toggle="tooltip" data-placement="right"
Expand All @@ -14,7 +14,7 @@ <h1 class="text-center">&nbsp;&nbsp;On Campus<sup data-toggle="tooltip" data-pla
<app-stats-row [data]="covid_data.on_campus"></app-stats-row>


<div class="row" style="width:100%;margin-top:20px;">
<div class="row" style="width:100%;margin-top:60px;">
<h1 class="text-center mx-auto">&nbsp;&nbsp;Near Campus<sup data-toggle="tooltip" data-placement="right"
title="This data is based on the census tracts that are near the UW Madison campus (excluding campus). Read more in the about section."
style="vertical-align: super;
Expand All @@ -24,7 +24,7 @@ <h1 class="text-center mx-auto">&nbsp;&nbsp;Near Campus<sup data-toggle="tooltip

<app-stats-row [data]="covid_data.near_campus"></app-stats-row>

<div class="row" style="width:100%;margin-top:20px;">
<div class="row" style="width:100%;margin-top:60px;">
<h1 class="text-center mx-auto">&nbsp;&nbsp;Madison, WI<sup data-toggle="tooltip" data-placement="right"
title="This data is based on the census tracts that fall within the city lines. Read more in the about section."
style="vertical-align: super;
Expand All @@ -34,7 +34,7 @@ <h1 class="text-center mx-auto">&nbsp;&nbsp;Madison, WI<sup data-toggle="tooltip

<app-stats-row [data]="covid_data.madison"></app-stats-row>

<div class="row" style="width:100%;margin-top:20px;">
<div class="row" style="width:100%;margin-top:60px;">
<h6 class="text-center mx-auto">Last Updated: {{covid_data.updated}}</h6>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class LandingComponent implements OnInit {
})

dataService.getHistory(tmp_arr_2, 14, res.features[0].attributes.DATE).subscribe((results) => {
console.log(results);
this.process_history(results, 14)
})

Expand Down Expand Up @@ -125,6 +126,7 @@ export class LandingComponent implements OnInit {
this.covid_data[key_word].pos_change = this.covid_data[key_word].pos_change + this.refine_number(e.attributes.POS_NEW) || this.refine_number(e.attributes.POS_NEW);
this.covid_data[key_word].neg_change = this.covid_data[key_word].neg_change + this.refine_number(e.attributes.NEG_NEW) || this.refine_number(e.attributes.NEG_NEW);
this.covid_data[key_word].deaths = this.covid_data[key_word].deaths + this.refine_number(e.attributes.DEATHS) || this.refine_number(e.attributes.DEATHS);
this.covid_data[key_word].hosp_total = this.covid_data[key_word].hosp_total + this.refine_number(e.attributes.HOSP_YES) || this.refine_number(e.attributes.HOSP_YES);
}
})
}
Expand All @@ -140,7 +142,8 @@ export class LandingComponent implements OnInit {
if (key.includes(e.attributes.GEOID)) {
this.covid_data[key_word]['pos_' + String(days) + '_days_ago'] = this.covid_data[key_word]['pos_' + String(days) + '_days_ago'] + this.refine_number(e.attributes.POSITIVE) || this.refine_number(e.attributes.POSITIVE);
this.covid_data[key_word]['neg_' + String(days) + '_days_ago'] = this.covid_data[key_word]['neg_' + String(days) + '_days_ago'] + this.refine_number(e.attributes.NEGATIVE) || this.refine_number(e.attributes.NEGATIVE);
this.covid_data[key_word]['deaths_' + String(days) + '_days_ago'] = this.covid_data[key_word]['deaths_' + String(days) + '_days_ago'] + this.refine_number(e.attributes.DEATHS) || this.refine_number(e.attributes.DEATHS)
this.covid_data[key_word]['deaths_' + String(days) + '_days_ago'] = this.covid_data[key_word]['deaths_' + String(days) + '_days_ago'] + this.refine_number(e.attributes.DEATHS) || this.refine_number(e.attributes.DEATHS);
this.covid_data[key_word]['hosp_' + String(days) + '_days_ago'] = this.covid_data[key_word]['hosp_' + String(days) + '_days_ago'] + this.refine_number(e.attributes.HOSP_YES) || this.refine_number(e.attributes.HOSP_YES);
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions corona-dashboard/src/app/services/data-collector.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DataCollectorService {
filter = filter + " OR "
}
}
return this.http.get(`https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI/FeatureServer/10/query?outFields=*&returnGeometry=false&resultOffset=0&resultRecordCount=${geoIDs.length}&f=json&orderByFields=DATE desc&where=GEO = 'Census tract' AND (${filter})`)
return this.http.get(`https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI/MapServer/13/query?outFields=*&returnGeometry=false&resultOffset=0&resultRecordCount=${geoIDs.length}&f=json&orderByFields=DATE desc&where=GEO = 'Census tract' AND (${filter})`)
}

getHistory(geoIDs:any[], daysAgo:number, currDataEpoch:number): Observable<any> {
Expand All @@ -32,11 +32,11 @@ export class DataCollectorService {
filter = filter + " OR "
}
}
return this.http.get(`https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI/FeatureServer/10/query?outFields=*&returnGeometry=false&resultOffset=0&resultRecordCount=${geoIDs.length}&f=json&orderByFields=DATE desc&where=GEO = 'Census tract' AND DATE >= TIMESTAMP '${now.toISOString().split("T")[0] + " " + "00:00:00"}' AND DATE <= TIMESTAMP '${now.toISOString().split("T")[0] + " " + "23:59:59"}' AND (${filter})`)
return this.http.get(`https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI/MapServer/13/query?outFields=*&returnGeometry=false&resultOffset=0&resultRecordCount=${geoIDs.length}&f=json&orderByFields=DATE desc&where=GEO = 'Census tract' AND DATE >= TIMESTAMP '${now.toISOString().split("T")[0] + " " + "00:00:00"}' AND DATE <= TIMESTAMP '${now.toISOString().split("T")[0] + " " + "23:59:59"}' AND (${filter})`)
}

getDataTimestamp(): Observable<any> {
return this.http.get(`https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI/FeatureServer/10/query?outFields=*&returnGeometry=false&resultOffset=0&resultRecordCount=1&f=json&orderByFields=DATE desc&where=GEO = 'Census tract'`)
return this.http.get(`https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI/MapServer/13/query?outFields=*&returnGeometry=false&resultOffset=0&resultRecordCount=1&f=json&orderByFields=DATE desc&where=GEO = 'Census tract'`)
}

}
24 changes: 20 additions & 4 deletions corona-dashboard/src/app/stats-row/stats-row.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<div class="row" style="margin-top:20px;">
<div class="col-md-6" style="margin-top:10px;">
<div class="col-md-4" style="margin-top:10px;">
<i class="text-center fas fa-virus mx-auto"
style="font-size:10rem; top:8px;position: relative;width:100%; color:#fc5f5f;margin-bottom:15px;"></i>
<h3 class="text-center" style="margin-top:10px;">Active Cases: {{data.positive-data.pos_14_days_ago-(data.deaths-data.deaths_14_days_ago)}}
<h3 class="text-center" style="margin-top:10px;">Active Cases:
{{data.positive-data.pos_14_days_ago-(data.deaths-data.deaths_14_days_ago)}}
(+{{data.positive-data.pos_1_days_ago}})<sup data-toggle="tooltip" data-placement="right" data-html="true"
title="<b>Active cases:</b> An estimation using the total amount of positive tests in the last 14 days minus any deaths. <br><br>The number in the parentheses is how many new cases appeared in the last day."
style="vertical-align: super;
Expand All @@ -12,15 +13,30 @@ <h3 class="text-center" style="margin-top:10px;">Active Cases: {{data.positive-d
<h3 class="text-center">Total Positive: {{data.positive}}</h3>
</div>

<div class="col-md-6" style="margin-top:20px;">
<div class="col-md-4" style="margin-top:20px;">
<i class="text-center fas fa-walking mx-auto"
style="font-size:10rem; position: relative;width:100%; color:#87fc83;margin-bottom:15px;"></i>
<h3 class="text-center">Daily Negative: {{data.negative-data.neg_1_days_ago}} <sup data-toggle="tooltip"
data-placement="right"
title="This number underestimates the amount of total negative tests, because it only includes people who had their test results reported electronically to Wisconsin's DHS." style="vertical-align: super;
title="This number underestimates the amount of total negative tests, because it only includes people who had their test results reported electronically to Wisconsin's DHS."
style="vertical-align: super;
font-size: 1rem;">
*</sup></h3>
<h3 class="text-center">Weekly Negative: {{data.negative-data.neg_7_days_ago}}</h3>
</div>

<div class="col-md-4" style="margin-top:10px;">
<i class="text-center fas fa-hospital mx-auto"
style="font-size:10rem; position: relative;width:100%; color:#fc5f5f;margin-bottom:15px;"></i>
<h3 class="text-center" style="margin-top:10px;">Hospitalized:
{{data.hosp_14_days_ago}}
(+{{data.hosp_total-data.hosp_1_days_ago}})<sup data-toggle="tooltip" data-placement="right" data-html="true"
title="<b>Hospitalized:</b> An estimation using the total amount of confirmed hospitalizations in the last 14 days. <br><br>The number in the parentheses is how many were hospitalized in the last day."
style="vertical-align: super;
font-size: 1rem;">
*</sup>
</h3>
<h3 class="text-center">Total Hospitalized: {{data.hosp_total}}</h3>
</div>

</div>

0 comments on commit 68bb763

Please sign in to comment.