Jdlrobson has submitted this change and it was merged.

Change subject: Use NewEditorEdit schema for new graph
......................................................................


Use NewEditorEdit schema for new graph

Keep old graph and give it an end date
Show desktop vs mobile user activations

Change-Id: I825370ab6425e4936adfab5774128d6bc0b7b6ac
---
M dashboards/reportcard.json
A datasources/edits-monthly-active-2014.json
M generate.py
M graphs/edits-monthly-5plus-editors.json
A graphs/edits-monthly-active-2014.json
M mobile/config.yaml
M mobile/edits-monthly-5plus-editors.sql
A mobile/edits-monthly-active-2014.sql
8 files changed, 190 insertions(+), 6 deletions(-)

Approvals:
  Nuria: Verified; Looks good to me, approved
  Jdlrobson: Verified; Looks good to me, approved



diff --git a/dashboards/reportcard.json b/dashboards/reportcard.json
index 138ac14..c189417 100644
--- a/dashboards/reportcard.json
+++ b/dashboards/reportcard.json
@@ -6,6 +6,7 @@
         {
             "name": "Monthly reports",
             "graph_ids": [
+                "edits-monthly-active-2014",
                 "edits-monthly-unique-editors",
                 "monthly-contributions",
                 "edits-monthly-successful",
diff --git a/datasources/edits-monthly-active-2014.json 
b/datasources/edits-monthly-active-2014.json
new file mode 100644
index 0000000..ab8e161
--- /dev/null
+++ b/datasources/edits-monthly-active-2014.json
@@ -0,0 +1,22 @@
+{
+    "name": "Editors who reached 5 edits on enwiki within 30 days of 
registering",
+    "url": 
"http://stat1001.wikimedia.org/limn-public-data/mobile/datafiles/edits-monthly-active-2014.csv";,
+    "format": "csv",
+    "shortName": "edits-monthly-active-2014",
+    "type": "timeseries",
+    "id": "edits-monthly-active-2014",
+    "columns": [
+        {
+            "type": "date",
+            "label": "Month"
+        },
+        {
+            "type": "int",
+            "label": "Mobile"
+        },
+        {
+            "type": "int",
+            "label": "Desktop"
+        }
+    ]
+}
diff --git a/generate.py b/generate.py
index 48c50a1..9ddf03c 100644
--- a/generate.py
+++ b/generate.py
@@ -46,7 +46,7 @@
             db = self.config['databases'][name]
         except KeyError:
             raise ValueError('No such database: "{0}"'.format(name))
-
+        print db
         self.connections[name] = MySQLdb.connect(
             host=db['host'],
             port=db['port'],
@@ -148,7 +148,12 @@
             if due_at < now or self.force:
                 if "timeboxed" in value and "starts" in value:
                     from_date = value["starts"]
-                    self.generate_graph_timeboxed(key, value, from_date)
+
+                    if "ends" in value:
+                        to_date = value["ends"]
+                    else:
+                        to_date = None
+                    self.generate_graph_timeboxed(key, value, from_date, 
to_date)
                 else:
                     self.generate_graph_full( key, value )
                 try:
@@ -161,7 +166,7 @@
             else:
                 print('Skipping generation of {0}: not enough time has 
passed'.format(value['title']))
 
-    def generate_graph_timeboxed( self, graph_key, value, from_date ):
+    def generate_graph_timeboxed( self, graph_key, value, from_date, 
to_date=None ):
         csv_filename = self.get_csv_filename(graph_key)
         cache = {}
         # load existing values from csv
@@ -181,9 +186,14 @@
 
         today = datetime.date.today()
         this_month = datetime.date(today.year, today.month, 1)
+        if to_date:
+            end_date = to_date
+        else:
+            end_date = this_month
+
         sql_path = self.get_sql_path(graph_key)
         if os.path.exists(sql_path):
-            while from_date < this_month:
+            while from_date < end_date:
                 graph_date_key = from_date.strftime('%Y-%m-%d')
                 from_timestamp = from_date.strftime('%Y%m%d%H%M%S')
                 from_date = from_date + relativedelta(months=1)
diff --git a/graphs/edits-monthly-5plus-editors.json 
b/graphs/edits-monthly-5plus-editors.json
index bee1ff2..4541f7f 100644
--- a/graphs/edits-monthly-5plus-editors.json
+++ b/graphs/edits-monthly-5plus-editors.json
@@ -1,6 +1,6 @@
 {
   "graph_version": "0.6.0", 
-  "name": "Editors registered on mobile who made 5+ edits on enwiki 
(mobile+desktop)", 
+  "name": "Editors registered on mobile who made 5+ edits on enwiki 
(mobile+desktop) for 2013",
   "slug": "edits-monthly-5plus-editors", 
   "root": {
     "nodeType": "canvas", 
diff --git a/graphs/edits-monthly-active-2014.json 
b/graphs/edits-monthly-active-2014.json
new file mode 100644
index 0000000..e9e4583
--- /dev/null
+++ b/graphs/edits-monthly-active-2014.json
@@ -0,0 +1,128 @@
+{
+  "graph_version": "0.6.0",
+  "name": "Editors who reached 5 edits on enwiki within 30 days of 
registering",
+  "slug": "edits-monthly-active-2014",
+  "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": "edits-monthly-active-2014",
+              "type": "int",
+              "source_col": 1
+            },
+            "nodeType": "bar",
+            "options": {
+              "label": "Mobile",
+              "noLegend": false,
+              "dateFormat": "MMM YYYY"
+            }
+          },
+          {
+            "disabled": false,
+            "index": 1,
+            "metric": {
+              "source_id": "edits-monthly-active-2014",
+              "type": "int",
+              "source_col": 2
+            },
+            "nodeType": "bar",
+            "options": {
+              "label": "Desktop",
+              "noLegend": false,
+              "dateFormat": "MMM YYYY"
+            }
+          }
+        ]
+      }
+    ]
+  },
+  "id": "edits-monthly-active-2014"
+}
diff --git a/mobile/config.yaml b/mobile/config.yaml
index cfe9b67..cf6b910 100644
--- a/mobile/config.yaml
+++ b/mobile/config.yaml
@@ -76,7 +76,7 @@
                 title: Uploads deleted (per month)
                 frequency: hourly
         edits-monthly-active-editors:
-                title: Unique editors who made 5+ edits during this month on 
their mobile phone
+                title: Unique editors who became active with 5+ edits
                 frequency: daily
         edits-monthly-unique-editors:
                 title: Unique editors (per month)
@@ -89,6 +89,12 @@
                 frequency: daily
                 timeboxed: true
                 starts: 2013-05-01
+                ends: 2013-12-01
+        edits-monthly-active-2014:
+                title: Editors who reached 5 mobile edits on enwiki within 30 
days of registering
+                frequency: daily
+                timeboxed: true
+                starts: 2013-05-01
         monthly-contributions:
                 title: All monthly contributions on mobile
                 frequency: daily
diff --git a/mobile/edits-monthly-5plus-editors.sql 
b/mobile/edits-monthly-5plus-editors.sql
index 6be0618..6b3077c 100644
--- a/mobile/edits-monthly-5plus-editors.sql
+++ b/mobile/edits-monthly-5plus-editors.sql
@@ -10,6 +10,7 @@
   WHERE
       -- These expect to be substituted so they represent a month time period
       ssac.timestamp >= '{from_timestamp}' AND ssac.timestamp <= 
'{to_timestamp}' AND
+      rev.rev_timestamp > '{from_timestamp}' AND rev.rev_timestamp < 
'{to_timestamp}' AND
       ssac.event_displayMobile = 1 AND
       ssac.wiki = 'enwiki' AND
       page.page_namespace = 0
diff --git a/mobile/edits-monthly-active-2014.sql 
b/mobile/edits-monthly-active-2014.sql
new file mode 100644
index 0000000..0c0765f
--- /dev/null
+++ b/mobile/edits-monthly-active-2014.sql
@@ -0,0 +1,16 @@
+SELECT
+  sum(case when Main.isMobile = 1 then 1 else 0 end) as mobileEdits,
+  sum(case when Main.isMobile = 0 then 1 else 0 end) as desktopEdits
+FROM (
+  SELECT
+    ssac.event_userID,
+    Newbies.event_isMobile as isMobile,
+    count(*) as count
+  FROM log.ServerSideAccountCreation_5487345 AS ssac
+  LEFT JOIN NewEditorEdit_6792669 as Newbies ON ssac.event_userId = 
Newbies.event_userId
+  WHERE
+    ssac.timestamp >= '{from_timestamp}' and ssac.timestamp < '{to_timestamp}' 
AND
+    Newbies.timestamp >= '{from_timestamp}' and Newbies.timestamp < 
'{to_timestamp}' AND
+    ssac.wiki = 'enwiki'
+  group by ssac.event_userID, Newbies.event_isMobile
+) AS Main where Main.count > 5

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I825370ab6425e4936adfab5774128d6bc0b7b6ac
Gerrit-PatchSet: 6
Gerrit-Project: analytics/limn-mobile-data
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: JGonera <jgon...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org>
Gerrit-Reviewer: Nuria <nu...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to