The application is implemented in Python, using Plotly Dash, and packaged into a Docker container for ease of portability and deployement. The noise meters are sending data at regular intervals to a database hosted on WebCommand which exposes a REST API that is used to pull data for the maps and dashboard.
Process overview:
- The app sends a API requests to Webcommand for the unique Device IDs and locations to create the system map.
- The user selects a location and clicks on the map, a new page opens with the location dashboard.
- Multiple requests are sent to WebCommand to get the data required to construct each chart.
- The data is cached on the client side.
- After formatting and processing, we use
plotly
to generate the interactive visuals.
We aim to pull the minimum amount of data required to save network usage and improve performance even if it requires multiple requests. We expect much more data being stored in the future.
Prerequisites:
- Docker Engine and
make
installed. - Create a
config.env
file at the same level as themakefile
and add a lineAPI_TOKEN=...
with your WebCommand token. The public token can be accessed here with some more info about the data base.
Run the following commands to start the application locally:
- Build the production container:
make prod_build
- Run the production container:
make prod_container
- The Dash app is accessible on
http://localhost:8501
in your browser. - To stop the app, run
make docker_clean
.
For starting the development container:
- Build the dev container:
make dev_build
- Run dev container:
make dev_container
- There are two ways to run the app:
- Run
make debug
in the container to start the app in debug mode. - Run
make app
in the container to start the app in regular deploy mode.
- Run
- Hitting
Control+C
will stop the app and typingexit
will exit and shut down the container. - To remove the stopped container, run
make docker_clean
.
Currently, we have GitHub Actions setup so that each push to main
triggers a deployment.
Prerequisites: registered Heroku account and Heroku CLI authenticated; Heroku App set up on Heroku Dashboard with the app name appropriately matching in the makefile
.
The app is set up for deployement on Heroku.
- Build the production container:
make prod_build
- Push the container to the Heroku Container Registry:
make heroku_push
- Release the app publicly:
make heroku_release
For unit testing, run make test
.