Skip to content
/ HCRIS Public

Python Script to download and load Medicare HCRIS data into MySQL and export to CSV

License

Notifications You must be signed in to change notification settings

modanq/HCRIS

Repository files navigation

Medicare Hospital Cost Reports (HCRIS) Data

Python and MySQL Scripts to extract and analyze Medicare HCRIS files.

Load HCRIS files from CMS

  1. Setup MySQL environment
    • Recommend high cpu and high memory server with optimization of mysqld.cnf configuration
    • Using Google Cloud compute engine n1-highmem-4 (4 vCPUs, 26 GB memory) it takes ~15 min
  2. Run hcris_create_database.sql
    • Creates empty HCRIS databsase and tables
  3. Setup Python 3 enviornment
    • Create config.py file as below
    • Install mysql.connector Python package
  4. Review and update features.csv file
    • Lists variable that will be extracted from HCRIS files
    • Contains variable names and variable locations in HCRIS worksheets
  5. Run hcris_load_extract.py
    • Downloads and loads Medicare HCRIS data into MySQL
    • Extracts features present in features.csv and creates hcris.csv file for analysis with R or Python

config.py

class Database:
    def __init__(self):
        self.user = "[user]"
        self.password = "[password]"


database = Database()

Clean up

About

Python Script to download and load Medicare HCRIS data into MySQL and export to CSV

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages