CostCrawler is a Python3 application designed to streamline the collection and comparison of hospital rate cards. It features a Flask interface running on port 5000, making the process of gathering hospital pricing data efficient and user-friendly. CostCrawler enables users to make more informed healthcare decisions by comparing prices for different procedures across various facilities. I created the project in 2019, but kept it private until 2023. Please feel free to adapt it or use it for your own purposes.
CostCrawler provides the following key functionalities:
-
Facilities: Manage a list of facilities to scan and monitor, including details like zip codes and postal locations.
-
Procedures: Track various procedures, with a particular emphasis on radiology.
-
Locations: View all available hospitals and procedures within a defined area, defaulting to a 30-mile radius from the center of a given location.
-
Configurable API Keys: The config.yaml file allows setting API keys for Azure and Google services, if required.
CostCrawler has been tested on Ubuntu but it should work on other operating systems with minor modifications. Follow the steps below to install and run the project:
- Clone the repo and navigate to it.
- Create a Python virtual environment (e.g.,
python3 -m venv env). - Install the dependencies using the
requirements.txtfile (e.g.,python3 -m pip install -r requirements.txt). - Install and set up a PostgreSQL database (version 10.12 recommended).
- Edit the
config.yamlfile to add the path to the PostgreSQL database underdb:, addsalt:, and addgv_keyandmv_keyfor Google and Microsoft scraping. - Load the initial schema from
data/schema.sql. - Run the
load_facilities.py,load_procedures.py, andload_zones.pyscripts to load the initial data. - Run the web UI using the
run.web.shscript located in thebindirectory. - Scrape data using the
scrape_raw_charges.pyscript. - Inspect the scraped data for integrity and load it using
load_raw_charges.py.
You should now have a fully functional hospital charge list portal!
The initial data for CostCrawler can be found in CostCrawler/data/init. The files include:
facilities.txt: List of facilitiesraw_charges.txt: Raw collected charge data from 2021schema.sql: Initial database schematrue_proc.txt: Procedure charge codeszone.txt: Facility locations (these are the Locations)
The bin directory contains scripts that handle various aspects of the project:
facade.py: Runs the web interface on port 5000.load_facilities.py: Loads eligible facilities into the database from a formatted data file.load_procedures.py: Loads eligible procedures into the database from a formatted data file.load_zones.py: Loads all "Locations" into the database model from a formatted data file.make_static_output.py: Renders all content from the web UI into JSON blobs.map_raw_procedures.py: Performs data cleanup.run.web.sh: A helper script that runs the web services.scrape_raw_charges.py: A script that scrapes health care provider information from a list of domains.

