Last active
December 16, 2015 13:08
-
-
Save ashaw/5439381 to your computer and use it in GitHub Desktop.
How we're calculating death in our HeartSaver experimental news game.
This file contains hidden or 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
var calculateDeath = function(hospital, pickupTime, travelTime) { | |
var survivalChance = 1; | |
// A victim’s chance of survival decreases by 7 to 10 percent / minute | |
// that passes without defibrillation. | |
// http://www.heart.org/idc/groups/heart-public/@wcm/@ecc/documents/downloadable/ucm_438703.pdf | |
survivalChance -= (0.10 * pickupTime); | |
// Time in transit to ER (.58% / minute, via the Google Directions API) | |
// http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2464671/table/tbl1/ | |
survivalChance -= (0.0058 * travelTime); | |
// Medicare heart attack mortality | |
// http://www.medicare.gov/HospitalCompare/Data/RCD/30-day-measures.aspx | |
survivalChance *= (1 - (hospital.heart_attack_mortality_rate / 100)); | |
return (Math.random() < survivalChance); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment