Awesome
Covid19 Trends ZA Dashboard Project
Introduction
This is a Covid-19 analytics dashboard for South Africa. The focus is on the Effective Reproduction Number (Rt).
This project was inspired by analytics on USA data, Rt.live. The South African model was refined by the Data Science for Social Impact research group (DFSI).
The dashboard is build with Django. The analytics engine currently runs from a Github Actions pipeline at the DFSI repo.
Contributing
- Fork the repo
- Open a new issue
- Make changes and commit code
- Submit a pull request
TODOs
- Use a cron job to store the latest Rt data
- Run the Rt analytics engine directly in this project
- Change loading animation
- Consider optimising page loading by using a daily shared cache in db
- Use a faster front-end plotting framework/method
Local install
Setup
brew install postgresql
pip install virtualenv
cd /your_project_folder
virtualenv env
cd env/bin
activate
cd ../..
pip install -r requirements.txt
Run Local
After adding new static file images, js, etc:
python manage.py collectstatic --noinput
Setup DB: Mac
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l logfile start
createdb <db_name>
psql <db_name>
Ubuntu
sudo apt-get install postgresql postgresql-contrib
sudo su - postgres
psql
- CTRL + D
createdb <db_name>
General
CREATE USER <db_user> WITH PASSWORD '<db_password>';
GRANT ALL PRIVILEGES ON DATABASE <db_name> to <db_user>;
Local run:
python manage.py runserver
After local session changes (due to WSGI config):
touch Covid19TrendsZA/wsgi.py
Production Install
Nginx: Include this in your Nginx config
location ^/static {
autoindex on;
alias /static/;
}
Docker build:
docker build --rm -t covid19trends .
Docker migration (complete your params):
docker run --rm -e SECRET_KEY="" -e DJANGO_DEBUG="0" -e ALLOWED_HOSTS="" -e DB_ENGINE="django.db.backends.postgresql_psycopg2" -e DB_NAME="" -e DB_USER="" -e DB_PASSWORD="" -e DB_HOST="" -e DB_PORT="5432" -e RUN_MIGRATE="1" --network <correct_docker_network> covid19trends python manage.py migrate
Caprover: Self host with Caprover! See the simple captain-definition config file, linked to Docker.