A repo for working with data from CMS's EHR Incentive Programs Data and Program Reports page. after a tweet from @Cascadia and subsequent chat through direct messages inspired me to do something with the data.
Screenshot last updated 9/12/2013 at 12pm EST
data
directory are from CMS's EHR Incentive Programs Data and Program Reports page. They are included only for convenience to fellow developers looking to get up and running with a copy of the data.DSTK_HOST
variable in lib/tasks/geocode.rake
EH: Providers Paid By EHR Program: September 2013 Eligible Hospitals
Create a directory for the raw data and later exports:
mkdir -p public/data/ProvidersPaidByEHRProgram_Sep2013_EH/geojson
Download data file:
curl http://www.cms.gov/Regulations-and-Guidance/Legislation/EHRIncentivePrograms/Downloads/EH_ProvidersPaidByEHRProgram_Sep2013_FINAL.zip -o public/data/ProvidersPaidByEHRProgram_Sep2013_EH/EH_ProvidersPaidByEHRProgram_Sep2013_FINAL.zip
Unzip data file:
unzip public/data/ProvidersPaidByEHRProgram_Sep2013_EH/EH_ProvidersPaidByEHRProgram_Sep2013_FINAL.zip -d public/data/ProvidersPaidByEHRProgram_Sep2013_EH/
Import CSV into MongoDB and ensure the fields are properly formatted.
bundle exec rake hospitals:ingest_latest_payments_csv
bundle exec rake hospitals:ensure_fields_are_properly_formatted
Bring in additional data from the General Hospital Information and HCAHPS (patient experience) data sets on Socrata:
bundle exec rake hospitals:ingest_general_info
bundle exec rake hospitals:ingest_hcahps
bundle exec rake hospitals:ingest_joint_commission_ids
bundle exec rake hospitals:ingest_hc_hais
bundle exec rake hospitals:ingest_hc_hacs
bundle exec rake hospitals:ingest_ahrq_m
bundle exec rake hospitals:ingest_ooc
bundle exec rake hospitals:ingest_cms_form_2552_10
Geocode provider addresses:
bundle exec rake geocode
Print out a nice little report about hospital counts with different types of data (geo, general info, hcahps):
bundle exec rake hospitals:simple_report
Export select information to CSV for safe keeping and offline analysis:
mongoexport --csv -d cms_incentives -c ProvidersPaidByEHRProgram_June2013_EH -o public/data/ProvidersPaidByEHRProgram_June2013_EH/ProvidersPaidByEHRProgram_June2013_EH-normalized-geocodedAndSelectedData.csv -f "PROVIDER NPI,PROVIDER CCN,PROVIDER - ORG NAME,PROVIDER STATE,PROVIDER CITY,PROVIDER ADDRESS,PROVIDER ZIP 5 CD,PROVIDER ZIP 4 CD,PROVIDER PHONE NUM,PROVIDER PHONE EXT,PROGRAM YEAR 2011,PROGRAM YEAR 2012,PROGRAM YEAR 2013,geo.provider,geo.updated_at,geo.data.types.0,geo.data.geometry.location.lat,geo.data.geometry.location.lng,general.hospital_type,general.hospital_owner,general.emergency_services,general.country_name,hcahps.survey_response_rate_percent,hcahps.number_of_completed_surveys,hcahps.percent_of_patients_who_reported_yes_they_would_definitely_recommend_the_hospital_,jc.org_id,hc_hais"
Create MongoDB indexes:
bundle exec rake mongodb:mongoid_create_indexes
If you intend to run the visualization in a production environemnt:
# You will want to create a static `.geojson`
bundle exec ruby app.rb -p 4567 -e development
curl http://localhost:4567/db/cms_incentives/EH/all.geojson -o public/data/ProvidersPaidByEHRProgram_Sep2013_EH/geojson/all.geojson
# Refresh the minified static assets
rm public/static/*
bundle exec rake assetpack:build
# Push the code to Heroku or similar
git push heroku master
# Send updated mongodb database to MongoHQ or similar
bundle exec rake mongodb:export_to_mongohq
# Don't forget to clear AWS Cloudfront caches for static assets and root route.
EP: Providers Paid By EHR Program: June 2013 Eligible Providers
Create a directory for the raw data and later exports:
mkdir -p public/data/ProvidersPaidByEHRProgram_June2013_EP/
Download data file:
curl http://www.cms.gov/Regulations-and-Guidance/Legislation/EHRIncentivePrograms/Downloads/ProvidersPaidByEHRProgram_June2013_EP.zip -o public/data/ProvidersPaidByEHRProgram_June2013_EP/ProvidersPaidByEHRProgram_June2013_EP.zip
Unzip data file:
unzip public/data/ProvidersPaidByEHRProgram_June2013_EP/ProvidersPaidByEHRProgram_June2013_EP.zip -d public/data/ProvidersPaidByEHRProgram_June2013_EP/
Import CSV into MongoDB and ensure the fields are properly formatted. See EH section note for step 4 above. Same applies here, for EPs.
mongoimport --type csv -d cms_incentives -c ProvidersPaidByEHRProgram_June2013_EP --headerline --file public/data/ProvidersPaidByEHRProgram_June2013_EP/ProvidersPaidByEHRProgram_June2013_EP-normalizedByBrianNorris.csv
bundle exec rake providers:ensure_fields_are_properly_formatted
Update for latest CSV which includes payment data: mkdir -p public/data/ProvidersPaidByEHRProgram_Sep2013_EP/geojson
curl http://www.cms.gov/Regulations-and-Guidance/Legislation/EHRIncentivePrograms/Downloads/EP_ProvidersPaidByEHRProgram_Sep2013_FINAL.zip -o public/data/ProvidersPaidByEHRProgram_Sep2013_EP/ProvidersPaidByEHRProgram_Sep2013_EP.zip
unzip public/data/ProvidersPaidByEHRProgram_Sep2013_EP/ProvidersPaidByEHRProgram_Sep2013_EP.zip -d public/data/ProvidersPaidByEHRProgram_Sep2013_EP/
iconv -f ISO-8859-1 -t UTF-8 public/data/ProvidersPaidByEHRProgram_Sep2013_EP/EP_ProvidersPaidByEHRProgram_Sep2013_FINAL.csv > public/data/ProvidersPaidByEHRProgram_Sep2013_EP/EP_ProvidersPaidByEHRProgram_Sep2013_FINAL-utf8.csv
bundle exec rake providers:ingest_latest_payments_csv
If you are running in a production environment, export the geojson to flat files (instead of hitting the database) by running the following rake task:
bundle exec rake providers:output_provider_geojson_by_state