-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
108 lines (67 loc) · 2.26 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
from flask import Flask, jsonify, request, send_file
from flask_cors import CORS
app = Flask(__name__,
static_url_path='',
static_folder='.'
)
CORS(app)
from graphs import summary_graph, evolution_graph
from graphs import evolution_recuperados_graph
from graphs import evolution_fallecidos_graph
from graphs import sexo_graph, modo_graph, pais_graph
from graphs import nacionalidad_graph, edad_graph, tests_graph, provincias_graph, municipios_graph
@app.route('/', methods=['GET'])
def index():
return jsonify({
'message': 'Covid19 Cuba API GRAPH'
})
@app.route('/summary', methods=['POST'])
def summary():
filename = summary_graph(request.json)
return send_file(filename)
@app.route('/evolution', methods=['POST'])
def evolution():
filename = evolution_graph(request.json)
return send_file(filename)
@app.route('/evolution_recuperados', methods=['POST'])
def evolution_recuperados():
filename = evolution_recuperados_graph(request.json)
return send_file(filename)
@app.route('/evolution_fallecidos', methods=['POST'])
def evolution_fallecidos():
filename = evolution_fallecidos_graph(request.json)
return send_file(filename)
@app.route('/sexo', methods=['POST'])
def sexo():
filename = sexo_graph(request.json)
return send_file(filename)
@app.route('/modo', methods=['POST'])
def modo():
filename = modo_graph(request.json)
return send_file(filename)
@app.route('/pais', methods=['POST'])
def pais():
filename = pais_graph(request.json)
return send_file(filename)
@app.route('/nacionalidad', methods=['POST'])
def nacionalidad():
filename = nacionalidad_graph(request.json)
return send_file(filename)
@app.route('/edad', methods=['POST'])
def edad():
filename = edad_graph(request.json)
return send_file(filename)
@app.route('/tests', methods=['POST'])
def tests():
filename = tests_graph(request.json)
return send_file(filename)
@app.route('/provincias', methods=['POST'])
def provincias():
filename = provincias_graph(request.json)
return send_file(filename)
@app.route('/municipios', methods=['POST'])
def municipios():
filename = municipios_graph(request.json)
return send_file(filename)
if __name__ == '__main__':
app.run(debug=True)