App showing estimated flood exposure based on WorldPop and Floodscan.
Running the app locally:
- Install the dependencies with
pip install -r requirements.txt
- Install the local package with
pip install -e .
- Create a local
.env
file with the variables:
PROD_BLOB_SAS=<provided-on-request>
DEV_BLOB_SAS=<provided-on-request>
AZURE_DB_PW_DEV=<provided-on-request>
AZURE_DB_UID=<provided-on-request>
STAGE=<"dev" or "prod">
token for the blob storage account.
4. Run the app with python app.py
for debugging, or
gunicorn -w 4 -b 127.0.0.1:8000 app:server
for production.
Changes need to be made in this repo so that flood exposure data from a new ISO3 can be displayed in the app. Once there is new data in the Postgres database (as output from here):
- Pull this code locally and create a new branch
- Add the new ISO3 code to the list of
ISO3S
here - Run
python download_geodata.py
to update the boundary files inassets/geo/
and theadm
database table. Note that both thedev
andprod
databases will need to be updated. This can be configured via theSTAGE
environment variable. - Commit the changes and open a PR on GitHub for review
All code is formatted according to black and flake8 guidelines. The repo is set-up to use pre-commit. Before you start developing in this repository, you will need to run
pre-commit install
The markdownlint
hook will require
Ruby
to be installed on your computer.
You can run all hooks against all your files using
pre-commit run --all-files
It is also strongly recommended to use jupytext
to convert all Jupyter notebooks (.ipynb
) to Markdown files (.md
)
before committing them into version control. This will make for
cleaner diffs (and thus easier code reviews) and will ensure that cell outputs aren't
committed to the repo (which might be problematic if working with sensitive data).