-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
59 lines (44 loc) · 1.69 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from flask import Flask, render_template, request, redirect
import requests
app = Flask(__name__)
app.secret_key = "mysecret123"
url = "https://api.rootnet.in/covid19-in/stats/latest"
response = requests.get(url)
covidData = response.json()
indiaTotal = {
"total" : covidData['data']['summary']['total'],
"recovered" : covidData['data']['summary']['discharged'],
"death" : covidData['data']['summary']['deaths'],
"active" : covidData['data']['summary']['total'] - (covidData['data']['summary']['discharged'] + covidData['data']['summary']['deaths']),
}
stateData = []
for stateCount in range(0, 35):
stateData.append([
covidData['data']['regional'][stateCount]['loc'],
covidData['data']['regional'][stateCount]['totalConfirmed'],
covidData['data']['regional'][stateCount]['discharged'],
covidData['data']['regional'][stateCount]['totalConfirmed'] - (covidData['data']['regional'][stateCount]['discharged'] + covidData['data']['regional'][stateCount]['deaths']),
covidData['data']['regional'][stateCount]['deaths'],
])
#print(indiaTotal)
#print(stateData)
@app.route('/')
def index():
return render_template("index.html", indiaTotal = indiaTotal, stateData = stateData)
@app.route('/assessment')
def assessment():
return render_template("assessment.html")
@app.route('/symptoms')
def symptoms():
return render_template("symptoms.html")
@app.route('/helpline')
def helpline():
return render_template("helpline.html")
@app.route('/about')
def about():
return render_template("about.html")
@app.route('/statsdaily')
def statesdaily():
return render_template("dailyStats.html")
if __name__ == '__main__':
app.run(debug = True)