Wikipedia talk:WikiProject Wikipedia essays/Archives/2020/May

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Essays about edit summaries

I've recently used Template:Uw-editsummary several times, which got me wondering: are there any essays which highlight the importance of using edit summaries for collaboration? —⁠andrybak (talk) 18:27, 8 May 2020 (UTC)

At WP:ESDONTS we have more information and links.--Moxy 🍁 18:34, 8 May 2020 (UTC)

Making the impact rating more accessible to readers

As someone who mostly reads essays rather than editing them, I only recently discovered the impact scale you all use to assess them. I found it both cleverly designed and hugely useful, since before I could see the "some essays represent widespread norms; others only represent minority viewpoints" disclaimer at the top of every essay but had no easy way to tell which end of the spectrum the particular essay I was viewing fell at. In this sense, I think the impact scores are of use to essay readers, not just editors, and should therefore be included on the main essay page. Therefore, I propose to add a sentence to the end of the essay box saying something like "This essay has been rated high-impact." What would you all think of that? - Sdkb (talk) 07:21, 2 February 2020 (UTC)

The page you have found is 8 years out of date.....plus..this 😠. Before any link is added to the top of 2000 essays by ranking we would need to update and automate Wikipedia:WikiProject Wikipedia essays/Assessment/Links. User:BernsteinBot did it in 2012 ...so @MZMcBride: (bot operator) and @Xeno: (original requester) see if this is viable....as in frequently updated and worthy of inclusion at the top.--Moxy 🍁 03:05, 14 February 2020 (UTC)
Moxy that's a blast from the past. MZMcBride is one of my go-to tech gurus, who helped write a bot to 'score' essays. I believe the scoring was based on the inbound links/page watchers of the essays. There might have been other factors too. Sdkb If you really want I can dig up the original request if you want to pick up this torch. I'm just not sure that it's would still be useful (on a wide scale, anyway). Keep in mind some essays get linked through maintenance templates, which can greatly inflate their inbound links (we might have corrected for this, I can't rememeber). –xenotalk 13:54, 14 February 2020 (UTC)
I probably have the script somewhere still. You could also look at stats such as page views, of course. --MZMcBride (talk) 00:20, 16 February 2020 (UTC)
@Xeno: @MZMcBride: The formula for the impact rating is here. Setting up the list to update itself seems like it'd be useful, since hopefully we'd only need to do it once and it'd then be useful in perpetuity as essays likely aren't going away from WP anytime soon (there was also a request to update it a little while back). I'm not sure how big a warping factor maintenance templates are, but we could always add a discounting factor for them either now or later. Sdkb (talk) 06:48, 17 February 2020 (UTC)
@MZMcBride: Just following up, were you able to find the code? Is there anything I could do (as a mostly non-programmer) to help at WP:BOTREQ or the like? Sdkb (talk) 19:19, 11 March 2020 (UTC)

Hi Sdkb. I probably still have the script somewhere, but I haven't looked. Checking <https://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject_Wikipedia_essays/Assessment/Links&action=history>, it seems this report turns 10 years old today. That's kind of neat.

I asked Moxy at <https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:WikiProject_Wikipedia_essays/Assessment/Links&oldid=941211352#Data_update> if there was interest in updating this report and never received a reply. --MZMcBride (talk) 10:18, 15 March 2020 (UTC)

@MZMcBride: Ooh, that's neat about the anniversary! Regarding interest, I think many editors reading essay talk pages might benefit from an update, even if they might not know to express interest here. If you decide to get BernsteinBot up and running again, please let me know if there's anything I could do to help. Sdkb (talk) 20:28, 21 March 2020 (UTC)

Hi Sdkb. Here's the script:

#!/usr/bin/env python2.5

# Copyright 2010 bjweeks, MZMcBride

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import datetime
import MySQLdb
import operator
import simplejson as json
import urllib
import wikitools
import settings

stats_date = '%s' % datetime.datetime.strftime(datetime.datetime.utcnow() - datetime.timedelta(days=30), '%Y%m')
stats_date_readable = '%s' % datetime.datetime.strftime(datetime.datetime.utcnow() - datetime.timedelta(days=30), '%b %Y')
stats_url = 'http://stats.grok.se/json/en/%s/' % stats_date

report_title = 'Wikipedia:WikiProject Essays/Assessment/Links'

report_template = u'''
Pages where the talk page transcludes {{tl|essaysort}} sorted by number of \
[[Special:WhatLinksHere|incoming links]]. Number of watchers is included if the \
result is greater than 29. Page views data is from %s. Data as of %s.

{| class="wikitable sortable plainlinks" style="width:100%%; margin:auto;"
|- style="white-space:nowrap;"
! No.
! Page
! Incoming links
! Watchers
! Page views (%s)
! Score
|-
%s
|}
'''

wiki = wikitools.Wiki()
wiki.login(settings.username, settings.password)

def count_watchers(cursor, page_namespace, page_title):
    cursor.execute('''
    /* wikiprojessaycat.py SLOW_OK */
    SELECT
      COUNT(*)
    FROM watchlist
    WHERE wl_namespace = %s
    AND wl_title = %s;
    ''' , (page_namespace, page_title))
    watchers = cursor.fetchone()[0]
    if watchers > 29:
        watchers = watchers
    else:
        watchers = '&mdash;'
    return watchers

def count_views(clean_page_title):
    request = urllib.urlopen(u'%s%s' % (stats_url, urllib.quote(clean_page_title.encode('utf-8'))))
    grok_data = request.read()
    views_data = json.loads(grok_data)
    total_views = views_data['total_views']
    return total_views

conn = MySQLdb.connect(host=settings.host, db=settings.dbname, read_default_file='~/.my.cnf')
cursor = conn.cursor()
cursor.execute('''
/* wikiprojessaycat.py SLOW_OK */
SELECT
  page_namespace,
  ns_name,
  page_title,
  link_count
FROM (SELECT
        page_namespace-1 AS page_namespace,
        ns_name,
        page_title,
        COUNT(pl_from) AS link_count
      FROM page
      JOIN toolserver.namespace
      ON dbname = 'enwiki_p'
      AND (page_namespace-1) = ns_id
      JOIN pagelinks
      ON pl_namespace = page_namespace-1
      AND pl_title = page_title
      JOIN templatelinks
      ON tl_from = page_id
      WHERE tl_namespace = 10
      AND tl_title = 'Essaysort'
      AND page_namespace mod 2 != 0
      GROUP BY page_id) AS tbl1
UNION (SELECT
         page_namespace-1 AS page_namespace,
         ns_name,
         page_title,
         0 AS link_count
       FROM page
       JOIN toolserver.namespace
       ON dbname = 'enwiki_p'
       AND (page_namespace-1) = ns_id
       LEFT JOIN pagelinks
       ON pl_namespace = page_namespace-1
       AND pl_title = page_title
       JOIN templatelinks
       ON tl_from = page_id
       WHERE tl_namespace = 10
       AND tl_title = 'Essaysort'
       AND pl_from IS NULL
       AND page_namespace mod 2 != 0);
''')

output = []
for row in cursor.fetchall():
    page_namespace = row[0]
    ns_name = u'%s' % unicode(row[1], 'utf-8')
    page_title = u'%s' % unicode(row[2], 'utf-8')
    link_count = row[3]
    if page_namespace in (6,14):
        full_page_title = u'[[:%s:%s]]' % (ns_name, page_title)
        clean_page_title = u'%s:%s' % (ns_name, page_title)
    elif page_namespace == 0:
        full_page_title = u'[[%s]]' % (page_title)
        clean_page_title = u'%s' % (page_title)
    else:
        full_page_title = u'[[%s:%s]]' % (ns_name, page_title)
        clean_page_title = u'%s:%s' % (ns_name, page_title)
    watchers = count_watchers(cursor, row[0], row[2])
    views = count_views(clean_page_title)
    if watchers == '&mdash;':
        watchers_score = 1
    else:
        watchers_score = watchers
    score = (int(watchers_score) * 10) + (int(views) * 2) + (int(link_count) / 100)
    sort_row = (full_page_title, link_count, watchers, views, score)
    output.append(sort_row)

sorted_output = sorted(output, key=operator.itemgetter(4), reverse=True)

i = 1
final_output = []
for table_entry in sorted_output:
    table_row = u'''| %d
| %s
| %s
| %s
| %s
| %s
|-''' % (i, table_entry[0].replace('_', ' '), str(table_entry[1]), str(table_entry[2]), str(table_entry[3]), '{{essaycatscore|watchers=%s|views=%s|links=%s}}' % (str(table_entry[2]), str(table_entry[3]), str(table_entry[1])))
    final_output.append(table_row)
    i += 1

cursor.execute('SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1;')
rep_lag = cursor.fetchone()[0]
current_of = (datetime.datetime.utcnow() - datetime.timedelta(seconds=rep_lag)).strftime('%H:%M, %d %B %Y (UTC)')

report = wikitools.Page(wiki, report_title)
report_text = report_template % (stats_date_readable, current_of, stats_date_readable, '\n'.join(final_output))
report_text = report_text.encode('utf-8')
report.edit(report_text, summary=settings.editsumm, bot=1)

cursor.close()
conn.close()

It's not a very complicated script, but many parts of it are broken and need rewriting. There are almost enough broken parts that it doesn't matter which language someone chooses because you'd essentially just be rewriting the script. --MZMcBride (talk) 08:36, 22 March 2020 (UTC)

@MZMcBride: Thanks for sharing! I'm not a programmer myself, so I'll wait for someone else to come along to handle this. Sdkb (talk) 08:43, 22 March 2020 (UTC)