Skip to content

openactive/api-dashboard

Repository files navigation

Build Status Coverage Status

OpenActive Logo

OpenActive Dashboard

A dashboard to support Openactive API users/publishers.

Quick Run

If you have docker installed you can build and launch the API Dashboard with the dockerize.sh script. All you need to do is clone the repository and from the project directory run the following scripts:

  1. Install docker
  2. git clone https://github.com/openactive/api-dashboard.git
  3. cd api-dashboard
  4. bundle install
  5. docker build -t openactive/dashboard .
  6. ./dockerize.sh

You can now see the dashboard at http://localhost:3000

Getting started with development

The API Dashboard is built with Sinatra, a Ruby web application framework. The dashboard uses Redis to store API calls.

To manage versions of Ruby, use a utility like rbenv, rvm or chruby. This code uses version 3.1.2.

Once you have the requisite ruby version, install gems using bundle install. Once installed you should be able to launch the application with the command bundle exec rackup. The application should be available at: http://localhost:9292.

For the application to work you will also need to have a redis server running. The application will try to connect to the default redis host and port (127.0.0.1:6379). Alternatively, you can specify the host and port with the environment variables OA_REDIS_HOST and OA_REDIS_PORT. NB the application reads these, and other environment variables in config/environment.rb.

Tests

The API Dashboard use the Rspec test suite. To run the tests install the testset gems with bundle install, and then run bundle exec rspec.

Command Line Tools

Metadata

There is a script you can run to update the dashboard metadata. To run:

bundle exec ./bin/update_metadata.rb

Or on Heroku:

heroku run bundle exec ./bin/update_metadata.rb

This script checks if the metadata has been updated recently. If you want to force it to update, provide an -f flag, e.g.:

bundle exec ./bin/update_metadata.rb -f

Summary

There is a script you can run to update the dataset summaries. To run:

bundle exec ./bin/update_summaries.rb

Or on Heroku:

heroku run bundle exec ./bin/update_summaries.rb

This script pages through the data and saves the page where it stopped. Subsequent updates will pick up where it left off.

If you want to build a summary sampling from the first page you can provide the --restart option to restart from the beginning. E.g.

bundle exec ./bin/update_summaries.rb --restart

If you want to clear the summary, but coninue from the last page, you can provide the --last-page-restart option e.g.

bundle exec ./bin/update_summaries.rb --last-page-restart

Attribution

Contains National Statistics data © Crown copyright and database right [2017]

About

A dashboard to support OpenActive API users & publishers

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published