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
NUM_SHIFTS_PER_DAY_OF_WEEK = { | |
0: 5, | |
1: 4, | |
2: 7, | |
3: 5, | |
4: 4, | |
} | |
SHIFTNAME = { | |
0: 'LOW 1', |
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
# Parse an abstrat syntax tree from a Lisp expression | |
def tokenize(expression): | |
'''Ensures the expression is parsed into words and parentheses.''' | |
# only tokenize if it's not already tokenized | |
if type(expression) == list: | |
return expression | |
if type(expression) == str: | |
# put spaces around parentheses so they get tokenized separately | |
expression = expression.replace('(', ' ( ').replace(')', ' ) ') |
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
SELECT top_alternative AS alternative, | |
ROUND(NTH(500, QUANTILES(ud_points, 1001)), 2) AS median_points, | |
ROUND(avg(ud_points),2) AS mean_points, | |
ROUND(NTH(500, QUANTILES(ud_weekly_problem_days, 1001)),2) AS median_weekly_days, | |
ROUND(avg(ud_weekly_problem_days),2) AS mean_weekly_days, | |
ROUND(NTH(500, QUANTILES(ud_monthly_problem_seconds/60, 1001)),2) AS median_monthly_minutes, | |
ROUND(avg(ud_monthly_problem_seconds/60),2) AS mean_monthly_minutes, | |
ROUND(NTH(500, QUANTILES(ud_monthly_problems_done, 1001)),2) AS median_monthly_problems, | |
ROUND(avg(ud_monthly_problems_done),2) AS mean_monthly_problems, | |
ROUND(NTH(500, QUANTILES(percent_mastered, 1001)*100),2) AS median_percent_mastered, |
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
SELECT alternative, mission_title, INTEGER(ROUND(NTH(500, QUANTILES(percent_mastered, 1001)) * 100)) as median_pct_mastered, | |
INTEGER(ROUND(NTH(500, QUANTILES(ud_total_problem_seconds, 1001)) / 60)) as median_problem_minutes, | |
NTH(500, QUANTILES(ud_age, 1001)) as median_age, | |
COUNT(1) as N FROM | |
(SELECT ud_age, ud_total_problem_seconds, mission_title, percent_mastered, alternative FROM [eli.advanced_mission_demos]) | |
GROUP BY alternative, mission_title | |
order by mission_title, alternative |
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
# To run: | |
# install graphviz commands | |
# Download topictree from http://www.khanacademy.org/api/v1/topictree | |
# open ipython or something and run the following script. Save the output | |
# as, for instance, covers.gv | |
# run: | |
# dot covers.gv -T ps > out.ps | |
# open out.ps | |
# Make it look better by playing with it and then let me know what you did! |
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
Patients | |
age - int | |
intervention (str, always IV tPA) | |
patient id: alpha num, 6 - 12 chars | |
LSN datetime | |
Triage datetime | |
MRI datetime | |
treatment datetime | |
LSN-triage int (minutes) | |
LSN-MRI int(minutes) |