API for processing GOV.UK named requests and anonymous feedback
Ruby Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app Added Pagination to the /feedback-by-day Endpoint Feb 26, 2018
bin Upgrade to rails 5.0.2 May 24, 2017
config Remove no-op configuration option Apr 13, 2018
db Add index to document type Jan 8, 2018
lib Add and populate `document_type` field for ContentItem Dec 18, 2017
log
public Remove unnecessary Rails files Jun 18, 2014
spec
.gitignore Upgrade to rails 5.0.2 May 24, 2017
.rspec Add rspec 3.0.0 Jun 18, 2014
.rubocop.yml Lint against ruby 2.2 syntax May 24, 2017
.ruby-version Bump to ruby-2.5.1 May 29, 2018
Gemfile Bump govuk_app_config from 1.6.0 to 1.7.0 Jul 18, 2018
Gemfile.lock Merge pull request #221 from alphagov/dependabot/bundler/fakefs-0.17.0 Jul 18, 2018
Jenkinsfile Pin tests to run on Postgres 9.3 Jun 19, 2018
LICENCE Add LICENCE file Nov 22, 2017
Procfile Add Foreman configuration for 'sidekiq' queue Aug 15, 2014
README.md Update README to bring it in line with styleguide Nov 22, 2017
Rakefile Upgrade to rails 5.0.2 May 24, 2017
config.ru Upgrade to rails 5.0.2 May 24, 2017
import.rb
startup.sh Add startup.sh Sep 9, 2016

README.md

Support API

This app provides an API for storing and fetching anonymous feedback about pages on GOV.UK. Data comes in from the feedback app on the public-facing frontend and is read by the support app on the admin-facing backend.

Nomenclature

  • Feedback: Everything stored in the app is considered to be "feedback" of some form or other and relates to pages published on GOV.UK. Confusingly most of the data also comes from the feedback app, but when we talk about feedback in the context of the support-api we don't usually mean the feedback app, we mean the data stored in the database.
  • Anonymous Contact: All feedback stored in this app is anonymous. This is in contrast with the Named Contact feedback that is sent directly to the support app. All feedback in this app is scanned to see if it may contain Personally Identifiable Information (PII) and flagged if we think it might.
  • Service Feedback: This is feedback that came from the short survey on a "done" page and contains a 1-5 rating for what the user thought of the service. These ratings are aggregated and sent to the performance platform so that it can appear in the performance details as user satisfaction of those services.
  • Page Improvement: Unlike other feedback types, this is not stored in the database, but instead is sent directly to Zendesk to be handled by the GOV.UK support team.

Technical documentation

This is a Ruby on Rails application that provides an API for storing and retrieving feedback about GOV.UK. It has 3 main functions:

  1. a write API used by the feedback app to store feedback
  2. a read API used by the support app to read that feedback and request exports to CSV
  3. a background job used to aggregate service feedback and write it to the performance platform

Dependencies

  • content-store - Support API can receive feedback about any page on GOV.UK, but all it is sent is the path. We use the content-store to look up extra information (content_id, associated organisations, etc) about these pages to allow for better search and filtering of the feedback.
  • whitehall - Support API has a table of Organisations and as Whitehall is the canonical source of that information we use its Organisations API to keep our data up to date.
  • performance platform - Support API stores ratings for services. It aggregates those ratings every day and writes that data to the performance platform write API. We can also use the performance platform read API to import those ratings if there's ever a discrepancy.
  • zendesk - Support API sends some types of feedback to Zendesk so it can be acted on by the support teams directly rather than storing it in its own database.
  • postgres - Support API uses postgres as its own database
  • redis - Support API uses sidekiq to process background jobs (like sending feedback to zendesk, or aggregating feedback and sending it to the performance platform) and sidekiq relies on redis

Running the application

./startup.sh

This will install any dependencies via bundler and then run the app. It listens on port 3075 and if run via the GOV.UK Dev VM will be available at http://support-api.dev.gov.uk (although as an API it has no UI pages for you to visit).

Running the test suite

bundle exec rake

This will run the rspec test suite and generate a coverage report for these specs in ./coverage.

Organisations

This app keeps a local copy of Organisations from Whitehall in the organisations table. In order to keep this up-to-date it runs a sync job overnight via cron. To run the same script on your local development environment do the following:

  1. Ensure whitehall is running: bowl whitehall
  2. Run the rake task rake api_sync:import_organisations

You most likely will only need to do this if your whitehall data is more recent than your data for this app.

Getting Data

When replicating data into your dev VM the database for the support-api is one of the ones ignored by default because it's quite large. To get this data you will have to explicitly request to import it by running:

./sync-postgresql.sh -r -s -d backups/YYYY-MM-DD postgresql-primary-1.backend.integration

Replacing YYYY-MM-DD with the date of your latest backup. Note that this may take some time as it will re-import all the postgres databases that come from that server. You may wish to explore other arguments to the replication scripts which will allow you to filter out other databases from that server.

Licence

MIT License