marks / ONC-EHR-Incentives-Program-Payout-Data

Working with data from various HHS/CMS and other data sources to compare healthcare providers
http://hitech.socialhealthinsights.com
MIT License
3 stars 3 forks source link

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

Screenshot Screenshot last updated 9/12/2013 at 12pm EST

Notes

Procedure

EH: Providers Paid By EHR Program: September 2013 Eligible Hospitals

  1. Create a directory for the raw data and later exports:

    mkdir -p public/data/ProvidersPaidByEHRProgram_Sep2013_EH/geojson
  2. 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
  3. Unzip data file:

    unzip public/data/ProvidersPaidByEHRProgram_Sep2013_EH/EH_ProvidersPaidByEHRProgram_Sep2013_FINAL.zip -d public/data/ProvidersPaidByEHRProgram_Sep2013_EH/
  4. 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
  5. 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
  6. Geocode provider addresses:

    bundle exec rake geocode
  7. Print out a nice little report about hospital counts with different types of data (geo, general info, hcahps):

    bundle exec rake hospitals:simple_report
  8. 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"
  9. Create MongoDB indexes:

    bundle exec rake mongodb:mongoid_create_indexes
  10. 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

  1. Create a directory for the raw data and later exports:

    mkdir -p public/data/ProvidersPaidByEHRProgram_June2013_EP/
  2. 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
  3. Unzip data file:

    unzip public/data/ProvidersPaidByEHRProgram_June2013_EP/ProvidersPaidByEHRProgram_June2013_EP.zip -d public/data/ProvidersPaidByEHRProgram_June2013_EP/
  4. 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
  5. 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
  6. 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