forked from rdingwell/measures
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65a11ed
commit b14d06d
Showing
24 changed files
with
975 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
fixtures/measures/0004_aod_treatment/patients/denominator_adult.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Happy", // personal data | ||
"last": "Golucky", | ||
"gender": "F", | ||
"birthdate": 549504000, // Time.gm(1987,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period) | ||
"alcohol_or_drug_dependence_diagnosis_active": [1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1255910400] //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
fixtures/measures/0004_aod_treatment/patients/denominator_youth.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Mindy", // personal data | ||
"last": "Chrysler", | ||
"gender": "F", | ||
"birthdate": 865123200, // Time.gm(1997,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period) | ||
"alcohol_or_drug_dependence_diagnosis_active": [1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1255910400] //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
fixtures/measures/0004_aod_treatment/patients/numerator1_adult.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Milo", // personal data | ||
"last": "Jones", | ||
"gender": "F", | ||
"birthdate": 865123200, // Time.gm(1997,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period) | ||
"alcohol_or_drug_dependence_diagnosis_active": [1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_outpatient_BH_encounter":[ 1256515200] // Time.gm(2009,10,26).to_i | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
fixtures/measures/0004_aod_treatment/patients/numerator1_youth.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Mindy", // personal data | ||
"last": "Chrysler", | ||
"gender": "F", | ||
"birthdate": 865123200, // Time.gm(1997,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period) | ||
"alcohol_or_drug_dependence_diagnosis_active": [1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_outpatient_BH_encounter":[ 1256515200] // Time.gm(2009,10,26).to_i | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
fixtures/measures/0004_aod_treatment/patients/numerator2_adult.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Jose", // personal data | ||
"last": "Feliciano", | ||
"gender": "M", | ||
"birthdate": 549504000, // Time.gm(1987,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period) | ||
"alcohol_or_drug_dependence_diagnosis_active": [1255910400], // Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1255910400], // Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_outpatient_bh_encounter":[ 1256515200,1256517000] // Treatment Events: Time.gm(2009,10,26).to_i | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
fixtures/measures/0004_aod_treatment/patients/numerator2_youth.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Juanita", // personal data | ||
"last": "Sombrero", | ||
"gender": "F", | ||
"birthdate": 865123200, // Time.gm(1997,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period) | ||
"alcohol_or_drug_dependence_diagnosis_active": [1255910400], // Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1255910400], // Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_outpatient_bh_encounter":[ 1256515200,1256517000] // Treatment Events: Time.gm(2009,10,26).to_i | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
fixtures/measures/0004_aod_treatment/patients/population_adult.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Fox", // personal data | ||
"last": "Trot", | ||
"gender": "F", | ||
"birthdate": 549504000, // Time.gm(1987,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period), preceeded by diagnosis on 2009/9/1...this is within 60 days and prevents denominator | ||
"alcohol_or_drug_dependence_diagnosis_active": [1251763200, 1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1251763200, 1255910400] //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
fixtures/measures/0004_aod_treatment/patients/population_youth.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// names generated by http://rockstarname.com/ | ||
{ | ||
"first": "Mindy", // personal data | ||
"last": "Chrysler", | ||
"gender": "F", | ||
"birthdate": 865123200, // Time.gm(1997,6,1).to_i | ||
"measures": { // bag of measures, one entry per measure | ||
"0004": { | ||
// Diagnosis on 2009/10/19 (within measurement period), preceeded by diagnosis on 2009/9/1...this is within 60 days and prevents denominator | ||
"alcohol_or_drug_dependence_diagnosis_active": [1251763200, 1255910400], //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
"encounter_acute_inpt_encounter": [1251763200, 1255910400] //Time.gm(2009,10,19).to_i and Time.gm(2009,9,1).to_i | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"results":[ | ||
{ | ||
"id": "0004", | ||
"sub_id": "a", | ||
"initialPopulation": 5, | ||
"numerator": 1, | ||
"denominator": 4, | ||
"exclusions": 0 | ||
}, | ||
{ | ||
"id": "0004", | ||
"sub_id": "b", | ||
"initialPopulation": 5, | ||
"numerator": 1, | ||
"denominator": 4, | ||
"exclusions": 0 | ||
}, | ||
{ | ||
"id": "0004", | ||
"sub_id": "c", | ||
"initialPopulation": 3, | ||
"numerator": 1, | ||
"denominator": 2, | ||
"exclusions": 0 | ||
}, | ||
{ | ||
"id": "0004", | ||
"sub_id": "d", | ||
"initialPopulation": 3, | ||
"numerator": 1, | ||
"denominator": 2, | ||
"exclusions": 0 | ||
}, | ||
{ | ||
"id": "0004", | ||
"sub_id": "e", | ||
"initialPopulation": 8, | ||
"numerator": 2, | ||
"denominator": 6, | ||
"exclusions": 0 | ||
}, | ||
{ | ||
"id": "0004", | ||
"sub_id": "f", | ||
"initialPopulation": 8, | ||
"numerator": 2, | ||
"denominator": 6, | ||
"exclusions": 0 | ||
} | ||
|
||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Adds alcohol and drug treatment utility functions to the root JS object. | ||
// Since measure 0004 has 3 populations with two numerators each, this allows code reuse. | ||
// | ||
// lib/qme/mongo_helpers.rb executes this function on a database | ||
// connection. | ||
(function () { | ||
var root = this; | ||
|
||
var day = 24 * 60 * 60; | ||
var year = 365 * day; | ||
var latest_birthdate; | ||
var earliest_birthdate; | ||
var earliest_encounter; | ||
var earliest_diagnosis; | ||
var latest_diagnosis; | ||
var diagnoses_during_period; | ||
var inpatient_encounters; | ||
var encounters; | ||
var diagnoses_during_encounters; | ||
var rehab_and_detox_during_inpatient_encounters; | ||
|
||
var first_alcohol_drug_event; | ||
var first_alcohol_drug_treatment_event; | ||
|
||
|
||
root.alcoholDrugFirstEvent = function(measure, effective_date){ | ||
|
||
earliest_encounter = effective_date - 1*year; | ||
earliest_diagnosis = effective_date - 1*year; | ||
latest_diagnosis = effective_date - 45*day; | ||
|
||
|
||
|
||
diagnoses_during_period = selectWithinRange(measure.alcohol_or_drug_dependence_diagnosis_active,earliest_diagnosis, latest_diagnosis); | ||
inpatient_encounters = normalize(measure.encounter_acute_inpt_encounter,measure.encounter_non_acute_inpatient_encounter); | ||
encounters = normalize( inpatient_encounters, | ||
measure.encounter_ed_encounter, | ||
measure.encounter_outpatient_bh_encounter); | ||
diagnoses_during_encounters = allDiagnosesDuringEncounter( | ||
measure.alcohol_or_drug_dependence_diagnosis_active, | ||
encounters, earliest_diagnosis, latest_diagnosis); | ||
rehab_and_detox_during_inpatient_encounters = allEventsDuringEncounter( | ||
measure.alcohol_drug_rehab_and_detox_interventions_procedure_performed, | ||
inpatient_encounters, | ||
earliest_diagnosis, latest_diagnosis); | ||
|
||
var first_diagnosis_during_encounter = _.min(diagnoses_during_encounters); | ||
var first_rehab_and_detox_during_inpatient_encounter = _.min(rehab_and_detox_during_inpatient_encounters); | ||
|
||
first_alcohol_drug_event = Math.min(first_diagnosis_during_encounter, first_rehab_and_detox_during_inpatient_encounter); | ||
|
||
return(first_alcohol_drug_event); | ||
|
||
}; | ||
|
||
|
||
root.alcohol_drug_denominator = function(measure) { | ||
// first_alcohol_drug_event is defined in population | ||
var begin_range = first_alcohol_drug_event - 60*day; | ||
var previous_event = inRange(measure.alcohol_or_drug_dependence_diagnosis_active, begin_range, first_alcohol_drug_event-1); | ||
return(previous_event == 0 ); | ||
}; | ||
|
||
root.alcohol_drug_numerator1 = function(measure) { | ||
alcohol_drug_treatments = normalize( | ||
selectWithinRange( measure.encounter_acute_inpt_encounter, first_alcohol_drug_event+1, first_alcohol_drug_event + 14*day), | ||
selectWithinRange( measure.encounter_non_acute_inpatient_encounter, first_alcohol_drug_event+1, first_alcohol_drug_event + 14*day), | ||
selectWithinRange( measure.encounter_outpatient_bh_encounter, first_alcohol_drug_event+1, first_alcohol_drug_event + 14*day)); | ||
|
||
if(alcohol_drug_treatments.length > 0) first_alcohol_drug_treatment_event = _.min(alcohol_drug_treatments); | ||
|
||
return(alcohol_drug_treatments.length > 0); | ||
}; | ||
|
||
root.alcohol_drug_numerator2 = function(measure) { | ||
return (inRange(encounters, first_alcohol_drug_treatment_event+1, first_alcohol_drug_treatment_event + 30*day) ); | ||
}; | ||
|
||
|
||
})(); | ||
|
||
|
Oops, something went wrong.