Bearloga has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/374442 )

Change subject: Add a tab to track morelike search usage
......................................................................


Add a tab to track morelike search usage

Bug: T172452
Change-Id: I0d0b107df1f6b46a28b8e2c025d1acf5f0fec327
---
M CHANGELOG.md
M modules/api.R
M modules/key_performance_metrics/api_usage.R
M modules/key_performance_metrics/monthly_metrics.R
M modules/key_performance_metrics/summary/boxes.R
M modules/key_performance_metrics/summary/sparklines.R
M tab_documentation/fulltext_basic.md
M tab_documentation/geo_basic.md
M tab_documentation/kpi_api_usage.md
M tab_documentation/language_basic.md
A tab_documentation/morelike_basic.md
M tab_documentation/open_basic.md
M tab_documentation/prefix_basic.md
M ui.R
M utils.R
15 files changed, 91 insertions(+), 71 deletions(-)

Approvals:
  Bearloga: Verified; Looks good to me, approved



diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee934a6..7cb188e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
 
 All notable changes to this project will be documented in this file.
 
+## 2017/08/29
+- Added support for breakdown of API usage by referrer 
([T172452](https://phabricator.wikimedia.org/T172452))
+- Added morelike API usage (see [Gerrit change 
345863](https://gerrit.wikimedia.org/r/#/c/345863/)) for more details
+
 ## 2017/07/07
 - Modularizes the code in server.R
 
diff --git a/modules/api.R b/modules/api.R
index 73368cd..dc8e332 100644
--- a/modules/api.R
+++ b/modules/api.R
@@ -1,54 +1,55 @@
 output$cirrus_aggregate <- renderDygraph({
   split_dataset$cirrus %>%
-    tidyr::spread(key = referer_class, value = calls) %>%
-    dplyr::mutate(All = ifelse(is.na(All), rowSums(.[, -c(1, 2)], na.rm = 
TRUE), All)) %>%
+    tidyr::spread(referrer, calls) %>%
     polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_fulltext_search)) 
%>%
-    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Full-text 
via API usage by day", legend_name = "Searches") %>%
+    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Daily 
Full-text search API usage by referrer", legend_name = "Searches") %>%
     dyRangeSelector %>%
     dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom") 
%>%
-    dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = "bottom")
+    dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = "bottom")
+})
+
+output$morelike_aggregate <- renderDygraph({
+  split_dataset$`cirrus (more like)` %>%
+    tidyr::spread(referrer, calls) %>%
+    polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_morelike_search)) 
%>%
+    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Daily 
Morelike search API usage by referrer", legend_name = "Searches") %>%
+    dyRangeSelector
 })
 
 output$open_aggregate <- renderDygraph({
   split_dataset$open %>%
-    tidyr::spread(key = referer_class, value = calls) %>%
-    dplyr::mutate(All = ifelse(is.na(All), rowSums(.[, -c(1, 2)], na.rm = 
TRUE), All)) %>%
+    tidyr::spread(referrer, calls) %>%
     polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_open_search)) %>%
-    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "OpenSearch 
API usage by day", legend_name = "Searches") %>%
+    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Daily 
OpenSearch API usage by referrer", legend_name = "Searches") %>%
     dyRangeSelector %>%
     dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom") 
%>%
-    dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = "bottom")
+    dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = "bottom")
 })
 
 output$geo_aggregate <- renderDygraph({
   split_dataset$geo %>%
-    tidyr::spread(key = referer_class, value = calls) %>%
-    dplyr::mutate(All = ifelse(is.na(All), rowSums(.[, -c(1, 2)], na.rm = 
TRUE), All)) %>%
-    polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_geo_search)) %>%
-    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Geo Search 
API usage by day", legend_name = "Searches") %>%
+    tidyr::spread(referrer, calls) %>%polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_geo_search)) %>%
+    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Daily Geo 
Search API usage by referrer", legend_name = "Searches") %>%
     dyRangeSelector %>%
     dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom") 
%>%
-    dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = "bottom")
+    dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = "bottom")
 })
 
 output$language_aggregate <- renderDygraph({
   split_dataset$language %>%
-    tidyr::spread(key = referer_class, value = calls) %>%
-    dplyr::mutate(All = ifelse(is.na(All), rowSums(.[, -c(1, 2)], na.rm = 
TRUE), All)) %>%
-    polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_language_search)) 
%>%
-    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Language 
Search API usage by day", legend_name = "Searches") %>%
+    tidyr::spread(referrer, calls) %>%polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_language_search)) 
%>%
+    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Daily 
Language search API usage by referrer", legend_name = "Searches") %>%
     dyRangeSelector %>%
     dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom") 
%>%
-    dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = "bottom")
+    dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = "bottom")
 })
 
 output$prefix_aggregate <- renderDygraph({
   split_dataset$prefix %>%
-    tidyr::spread(key = referer_class, value = calls) %>%
-    dplyr::mutate(All = ifelse(is.na(All), rowSums(.[, -c(1, 2)], na.rm = 
TRUE), All)) %>%
+    tidyr::spread(referrer, calls) %>%
     polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, input$smoothing_prefix_search)) 
%>%
-    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Prefix 
Search API usage by day", legend_name = "Searches") %>%
+    polloi::make_dygraph(xlab = "Date", ylab = "Searches", title = "Daily 
Prefix search API usage by referrer", legend_name = "Searches") %>%
     dyRangeSelector %>%
     dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = "bottom") 
%>%
-    dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = "bottom")
+    dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = "bottom")
 })
diff --git a/modules/key_performance_metrics/api_usage.R 
b/modules/key_performance_metrics/api_usage.R
index 13a4c3a..3732619 100644
--- a/modules/key_performance_metrics/api_usage.R
+++ b/modules/key_performance_metrics/api_usage.R
@@ -2,45 +2,41 @@
   smooth_level <- input$smoothing_kpi_api_usage
   start_date <- Sys.Date() - switch(input$kpi_summary_date_range_selector, all 
= NA, daily = 1, weekly = 8, monthly = 31, quarterly = 91)
   api_usage <- split_dataset %>%
-  purrr::map(function(x) {
-    dplyr::group_by(x, date) %>%
-    dplyr::summarize(calls = sum(calls, na.rm = TRUE)) %>%
-    dplyr::ungroup()
-  }) %>%
-  {
-    if (!is.na(start_date)) {
-      lapply(., polloi::subset_by_date_range, from = start_date, to = 
Sys.Date() - 1)
-    } else {
-      .
-    }
-  } %>%
+    purrr::map(function(x) {
+      dplyr::filter(x, referrer == "All") %>%
+        dplyr::group_by(date) %>%
+        dplyr::summarize(calls = sum(calls, na.rm = TRUE)) %>%
+        dplyr::ungroup()
+    }) %>%
+    {
+      if (!is.na(start_date)) {
+        lapply(., polloi::subset_by_date_range, from = start_date, to = 
Sys.Date() - 1)
+      } else {
+        .
+      }
+    } %>%
     dplyr::bind_rows(.id = "api") %>%
     tidyr::spread("api", "calls")
-  if ( input$kpi_api_usage_series_include_open ) {
-    api_usage <- dplyr::mutate(api_usage, all = cirrus + ifelse(is.na(`cirrus 
(more like)`), 0, `cirrus (more like)`) + geo + language + open + prefix)
-  } else {
-    api_usage <- dplyr::mutate(api_usage, all = cirrus + ifelse(is.na(`cirrus 
(more like)`), 0, `cirrus (more like)`) + geo + language + prefix)
-  }
+  api_usage <- dplyr::mutate(api_usage, all = cirrus + 
dplyr::if_else(is.na(`cirrus (more like)`), 0, `cirrus (more like)`) + geo + 
language + prefix)
   if ( input$kpi_api_usage_series_data == "raw" ) {
     api_usage %<>%
       polloi::smoother(ifelse(smooth_level == "global", 
input$smoothing_global, smooth_level), rename = FALSE) %>%
       { xts::xts(.[, -1], order.by = .$date) }
-    if (!input$kpi_api_usage_series_include_open) {
-      colnames(api_usage)[7] <- "all except open"
-    }
     return(dygraph(api_usage, main = "Calls over time", xlab = "Date",
                    ylab = ifelse(input$kpi_api_usage_series_log_scale, "Calls 
(log10 scale)", "Calls")) %>%
              dySeries("cirrus", label = "full-text via API") %>%
+             dySeries("cirrus (more like)", label = "morelike via API") %>%
              dyLegend(width = 400, show = "always") %>%
-             dyOptions(strokeWidth = 3, colors = RColorBrewer::brewer.pal(7, 
"Set2")[7:1],
-                       drawPoints = FALSE, pointSize = 3, labelsKMB = TRUE,
-                       includeZero = input$kpi_api_usage_series_log_scale,
-                       logscale = input$kpi_api_usage_series_log_scale
+             dyOptions(
+               strokeWidth = 3, colors = RColorBrewer::brewer.pal(7, 
"Set2")[7:1],
+               drawPoints = FALSE, pointSize = 3, labelsKMB = TRUE,
+               includeZero = input$kpi_api_usage_series_log_scale,
+               logscale = input$kpi_api_usage_series_log_scale
              ) %>%
              dyCSS(css = system.file("custom.css", package = "polloi")) %>%
              dyRangeSelector %>%
              dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = 
"bottom") %>%
-             dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = 
"bottom"))
+             dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = 
"bottom"))
   }
   api_usage_change <- api_usage %>%
     dplyr::mutate(
@@ -58,10 +54,12 @@
   if (!input$kpi_api_usage_series_include_open) colnames(api_usage_change)[7] 
<- "all except open"
   return(dygraph(api_usage_change, main = "Day-to-day % change over time", 
xlab = "Date", ylab = "% change") %>%
            dyLegend(width = 400, show = "always") %>%
-           dyOptions(strokeWidth = 3, colors = RColorBrewer::brewer.pal(7, 
"Set2"),
-                     drawPoints = FALSE, pointSize = 3, labelsKMB = TRUE, 
includeZero = TRUE) %>%
+           dyOptions(
+             strokeWidth = 3, colors = RColorBrewer::brewer.pal(7, "Set2"),
+             drawPoints = FALSE, pointSize = 3, labelsKMB = TRUE, includeZero 
= TRUE
+           ) %>%
            dyCSS(css = system.file("custom.css", package = "polloi")) %>%
            dyRangeSelector %>%
            dyEvent(as.Date("2017-01-01"), "R (reportupdater)", labelLoc = 
"bottom") %>%
-           dyEvent(as.Date("2017-08-14"), "U (new UDF)", labelLoc = "bottom"))
+           dyEvent(as.Date("2017-06-29"), "U (new UDF)", labelLoc = "bottom"))
 })
diff --git a/modules/key_performance_metrics/monthly_metrics.R 
b/modules/key_performance_metrics/monthly_metrics.R
index 9cf6888..e6895fe 100644
--- a/modules/key_performance_metrics/monthly_metrics.R
+++ b/modules/key_performance_metrics/monthly_metrics.R
@@ -22,6 +22,7 @@
   smoothed_zrr <- polloi::smoother(failure_data_with_automata, "month", rename 
= FALSE)
   smoothed_api <- split_dataset %>%
     dplyr::bind_rows(.id = "api") %>%
+    dplyr::filter(referrer == "All") %>%
     dplyr::group_by(date) %>%
     dplyr::summarize(total = sum(calls)) %>%
     polloi::smoother("month", rename = FALSE)
diff --git a/modules/key_performance_metrics/summary/boxes.R 
b/modules/key_performance_metrics/summary/boxes.R
index ec055c6..f16ee74 100644
--- a/modules/key_performance_metrics/summary/boxes.R
+++ b/modules/key_performance_metrics/summary/boxes.R
@@ -53,6 +53,7 @@
   x <- split_dataset %>%
     lapply(polloi::subset_by_date_range, from = start_date(date_range), to = 
Sys.Date() - 1) %>%
     dplyr::bind_rows(.id = "api") %>%
+    dplyr::filter(referrer == "All") %>%
     dplyr::group_by(date) %>%
     dplyr::summarize(total = sum(calls)) %>%
     { .$total }
diff --git a/modules/key_performance_metrics/summary/sparklines.R 
b/modules/key_performance_metrics/summary/sparklines.R
index 591d7a6..e7ef49e 100644
--- a/modules/key_performance_metrics/summary/sparklines.R
+++ b/modules/key_performance_metrics/summary/sparklines.R
@@ -76,6 +76,7 @@
   }
   output_sl <- output_sl %>%
     dplyr::bind_rows(.id = "api") %>%
+    dplyr::filter(referrer == "All") %>%
     dplyr::group_by(date) %>%
     dplyr::summarize(total = sum(calls)) %>%
     dplyr::select(total) %>%
diff --git a/tab_documentation/fulltext_basic.md 
b/tab_documentation/fulltext_basic.md
index c2a121a..49acc24 100644
--- a/tab_documentation/fulltext_basic.md
+++ b/tab_documentation/fulltext_basic.md
@@ -13,7 +13,7 @@
 ------
 
 * '__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. 
Furthermore, we switched to an updated UDF for counting API calls -- the 
previous version was undercounting full-text and geo search API calls (see 
[Gerrit change 315503](https://gerrit.wikimedia.org/r/#/c/315503/) for more 
details).
-* '__U__': on 2017-08-14 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
+* '__U__': on 2017-06-29 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class. The number of 
full-text search drops a lot because the [morelike search 
requests](https://discovery.wmflabs.org/metrics/#morelike_search) are separated 
by utilizing the new UDF.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/geo_basic.md b/tab_documentation/geo_basic.md
index 5933b4a..83fadcd 100644
--- a/tab_documentation/geo_basic.md
+++ b/tab_documentation/geo_basic.md
@@ -12,7 +12,7 @@
 ------
 
 * '__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. 
Furthermore, we switched to an updated UDF for counting API calls -- the 
previous version was undercounting full-text and geo search API calls (see 
[Gerrit change 315503](https://gerrit.wikimedia.org/r/#/c/315503/) for more 
details).
-* '__U__': on 2017-08-14 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
+* '__U__': on 2017-06-29 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/kpi_api_usage.md 
b/tab_documentation/kpi_api_usage.md
index c5712c7..0702341 100644
--- a/tab_documentation/kpi_api_usage.md
+++ b/tab_documentation/kpi_api_usage.md
@@ -7,7 +7,7 @@
 ------
 
 * '__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. 
Furthermore, we switched to an updated UDF for counting API calls -- the 
previous version was undercounting full-text and geo search API calls (see 
[Gerrit change 315503](https://gerrit.wikimedia.org/r/#/c/315503/) for more 
details).
-* '__U__': on 2017-08-14 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details).
+* '__U__': on 2017-06-29 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details).
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/language_basic.md 
b/tab_documentation/language_basic.md
index 2742bc4..1bd3792 100644
--- a/tab_documentation/language_basic.md
+++ b/tab_documentation/language_basic.md
@@ -12,7 +12,7 @@
 ------
 
 * '__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.
-* '__U__': on 2017-08-14 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
+* '__U__': on 2017-06-29 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/morelike_basic.md 
b/tab_documentation/morelike_basic.md
new file mode 100644
index 0000000..0d1c5ec
--- /dev/null
+++ b/tab_documentation/morelike_basic.md
@@ -0,0 +1,16 @@
+Morelike Search via API usage
+=======
+
+[Morelike](https://www.mediawiki.org/wiki/Help:CirrusSearch#Morelike) is a 
feature of CirrusSearch that is used in extensions like 
[RelatedArticles](https://www.mediawiki.org/wiki/Extension:RelatedArticles). As 
of 2017-06-29, we use a new UDF which can distinguish morelike vs fulltext 
search API requests (see [Gerrit change 
345863](https://gerrit.wikimedia.org/r/#/c/345863/) for more details).
+
+Questions, bug reports, and feature suggestions
+------
+For technical, non-bug questions, [email 
Mikhail](mailto:[email protected]?subject=Dashboard%20Question) or 
[Chelsy](mailto:[email protected]?subject=Dashboard%20Question). If you 
experience a bug or notice something wrong or have a suggestion, [open a ticket 
in 
Phabricator](https://phabricator.wikimedia.org/maniphest/task/create/?projects=Discovery)
 in the Discovery board or [email 
Deb](mailto:[email protected]?subject=Dashboard%20Question).
+
+<hr style="border-color: gray;">
+<p style="font-size: small;">
+  <strong>Link to this dashboard:</strong> <a 
href="https://discovery.wmflabs.org/metrics/#morelike_search";>https://discovery.wmflabs.org/metrics/#morelike_search</a>
+  | Page is available under <a 
href="https://creativecommons.org/licenses/by-sa/3.0/"; title="Creative Commons 
Attribution-ShareAlike License">CC-BY-SA 3.0</a>
+  | <a href="https://phabricator.wikimedia.org/diffusion/WDRN/"; title="Search 
Metrics Dashboard source code repository">Code</a> is licensed under <a 
href="https://phabricator.wikimedia.org/diffusion/WDRN/browse/master/LICENSE.md";
 title="MIT License">MIT</a>
+  | Part of <a href="https://discovery.wmflabs.org/";>Discovery Dashboards</a>
+</p>
diff --git a/tab_documentation/open_basic.md b/tab_documentation/open_basic.md
index 43673b1..99be0f8 100644
--- a/tab_documentation/open_basic.md
+++ b/tab_documentation/open_basic.md
@@ -1,21 +1,13 @@
 OpenSearch API usage
 =======
 
-[OpenSearch](https://en.wikipedia.org/wiki/OpenSearch) is a search format 
optimised for syndication and aggregation.
-MediaWiki has OpenSearch support, and so does its API; that's what's tracked 
here. OpenSearch allows you to retrieve
-full content as well as snippets, and allows you to *search* full content for 
your search term.
-
-General trends
-------
-
-There's not enough data to be able to say much about the patterns inherrent to 
OpenSearch usage right now, but it's clear from comparing
-the results to other types of search event that OpenSearch is the most 
commonly used search format.
+[OpenSearch](https://en.wikipedia.org/wiki/OpenSearch) is a search format 
optimised for syndication and aggregation. MediaWiki has OpenSearch support, 
and so does its API; that's what's tracked here. OpenSearch allows you to 
retrieve full content as well as snippets, and allows you to *search* full 
content for your search term.
 
 Outages and inaccuracies
 ------
 
 * '__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.
-* '__U__': on 2017-08-14 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
+* '__U__': on 2017-06-29 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/tab_documentation/prefix_basic.md 
b/tab_documentation/prefix_basic.md
index 1f8a342..c6e94d0 100644
--- a/tab_documentation/prefix_basic.md
+++ b/tab_documentation/prefix_basic.md
@@ -12,7 +12,7 @@
 ------
 * After learning of a change to the search API call, we patched the Analytics 
Hive UDF refinery (see [287264](https://gerrit.wikimedia.org/r/#/c/287264/)) to 
check for generator=prefixsearch as well, not just list=prefixsearch. The data 
was backfilled from 20 March 2016 using the updated Prefix API detection.
 * '__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.
-* '__U__': on 2017-08-14 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
+* '__U__': on 2017-06-29 we started to use a new UDF to get the type of search 
API (see [Gerrit change 345863](https://gerrit.wikimedia.org/r/#/c/345863/) for 
more details) and break down the API calls by referer class.
 
 Questions, bug reports, and feature suggestions
 ------
diff --git a/ui.R b/ui.R
index 7e3f243..8b20615 100644
--- a/ui.R
+++ b/ui.R
@@ -56,6 +56,7 @@
                   ),
                   menuItem(text = "API",
                            menuSubItem(text = "Full-text via API", tabName = 
"fulltext_search"),
+                           menuSubItem(text = "Morelike Search", tabName = 
"morelike_search"),
                            menuSubItem(text = "Open Search", tabName = 
"open_search"),
                            menuSubItem(text = "Geo Search", tabName = 
"geo_search"),
                            menuSubItem(text = "Prefix Search", tabName = 
"prefix_search"),
@@ -143,12 +144,8 @@
                          column(checkboxInput("kpi_api_usage_series_log_scale",
                                               label = "Log10 Scale",
                                               value = FALSE),
-                                width = 2),
-                         
column(checkboxInput("kpi_api_usage_series_include_open",
-                                              label = "Include OpenSearch in 
total",
-                                              value = TRUE),
-                                width = 3),
-                         
column(polloi::smooth_select("smoothing_kpi_api_usage"), width = 3)),
+                                width = 4),
+                         
column(polloi::smooth_select("smoothing_kpi_api_usage"), width = 4)),
                 dygraphOutput("kpi_api_usage_series"),
                 includeMarkdown("./tab_documentation/kpi_api_usage.md")),
         tabItem(tabName = "kpi_augmented_clickthroughs",
@@ -226,6 +223,11 @@
                 dygraphOutput("cirrus_aggregate"),
                 includeMarkdown("./tab_documentation/fulltext_basic.md")
         ),
+        tabItem(tabName = "morelike_search",
+                polloi::smooth_select("smoothing_morelike_search"),
+                dygraphOutput("morelike_aggregate"),
+                includeMarkdown("./tab_documentation/morelike_basic.md")
+        ),
         tabItem(tabName = "open_search",
                 polloi::smooth_select("smoothing_open_search"),
                 dygraphOutput("open_aggregate"),
diff --git a/utils.R b/utils.R
index eb13192..70db0ed 100644
--- a/utils.R
+++ b/utils.R
@@ -91,6 +91,10 @@
     dplyr::filter(!is.na(api), !is.na(referer_class), !is.na(calls)) %>%
     dplyr::distinct(date, api, referer_class, .keep_all = TRUE) %>%
     dplyr::arrange(api, date) %>%
+    dplyr::mutate(referer_class = 
polloi::capitalize_first_letter(referer_class)) %>%
+    tidyr::spread(referer_class, calls) %>%
+    dplyr::mutate(All = ifelse(is.na(All), rowSums(.[, -c(1, 2)], na.rm = 
TRUE), All)) %>%
+    tidyr::gather(referrer, calls, -c(date, api)) %>%
     { split(., f = .$api) } %>%
     lapply(dplyr::select_, .dots = list(quote(-api)))
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d0b107df1f6b46a28b8e2c025d1acf5f0fec327
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/discovery/rainbow
Gerrit-Branch: develop
Gerrit-Owner: Chelsyx <[email protected]>
Gerrit-Reviewer: Bearloga <[email protected]>

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

Reply via email to