Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@equivalentideas equivalentideas commented Aug 17, 2017

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