A dashboard to support Openactive API users/publishers.
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:
- Install docker
git clone https://github.com/openactive/api-dashboard.git
cd api-dashboard
bundle install
docker build -t openactive/dashboard .
./dockerize.sh
You can now see the dashboard at http://localhost:3000
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
.
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
.
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
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
Contains National Statistics data © Crown copyright and database right [2017]