ccdb5-api
November 19, 2025 · View on GitHub
ccdb5-api
An API that provides an interface to search complaint data.
Features
- Search complaint data
- Suggest complaint data based on input
- Get complaint based on ID
Requirements
Requirements are batch-installed via pip (see below).
- django - Web framework
- django-localflavor - Country-specific Django helpers
- djangorestframework - Rest API framework
- opensearchpy - low-and-high-level client for OpenSearch
- requests - http requests to get different data format
Setup & Running
This repository assumes that you have an instance of OpenSearch (or Elasticsearch) running with complaint data set up and running.
If not, please refer to the CCDB Data Pipeline to load data into OpenSearch.
Environment Variables
This project uses environment variables and uses autoenv to automatically define environment variables and launch the virtualenv upon cding to the project folder.
You will need to install Autoenv if you haven't:
brew install autoenv
After installation, Homebrew will output instructions similar to:
To finish the installation, source activate.sh in your shell:
source /Users/[YOUR USERNAME]/homebrew/opt/autoenv/activate.sh
Run that now for your initial setup. Any time you run the project you’ll need to run that last line, so if you’ll be working with the project consistently, we suggest adding it to your Bash profile by running:
echo 'source /Users/[YOUR USERNAME]/homebrew/opt/autoenv/activate.sh' >> ~/.bash_profile
If you need to find this info again later, you can run:
brew info autoenv
You can then copy the .env_SAMPLE file to .env, then update any environment variables accordingly.
Dependencies
First, create a virtual environment for Python dependencies:
mkvirtualenv ccdb5-api
Next, use pip to install dependencies, which are defined in setup.py:
pip install -e '.[testing]'
With that, you just need a few additional commands to get up and running:
python manage.py runserver
API Docs
Original API documentation is available at https://cfpb.github.io/ccdb5-api/, but the docs are not being updated at this time.
Running Tests
If you have Tox installed (recommended),
you can run the specs for this project with the tox command.
If not, this command will run the specs on the python version your local
environment has installed: ./manage.py test.
If you run the tests via Tox, it will automatically display spec coverage information. To get test coverage information outside of Tox, install Coverage.py and run these commands:
coverage erase
coverage run manage.py test
coverage report