Bearloga has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363752 )

Change subject: Sister search traffic changes per Deb's feedback
......................................................................

Sister search traffic changes per Deb's feedback

- Corrects referenced ticket
- Changes title and summary
- Adds more notes and explanations
- Changes the UI/UX to a "choose-your-own-split-by-combo"
  adventure using checkboxes
- Adds annotations for sister search on KPI::LoadTimes and
  Desktop::LoadTimes dashboards because it's relevant

Bug: T164854
Change-Id: I5c1e4db0b2b92ad3b28d74b8113a511704946326
---
M server.R
M tab_documentation/desktop_load.md
M tab_documentation/kpi_load_time.md
M tab_documentation/sister_search_traffic.md
M ui.R
A www/js4checkbox.js
6 files changed, 67 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/rainbow 
refs/changes/52/363752/1

diff --git a/server.R b/server.R
index 49c429b..972cd74 100644
--- a/server.R
+++ b/server.R
@@ -83,7 +83,8 @@
       polloi::make_dygraph(xlab = "Date", ylab = "Load time (ms)", title = 
"Desktop load times, by day", use_si = FALSE) %>%
       dyRangeSelector %>%
       dyEvent(as.Date("2016-07-12"), "A (schema switch)", labelLoc = "bottom") 
%>%
-      dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom")
+      dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom") 
%>%
+      dyEvent(as.Date("2017-06-15"), "B (sister search)", labelLoc = "bottom")
   })
 
   output$paulscore_approx_plot_fulltext <- renderDygraph({
@@ -363,34 +364,37 @@
 
   # Sister Search
   output$sister_search_traffic_plot <- renderDygraph({
-    switch(
-      input$sister_search_traffic_split,
-      "none" = {
-        sister_search_traffic %>%
+    # Code that prepares a custom data.frame 'sst'
+    # that will then be processed in a generic way:
+    if (length(input$sister_search_traffic_split) == 0) {
+      sst <- sister_search_traffic %>%
           dplyr::mutate(split = "Sister search traffic")
-      },
-      "project" = {
-        sister_search_traffic %>%
-          dplyr::rename(split = project)
-      },
-      "destination" = {
-        sister_search_traffic %>%
-          dplyr::mutate(split = dplyr::if_else(is_serp, "Search results page", 
"Article"))
-      },
-      "language" = {
-        sister_search_traffic %>%
-          dplyr::filter(project != "wikimedia commons", !is.na(language)) %>%
-          dplyr::mutate(split = language)
-      },
-      "access_method" = {
-        sister_search_traffic %>%
-          dplyr::mutate(split = access_method)
+    } else {
+      split_by <- head(input$sister_search_traffic_split, 2)
+      sst <- sister_search_traffic
+      if ("language" %in% split_by) {
+        sst <- dplyr::filter(sst, !is.na(language))
       }
-    ) %>%
+      if ("destination" %in% split_by) {
+        sst <- dplyr::mutate(sst, destination = dplyr::if_else(is_serp, 
"Search results page", "Article"))
+      }
+      if (length(split_by) == 1) {
+        sst$split <- sst[[split_by[1]]]
+      } else {
+        sst$split <- paste0(sst[[split_by[1]]], " (", sst[[split_by[2]]], ")")
+      }
+    }
+    # Code that works on the prepared dataet:
+    sst %>%
       dplyr::group_by(date, split) %>%
       dplyr::summarize(pageviews = sum(pageviews)) %>%
       tidyr::spread(split, pageviews, fill = 0) %>%
-      polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, 
input$smoothing_sister_search_traffic_plot)) %>%
+      {
+        # Reorder columns according to the last observed values:
+        cols <- unlist(polloi::safe_tail(., 1)[, -1])
+        .[, c(1, order(cols, decreasing = TRUE) + 1)]
+      } %>%
+      polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, 
input$smoothing_sister_search_traffic_plot), rename = FALSE) %>%
       polloi::make_dygraph(xlab = "Date", ylab = "Pageviews", title = "Traffic 
to sister projects from Wikipedia SERPs") %>%
       dyAxis("x", ticker = "Dygraph.dateTicker", axisLabelFormatter = 
polloi::custom_axis_formatter,
              axisLabelWidth = 100, pixelsPerLabel = 80) %>%
@@ -735,7 +739,8 @@
              dyCSS(css = system.file("custom.css", package = "polloi")) %>%
              dyRangeSelector %>%
              dyEvent(as.Date("2016-07-12"), "A (schema switch)", labelLoc = 
"bottom") %>%
-             dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = 
"bottom"))
+             dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = 
"bottom") %>%
+             dyEvent(as.Date("2017-06-15"), "B (sister search)", labelLoc = 
"bottom"))
   })
   output$kpi_zero_results_series <- renderDygraph({
     smooth_level <- input$smoothing_kpi_zero_results
diff --git a/tab_documentation/desktop_load.md 
b/tab_documentation/desktop_load.md
index be3d643..dcd55c0 100644
--- a/tab_documentation/desktop_load.md
+++ b/tab_documentation/desktop_load.md
@@ -10,7 +10,7 @@
 
 Load times for results are remarkably consistent, absent the situation, 
mentioned above, where a tiny number of users face a really slow service. Other 
than that, there's little interesting to see here unless we decide to start 
focusing specifically on speeding up the service.
 
-Outages and inaccuracies
+Notes, outages, and inaccuracies
 ------
 There are occasionally going to be outages that will affect the accuracy of 
data. To make it easier to rely on the data (or not!) they will be listed here, 
from most- to least-recent.
 
@@ -19,6 +19,7 @@
 * Data in late September/early October 2015 is unavailable due to another bug 
in EventLogging as a whole, which impacted data collection.
 * '__A__': we switched to using data from 
[Schema:TestSearchSatisfaction2](https://meta.wikimedia.org/wiki/Schema:TestSearchSatisfaction2)
 instead of [Schema:Search](https://meta.wikimedia.org/wiki/Schema:Search) for 
Desktop event counts and load times on 12 July 2016.
 * '__R__': on 2017-01-01 we started calculating all of Discovery's metrics 
using a new version of [our data retrieval and processing 
codebase](https://phabricator.wikimedia.org/diffusion/WDGO/) that we migrated 
to [Wikimedia Analytics](https://www.mediawiki.org/wiki/Analytics)' 
[Reportupdater 
infrastructure](https://wikitech.wikimedia.org/wiki/Analytics/Reportupdater). 
See [T150915](https://phabricator.wikimedia.org/T150915) for more details.
+* '__B__': [on 
2017-06-15](https://lists.wikimedia.org/pipermail/discovery/2017-June/001536.html)
 we deployed the sister search feature to all Wikipedia in all languages. This 
_technically_ has a slight impact on load time since we are performing 
additional searches, but we have not seen any noticeable or alarming increases 
since the feature's deployment.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/kpi_load_time.md 
b/tab_documentation/kpi_load_time.md
index e298c66..25fba00 100644
--- a/tab_documentation/kpi_load_time.md
+++ b/tab_documentation/kpi_load_time.md
@@ -7,6 +7,7 @@
 ------
 * '__A__': we switched to using data from 
[Schema:TestSearchSatisfaction2](https://meta.wikimedia.org/wiki/Schema:TestSearchSatisfaction2)
 instead of [Schema:Search](https://meta.wikimedia.org/wiki/Schema:Search) for 
Desktop event counts and load times on 12 July 2016.
 * '__R__': on 2017-01-01 we started calculating all of Discovery's metrics 
using a new version of [our data retrieval and processing 
codebase](https://phabricator.wikimedia.org/diffusion/WDGO/) that we migrated 
to [Wikimedia Analytics](https://www.mediawiki.org/wiki/Analytics)' 
[Reportupdater 
infrastructure](https://wikitech.wikimedia.org/wiki/Analytics/Reportupdater). 
See [T150915](https://phabricator.wikimedia.org/T150915) for more details.
+* '__B__': [on 
2017-06-15](https://lists.wikimedia.org/pipermail/discovery/2017-June/001536.html)
 we deployed the sister search feature to all Wikipedia in all languages. This 
_technically_ has a slight impact on load time since we are performing 
additional searches, but we have not seen any noticeable or alarming increases 
since the feature's deployment.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/sister_search_traffic.md 
b/tab_documentation/sister_search_traffic.md
index 6258a6b..e6df9ec 100644
--- a/tab_documentation/sister_search_traffic.md
+++ b/tab_documentation/sister_search_traffic.md
@@ -1,18 +1,23 @@
-Sister search traffic
-=======
-Sister (cross-wiki) search is a feature that adds results from other projects 
to a sidebar on the search engine results page (SERP). For example: if there 
are additional results found, users are shown images from Wikimedia Commons, 
definitions from Wiktionary, and results from works on Wikisource. See 
[T146667](https://phabricator.wikimedia.org/T146667) for more details.
+<p style="text-align: right; font-size: small; color: #737373;">
+  <span><strong>*</strong> Users can click on a cross-wiki result or view all 
the results at the sister project</span>
+  <br>
+  <span><strong>†</strong> This excludes the language-less Wikimedia 
Commons</span>
+</p>
 
-Notes
------
+Sister project search results traffic
+=======
+Sister project (cross-wiki) snippets is a feature that adds search results 
from sister projects of Wikipedia to a sidebar on the search engine results 
page (SERP). If a query results in matches from the sister projects, users will 
be shown snippets from Wiktionary, Wikisource, Wikiquote and/or other projects. 
See [T162276](https://phabricator.wikimedia.org/T162276) for more details.
+
 Some communities (e.g. Italian Wikipedia) developed their own cross-wiki 
search results sidebars, which is why we see some sister traffic before the 
deployment of the sister search feature across all Wikipedias.
 
-__\*__ Users can click on a cross-wiki result or view all the results at the 
sister project
+When viewing traffic split by project, these statistics include all languages 
and any click into a sister project snippet (either article or more results).
 
-__†__ This excludes the language-less Wikimedia Commons
+English Wikipedia has a different display than all the other languages due to 
community feedback. Specifically, it does not show results from 
Commons/multimedia, Wikinews, and Wikiversity. Refer to 
[T162276#3278689](https://phabricator.wikimedia.org/T162276#3278689) for more 
details.
 
-Outages and inaccuracies
-------
+Notes, outages, and inaccuracies
+-----
 * '__A__': [on 
2017-06-15](https://lists.wikimedia.org/pipermail/discovery/2017-June/001536.html)
 we deployed the sister search feature to all Wikipedia in all languages.
+* Wikisource had a unknown spike on 22 June 2017 that slightly skews that 
project's results and overall results for that day. Specifically, we calculated 
5129 pageviews on Desktop from English Wikipedia, which is an extreme outlier 
that we removed and imputed.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/ui.R b/ui.R
index cefcb03..7e3f243 100644
--- a/ui.R
+++ b/ui.R
@@ -23,6 +23,7 @@
       tags$head(
         tags$link(rel = "stylesheet", type = "text/css", href = 
"stylesheet.css"),
         tags$script(src = "custom.js"),
+        tags$script(src = "js4checkbox.js"),
         with_wikimedia_mathjax()
       ),
       sidebarMenu(id = "tabs",
@@ -276,7 +277,12 @@
         tabItem(tabName = "sister_search_traffic",
                 fluidRow(
                   
column(polloi::smooth_select("smoothing_sister_search_traffic_plot"), width = 
3),
-                  column(shiny::radioButtons("sister_search_traffic_split", 
"Split pageviews by", choices = list("None" = "none", "Project" = "project", 
"Search results pages vs Articles*" = "destination", "English vs other 
languages†" = "language", "Desktop vs Mobile Web" = "access_method"), inline = 
TRUE, selected = "none"), width = 9)
+                  
column(shiny::checkboxGroupInput("sister_search_traffic_split", "Split 
pageviews by", selected = "none", choices = list(
+                    "Project" = "project",
+                    "More Results vs Articles*" = "destination",
+                    "English vs other languages†" = "language",
+                    "Desktop vs Mobile Web" = "access_method"
+                  ), inline = TRUE), helpText("Select up to 2"), width = 9)
                 ),
                 dygraphOutput("sister_search_traffic_plot"),
                 div(id = "sister_search_traffic_plot_legend"),
diff --git a/www/js4checkbox.js b/www/js4checkbox.js
new file mode 100644
index 0000000..e3d328d
--- /dev/null
+++ b/www/js4checkbox.js
@@ -0,0 +1,13 @@
+/* This particular code by 'Dart' and Victor Perrier is available under 
CC-BY-SA 3.0
+ * checkboxGroupInput - set minimum and maximum number of selections - ticks
+ * 
https://stackoverflow.com/questions/31139791/checkboxgroupinput-set-minimum-and-maximum-number-of-selections-ticks
+ * originally: Restricting user to check checkbox in jQuery
+ * 
https://stackoverflow.com/questions/18699839/restricting-user-to-check-checkbox-in-jquery/18700246
+ */
+$( document ).ready( function() {
+  $( 'input[name=sister_search_traffic_split]' ).on( 'click', function( event 
) {
+    if ( $('input[name=sister_search_traffic_split]:checked' ).length > 2 ) {
+      $( this ).prop( 'checked', false );
+    }
+  } );
+} );

-- 
To view, visit https://gerrit.wikimedia.org/r/363752
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c1e4db0b2b92ad3b28d74b8113a511704946326
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/rainbow
Gerrit-Branch: develop
Gerrit-Owner: Bearloga <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to