Bearloga has submitted this change and it was merged.

Change subject: Add geographic visualisation code
......................................................................


Add geographic visualisation code

Seems to work nicely now but plz test

Bug: T119448
Change-Id: I216caa9960a29bc368dcfb99c576f1eab287ab97
---
M server.R
A tab_documentation/geo_breakdown.md
M tab_documentation/tiles_total_by_style.md
M tab_documentation/tiles_total_by_zoom.md
M tab_documentation/tiles_users_by_style.md
M ui.R
M utils.R
7 files changed, 47 insertions(+), 3 deletions(-)

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



diff --git a/server.R b/server.R
index f1e87db..3b3ce8d 100644
--- a/server.R
+++ b/server.R
@@ -9,6 +9,7 @@
     read_actions()
     read_users()
     suppressWarnings(read_tiles())
+    read_countries()
     existing_date <<- Sys.Date()
   }
   
@@ -125,6 +126,12 @@
       polloi::make_dygraph("Date", "Events", "Feature usage for WIWOSM")
   })
   
+  
+  output$users_by_country <- renderDygraph({
+    country_data %>%
+      polloi::make_dygraph("Date", "Users (%)", "Geographic breakdown of maps 
users")
+  })
+  
   # Check datasets for missing data and notify user which datasets are missing 
data (if any)
   output$message_menu <- renderMenu({
     notifications <- list(
diff --git a/tab_documentation/geo_breakdown.md 
b/tab_documentation/geo_breakdown.md
new file mode 100644
index 0000000..ca8a5ff
--- /dev/null
+++ b/tab_documentation/geo_breakdown.md
@@ -0,0 +1,21 @@
+WIWOSM feature usage
+=======
+
+This tab contains a geographic breakdown of Maps traffic. The percentage of 
traffic from each of the top 9 countries is displayed: for privacy and display 
reasons, all others are grouped into "Other".
+
+Outages and inaccuracies
+------
+
+* None so far!
+
+Questions, bug reports, and feature suggestions
+------
+For technical, non-bug questions, [email 
Mikhail](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 
Dan](mailto:[email protected]?subject=Dashboard%20Question).
+
+<hr style="border-color: gray;">
+<p style="font-size: small; color: gray;">
+  <strong>Link to this dashboard:</strong>
+  <a href="http://discovery.wmflabs.org/maps/#geo_breakdown";>
+    http://discovery.wmflabs.org/maps/#geo_breakdown
+  </a>
+</p>
diff --git a/tab_documentation/tiles_total_by_style.md 
b/tab_documentation/tiles_total_by_style.md
index aa3e8d5..5414689 100644
--- a/tab_documentation/tiles_total_by_style.md
+++ b/tab_documentation/tiles_total_by_style.md
@@ -3,6 +3,8 @@
 
 Currently there are two styles: OpenStreetMap ("osm") and OSM with labels 
("osm-intl"). After the announcement, most of the tiles served are _osm-intl_.
 
+Data is displayed on a 30-day rolling window for performance reasons but the 
original data can be found in 
[here](http://datasets.wikimedia.org/aggregate-datasets/maps/)
+
 Outages and inaccuracies
 ------
 
diff --git a/tab_documentation/tiles_total_by_zoom.md 
b/tab_documentation/tiles_total_by_zoom.md
index ade3d31..85099b6 100644
--- a/tab_documentation/tiles_total_by_zoom.md
+++ b/tab_documentation/tiles_total_by_zoom.md
@@ -3,6 +3,8 @@
 
 **Note** that you can select multiple zoom levels. Windows and Linux users can 
select additional zoom levels by holding the Ctrl key when selecting, while Mac 
users have to use the Cmd key.
 
+Data is displayed on a 30-day rolling window for performance reasons but the 
original data can be found in 
[here](http://datasets.wikimedia.org/aggregate-datasets/maps/)
+
 Outages and inaccuracies
 ------
 
diff --git a/tab_documentation/tiles_users_by_style.md 
b/tab_documentation/tiles_users_by_style.md
index 911aa74..9e00193 100644
--- a/tab_documentation/tiles_users_by_style.md
+++ b/tab_documentation/tiles_users_by_style.md
@@ -3,6 +3,8 @@
 
 Currently there are two styles: OpenStreetMap ("osm") and OSM with labels 
("osm-intl"). After the announcement, most of the users use _osm-intl_.
 
+Data is displayed on a 30-day rolling window for performance reasons but the 
original data can be found in 
[here](http://datasets.wikimedia.org/aggregate-datasets/maps/)
+
 Outages and inaccuracies
 ------
 
diff --git a/ui.R b/ui.R
index adec0f2..48d93e3 100644
--- a/ui.R
+++ b/ui.R
@@ -22,6 +22,7 @@
              menuSubItem(text = "WikiMiniAtlas", tabName = 
"wikiminiatlas_usage"),
              menuSubItem(text = "Wikivoyage", tabName = "wikivoyage_usage"),
              menuSubItem(text = "WIWOSM", tabName = "wiwosm_usage")),
+    menuItem(text = "Geographic breakdown", tabName = "geo_breakdown"),
     menuItem(text = "Global Settings",
              selectInput(inputId = "smoothing_global", label = "Smoothing", 
selectize = TRUE, selected = "day",
                          choices = c("No Smoothing" = "day", "Weekly Median" = 
"week", "Monthly Median" = "month")),
@@ -114,7 +115,10 @@
               
column(polloi::timeframe_select("wiwosm_feature_usage_timeframe"), width = 4),
               
column(polloi::timeframe_daterange("wiwosm_feature_usage_timeframe"), width = 
4)),
             dygraphOutput("wiwosm_feature_usage"),
-            includeMarkdown("./tab_documentation/wiwosm_usage.md"))
+            includeMarkdown("./tab_documentation/wiwosm_usage.md")),
+    tabItem(tabName = "geo_breakdown",
+            dygraphOutput("users_by_country"),
+            includeMarkdown("./tab_documentation/geo_breakdown.md"))
   )
 )
 
diff --git a/utils.R b/utils.R
index 028d186..223d1e0 100644
--- a/utils.R
+++ b/utils.R
@@ -30,8 +30,14 @@
 }
 
 read_tiles <- function() {
-  new_tiles_automata <<- 
polloi::read_dataset("maps/tile_aggregates_with_automata.tsv", col_types = 
"Dcidcciidiii")
-  new_tiles_no_automata <<- 
polloi::read_dataset("maps/tile_aggregates_no_automata.tsv", col_types = 
"Dcidcciidiii")
+  new_tiles_automata <<- 
polloi::read_dataset("maps/tile_aggregates_with_automata_rolling.tsv", 
col_types = "Dcidcciidiii")
+  new_tiles_no_automata <<- 
polloi::read_dataset("maps/tile_aggregates_no_automata_rolling.tsv", col_types 
= "Dcidcciidiii")
                                                                         
   return(invisible())
 }
+
+read_countries <- function(){
+  interim <- polloi::read_dataset("maps/users_by_country.tsv")
+  interim$users <- interim$users*100
+  country_data <<- reshape2::dcast(interim, formula = date ~ country, 
fun.aggregate = sum)
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I216caa9960a29bc368dcfb99c576f1eab287ab97
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/discovery/wetzel
Gerrit-Branch: master
Gerrit-Owner: OliverKeyes <[email protected]>
Gerrit-Reviewer: Bearloga <[email protected]>
Gerrit-Reviewer: OliverKeyes <[email protected]>

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

Reply via email to