You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-33Lines changed: 9 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@
6
6
7
7

8
8
9
-
Versione Italiana [qui](https://github.com/fabriziomiano/covidashit/blob/main/README_IT.md)
10
-
11
-
A simple dashboard to display and monitor the official data of the COVID-19 outbreak in Italy released by the [Civil Protection Dept.](https://github.com/pcm-dpc/COVID-19) and updated on a daily basis.
9
+
A simple dashboard to display and monitor the official data of the COVID-19 outbreak in Italy, released by the [Italian Civil Protection Dept.](https://github.com/pcm-dpc/COVID-19), and the vaccination-status data, released by [Italia Open Data](https://github.com/italia/covid19-opendata-vaccini/).
12
10
13
11
**The app is deployed on an AWS EC2 instance [here](https://www.covidash.it/)**
14
12
@@ -29,41 +27,19 @@ which is built using [HighCharts](https://www.highcharts.com/).
29
27
30
28
In order for the app to be operational, a mongoDB must be populated
31
29
([see here](https://docs.atlas.mongodb.com/tutorial/create-new-cluster) for the creation of an Atlas mongoDB free cluster).
32
-
Additionally, mongo collections must be updated on a daily basis. The Flask contains a number of API whose purpose is to
33
-
update the DB every time the `master` branch of the CP Dept repository is updated, via a GitHub webhook (see the GitHub workflow [here](https://github.com/fabriziomiano/COVID-19/blob/master/.github/workflows/merge-upstream.yml)).
34
-
Ultimately, the webhooks for the following APIs must be set on the CP forked repository:
35
-
36
-
*`POST /update/<data_type>`
37
-
*`POST /update/<data_type>/<coll_type>`
30
+
The backend is populated by [covidashflow](https://github.com/fabriziomiano/covidashflow) - an Apache-Airflow ETL - which reads the pandemic data from the `master` branch of the [PCM-DPC repository](https://github.com/pcm-dpc/COVID-19/), and the vaccines data from the `master` branch of the [Italia Open Data repository](https://github.com/italia/covid19-opendata-vaccini/)
38
31
39
-
| data_type | coll_type |
40
-
|------------|-----------------------------|
41
-
| national |[series, trends]|
42
-
| regional |[breakdown, series, trends]|
43
-
| provincial |[breakdown, series, trends]|
44
-
| vax |[summary]|
45
32
46
33
### Local deployment (DEV)
47
-
* create and activate a virtual environment [(follow this)](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)
48
-
* install the requirements in `requirements.txt`
34
+
* create and activate a virtual environment [(follow this)](https://python-poetry.org/docs/managing-environments/)
35
+
* install the requirements via poetry `pip install --upgrade pip poetry && poetry install`
49
36
50
37
The `.env` file contains all the env vars needed by the webapp.
51
38
In particular, the `MONGO_URI` and the various collection names string must be set.
52
-
Before the Flask server is started, but after the virtual environment has been activated,
53
-
the DB must be populated.
54
-
For this purpose a Flask CLI, that populates the various collections, is included.
55
-
This, with a very basic ETL procedure, will populate the various collections on
56
-
the DB with the official data released by the Civil Protection Dept.
39
+
The values of these variables should match those in [covidashflow](https://github.com/fabriziomiano/covidashflow)
40
+
The WebApp should start without errors even if the backend is empty; no data will be visualized.
57
41
58
-
Clone the repo, `cd` into it, activate the virtual environment, and run the procedure
59
-
```shell
60
-
flask createdb
61
-
```
62
-
then run the worker
63
-
```shell
64
-
celery -A celery_worker.celery worker
65
-
```
66
-
and, in a new shell, run the application server
42
+
Clone the repo, `cd` into it, activate the virtual environment, run the application server
67
43
```shell
68
44
gunicorn wsgi:app
69
45
```
@@ -83,7 +59,7 @@ docker-compose down
83
59
```
84
60
85
61
## Plots API
86
-
The app provides an API to produce a server-side plot with `matplotlib`.
62
+
The app provides an API to produce plots with `matplotlib`.
87
63
The API can return a JSON response with the base64-encoded image, or
88
64
the bytes content to be saved as a file.
89
65
@@ -146,4 +122,4 @@ The plot will be saved in `./plot.png`
146
122
## Donation
147
123
If you liked this project or if I saved you some time, feel free to buy me a beer. Cheers!
0 commit comments