Giter Club home page Giter Club logo

open-data-certificate's Introduction

ODI Open Data Certificate

Build Status Code Climate Dependency Status

The original prototype has been moved to /prototype.

Surveyor

The Open Data Certificate uses surveyor to generate and display the data questionnaires. We've changed the look, feel & structure to fit the site and extended it to support certificate levels.

Although all of Surveyor's functionality is supported - much of it isn't incorporated into the initial designs, and so hasn't been tested to work correctly. Experiments with the demo "kitchen sink survey" illustrate that some of the question types that Surveyor supports break the CSS, so please beware if extending the current questionnaire with other question types - they will need to be tested and possibly need CSS/renderer design changes.

Deploying questionnaires

Any changed surveys can be generated by running a rake task:

# build all surveys in ./surveys
rake surveyor:build_changed_surveys

# specify a survey directory
rake surveyor:build_changed_surveys DIR=surveys/development

Survey versions

When a survey is updated and re-imported, it will be imported as a new version of the survey.

The identity of a survey is judged by the title (the string following survey on the first line of the survey dsl). This is transformed slightly from "My awesome title!!1" to "my-awesome-title"

With this in mind, be careful:

  • that different survey files have unique names
  • that changing the name of the survey might be painful.

Surveyor extensions

We've extended surveyor with some attributes for the Open Data Certificate.

requirment

A 'Requirement' is a bar that needs to be passed to contribute to attaining a certain level in the questionnaire. This is not the same as being "required" - which is about whether a question is mandatory to be completed. For the moment, requirements are stored in the questions database table as labels with a 'requirement' attribute set.

Questions and Answers are associated to requirements by having their 'requirement' attribute set as the same value. Thus; for every label with a requirement set, there should be a question (or an answer) with the same value set.

survey
  • :dataset_curator - Identifies (by its 'reference_identifier' value) which form element should be used to populate the dataset curator field (currently publisher).

  • :dataset_title - Identifies (by its 'reference_identifier' value) which form element should be used to populate the dataset title field (currently dataTitle)

  • :description - Copy to be displayed above the questionnaire

  • :default_locale_name - When there are multiple translations, this is the friendly name for the default one (the others are defined in the translation files)

section
  • :display_header - Whether the header should be displayed on the header (defaults to true)
question
  • :requirment - If the question is a Label-type, requirement is the identifier of an improvement that is recommended to meet a certain level. The value will be stored as "pilot_1", "pilot_2", "pilot_3", "basic_1", "basic_2", etc. With the part before the underscore representing the level, and everything after the underscore uniquely identifying the requirement. If the question is a "normal" question (ie: not a label), the requirement attribute is used to identify to the recommended improvement this question satisfies.

  • :required - Whether or not this question is required/mandatory to be completed (it also has to be triggered in the questionnaire by its dependencies). Any value in here will make the question mandatory, but it can also be used to identify if it is mandatory for a specific level of certificate attainment (if this requires different styling in the UI) ie: :required #=> mandatory for every level , :pilot #=> mandatory for 'pilot' level

  • :help_text_more_url - The url to link to at the end of the help text

  • :text_as_statement - How the text should appear when it's displayed on the certificate (eg. "What is your name?" should read as "Name")

  • :display_on_certificate - If the question should appear on the certificate

answer
  • :requirement - Identifies the recommended improvement that this answer satisfies.

  • :help_text_more_url - as above

  • :text_as_statement - as above

  • :input_type - alternative input types (eg. url, number, phone)

  • :placeholder - placeholder text displayed in a field before anything is entered

Translations

Questionnaires are able to be translated and a user can select the locale when they are filling them out.

To enable this for a questionnaire:

  • specify a default_locale_name for the survey
  • set any alternative translations files using the translations method (eg. :es => 'translations/my-file.es.yml')

In the translation file (eg. surveys/translations/my-file.es.yml)

  • set the locale name with es: Spanish (where 'es' was the reference given in the survey file)

There is an example of adding a translation on this gist

Running

bundle install
rake db:migrate
rake surveyor:build_changed_survey FILE=surveys/odc_questionnaire.UK.rb
rails s

# to include some other jurisdictions
rake surveyor:build_changed_surveys LIMIT=5

Development things

# generate a stripped back version of the default survey (GB)
# - makes page loads more bearable in development
rake surveyor:build_changed_survey FILE=surveys/development/odc_GB_stub.rb

# generate development surveys (includes GB stub)
rake surveyor:build_changed_surveys DIR=surveys/development

# run tests on file change
bundle exec guard

Environment variables

Some environment variables are required for the certificates site, these can be set in a .env file in the root of the project.

# 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

Admin functions

To mark a user as being an admin - the users ID should be included in the ODC_ADMIN_IDS environment variable (comma separated). The easiest way to find the ID is to look on the URL of their account page.

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).

Changing surveys

To change surveys, you'll need Saxon installed. On a Mac, this is as simple as running:

brew install saxon 

You can then change the prototype/survey.xsl file and run:

saxon -s:prototype/jurisdictions/ -xsl:prototype/surveyor.xsl -o:prototype/temp/

The approach to the new app is outlined in a google doc, which will be moved into this readme file.

open-data-certificate's People

Contributors

benfoxall avatar pezholio avatar pavling avatar peterjwest avatar jenit avatar jolankester avatar carlwood avatar floppy avatar hendranna avatar jdeslangles avatar the-skas avatar adamgoodapp avatar cjkenworthy avatar 4foot30 avatar jamesroypoulter avatar jameswillock avatar projectdavis avatar britneyjo avatar

Watchers

Maurizio Napolitano avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.