-
Notifications
You must be signed in to change notification settings - Fork 33
Testing Your Local Environment Setup
Once you've got dependencies installed and the BFD repository downloaded as noted in Local Environment Setup for BFD Development, you may want to run a test to ensure everything is set up correctly. This guide will run you through loading data using the pipeline into your local BFD database, setting up a local BFD server, and then hitting the server to return data.
- First let's make sure the containerized database is set up completely.
Move to the scripts directory, where we have a number of useful scripts for setting up the pieces of BFD:
Starting from the top level of your bfd-repo:
cd apps/utils/scripts
If you did not create a containerized database in the prior setup, we can do that now. Make sure your container service (docker, podman, etc) is running and run:
./create-bfd-db
Once this is complete, the bfd database should be created and running in your container service. Now let's make sure the schema is up-to-date:
./run-db-migrator
This will apply the latest schema to your database and it should be ready to ingest data.
-
To load one test beneficiary, with your container database running, change directories into
apps/bfd-pipeline/bfd-pipeline-ccw-rif
and run:mvn -Dits.db.url="jdbc:postgresql://localhost:5432/bfd" -Dits.db.username=bfd -Dits.db.password=InsecureLocalDev -Dit.test=RifLoaderIT#loadSampleA clean verify
This will kick off the integration test
loadSampleA
. After the job completes, you can verify that it ran properly with:docker exec bfd-db psql 'postgresql://bfd:InsecureLocalDev@localhost:5432/bfd' -c 'SELECT "bene_id" FROM "beneficiaries" LIMIT 1;'
-
Now it's time to start the server up. Change to
apps/utils/scripts
. If this is your first time running this script, you will be prompted to set a couple environment variables: BFD_PATH: this should be set to the top-level BFD repo directory you downloaded locally. Example:export BFD_PATH=~/Git/beneficiary-fhir-data
BFD_EXEC: This should be set to a directory on your machine the script will store some local files to. Create a directory somewhere outside your repo for this and set the env var. Example, after having created a bfd-scripts directory in Documents:
export BFD_EXEC=~/Documents/bfd-scripts
Once these are set, we can run the server using the server start script (make sure you're in apps/utils/scripts):
./run-bfd-server
-
We're finally going to make a request. BFD requires that clients authenticate themselves with a certificate. Those certs live in the
apps/bfd-server/dev/ssl-stores
directory. We can curl the server using a cert with this command:curl --silent --insecure --cert $BFD_PATH/apps/bfd-server/dev/ssl-stores/client-unsecured.pem "https://localhost:6500/v2/fhir/ExplanationOfBenefit/?patient=567834&_format=json"
-
Total success (probably)!. You have a working call. To stop the server, you can ctrl+c in the command tab you were running the server in to stop it.
- Home
- For BFD Users
- Making Requests to BFD
- API Changelog
- Migrating to V2 FAQ
- Synthetic and Synthea Data
- BFD SAMHSA Filtering