Giter Site home page Giter Site logo

aquaroyal72 / sage-risk-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from santhosh-george/sage-risk-engine

0.0 0.0 0.0 539 KB

The SaGe Risk Engine is a flexible data driven engine to calculate risk scores based on CMS HCC, RX, and ESRD models.

License: Other

PLpgSQL 100.00%

sage-risk-engine's Introduction

The SaGe Risk Engine is a flexible data driven engine to calculate the risk adjustment factors (RAF) / risk scores based on CMS HCC (V22, V24, V21 (ESRD), V05 (RX)) models. The active models are included in the model and future models will be incorporated as CMS publishes the model software. The engine is developed for the Amazon Redshift platform. PostgreSQL and MySQL versions are also available. This codebase enables you to avoid SAS and calculate the risk score using the SaGe Risk Engine in the cloud (Redshift) or database on your local machine (MySQL / PostgreSQL)

How to run the engine

  1. Create a cluster with database name genericmodelv3 (if using a different database name please update the stored procedures with the database name used)
  2. Upload the .txt files in model-settings folder to S3 bucket and apply IAM role for Redshift to access the S3 bucket
  3. There are sample person and diag files that could be used to try the engine. If using the sample data in the sample-data folder upload the .txt files to the S3 bucket. When using your data use your data in similar structure. If the structure is different make necessary changes to me_person table found in sage-risk-engine-step-0.sql. One requirement to have the bene id to be identified as HICNO column
  4. Modify the URL for S3 bucket and IAM role in sage-risk-engine-step-0.sql
  5. Create stored procedures by running the script in sage-risk-engine-step-0.sql through sage-risk-engine-step-7.sql one at a time. The scripts can be found in the code folder
  6. Create wrapper stored procedure by running the script in sage-risk-engine-wrapper.sql
  7. Run the following command to populate the engine parameters: call genericmodelv3.public.SAGE_MEP_STEP_0();
  8. Run the following command to run the model: call genericmodelv3.public.SAGE_MEP_WRAPPER (<>,<<Model Type (example 'V24', 'V22', 'RX', 'ESRD-P1', 'ESRD-P2'>>,<<Age calculated as of Date in 'YYYY-MM-DD' format (usually February 1 of the Model Year)>>,<<run MCE Edits 'Y' or NULL>>,<<Specify date different than the third parameter to calculate age for MCE Edits 'YYYY-MM-DD' format or NULL); Example: call genericmodelv3.public.SAGE_MEP_WRAPPER (2020,'V24','2020-02-01','Y',NULL);
  9. The outputs are available in three redshift tables: a. SAFE_OFILE_VARIABLE - This table is a wide table with columns for all inputs used in the model and the variable switches calculated b. SAGE_OFILE_SCORE - This table has a row for each beneficiary and score type c. SAGE_OFILE_SCORE_PART - This table is created for the purposes of BI reporting. This has rows for beneficiaries and the variable switch names that are equal to 1 along with it's coefficient

Note: Each run of the model engine will drop the previously created tables. The output tables will need to copied to another name if required.

License

SaGe Risk Engine is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). See LICENSE.md for more info.

sage-risk-engine's People

Contributors

santhosh-george avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.