Python and MySQL Scripts to extract and analyze Medicare HCRIS files.
- 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
- Recommend high cpu and high memory server with optimization of
- Run
hcris_create_database.sql
- Creates empty HCRIS databsase and tables
- Setup Python 3 enviornment
- Create
config.py
file as below - Install
mysql.connector
Python package
- Create
- Review and update
features.csv
file- Lists variable that will be extracted from HCRIS files
- Contains variable names and variable locations in HCRIS worksheets
- Run
hcris_load_extract.py
- Downloads and loads Medicare HCRIS data into MySQL
- Extracts features present in
features.csv
and createshcris.csv
file for analysis with R or Python
class Database:
def __init__(self):
self.user = "[user]"
self.password = "[password]"
database = Database()