Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save equivalentideas/23335c209c3857f2e16049ea78289822 to your computer and use it in GitHub Desktop.
Save equivalentideas/23335c209c3857f2e16049ea78289822 to your computer and use it in GitHub Desktop.
Script to run using rails runner to extract information about hidden information requests from Right To Know for analysis. It makes a .csv file with the days date in the title, containing some select (and not safe to publish) information on every hidden request.
CSV.open("./tmp/#{Date.today.to_s}_hidden_requests.csv", "wb") do |csv|
# Make headers
csv << [
"id",
"title",
"url",
"public_body_name",
"jurisdiction",
"created_at",
"requester_name",
"initial_request_text"
]
# Add rows
InfoRequest.where('prominence != ?', 'normal').each do |request|
csv << [
request.id,
request.title,
"https://www.righttoknow.org.au/request/#{request.url_title}",
request.public_body.name,
request.public_body.jurisdiction,
request.created_at.to_s,
request.user.name,
request.initial_request_text
]
end
end
@equivalentideas
Copy link
Author

Here's some instructions on how I run this openaustralia/righttoknow#584 (comment) and used it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment