Usage

edit
input
{{Metric infobox
 | name = New editor
 | filename = Wiki_metrics.new_editor.svg
 | measures = [[R:Editor activation|Editor activation]] & [[R:Editor productivity|Editor productivity]]
 | specification = 
A '''<math>\text{new editor}(n, t)</math>'''  is a [[R:Newly registered user|newly registered user]] completing <math>n</math> edits to a page in a [[R:content namespace|content namespace]] of a Wikimedia project within <math>t</math> time since registration (<math>T</math>).
 | wmf-standard = 
* <math>n</math> = 1 edit 
* <math>t</math> = 24 hours
 | aliases = [[R:First-time editor|First-time editor]]
 | related-metrics = [[Research:Newly registered user|Newly registered user]]
 | status = draft
 | repository = [https://github.com/halfak/Productive-new-editor-demonstration https://github.com/halfak/Productive-new-editor-demonstration]
 | sql = 
<syntaxhighlight lang="SQL">
SET @content_namespaces = (0);
/* ... snip ... */
GROUP BY 1,2,3
HAVING SUM(content_revisions) >= @n;
</syntaxhighlight>
}}
output
New editor
Specification
A is a newly registered user completing edits to a page in a content namespace of a Wikimedia project within time since registration ().
WMF Standard
  • = 1 edit
  • = 24 hours
Related metrics
Newly registered user
Status
draft
SQL
SET @content_namespaces = (0);
SET @t = 1; /* time cutoff in days */
SET @n = 1; /* edits threshold */

/* Results in a set of "new editors" */
SELECT
    user_id,
    user_name,
    user_registration
FROM
    (
        /* Get revisions to content pages that are still visible */
        SELECT
            user_id,
            user_name,
            user_registration,
            IFNULL(SUM(page_namespace IN (@content_namespaces)), 0) AS content_revisions
        FROM user
        LEFT JOIN revision ON rev_user = user_id
        LEFT JOIN page ON 
            rev_page = page_id AND
            rev_timestamp <= DATE_FORMAT(
                DATE_ADD(user_registration, INTERVAL @t DAY),
                '%Y%m%d%H%i%S')
        GROUP BY 1,2
        
        UNION
        
        /* Get revisions to content pages that have been archived */
        SELECT
            user_id,
            user_name,
            user_registration,
            IFNULL(SUM(ar_namespace IN (@content_namespaces)), 0) AS content_revisions
        FROM user
        LEFT JOIN archive ON 
            ar_user = user_id AND
            ar_timestamp <= DATE_FORMAT(
                DATE_ADD(user_registration, INTERVAL @t DAY),
                '%Y%m%d%H%i%S')
        GROUP BY 1,2,3
    ) AS user_content_revision_count
GROUP BY 1,2,3
HAVING SUM(content_revisions) >= @n;