repo to automate NPI file download, extract and load into a database and create an api for endpoint
work in progress... pod_setup.sh
The instructions below are specific to local Postgres environment. This is the current default method.
Once the application is more flushed out, this repo will be updated for instructions to containerize with a Postgres database.
This requirement will have you create a copy of .env.dummy
and update the file with appropriate values so you don't check in any passwords or settings. These values are referenced in Django's settings.py
file
-
Navigate to
NPI_FILES/backend
-
Create a copy of
.env.dummy
cp .env.dummy .env
-
Update all the relevant fields with your local postgres in
backend/.env
.
-
Ensure you are in
NPI_FILES directory
and create virtual environmentpython -m venv env
-
Activate your virtual environment
source env/bin/activate
NOTE: Windows may use this env/Scripts/activate path instead -
Install requirements
pip install -r backend/requirements.txt
-
Make db migrations
python backend/manage.py migrate
-
Create super user before logging in to admin
python backend/manage.py createsuperuser
-
Launch Django
python backend/manage.py runserver
These commands are used to run automated tasks. The order in this sense matters as later this can be used with an orchestration tool.
-
fetch_urls
- scrapes urls of npi zip files to download
-
get_download
- this one is getting list of files to download
- downloading files that have yet to be downloaded
- then loading them up to the db.
- needs work and to be cleaned up.
-
load_large_csv
- This function upload csv to a target table using pg command.
- need to remember why i did this, probably for the 9gb file
-
seed_sample_data
- loads npi sample file with a 110 records
Misc
- hello_world
- just a dummy command to verify things are working and build use as a template.