Outcome Toolkit is a program to guide investment into important national health outcomes. It aggregates high-level health information on specific outcomes, coupled with demographics from US Census data.
The frontend can run without the backend. By default it loads outcome data from the
PopHIVE Ingest bundle_health_outcomes
parquet files at page load, and geography from frontend/public/local-data/ (built by
node frontend/scripts/build-geography.mjs). Pushing to main builds and deploys it with
.github/workflows/deploy-pages.yml.
To preview locally: cd frontend && npm ci && npm run dev. Set VITE_DATA_SOURCE=api to use the original backend
instead. Login-only features (projects, invites) and payout targets require the backend.
- Docker
- Python 3.11
git clone https://github.com/PopHIVE/health_indicator_dash_archive.gitLocal secrets/credentials are not used in production, but to avoid checking any secrets/credentials into production
secrets/credentials should not be placed in the .env and instead in a local .env.secrets file. To setup your local
.env.secrets file:
# 1. Copy the template
$ cp .env.secrets.template .env.secrets
# 2. Generate passwords for each of the missing variables in .env.secrets file
# Would recommend using python's secrets module.
# Run the following command for each unassigned variable in your new .env.secrets file.
# Use a text editor to set each unassigned variable to one of the generated strings.
$ python3 -c 'import secrets; print(secrets.token_hex()[:20])'Note that if you do not do this step docker compose will not start and give an error: .env.secrets not found.
Since the data is moderately large, we don't push it to git. Instead, contact the team for the location of the latest
data bundle, and place the zip file in the backend/bundles directory.
For more information on each data bundle see: Data Changelog.
If you would like to build your own data bundle:
# For Backend Dev
cd backend
# Build Docker Container
docker build -f Dockerfile.make . -t outcome-toolkit-etl
# Run Make Commands (puts data in backend/build directory)
docker run -v .:/data outcome-toolkit-etl all
# Zip into a bundle
docker run -v .:/data outcome-toolkit-etl zipYou should now see a bunch of files in the backend/build/ directory.
ls -l build/*.csvOnce you build a bundle and compress everything into a .zip file, please also copy the compiled bundle into the CI VM with the following command, filling in the appropriate variables accordingly:
scp <path to data bundle> <username>@outcome-toolkit-test:/data/bundles/The final command should look something like:
scp backend/bundles/data_bundle_v0.14.0.zip <username>@outcome-toolkit-test:/data/bundles/The first time you run the system, you will need to rebuild the database first. This can take a minute or so. run the
start.sh script from the project's root directory. If you encounter build errors, it may be due to an old docker
version. It is recommended you use docker version 27.1 and above.
./start.sh -d yesTo start the containers without rebuilding the database, leave off the -d (or specify -d no):
./start.shTo start the containers in hot-reload mode for development, specify the dev profile:
./start.sh -p devOther options for start.sh can be found by running it with -h.
WINDOWS NOTE
The above commands work on Mac, Linux, and gitbash (or Windows/Linux sub-system) but not Powershell. To use these commands, install a WSL Linux (Ubuntu 20.04 works) distribution and run the commands from within that terminal. If you're running Docker Desktop, you may need to manually allow WSL integration in the Docker Desktop settings.
To run automated testing against the database, use the -n flag. This can occasionally cause docker to time out. The
following example includes shows the recommended setup for running automated testing in a CI/CD pipeline:
./start.sh -n -p prod -d yesTo just run the tests without launching the application you can run the following script.
docker exec backend_container python3 -m pytest tests/ -vvWINDOWS NOTE
The above command works on Mac, Linux, and gitbash (or Windows/Linux sub-system) but not Powershell. If you are using Powershell you can edit the
.envfile with entries likeRUN_TESTS=yes,REBUILD_DB=yes, andCOMPOSE_PROFILES=dev.
CI/CD is not yet configured for this repository. Jobs must succeed to be merged into main once it is set up.
To push a new image to AWS ECR you must commit all changes since the Commit tag will be used as the docker image tag.
bash push.sh
The script will build the images locally, then push to ECR. It will also create a task definition under the outcome-toolkit-all
family and push the revision.
To then update the service run:
bash deploy.sh
Note that this will update the service but it may change the IP address of the ECS service. So you may need to manually check to make sure the load balancer is pointing to the correct IP.
TBD
Census Resources: