Django backend that provides a FHIR API for accessing data from the npd database and supporting code for the National Provider Directory search web application.
backend/contains code for deploying the application within a docker containerbackend/app/directory contains code that controls the overall applicationbackend/npdfhir/contains code that drives the FHIR APIbackend/provider_directory/contains code that drives the landing page and search application
- Ensure that either colima (if using macOS) or the docker service is running
- Create a
.envfile in this directory, following the template of the.env_templatefile- n.b. ensure that NPD_DB_HOST is set to
dbif using a local postgres instance.
- n.b. ensure that NPD_DB_HOST is set to
- Run
docker-compose up --buildfrom the project root and following any changes - Happy coding!
Without docker:
- Ensure that you have a running local postgres instance
- Make sure that you have a working
.envfile as described above - Make sure all python dependencies are installed in a venv or otherwise
- Navigate to the
backend/directory and runpython manage.py test
All commands below
With docker, full setup every time:
- Run
make testfrom project root
With docker, setup once:
- (one-time) Run
make test-setup - Run
make test-backend
Automated tests run in a GitHub workflow whenever a PR is created or a push is made to the main branch. All tests must pass for PRs to be accepted.
We use ruff to lint and format all Python in this project. All PRs must pass the linter to be accepted.
You can install ruff with pip install ruff, brew install ruff, or make install-tools and run it natively or with the make lint command.
make lint
# runs `ruff check .`You can format all code in the project with make format, or rely on the pre-commit hooks installed by make install-tools to format just the files you are making changes to.
API documentation can be viewed at /fhir/docs. If you make any changes to the Views, please update the swagger schema accordingly!
