diff --git a/hnq-research/HNQ.backup b/hnq-research/HNQ.backup index b46b509..c9f2df0 100644 Binary files a/hnq-research/HNQ.backup and b/hnq-research/HNQ.backup differ diff --git a/hnq-research/hotness-calculation-20181108-2345.csv b/hnq-research/hotness-calculation-20181108-2345.csv new file mode 100644 index 0000000..2ce3dc8 --- /dev/null +++ b/hnq-research/hotness-calculation-20181108-2345.csv @@ -0,0 +1,101 @@ +site,question,timestamp,hotness,calculated_hotness,views,traffic +history,49243,2018-11-08 23:45:00,161.908,4.49861102725452,5873,12954 +codegolf,175485,2018-11-08 23:45:00,122.779,3.65374374432519,1479,5854 +security,197236,2018-11-08 23:45:00,118.193,3.28040308536082,3394,65844 +workplace,122351,2018-11-08 23:45:00,95.202,6.43006466875273,2304,43644 +writing,39988,2018-11-08 23:45:00,94.765,2.62750732565308,2106,10607 +worldbuilding,129621,2018-11-08 23:45:00,87.784,2.11622381503254,604,16364 +space,31898,2018-11-08 23:45:00,79.908,2.21347586827745,2418,8506 +math,2990086,2018-11-08 23:45:00,77.972,2.20902205436392,724,368175 +rpg,135174,2018-11-08 23:45:00,72.919,2.02059016296967,2021,65265 +security,197250,2018-11-08 23:45:00,68.433,2.53547851559996,1851,65844 +puzzling,74890,2018-11-08 23:45:00,61.784,1.48135667052278,508,13375 +worldbuilding,129519,2018-11-08 23:45:00,58.714,1.94243637166673,4755,16364 +superuser,1373841,2018-11-08 23:45:00,56.894,1.70925769675705,401,668110 +rpg,135182,2018-11-08 23:45:00,54.244,1.93697500333388,930,65265 +parenting,35218,2018-11-08 23:45:00,54.006,1.37044798383585,29350,17096 +ell,184991,2018-11-08 23:45:00,52.679,1.51517046835114,4007,134802 +tex,458975,2018-11-08 23:45:00,52.169,1.44228332322318,327,115906 +scifi,198138,2018-11-08 23:45:00,47.946,1.29082766942969,3077,74500 +academia,119774,2018-11-08 23:45:00,45.784,1.09066919697831,125,39532 +workplace,122337,2018-11-08 23:45:00,43.022,3.42779284297849,3122,43644 +codereview,207240,2018-11-08 23:45:00,42.523,1.23316330560534,181,88002 +judaism,96770,2018-11-08 23:45:00,40.451,0.960440039130155,104,4672 +writing,39965,2018-11-08 23:45:00,39.442,1.29123501660687,3496,10607 +stackoverflow,53215736,2018-11-08 23:45:00,39.400,2.36040348599784,78,9837321 +electronics,405687,2018-11-08 23:45:00,39.050,1.07488936049444,994,116661 +ell,185051,2018-11-08 23:45:00,37.868,1.13950513117137,297,134802 +boardgames,43952,2018-11-08 23:45:00,37.190,1.0757382027621,359,14154 +skeptics,42731,2018-11-08 23:45:00,36.479,1.00323006979481,2261,11354 +worldbuilding,129626,2018-11-08 23:45:00,35.348,1.23717699955749,230,16364 +rpg,135198,2018-11-08 23:45:00,34.438,1.20461971009545,421,65265 +music,76305,2018-11-08 23:45:00,33.784,0.797653591819959,579,29062 +physics,439746,2018-11-08 23:45:00,33.118,0.781374947088939,168,102997 +writing,39983,2018-11-08 23:45:00,32.973,1.31236510000252,2797,10607 +academia,119646,2018-11-08 23:45:00,32.648,1.054004669012,7026,39532 +english,472044,2018-11-08 23:45:00,32.419,0.891846692621097,862,471776 +aviation,56891,2018-11-08 23:45:00,31.828,0.944161394399135,573,29518 +codegolf,175516,2018-11-08 23:45:00,30.494,1.0589650736723,624,5854 +puzzling,74862,2018-11-08 23:45:00,29.588,1.02711650002802,610,13375 +workplace,122241,2018-11-08 23:45:00,29.529,2.48008855181521,14277,43644 +unix,480520,2018-11-08 23:45:00,28.946,0.77630195504163,325,349353 +codereview,207171,2018-11-08 23:45:00,28.689,0.9474332506701,2432,88002 +politics,35176,2018-11-08 23:45:00,28.561,0.740643496039403,6508,15048 +law,33212,2018-11-08 23:45:00,27.619,0.702898370220731,22494,8675 +askubuntu,1091069,2018-11-08 23:45:00,27.578,0.745661988637793,1356,538353 +worldbuilding,129614,2018-11-08 23:45:00,27.363,1.3348488679436,548,16364 +travel,125296,2018-11-08 23:45:00,26.276,0.676731240589597,6407,58416 +security,197169,2018-11-08 23:45:00,25.788,0.97385395797441,9018,65844 +workplace,122361,2018-11-08 23:45:00,25.693,2.3278461965358,728,43644 +academia,119577,2018-11-08 23:45:00,25.451,0.964958509882148,23038,39532 +stackoverflow,53211917,2018-11-08 23:45:00,25.324,2.32202026693771,467,9837321 +worldbuilding,129489,2018-11-08 23:45:00,25.187,1.15625,4216,16364 +retrocomputing,8208,2018-11-08 23:45:00,24.595,0.759463199185152,1175,2040 +chess,22824,2018-11-08 23:45:00,24.217,0.682845107641099,1032,3358 +english,471888,2018-11-08 23:45:00,24.215,0.816070268977754,4676,471776 +japanese,62727,2018-11-08 23:45:00,23.784,0.553473920854665,77,10911 +puzzling,74868,2018-11-08 23:45:00,23.739,0.987357115102669,420,13375 +aviation,56876,2018-11-08 23:45:00,23.544,0.865927066444712,4510,29518 +outdoors,20940,2018-11-08 23:45:00,23.435,0.595097262851153,11472,9333 +rpg,135171,2018-11-08 23:45:00,23.097,1.03816529062925,1024,65265 +scifi,198094,2018-11-08 23:45:00,21.913,0.711232386157055,8069,74500 +math,2988516,2018-11-08 23:45:00,21.538,0.911450813924459,1992,368175 +worldbuilding,129536,2018-11-08 23:45:00,20.318,1.00444319354376,2518,16364 +physics,439450,2018-11-08 23:45:00,20.186,0.660263581740553,5534,102997 +unix,480656,2018-11-08 23:45:00,19.905,0.618588499778744,66,349353 +puzzling,74866,2018-11-08 23:45:00,19.564,1.0150400248719,844,13375 +photo,102652,2018-11-08 23:45:00,19.387,0.515919865606154,5967,26574 +mathematica,185618,2018-11-08 23:45:00,19.028,0.553473920854665,95,12408 +space,31856,2018-11-08 23:45:00,18.841,0.627039450040768,4167,8506 +matheducators,14751,2018-11-08 23:45:00,18.768,0.489573248777227,2478,1022 +electronics,405520,2018-11-08 23:45:00,17.868,0.603682858204162,4388,116661 +reverseengineering,19848,2018-11-08 23:45:00,17.077,0.454551140505342,1241,5545 +academia,119614,2018-11-08 23:45:00,17.046,0.710240395442039,9318,39532 +stats,376020,2018-11-08 23:45:00,17.020,0.56410661852159,179,135032 +softwareengineering,381047,2018-11-08 23:45:00,16.484,0.93429716482555,13204,77307 +travel,125356,2018-11-08 23:45:00,16.321,0.561329211605516,1494,58416 +politics,35240,2018-11-08 23:45:00,16.207,0.472080697199567,147,15048 +puzzling,74851,2018-11-08 23:45:00,16.110,0.777550160029687,1070,13375 +ell,184925,2018-11-08 23:45:00,16.082,0.625,3474,134802 +tex,458913,2018-11-08 23:45:00,15.972,0.575764777973433,378,115906 +rpg,135147,2018-11-08 23:45:00,15.451,0.718136741108942,1850,65265 +academia,119396,2018-11-08 23:45:00,15.129,0.675510119695094,26346,39532 +salesforce,238786,2018-11-08 23:45:00,15.118,0.341851539351411,233,46708 +physics,439511,2018-11-08 23:45:00,15.070,0.600782959115698,6726,102997 +biology,78792,2018-11-08 23:45:00,15.032,0.38571151857222,6029,31022 +workplace,122320,2018-11-08 23:45:00,14.857,1.6163151124472,1100,43644 +graphicdesign,116862,2018-11-08 23:45:00,14.651,0.376157389606934,4940,65959 +skeptics,42692,2018-11-08 23:45:00,14.379,0.458887394531529,24087,11354 +german,47857,2018-11-08 23:45:00,14.253,0.374138384105758,1713,13668 +math,2988348,2018-11-08 23:45:00,14.025,0.663057093544425,3080,368175 +gis,301903,2018-11-08 23:45:00,13.784,0.309294249889372,18,63075 +askubuntu,1091235,2018-11-08 23:45:00,13.566,0.39068747354447,62,538353 +politics,35199,2018-11-08 23:45:00,13.547,0.546953133405022,3867,15048 +ell,185030,2018-11-08 23:45:00,13.433,0.692072744230843,358,134802 +worldbuilding,129336,2018-11-08 23:45:00,13.191,0.669317989171688,9578,16364 +english,472009,2018-11-08 23:45:00,12.998,0.507582106897632,826,471776 +stackoverflow,53214900,2018-11-08 23:45:00,12.697,1.17206242063341,47,9837321 +bicycles,57914,2018-11-08 23:45:00,12.604,0.319464292419719,6643,17456 +physics,439604,2018-11-08 23:45:00,12.521,0.534024605784247,3422,102997 +mathoverflow,314613,2018-11-08 23:45:00,12.498,0.316680550216508,2026,18246 +puzzling,74860,2018-11-08 23:45:00,12.329,0.636971472885596,800,13375 diff --git a/hnq-research/hotness-calculation-20181108-2345.sql b/hnq-research/hotness-calculation-20181108-2345.sql new file mode 100644 index 0000000..6c89f4f --- /dev/null +++ b/hnq-research/hotness-calculation-20181108-2345.sql @@ -0,0 +1,21 @@ +SELECT q.site, q.question, q.timestamp, q.hotness, + (LEAST(COUNT(a.*), 10) * (q.up_votes - q.down_votes) / 5.0 + SUM(a.up_votes - a.down_votes)) / + (GREATEST(DATE_PART('day', q.timestamp - qq.createddate) * 24 + + DATE_PART('hour', q.timestamp - qq.createddate) + 1, 6) ^ 1.4) AS calculated_hotness, + q.hotness / + ((LEAST(COUNT(a.*), 10) * (q.up_votes - q.down_votes) / 5.0 + SUM(a.up_votes - a.down_votes)) / + (GREATEST(DATE_PART('day', q.timestamp - qq.createddate) * 24 + + DATE_PART('hour', q.timestamp - qq.createddate) + 1, 6) ^ 1.4)) AS calculated_traffic_factor, + + s.visits AS traffic, q.views + + FROM snapshots AS q INNER JOIN questions AS qq + ON q.site = qq.site AND q.question = qq.id + INNER JOIN sites AS s ON q.site = s.name + INNER JOIN snapshots_answers AS a + ON q.site = a.site AND q.question = a.question AND q.timestamp = a.timestamp + WHERE --q.timestamp = '2018-11-08 23:45' + q.site = 'history' AND q.question = 49243 + GROUP BY q.site, q.question, q.timestamp, qq.createddate, s.visits + ORDER BY --q.hotness DESC + q.timestamp DESC \ No newline at end of file diff --git a/hnq-research/hotness-calculation-history-49243.csv b/hnq-research/hotness-calculation-history-49243.csv new file mode 100644 index 0000000..234b642 --- /dev/null +++ b/hnq-research/hotness-calculation-history-49243.csv @@ -0,0 +1,40 @@ +site,question,timestamp,hotness,calculated_hotness,calculated_traffic_factor,traffic,views +history,49243,2018-11-08 23:45:00,161.908,4.49861102725452,35.9906644560047,12954,5873 +history,49243,2018-11-08 23:30:00,161.908,4.49861102725452,35.9906644560047,12954,5803 +history,49243,2018-11-08 23:15:00,161.908,5.21361467320568,31.054845850441,12954,5740 +history,49243,2018-11-08 23:00:00,179.417,5.21361467320568,34.4131684533721,12954,5663 +history,49243,2018-11-08 22:45:00,176.217,5.06597248776977,34.7844368332875,12954,5597 +history,49243,2018-11-08 22:30:00,169.817,4.9275579389236,34.462709947779,12954,5493 +history,49243,2018-11-08 22:15:00,169.817,5.75651559979562,29.4999634859027,12954,5407 +history,49243,2018-11-08 22:00:00,200.258,5.70210618958961,35.1200053702284,12954,5293 +history,49243,2018-11-08 21:45:00,200.258,5.70210618958961,35.1200053702284,12954,5177 +history,49243,2018-11-08 21:30:00,196.448,5.64769677938361,34.7837371009568,12954,5037 +history,49243,2018-11-08 21:15:00,192.258,6.66432935369693,28.8488143061759,12954,4914 +history,49243,2018-11-08 21:00:00,219.856,6.53314176799423,33.6524153014819,12954,4792 +history,49243,2018-11-08 20:45:00,217.634,6.46754797514289,33.6501562626896,12954,4678 +history,49243,2018-11-08 20:30:00,210.967,6.33636038944019,33.2946655546274,12954,4552 +history,49243,2018-11-08 20:15:00,206.523,7.61840573411716,27.1084275644624,12954,4433 +history,49243,2018-11-08 20:00:00,257.428,7.83002811562041,32.8770211548088,12954,4321 +history,49243,2018-11-08 19:45:00,257.428,7.83002811562041,32.8770211548088,12954,4179 +history,49243,2018-11-08 19:30:00,231.294,7.11376774745555,32.5135720213426,12954,4040 +history,49243,2018-11-08 19:15:00,228.628,6.95098130014536,32.8914710208211,12954,3914 +history,49243,2018-11-08 19:00:00,282.451,6.86958807649026,41.1161479924291,12954,3782 +history,49243,2018-11-08 18:45:00,275.784,6.70680162918006,41.1200472666605,12954,3638 +history,49243,2018-11-08 18:30:00,269.118,6.54401518186987,41.1242933460162,12954,3485 +history,49243,2018-11-08 18:15:00,262.451,6.38122873455967,41.1285993524428,12954,3327 +history,49243,2018-11-08 18:00:00,251.118,6.10449177413234,41.1365940509753,12954,3166 +history,49243,2018-11-08 17:45:00,239.784,5.827754813705,41.1451764298843,12954,3027 +history,49243,2018-11-08 17:30:00,233.118,5.66496836639481,41.1508034860143,12954,2879 +history,49243,2018-11-08 17:15:00,223.118,5.50218191908461,40.5508220704414,12954,2692 +history,49243,2018-11-08 17:00:00,208.451,5.06265851134709,41.1742169717338,12954,2528 +history,49243,2018-11-08 16:45:00,193.784,4.78592155091975,40.490425498671,12954,2334 +history,49243,2018-11-08 16:30:00,172.451,4.37895543264426,39.3817664172627,12954,2143 +history,49243,2018-11-08 16:15:00,141.784,3.43479403824513,41.2787487171833,12954,1912 +history,49243,2018-11-08 16:00:00,123.784,3.0766638541627,40.2331895414968,12954,1654 +history,49243,2018-11-08 15:45:00,74.451,1.79065092041215,41.5776180333706,12954,1399 +history,49243,2018-11-08 15:30:00,63.784,1.53019260471584,41.6836415255352,12954,1172 +history,49243,2018-11-08 15:15:00,57.784,1.46507802579176,39.4409027934005,12954,937 +history,49243,2018-11-08 15:00:00,51.118,1.22089835482647,41.869169368539,12954,722 +history,49243,2018-11-08 14:45:00,35.784,0.846489526013018,42.2734114248801,12954,526 +history,49243,2018-11-08 14:30:00,19.784,0.455802052468548,43.4048067419906,12954,347 +history,49243,2018-11-08 14:15:00,19.784,0.455802052468548,43.4048067419906,12954,197 diff --git a/hnq-research/hotness-calculation-history-49243.sql b/hnq-research/hotness-calculation-history-49243.sql new file mode 100644 index 0000000..a54a1d7 --- /dev/null +++ b/hnq-research/hotness-calculation-history-49243.sql @@ -0,0 +1,14 @@ +SELECT q.site, q.question, q.timestamp, q.hotness, + (LEAST(COUNT(a.*), 10) * (q.up_votes - q.down_votes) / 5.0 + SUM(a.up_votes - a.down_votes)) / + (GREATEST(DATE_PART('day', q.timestamp - qq.createddate) * 24 + + DATE_PART('hour', q.timestamp - qq.createddate) + 1, 6) ^ 1.4) AS calculated_hotness, + q.views, s.visits AS traffic + + FROM snapshots AS q INNER JOIN questions AS qq + ON q.site = qq.site AND q.question = qq.id + INNER JOIN sites AS s ON q.site = s.name + INNER JOIN snapshots_answers AS a + ON q.site = a.site AND q.question = a.question AND q.timestamp = a.timestamp + WHERE q.timestamp = '2018-11-08 23:45' + GROUP BY q.site, q.question, q.timestamp, qq.createddate, s.visits + ORDER BY q.hotness DESC \ No newline at end of file diff --git a/hnq-research/site-stats-extractor.js b/hnq-research/site-stats-extractor.js new file mode 100644 index 0000000..e27ccdb --- /dev/null +++ b/hnq-research/site-stats-extractor.js @@ -0,0 +1,9 @@ +// https://stackexchange.com/sites#traffic +var message = ''; +$('div.lv-item').each(function() { + let href = $(this).find('a')[0].getAttribute('href'); + let traffic = $(this).find('div.lv-stats-box:contains(visits/day) > span > span')[0]; + let visits = parseInt(traffic.getAttribute('title').replace(/,/g, '')); + message += 'UPDATE sites SET visits = ' + visits + ' WHERE url = \'' + href + '\';\n'; +}); +console.log(message); \ No newline at end of file