JGonera has submitted this change and it was merged.

Change subject: Story 1288: Show monthly contributions graph
......................................................................


Story 1288: Show monthly contributions graph

Change-Id: I027b00a8c3df9352d4a15c01cadbabce92a207a2
---
M dashboards/reportcard.json
A datasources/monthly-contributions.json
A graphs/monthly-contributions.json
M mobile/config.yaml
M mobile/month-uploads.sql
A mobile/monthly-contributions.sql
6 files changed, 260 insertions(+), 11 deletions(-)

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



diff --git a/dashboards/reportcard.json b/dashboards/reportcard.json
index 1562134..5853382 100644
--- a/dashboards/reportcard.json
+++ b/dashboards/reportcard.json
@@ -4,12 +4,16 @@
     "subhead"  : "Apps & Web",
     "tabs": [
         {
-            "name": "Edits monthly",
+            "name": "Monthly reports",
             "graph_ids": [
                 "edits-monthly-unique-editors",
+                "monthly-contributions",
                 "edits-monthly-successful",
                 "edits-monthly-5plus-editors",
-                "edits-monthly-active-editors"
+                "edits-monthly-active-editors",
+                "unique-uploaders",
+                "month-uploads",
+                "deleted-uploads"
             ]
         },
         {
@@ -20,14 +24,6 @@
                 "successful-edits-other",
                 "successful-edits-unique",
                 "error-edits"
-            ]
-        },
-        {
-            "name": "Uploads monthly",
-            "graph_ids": [
-                "unique-uploaders",
-                "month-uploads",
-                "deleted-uploads"
             ]
         },
         {
diff --git a/datasources/monthly-contributions.json 
b/datasources/monthly-contributions.json
new file mode 100644
index 0000000..fdd9d77
--- /dev/null
+++ b/datasources/monthly-contributions.json
@@ -0,0 +1,34 @@
+{
+    "name": "Monthly contributions",
+    "url": 
"http://stat1001.wikimedia.org/limn-public-data/mobile/datafiles/monthly-contributions.csv";,
+    "format": "csv",
+    "shortName": "monthly-contributions",
+    "type": "timeseries",
+    "id": "monthly-contributions",
+    "columns": [
+        {
+            "type": "date",
+            "label": "Month"
+        },
+        {
+            "type": "int",
+            "label": "Android photo uploads"
+        },
+        {
+            "type": "int",
+            "label": "iOS photo uploads"
+        },
+        {
+            "type": "int",
+            "label": "Web photo uploads"
+        },
+        {
+            "type": "int",
+            "label": "Web edits (main)"
+        },
+        {
+            "type": "int",
+            "label": "Web edits (other)"
+        }
+    ]
+}
diff --git a/graphs/monthly-contributions.json 
b/graphs/monthly-contributions.json
new file mode 100644
index 0000000..a0dbf2f
--- /dev/null
+++ b/graphs/monthly-contributions.json
@@ -0,0 +1,173 @@
+{
+  "graph_version": "0.6.0", 
+  "name": "Successful contributions (per month)", 
+  "slug": "monthly-contributions", 
+  "root": {
+    "nodeType": "canvas", 
+    "minWidth": 750, 
+    "minHeight": 500, 
+    "height": 500, 
+    "width": "auto", 
+    "x": {
+      "padding": 0.001
+    },
+    "children": [
+      {
+        "disabled": false, 
+        "nodeType": "axis", 
+        "options": {
+          "tickFormat": "MMM YY", 
+          "dimension": "x", 
+          "orient": "bottom"
+        }
+      }, 
+      {
+        "disabled": false, 
+        "nodeType": "axis", 
+        "options": {
+          "tickFormat": "MMM YY", 
+          "dimension": "y", 
+          "orient": "left"
+        }
+      }, 
+      {
+        "disabled": false, 
+        "nodeType": "grid", 
+        "options": {
+          "ticks": 10, 
+          "dimension": "x"
+        }
+      }, 
+      {
+        "disabled": false, 
+        "nodeType": "grid", 
+        "options": {
+          "ticks": 10, 
+          "dimension": "y"
+        }
+      }, 
+      {
+        "disabled": false, 
+        "nodeType": "zoom-brush", 
+        "options": {
+          "allowY": true, 
+          "allowX": true
+        }
+      }, 
+      {
+        "nodeType": "callout", 
+        "target": "latest", 
+        "disabled": false, 
+        "steps": [
+          "1y", 
+          "1M"
+        ], 
+        "metricRef": 0, 
+        "options": {
+          "deltaPercent": true, 
+          "dateFormat": "MMM YYYY", 
+          "colorDelta": true
+        }
+      }, 
+      {
+        "disabled": false, 
+        "nodeType": "legend", 
+        "options": {
+          "valueFormat": ",.2s", 
+          "dateFormat": "MMM YYYY"
+        }, 
+        "label": "Aug 2012"
+      }, 
+      {
+        "disabled": false, 
+        "nodeType": "bar-group", 
+        "options": {
+          "palette": "wmf_projects", 
+          "scale": "log", 
+          "stack" : {
+            "enabled": true
+          },
+          "dateFormat": "MMM YYYY"
+        }, 
+        "children": [
+          {
+            "disabled": false, 
+            "index": 0, 
+            "metric": {
+              "source_id": "monthly-contributions", 
+              "type": "int", 
+              "source_col": 1
+            }, 
+            "nodeType": "bar", 
+            "options": {
+              "label": "Edits (Main namespace)",
+              "noLegend": false, 
+              "dateFormat": "MMM YYYY"
+            }
+          }, 
+          {
+            "disabled": false, 
+            "index": 1, 
+            "metric": {
+              "source_id": "monthly-contributions", 
+              "type": "int", 
+              "source_col": 2
+            }, 
+            "nodeType": "bar", 
+            "options": {
+              "label": "Edit (Other namespaces)",
+              "noLegend": false, 
+              "dateFormat": "MMM YYYY"
+            }
+          },
+          {
+            "disabled": false, 
+            "index": 2, 
+            "metric": {
+              "source_id": "monthly-contributions",
+              "type": "int", 
+              "source_col": 3
+            }, 
+            "nodeType": "bar", 
+            "options": {
+              "label": "Android uploads",
+              "noLegend": false, 
+              "dateFormat": "MMM YYYY"
+            }
+          },
+          {
+            "disabled": false, 
+            "index": 3, 
+            "metric": {
+              "source_id": "monthly-contributions",
+              "type": "int", 
+              "source_col": 4
+            }, 
+            "nodeType": "bar", 
+            "options": {
+              "label": "iOS uploads",
+              "noLegend": false, 
+              "dateFormat": "MMM YYYY"
+            }
+          },
+          {
+            "disabled": false, 
+            "index": 4, 
+            "metric": {
+              "source_id": "monthly-contributions",
+              "type": "int", 
+              "source_col": 5
+            }, 
+            "nodeType": "bar", 
+            "options": {
+              "label": "Mobile web uploads",
+              "noLegend": false, 
+              "dateFormat": "MMM YYYY"
+            }
+          }
+        ]
+      }
+    ]
+  }, 
+  "id": "monthly-contributions"
+}
diff --git a/mobile/config.yaml b/mobile/config.yaml
index 7494aff..15d377a 100644
--- a/mobile/config.yaml
+++ b/mobile/config.yaml
@@ -67,6 +67,8 @@
                 title: Successful edits (per month)
         edits-monthly-5plus-editors:
                 title: Editors registered on mobile who made 5+ edits on 
enwiki (mobile+desktop)
+        monthly-contributions:
+                title: All monthly contributions on mobile
 
         performance-rendering:
                 title: Rendering time (ms)
diff --git a/mobile/month-uploads.sql b/mobile/month-uploads.sql
index ac773a0..8a491dd 100644
--- a/mobile/month-uploads.sql
+++ b/mobile/month-uploads.sql
@@ -9,7 +9,6 @@
     SELECT EXTRACT(YEAR_MONTH FROM SUBDATE(CURDATE(), INTERVAL @num:=@num+1 
MONTH)) AS month
     FROM information_schema.columns, (SELECT @num:=-1) num LIMIT 12
 ) AS Month
-
 LEFT JOIN (
     SELECT EXTRACT(YEAR_MONTH FROM timestamp) AS month, COUNT(*) AS count
     FROM {{ tables.upload_attempts }}
diff --git a/mobile/monthly-contributions.sql b/mobile/monthly-contributions.sql
new file mode 100644
index 0000000..2bf6c28
--- /dev/null
+++ b/mobile/monthly-contributions.sql
@@ -0,0 +1,45 @@
+SELECT
+    DATE_FORMAT(CONCAT(Date.month, '01'), '%Y-%m-%d') AS Month,
+    COALESCE(Edits.EditsMain, 0) AS EditsMain,
+    COALESCE(Edits.EditsOther, 0) AS EditsOther,
+    COALESCE(AppUploads.Android, 0) AS Android,
+    COALESCE(AppUploads.iOS, 0) AS iOS,
+    COALESCE(WebUploads.Web, 0) AS Web
+
+-- http://stackoverflow.com/a/6871220/365238
+FROM (
+    SELECT EXTRACT(YEAR_MONTH FROM SUBDATE(CURDATE(), INTERVAL @num:=@num+1 
MONTH)) AS month
+    FROM information_schema.columns, (SELECT @num:=-1) num LIMIT 12
+) AS Date
+LEFT JOIN (
+    SELECT
+        EXTRACT(YEAR_MONTH FROM timestamp) AS month,
+        SUM(IF( event_platform LIKE 'Android%', 1, 0)) AS Android,
+        SUM(IF( event_platform LIKE 'iOS%', 1, 0)) AS iOS
+
+    FROM {{ tables.upload_attempts }} WHERE
+        event_result = 'success' AND
+        wiki = 'commonswiki'
+    GROUP BY month
+) AS AppUploads ON Date.month = AppUploads.month
+LEFT JOIN (
+    SELECT
+        EXTRACT(YEAR_MONTH FROM timestamp) AS month,
+        SUM(1) AS Web
+
+    FROM {{ tables.upload_web }} WHERE
+        event_action = 'success' AND
+        wiki != 'testwiki'
+    GROUP BY month
+) AS WebUploads ON Date.month = WebUploads.month
+LEFT JOIN (
+    SELECT
+        EXTRACT(YEAR_MONTH FROM timestamp) AS month,
+        SUM(IF( event_namespace = 0, 1, 0)) AS EditsMain,
+        SUM(IF( event_namespace != 0, 1, 0)) AS EditsOther
+
+    FROM {{ tables.edits_web }} WHERE
+        event_action = 'success' AND
+        wiki != 'testwiki'
+    GROUP BY month
+) AS Edits ON Date.month = Edits.month;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I027b00a8c3df9352d4a15c01cadbabce92a207a2
Gerrit-PatchSet: 4
Gerrit-Project: analytics/limn-mobile-data
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>

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

Reply via email to