The Open Data Survey application
Open Data Census is a web application that supports a submission and reviews workflow to collect information on the state of open data.
Some presentation of data is supported, along with partitioning results by year. The code base supports multiple censuses in a multi-tenant configuration, where each tenant runs a census from a subdomain.
Tenant administrators can customize parts of the app, from look and feel to key texts on various views.
If you want to check out what an Open Data Census site looks like we have a demo site running at:
Open Data Census is a Node.js app, running Express v4 and Postgres 9.4 for the database.
Get a local server setup with the following steps:
NOTE: If you need to prefix your commands in your local environment with
sudo, then do that.
127.0.0.1 demo.dev.census.org global.dev.census.org id.dev.census.org system.dev.census.org.
opendatasurveyand move into it with
git clone https://github.com/okfn/opendatasurvey ..
settings.json.examplefile and name it
settings.jsonchanging any values as required.
Now we should be ready to run the server:
npm start(the server will be run on the 5000 port)
http://id.dev.census.org:5000/loginwith your admin account (the same that was setup on the settings.json file)
Other things you can do:
npm run lintusing the eslint config
Most of the site configuration is taken from config sheets in Google Sheets. You can use this registry sheet and its linked sheets as examples and clone them as necessary.
NOTE: Ensure your registry and all other config sheets have been published as CSV in Google Sheets (click File, Publish to the Web).
We run deployments on Heroku. The app should run anywhere that you can run Node.js and Postgres. The important thing to remember for deployments is that the
settings.jsonfile you are using for local development is not available, and therefore you need to configure several settings via environment variables. The key settings you should ensure are set:
When templates or strings in core code change, the translations have to be changed. Extract strings to the
messages.potfile by running this command:
You will need the GNU gettext commands. See here for more information.
To update the existing .po files, run:
To add a new language, create the directory
locale/[language-code]/LC_MESSAGESand create the translation files (*.po). Alternatively, you can copy the
locale/[language-code]and change existing files.
To update the translations cache, run:
Any column can be internationalised by adding another column with
@localeafter it. For example, the
descriptioncolumn can be translated to German by adding a column of
localessetting in the config document can be used to restrict the number of locales available. The first locale in the list is the default locale.
A script is provided to remove users by provider id. Removing a user will update entries where the user is a submitter or reviewer (changing the user id to the anonymous user), then remove the user.
$ npm run anonymize_user --
-dto perform a dry run, which will print the user id, and entry ids which will be affected (where the user is either a submitter or reviewer).
createdb opendatacensus_test npm test