Environmental noise, especially in urban settings, is a known public health concern:
The growing body of evidence indicates that exposure to excessive environmental noise does not only impact quality of life and cause hearing loss but also has other health impacts, such as cardiovascular effects, cognitive impacts, sleep disturbance and mental health effects.
Our application presents a real-time, interactive visual interface to a system of IoT sound meters deployed in the city of Toronto, Ontario, to better understand the ambient sound levels as well as extreme noise events local communities experience day to day.
The app is currently under active development but can be accessed by following this link. It might take a few seconds to load.
The project has been started and is maintained by volunteers from the CivicTech Toronto community.
We followed Privacy by Design principles in setting up the data collection.
- The sound meter devices are deployed on private properties in residential areas at different locations in the city. We are not publishing exact device locations.
- The devices do not record sound only sound levels in A-weighted decibel levels (dBA)(https://en.wikipedia.org/wiki/Decibel).
- We calculate minimum and maximum sound levels at 5 minute intervals on the device and only broadcast these aggregate values (along wiht the device ID) to a database.
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 SQL database hosted on WebCommand.
Process overview:
- The dashboard sends a web requests to Webcommand for the unique Device IDs available.
- The user selects a device based on the IDs to be presented.
- 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.
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
.
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
.