Coder Social home page Coder Social logo

mim18 / loyalty_cohort Goto Github PK

View Code? Open in Web Editor NEW

This project forked from i2b2plugins/loyalty_cohort

1.0 0.0 1.0 170 KB

Uses heuristics to find patients who get the majority of their care from your hospital system

License: Other

TSQL 77.86% PLpgSQL 22.14%

loyalty_cohort's Introduction

Loyalty Cohort Algorithm

See appendix table S1 for the regression equation used to calculate the score.

See algorithm outline for more details on the algorithm.

Notes:

  • Relies on i2b2 data using the ACT ontology.
  • This version is MSSQL. Oracle refactor underway in a separate branch.
  • (Maybe - The Loyalty Paths might be missing some sibling nodes).

From your ACT database...

To install:

  1. Run ddl_xref_LoyaltyCode_paths.sql to create the xref_LoyaltyCode_paths table.
  2. Run ddl_LU_CHARLSON.sql to create the LU_CHARLSON table.
  3. Import the contents of xref_LoyaltyCode_paths.csv into the table, or run insert_xref_LoyaltyCode_paths.sql
  4. Run insert_LU_CHARLSON.sql to populate the LU_CHARLSON table. Replace the prefix in the code pattern column if your data do not use ICD10CM: and ICD9CM:
  5. Run ddl_dml_xref_LoyaltyCohort_PSCoeff.sql to create and load the Predicted Score coefficients table.
  6. Run dbtype/LoyaltyCohortdbtype to create the usp_LoyaltyCohort_opt stored procedure.

To run:

  1. Create a cohort filter table, defining the patients on which to compute loyalty scores. The three columns are:
    • patient_num: patient_num from the i2b2 tables
    • cohort_name: a name for the cohort. You can optionally compute several cohorts separately, but specifying different values for this.
    • index_dt: a date which is a reference point in time at which to compute the loyalty score. It is suggested to select a common recent point in time or to choose each patient's most recent visit date, for example.
DECLARE @cfilter udt_CohortFilter

INSERT INTO @cfilter (PATIENT_NUM, COHORT_NAME, INDEX_DT)
   select distinct patient_num, substring(cohort,1,charindex('202',cohort)-1) cohort, admission_date 
 FROM [FourCE_LocalPatientSummary] /*  4CE X.2 COHORT FOR EXAMPLE */
  1. Customize the following statement and execute on your database to compute the loyalty cohort. EXEC [dbo].[usp_LoyaltyCohort_opt] @site='UKY', @lookbackYears=1, @demographic_facts=1, @gendered=0, @cohort_filter=@cfilter, @output=0 Note that steps 1-2 must be run in the same transaction.

  2. Execute the following statement on your database to print the output that can be shared: select * from loyalty_dev_summary where Summary_Description='PercentOfSubjects'

  3. We are collecting outputs of this script to compare heuristics. If participating, contact us for access and then paste the output of step 3 into the Google sheet here: https://docs.google.com/spreadsheets/d/1ubuRt_ffVcZiQgUdOmeMXxgjOdfkpQe2FNFyt0u2Un4/edit?usp=sharing

  4. The script also outputs patient level data in loyalty_dev and loyalty_charlson_dev. These cohorts are dependent on lookbackYears but not demographic_facts.

Parameter description:

  • site: A short (3-character) identifier for your site.
  • lookbackYears: A number of years for lookback. The original algorithm used 1 year, but we have found 3- or 5-years are more accurate, because some preventitive care like PSA and Pap Smears do not occurr every year.
  • demographic_facts: Set to 1 if demographic facts (e.g., age, sex) are stored in the fact table (rather than patient_dimension).
  • gendered: Set to 1 to create a summary table (and cutoffs) that do not include male-only facts for female patients in the denominator and vice-versa.
  • filter_by_existing_cohort and cohort_filter: If the first is 1, specify a table variable of (PATIENT_NUM, COHORT_NAME) in the second parameter.
  • output: If 1, pretty-print the loyalty_dev_summary percentages after the run.

loyalty_cohort's People

Contributors

darrenwhenderson avatar jklann avatar mim18 avatar

Stargazers

 avatar

Forkers

gaybro8777

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.