Josh Templeton
- Download Denver 311 Service request and Traffic Accident data
- Transform and Load to query store
- Analyze for patterns / trends
- Docker-based solution
- Apache Airflow: data acquisition, transformation and loading
- Postgres db as query store
- Apache Superset for analysis / reporting
1. External volume for Postgres
docker volume create --name postgres-db-volume -d local
- Bring up Postgres in background
docker-compose -f up postgres -d
- Initialize Airflow
docker-compose -f up airflow-init
- Bring up all services
docker-compose -f up
- Login to Airflow UI
http://localhost:8080
User and Password = airflow
Under DAGs
you will find 2 entries (service_requests
and traffic_accidents
) that correspond to the Python files found in /dags/
The Superset instance is empty at the outset and requires manual set-up.
- Either open the CLI to the Superset container through Docker desktop or:
docker exec -it ib_311-superset-1 /bin/bash
- Create admin user
superset fab create-admin --username superset --firstname Super --lastname Set --email admin@superset.com --password superset
- Upgrade the Superset database
superset db upgrade
- Initialize Superset
superset init
- Login to Superset UI
http://localhost:8088
- Add database connection
Data tab -> Databases -> + Database
button:
- Scroll to bottom and choose SQLAlchemy URI option and enter:
postgresql+psycopg2://superset:superset@postgres/denver