r85501 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85500‎ | r85501 | r85502 >
Date:01:13, 6 April 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
fixed issue with banner reporting when there are impressions leading to several different campaigns in a given interval. This had a major impact on some of the test results for the fundraiser analysis.
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py (modified) (history)
  • /trunk/fundraiser-statistics/fundraiser-scripts/query_store.py (modified) (history)
  • /trunk/fundraiser-statistics/fundraiser-scripts/sql/report_banner_confidence.sql (modified) (history)
  • /trunk/fundraiser-statistics/fundraiser-scripts/sql/report_banner_metrics_minutely.sql (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py
@@ -360,10 +360,15 @@
361361 print '\nCOMMAND = ' + test_call
362362 file.write('\nCOMMAND = ' + test_call)
363363
 364+
364365 print '\n\n' + metric_name
 366+ print '\nitem 1 = ' + labels[0]
 367+ print 'item 2 = ' + labels[1]
365368 print win_str
366369 print '\ninterval\tmean1\t\tmean2\t\tstddev1\t\tstddev2\n'
367370 file.write('\n\n' + metric_name)
 371+ file.write('\nitem 1 = ' + labels[0] + '\n')
 372+ file.write('\nitem 2 = ' + labels[1] + '\n')
368373 file.write(win_str)
369374 file.write('\n\ninterval\tmean1\t\tmean2\t\tstddev1\t\tstddev2\n\n')
370375
@@ -380,7 +385,7 @@
381386 line_args = '%.5f\t\t' + '%.5f\t\t' + '%.5f\t\t' + '%.5f\n'
382387 line_str = line_args % (av_means_1, av_means_2, av_std_dev_1, av_std_dev_2)
383388
384 - print '\n\nOverall Parameters:\n'
 389+ print '\n\nOverall Parameters -- the confidence test was run with these parameters:\n'
385390 print '\nmean1\t\tmean2\t\tstddev1\t\tstddev2\n'
386391 print line_str
387392
Index: trunk/fundraiser-statistics/fundraiser-scripts/sql/report_banner_metrics_minutely.sql
@@ -4,17 +4,17 @@
55
66 if(imp.dt_min < 10, concat(imp.dt_hr, '0', imp.dt_min,'00'), concat(imp.dt_hr, imp.dt_min,'00')) as day_hr,
77 lp.utm_source,
8 -impressions,
 8+impressions * (views / total_views) as impressions,
99 views,
1010 total_clicks,
1111 donations,
1212 amount,
1313 amount50,
14 -views / impressions as click_rate,
 14+(views / impressions) * (total_views / views) as click_rate,
1515 donations / total_clicks as completion_rate,
16 -round(donations / impressions, 6) as don_per_imp,
17 -amount / impressions as amt_per_imp,
18 -amount50 / impressions as amt50_per_imp
 16+round((donations / impressions) * (total_views / views), 6) as don_per_imp,
 17+(amount / impressions) * (total_views / views) as amt_per_imp,
 18+(amount50 / impressions) * (total_views / views) as amt50_per_imp
1919
2020 from
2121
@@ -24,7 +24,7 @@
2525 utm_source,
2626 sum(counts) as impressions
2727 from impression
28 -where on_minute >= '%s' and on_minute < '%s'
 28+where on_minute > '%s' and on_minute < '%s'
2929 group by 1,2,3) as imp
3030
3131 join
@@ -41,7 +41,19 @@
4242
4343 on imp.utm_source = lp.utm_source and imp.dt_hr = lp.dt_hr and imp.dt_min = lp.dt_min
4444
 45+join
4546
 47+(select
 48+DATE_FORMAT(request_time,'%sY%sm%sd%sH') as dt_hr,
 49+FLOOR(MINUTE(request_time) / %s) * %s as dt_min,
 50+utm_source,
 51+count(*) as total_views
 52+from landing_page
 53+where request_time >= '%s' and request_time < '%s'
 54+group by 1,2,3) as lp_tot
 55+
 56+on imp.utm_source = lp_tot.utm_source and imp.dt_hr = lp_tot.dt_hr and imp.dt_min = lp_tot.dt_min
 57+
4658 join
4759
4860 (select
Index: trunk/fundraiser-statistics/fundraiser-scripts/sql/report_banner_confidence.sql
@@ -5,18 +5,20 @@
66
77 lp.utm_source,
88 impressions as total_impressions,
9 -impressions as impressions,
 9+impressions * (views / total_views) as impressions,
1010 views as views,
1111 total_clicks as clicks,
1212 donations as donations,
1313 amount as amount,
14 -views / impressions as click_rate,
 14+(views / impressions) * (total_views / views) as click_rate,
1515 donations / total_clicks as completion_rate,
16 -round(donations / impressions, 6) as don_per_imp,
17 -amount / impressions as amt_per_imp,
 16+round((donations / impressions) * (total_views / views), 6) as don_per_imp,
 17+(amount / impressions) * (total_views / views) as amt_per_imp,
1818 donations / views as don_per_view,
1919 amount / views as amt_per_view,
20 -amount / donations as amt_per_donation
 20+amount / donations as amt_per_donation,
 21+(amount50 / impressions) * (total_views / views) as amt50_per_imp,
 22+(amount100 / impressions) * (total_views / views) as amt100_per_imp
2123
2224 from
2325
@@ -40,14 +42,27 @@
4143
4244 on imp.utm_source = lp.utm_source
4345
 46+join
4447
 48+(select
 49+utm_source,
 50+count(*) as total_views
 51+from landing_page
 52+where request_time >= '%s' and request_time < '%s'
 53+and utm_source REGEXP '%s'
 54+group by 1) as lp_tot
 55+
 56+on imp.utm_source = lp_tot.utm_source
 57+
4558 join
4659
4760 (select
4861 SUBSTRING_index(substring_index(utm_source, '.', 2),'.',1) as banner,
4962 count(*) as total_clicks,
5063 sum(not isnull(contribution_tracking.contribution_id)) as donations,
51 -sum(converted_amount) AS amount
 64+sum(converted_amount) AS amount,
 65+sum(if(converted_amount > 50, 50, converted_amount)) as amount50,
 66+sum(if(converted_amount > 100, 100, converted_amount)) as amount100
5267 from
5368 drupal.contribution_tracking LEFT JOIN civicrm.public_reporting
5469 ON (contribution_tracking.contribution_id = civicrm.public_reporting.contribution_id)
Index: trunk/fundraiser-statistics/fundraiser-scripts/query_store.py
@@ -102,7 +102,7 @@
103103 end = args[1]
104104 banner = args[2]
105105 campaign = args[3]
106 - sql_stmnt = sql_stmnt % (start, end, banner, start, end, campaign, start, end, campaign, banner)
 106+ sql_stmnt = sql_stmnt % (start, end, banner, start, end, campaign, start, end, banner, start, end, campaign, banner)
107107
108108 elif query_name == 'report_LP_confidence':
109109 start = args[0]
@@ -136,7 +136,7 @@
137137 imp_start_time = args[4]
138138
139139 sql_stmnt = sql_stmnt % ('%', '%', '%', '%', interval, interval, imp_start_time, end_time, '%', '%', '%', '%', interval, interval, start_time, end_time, campaign, \
140 - '%', '%', '%', '%', interval, interval, start_time, end_time, campaign)
 140+ '%', '%', '%', '%', interval, interval, start_time, end_time, '%', '%', '%', '%', interval, interval, start_time, end_time, campaign)
141141
142142 elif query_name == 'report_LP_metrics_minutely':
143143 start_time = args[0]

Status & tagging log