This source code is for the ODI's Open Data Certificates app at certificates.theodi.org. The online assessment tool allows publishers to assess how good their open data release is across technical, social, legal and other areas. When published, a certificate (which can be Bronze, Silver, Gold or Platinum) shows data reusers how much they can trust and rely on the dataset
This code is open source under the MIT license. See LICENSE.md file for full details.
Open Data Certificate is an online assessment tool for open data releases powered by Rails.
Follow the public feature roadmap for Open Data Certificates
ruby version 2.1.8
Some extra environment variables are required for the certificates site; these can be set in a .env file in the root of the project. The docker setup will create this file if it doesn't already exist.
# A hostname to create links in emails
CERTIFICATE_HOSTNAME="localhost:3000"
# Redis server URL
ODC_REDIS_SERVER_URL="redis://redis:6379"
The following extra are needed in production or for optional features:
# Rackspace credentials for saving certificate dumps
RACKSPACE_USERNAME
RACKSPACE_API_KEY
RACKSPACE_CERTIFICATE_DUMP_CONTAINER
# Juvia details to allow commenting
JUVIA_BASE_URL
CERTIFICATE_JUVIA_SITE_KEY
# Sending error reports to airbrake
AIRBRAKE_CERTIFICATE_KEY
# Enable footnotes for debugging info
ENABLE_FOOTNOTES=true
The simplest way to get a certificates app up and running is under Docker.
docker-machine start default
or run the Kitematic GUI.eval $(docker-machine env default)
to your .bashrc
export COMPOSE_TLS_VERSION=TLSv1_2
bin/dockerize
Connection to 192.168.99.100 port 3000 [tcp/hbci] succeeded!
docker-compose run web bin/setup
docker-machine create -d virtualbox default
bin/dockerize
docker-compose ps
opendatacertificate_web_1
container (likely 0.0.0.0:3000
)docker-compose run web bin/setup
bin/setup
(generates .env
file)bundle exec rails s
If you're not using docker, ignore the docker-compose run web
prefix on the commands below.
eventmachine rubyracer
Both of the above methods should set up your local app with a default admin user:
test@example.com
testtest
By default, only the UK survey is built in development, as building more can take a while.
To build a specific country survey (AU used as an example):
docker-compose run web bundle exec rake surveyor:build_changed_survey FILE=surveys/generated/surveyor/odc_questionnaire.AU.rb
To build a few surveys:
docker-compose run web bundle exec rake surveyor:build_changed_surveys LIMIT=5
To build all the other surveys (remember, this can take a while):
docker-compose run web bundle exec rake surveyor:build_changed_surveys
For information on how to translate and localise surveys, see below.
To run tests:
docker-compose run web bundle exec rake test
You can also run tests continuously whenever a file is changed:
docker-compose run web bundle exec guard
Certificates can be created and updated using a JSON API. See the API documentation for details.
To mark a user as being an admin use the rails console to set the admin
field to true. The easiest way to find the ID is to look on the URL of their account page.
User.find(<id>).update_attributes(admin: true)
Admins are able to block a dataset from displaying on the public /datasets page by visiting the dataset and toggling the visibility at the top of the page.
Removed datasets are listed at /datasets/admin
(only accessible by admin users).
The survey attempts to fetch answers from the documentation URL and fill them into the questionnaire. These answers are marked as autocompleted.
Surveys can be autocompleted if the pages machine-readable metadata in the following formats:
Some examples of URLS that can be autocompleted:
The original prototype has been moved to /prototype.