소스 검색

Restored scoreboard page with links to OpenlyLocal spreadsheet & Guardian Datablog

pull/3/head
Adrian Short 14 년 전
부모
커밋
894921bd9d
4개의 변경된 파일10개의 추가작업 그리고 141개의 파일을 삭제
  1. +1
    -24
      app.rb
  2. +0
    -22
      lib/models.rb
  3. +1
    -2
      views/layout.haml
  4. +8
    -93
      views/scoreboard.haml

+ 1
- 24
app.rb 파일 보기

@@ -159,33 +159,10 @@ get '/about' do
end end


get '/scoreboard.csv' do get '/scoreboard.csv' do
halt 404
@councils = Council.all( :order => ['name'] )
labels = %w[
id
created_at
updated_at
name
slug
url
data_url
open_licence
machine_readable
start_d
end_d
]
headers "Content-Disposition" => "attachment;filename=armchair-auditor-scoreboard.csv",
"Content-Type" => "text/csv"
output = ""
for council in @councils
output += "#{council.id},#{council.created_at.strftime("%d %b %Y")},#{council.updated_at.strftime("%d %b %Y")},#{council.name},#{council.slug},#{council.url},#{council.data_url},#{council.open_licence},#{council.machine_readable},#{council.start_d.strftime("%d %b %Y")},#{council.end_d.strftime("%d %b %Y")}\n"
end
labels.join(',') + "\n" + output
redirect '/scoreboard'
end end


get '/scoreboard' do get '/scoreboard' do
halt 404
@councils = Council.all( :order => ['name'] )
haml :scoreboard haml :scoreboard
end end




+ 0
- 22
lib/models.rb 파일 보기

@@ -91,28 +91,6 @@ class Supplier
# end # end
end end


class Council
include DataMapper::Resource
property :id, Serial
property :created_at, DateTime
property :updated_at, DateTime
property :name, String, :length => 255, :required => true
property :slug, String, :length => 255
property :url, String, :length => 255
property :data_url, String, :length => 512
property :open_licence, Boolean, :default => false
property :machine_readable, Boolean, :default => false
property :start_d, Date
property :end_d, Date
before :save, :slugify

def slugify
@slug = @name.gsub(/[^\w\s-]/, '').gsub(/\s+/, '-').downcase
end
end



# This is a singleton. We only use the first row in the settings table. # This is a singleton. We only use the first row in the settings table.




+ 1
- 2
views/layout.haml 파일 보기

@@ -34,8 +34,7 @@
%a{ :href => '/' } Home %a{ :href => '/' } Home
%a{ :href => '/services' } Services %a{ :href => '/services' } Services
%a{ :href => '/suppliers' } Suppliers %a{ :href => '/suppliers' } Suppliers
-#
%a{ :href => '/scoreboard' } Scoreboard
%a{ :href => '/scoreboard' } Scoreboard
%a{ :href => '/about' } About %a{ :href => '/about' } About
= yield = yield
.clear .clear


+ 8
- 93
views/scoreboard.haml 파일 보기

@@ -1,96 +1,11 @@
.grid_12 .grid_12
%h2= @page_title = "Council Spending Data Scoreboard" %h2= @page_title = "Council Spending Data Scoreboard"
%p Which councils are publishing their spending data and how are they doing it?

%p.noprint.download
%a{ :href => "/scoreboard.csv" }
Download data as CSV

%table
%tr
%th Council
%th Data URL
%th Open licence?
%th Machine readable?
%th Start
%th End
%th Updated
- for council in @councils
%tr
%td
%a{ :href => council.url }
= council.name
%td
%a{ :href => council.data_url }
data
%td= yesno(council.open_licence)
%td= yesno(council.machine_readable)
%td= council.start_d.strftime("%b %Y")
%td= council.end_d.strftime("%b %Y")
%td= nicedate(council.updated_at)
%p.highlight.noprint
This scoreboard data is free for you to use according to the
%a{ :href => "http://creativecommons.org/licenses/by/3.0/"}<
Creative Commons Attribution 3.0 Unported Licence.
Please credit to
%strong
Adrian Short/Armchair Auditor
and link back to
%a{ :href => "http://armchairauditor.co.uk/scoreboard" }<
http://armchairauditor.co.uk/scoreboard
where possible.
%h3 Notes
%p
If your council is publishing spending data please be aware of the guidance from
%a{ :href => "http://opengovernmentdata.org/finances/"}<
Open Government Data
and the
%a{ :href => "http://data.gov.uk/blog/publishing-itemised-local-authority-expenditure-advice-comment"}<
Local Public Data Panel.
You can ask questions and get support in the
%a{ :href => "http://www.communities.idea.gov.uk/c/3916997/home.do" }<
Local Open Data Community
on Communities of Practice for Local Government (approved registration required.)
%table
%tr
%td.strong Data URL
%td
A web page that links to the various downloadable data files.
%tr
%td.strong Open licence?
%td
If Yes, the council is explicitly stating an open licence which allows people to use and republish the data, including for commercial purposes. Councils that don't have an open licence could
%a{ :href => "http://www.rbwm.gov.uk/web/finance_payments_to_suppliers.htm"}<
follow Windsor and Maidenhead's example
and adopt
%a{ :href => "http://data.gov.uk/terms-and-conditions"}<
the data.gov.uk licence.
An open licence is essential to enable the maximum use of this data and allow it to be combined with data from other councils to enable comparisons and benchmarking.
%tr
%td.strong Machine readable?
%td
The data needs to be able to be pulled directly into a database or spreadsheet from the web, not just visible as a web page or document. Acceptable formats include CSV, JSON and XML. Unacceptable formats include PDF and Word documents which can't be directly loaded as data into another program. It is also unacceptable to use a word-verification
%a{:href => "http://en.wikipedia.org/wiki/CAPTCHA"}<
CAPTCHA
to prevent automated downloads.
%tr
%td.strong Start
%td
The start of the period for which spending data is published.
%tr
%td.strong End
%td
The end of the period for which spending data is published.
%tr
%td.strong Updated
%td
The date on which this scoreboard data was updated for this council. If you are concerned that your own council's data is out of date here, please
%a{ :href => '/about' }<
get in touch.
%p Data on which councils are publishing their spending data and how they're doing it:
%ul
%li
%a{ :href => "https://spreadsheets.google.com/ccc?key=0AhOqra7su40fdEgtaG4yVFZGVjdYREVIWmprX2dENkE&hl=en_GB#gid=3" }<
Local council spending data scoreboard by OpenlyLocal.com
%li
%a{ :href => "http://www.guardian.co.uk/news/datablog/2010/sep/10/local-council-spending-over-500-list" }<
Council spending data from The Guardian Datablog

불러오는 중...
취소
저장