This Source-Differentiated Air Quality System for Southwest Asia, Djibouti, and Afghanistan is an air quality reporting tool built for U.S. federal grant 80NSSC19K0225 and funded by the NASA Shared Services Center.
Generate a time series chart and downloadable CSV file of air pollution concentrations for over 1,200 military bases throughout Southwest Asia, broken down by month, for any period from 2002 to present.
SDAQS-SADA reports individual concentration levels for fine particulate matter (PM2.5) mass and components, including sulfate, nitrate, elemental carbon, organic carbon, and dust.
- Clinical: Department of Veterans’ Affairs CSP #595
- Meredith Franklin, Ph.D. (University of Toronto & University of Southern California)
- Petros Koutrakis, Ph.D. (Harvard University)
- Eric Garshick, M.D. (VA Boston Healthcare & Harvard Medical School)
- Olga Kalashnikova, Ph.D. (Jet Propulsion Laboratory)
- Joel Schwartz, Ph.D. (Harvard University)
- Harvard School of Public Health Environmental Chemistry Lab
Requires Docker Compose.
# download the repo
$ git clone https://github.com/rlue/sdaqs-sada
$ cd sdaqs-sada
# setup
$ mv path/to/db_seed.sql data/
$ export MAPBOXGL_ACCESS_TOKEN="pk.eyJ1Ijoicmx..."
# (re-)deploy
$ docker-compose up -d --build
The resulting container will expose the service at http://localhost:9292.
(Learn more about the setup steps in Installing Non-Public Data and Security Notice below.)
Deploying to the public Internet and enabling HTTPS are beyond the scope of this README. For help with these tasks, consider a reverse proxy or edge router like traefik.
This application depends on air quality exposure data derived through published research that can be found here and here . Data shown in this application cannot be distributed publicly, as they reference the geo-coordinates of various US military bases. Please contact the PI for access to gridded data.
Before the application can be deployed,
you will need to obtain a SQL dump of this data from the project team
and save it to data/db_seed.sql
.
This application requires a Mapbox access token. Get one at https://account.mapbox.com.
Deploying this application will expose this token to anyone who can access the site—it’s not shown in the open, but a determined attacker shouldn’t have a hard time finding it.
Typically, that’s Not a Good Thing, since anyone who obtains your token can use it in their own software and eat into your monthly usage allowance (or worse yet, rack up a big bill on a pay-as-you-go plan). But in this case, it’s just a necessary consequence of using a JavaScript library (Mapbox GL JS) to access a third-party API: the client-side application can’t query for map data without the token, so it must be present in the compiled JS file.
Fortunately, Mapbox has a generous free tier, so the likelihood of abuse is low. For more on access token best practices, read How to use Mapbox securely.
SDAQS-SADA is built using Roda + React.
# .envrc (for direnv)
export RACK_ENV="development"
export NODE_ENV="development"
export APP_DATABASE_URL="postgres:///sdaqs_${RACK_ENV}"
export MAPBOXGL_ACCESS_TOKEN="pk.eyJ1Ijoicmx..." # get one at account.mapbox.com
# .git/config
[core]
hooksPath = .git-hooks
# install dependencies
$ bundle install
$ npm install
# set up database
$ createdb sdaqs_development
$ dropdb sdaqs_development
$ rake db:seed
# generate confidential frontend assets
# (required for compilation of frontend app)
$ rake secrets:generate # or rake secrets:g
# launch ruby console
$ rake console # or rake c
# launch in development mode
$ rake server # or rake s
To embed new fonts into this project:
- Convert to WOFF/WOFF2 format
- Save to
public/assets/fonts
- Use the CSS
@font-face
directive
This repo follows a pattern for git commit messages inspired by the one used on AngularJS.
The first line of each commit should begin with one of the following three-letter codes:
bfx
: Bugfixchr
: Chore (deprecated, trydev
ordep
)dep
: Dependency (i.e., Bundler/npm files)dev
: Developer Concerns (notes, tooling, file structure, etc.)doc
: Documentationdpl
: Deploymentftr
: Featurerfg
: Refactoringtdd
: Testinguix
: UI/UXvis
: Visual Design
Copyright © 2022 University of Southern California. All rights reserved.