Christopher Johnson (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250185
Change subject: adds dynamic param charts to getclaims usage fixes integer
overflow in sum for P373 moves KPI to top of sidebar menu
......................................................................
adds dynamic param charts to getclaims usage
fixes integer overflow in sum for P373
moves KPI to top of sidebar menu
Bug: T116009
Change-Id: Ic5b48a913982c739d9508b7fc4e3adf9aabfd192
---
M server.R
M src/output/server-developer.R
M src/output/server-home.R
M src/utils.R
M ui.R
5 files changed, 73 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikidata/analytics/dashboard
refs/changes/85/250185/1
diff --git a/server.R b/server.R
index 5f82c16..de11d86 100644
--- a/server.R
+++ b/server.R
@@ -43,6 +43,11 @@
params_filename <<- "spql17.tsv"
params_file <<- get_local_set(params_filename, sparql_data_uri)
}
+ if (!is.null(context$property)) {
+ params_property <<- context$property
+ } else {
+ params_property <<- "P1"
+ }
})
observeEvent(input$switchtab, {
diff --git a/src/output/server-developer.R b/src/output/server-developer.R
index 1b38a95..bf44af0 100644
--- a/src/output/server-developer.R
+++ b/src/output/server-developer.R
@@ -8,8 +8,41 @@
metric_range <- paste0("From ", first_sample, " To ", last_sample)
box(title = "Definition", width = 6, status = "info", metric_desc,
HTML("<br/>"), metric_range)
})
-aggr_props <- aggregate(wikidata_daily_getclaims_property_use$count,
by=list(wikidata_daily_getclaims_property_use$property), FUN = sum)
+dt_getclaims_file <- data.table(wikidata_daily_getclaims_property_use)
+setkey(dt_getclaims_file, property)
+dt_getclaims_file <- dt_getclaims_file[which(dt_getclaims_file$date >
Sys.Date() - 3),]
+aggr_props <-
aggregate(as.numeric(wikidata_daily_getclaims_property_use$count),
by=list(wikidata_daily_getclaims_property_use$property), FUN = sum)
aggr_props_ordered <- aggr_props[order(aggr_props$x, decreasing = TRUE),]
-output$wikidata_daily_getclaims_property_use_table
<-DT::renderDataTable(datatable(aggr_props_ordered, class = "display compact",
colnames = c("Property", "Value"), rownames = FALSE, options = list(pageLength
= 50, autoWidth = TRUE, columnDefs = list(list(className = 'dt-left', targets =
c(0,1))))) %>%
-formatCurrency("x", currency = "", interval = 3, mark = ",")
-)
\ No newline at end of file
+dt_agg_props_ordered <- data.table(aggr_props_ordered)
+dt_agg_props_ordered <- setnames(dt_agg_props_ordered, c("property", "count"))
+setkey(dt_agg_props_ordered, property)
+aggr_props_join <- dt_agg_props_ordered[dt_getclaims_file]
+output$wikidata_daily_getclaims_property_use_table <-DT::renderDataTable(
+ datatable(aggr_props_ordered, class = "display compact", colnames =
c("Property", "Count", "Chart"),
+ rownames = FALSE,
+ options = list(
+ pageLength = 50,
+ columnDefs = list(
+ list(className = 'dt-left', targets = c(0,1)),
+ list(data = 0,targets = c(0,2)),
+ list(width='10%', targets = c(0)),
+ list(width='10%', targets = c(1)),
+ list(width='10%', targets = c(2)),
+ list(targets = c(2), render = JS(
+ "function(data, type, row, meta) {",
+ "return '<a
href=\"./?t=wikidata_getclaims_property_graphs&property='+data+'\">Chart</a>'",
+ "}")
+ )
+ )
+ ),
+ caption = "Statistics for GetClaims Property Use") %>%
+ formatCurrency("x", currency = "", interval = 3, mark = ",")
+)
+
+
+# http://wikiba.se/metrics#ParamPropertyGraph
+output$param_property_graph <- renderDygraph({
+ #comment_index <- substring(gsub(".tsv", "", params_filename),5)
+ #chart_title <- comments[comment_index,]
+ dygraph_from_param_property()
+})
\ No newline at end of file
diff --git a/src/output/server-home.R b/src/output/server-home.R
index 77b8c96..3c53f58 100644
--- a/src/output/server-home.R
+++ b/src/output/server-home.R
@@ -22,7 +22,7 @@
dt_join_hrefs <- dt_join_hrefs[,.SD,.SDcols=c(1:2,5:6)]
cuts <- 0
output$wikidata_daily_summary_table <- DT::renderDataTable(
- datatable(dt_join_hrefs[2:5], class = "display compact", colnames =
c("Object", "Value", "Delta", "Chart"),
+ datatable(dt_join_hrefs[2:5], class = "display compact", colnames =
c("Object", "Count", "Delta", "Chart"),
options = list(
dom = 't',
columnDefs = list(
@@ -64,7 +64,7 @@
dv_join_hrefs <- dv_join_hrefs[,.SD,.SDcols=c(1:2,5:6)]
cuts <- 0
output$wikidata_daily_datavalues_table <- DT::renderDataTable(
- datatable(dv_join_hrefs[2:5], class = "display compact", colnames =
c("Object", "Value", "Delta", "Chart"),
+ datatable(dv_join_hrefs[2:5], class = "display compact", colnames =
c("Object", "Count", "Delta", "Chart"),
options = list(
dom = 't',
columnDefs = list(
@@ -78,7 +78,7 @@
)
)
),
- caption = paste0("WDQS Sourced Statistics for ", dv_join[1,V1])) %>%
+ caption = paste0("WDQS Sourced Statistics for ", dv_join[1,V1]))
%>%
formatCurrency(2:3, currency = "", interval = 3, mark = ",") %>%
formatStyle(3, color = styleInterval(cuts, c("red", "green"))
)
diff --git a/src/utils.R b/src/utils.R
index 66a7410..9bca13b 100644
--- a/src/utils.R
+++ b/src/utils.R
@@ -196,3 +196,18 @@
strokeWidth = 2, colors = brewer.pal(5, "Set2")[5:1]) %>%
dyCSS(css = custom_css))
}
+
+dygraph_from_param_property <- function(){
+ dt_getclaims_file <- data.table(wikidata_daily_getclaims_property_use)
+ setkey(dt_getclaims_file, property)
+ dt_getclaims_property <- dt_getclaims_file[params_property]
+ dt_getclaims_property <- dt_getclaims_property[,.SD,.SDcols=c(1,3)]
+ return(dygraph(dt_getclaims_property,
+ main = params_property,
+ ylab = "") %>%
+ dyOptions(useDataTimezone = TRUE,
+ labelsKMB = TRUE,
+ fillGraph = TRUE,
+ strokeWidth = 2, colors = brewer.pal(5, "Set2")[5:1]) %>%
+ dyCSS(css = custom_css))
+}
\ No newline at end of file
diff --git a/ui.R b/ui.R
index a96010d..a06337b 100644
--- a/ui.R
+++ b/ui.R
@@ -10,13 +10,21 @@
sidebarMenu(
id = "tabs",
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
+ menuItem(text = "", badgeLabel = "Performance", badgeColor = "aqua"),
+ menuItem(text = "KPI", icon = icon("trophy"),
+ menuSubItem(text = "Community Health", tabName =
"wikidata_community_health"),
+ menuSubItem(text = "Quality", tabName = "wikidata_quality"),
+ menuSubItem(text = "Partnerships", tabName =
"wikidata_partnerships"),
+ menuSubItem(text = "External Use", tabName =
"wikidata_external_use"),
+ menuSubItem(text = "Internal Use", tabName =
"wikidata_internal_use")),
menuItem(text = "", badgeLabel = "Recent", badgeColor = "green"),
menuItem(text = "Frequency Stats", icon = icon("signal"),
menuSubItem(text = "Edits/Day", tabName =
"wikidata_daily_edits_delta"),
menuSubItem(text = "New Pages/Day", tabName =
"wikidata_daily_pages_delta"),
menuSubItem(text = "New Active Users/Day", tabName =
"wikidata_daily_users_delta")),
- menuItem(text = "Developer", icon = icon("gears"),
- menuSubItem(text = "getClaims Usage", tabName =
"wikidata_daily_getclaims_property_use")),
+ menuItem(text = "API Usage", icon = icon("gears"),
+ menuSubItem(text = "getClaims", tabName =
"wikidata_daily_getclaims_property_use"),
+ menuSubItem(text = "Graphs", tabName =
"wikidata_getclaims_property_graphs")),
menuItem(text = "", badgeLabel = "Graphite", badgeColor = "black"),
menuItem(text = "Usages", icon = icon("question"),
menuSubItem(text = "addUsagesForPage", tabName =
"wikidata_addUsagesForPage")),
@@ -41,14 +49,7 @@
menuSubItem(text = "Statements per item", tabName =
"wikidata_content_statement_item"),
menuSubItem(text = "Labels per item", tabName =
"wikidata_content_labels_item"),
menuSubItem(text = "Descriptions per item", tabName =
"wikidata_content_descriptions_item"),
- menuSubItem(text = "Wiki(m|p)edia links per item", tabName =
"wikidata_content_wikilinks_item")),
- menuItem(text = "", badgeLabel = "Performance", badgeColor = "aqua"),
- menuItem(text = "KPI", icon = icon("trophy"),
- menuSubItem(text = "Community Health", tabName =
"wikidata_community_health"),
- menuSubItem(text = "Quality", tabName = "wikidata_quality"),
- menuSubItem(text = "Partnerships", tabName =
"wikidata_partnerships"),
- menuSubItem(text = "External Use", tabName =
"wikidata_external_use"),
- menuSubItem(text = "Internal Use", tabName =
"wikidata_internal_use"))
+ menuSubItem(text = "Wiki(m|p)edia links per item", tabName =
"wikidata_content_wikilinks_item"))
)
)
@@ -107,6 +108,8 @@
uiOutput("metric_meta_getclaims_title")
),
DT::dataTableOutput("wikidata_daily_getclaims_property_use_table")),
+ tabItem(tabName = "wikidata_getclaims_property_graphs",
+ dygraphOutput("param_property_graph")),
tabItem(tabName = "wikidata_addUsagesForPage",
dygraphOutput("wikidata_addUsagesForPage_plot")),
tabItem(tabName = "wikidata_rdf_queries",
--
To view, visit https://gerrit.wikimedia.org/r/250185
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5b48a913982c739d9508b7fc4e3adf9aabfd192
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/analytics/dashboard
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits