mysociety / whatdotheyknow-theme

The Alaveteli theme for WhatDoTheyKnow (UK)
http://www.whatdotheyknow.com/
MIT License
31 stars 26 forks source link

Blog on what we've tracked through Citations so far #1510

Closed garethrees closed 3 weeks ago

garethrees commented 1 year ago

I was just putting together some stats for the 2022 annual report and had reason to count citations.

citations = Citation.where('created_at >= ?', '2022-01-01')

We've recorded 830 citations this year (so far).

citations.size
# => 830

Of those, 215 are unique URLs (indicating that many citations link the same URL to a bunch of related requests)

citations.pluck(:source_url).uniq.size
# => 215

Mostly news stories, but with lots of "other".


urls = []

citations.each_with_object(Hash.new(0)) do |citation, memo|
  next if urls.include?(citation.source_url)
  urls << citation.source_url
  memo[citation.type] += 1
end
# =>{"other"=>81, "news_story"=>117, "academic_paper"=>17}

Given I'd done all that, wasn't much more work to generate a quick CSV of what we've got.

citations = Citation.where('created_at >= ?', '2022-01-01')

# I know I can do this with SQL but there we go…
urls = []
unique_url_citations = 
  citations.map do |citation|
    next if urls.include?(citation.source_url)
    urls << citation.source_url
    citation
  end.compact

# And I know we can do this with rails routes but we do some weirdness so too
# much effort to work around this minute…
def request_or_batch_url(citable)
  base = "https://www.whatdotheyknow.com"
  if citable.is_a? InfoRequestBatch
    "#{base}/info_request_batch/#{citable.id}"
  else
    "#{base}/request/#{citable.url_title}"
  end
end

csv = CSV.generate do |csv|
  csv << %w[request_title url citation_type citation_url]
  unique_url_citations.each do |citation|
    csv << [
      citation.citable.title,
      request_or_batch_url(citable),
      citation.type,
      citation.source_url
    ]
  end
end

Could pick most interesting 10-20?

FOIMonkey commented 1 year ago

Good idea.

but with lots of "other".

"academic_paper"=>17

@confirmordeny has been busy adding citations to requests linked to from Wikipedia and journal articles. He's also been adding news links to historical requests, so a lot that were cited this year will be fairly old stories/requests.

FWIW, there are a 3 or 4 more that I could add to 'the request that can't be named' to push it into double figures 🐻, but I don't want to mess up the ordering in the sidebar.

RichardTaylor commented 1 year ago

In the "Other" category we have

5 ICO decision notices 4 Tribunal decisions 12 Tweets 24 Wikipedia articles 3 links to mySociety blogs, lots of links to blogs and similar. 2 datasets

a TheyWorkForyou link, and a couple of miscategorised academic articles and news stories.

We have suggestions for adding most of these categories, or something like them already at:

HelenWDTK commented 3 weeks ago

Noted at https://wdtkwiki.mysociety.org/wiki/List_of_blog_ideas