Find out about food safety problems when eating out or buying food
Ruby HTML JavaScript CSS Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Got Gastro

Got Gastro helps inform people about food safety problems when eating out or buying food.



Tap to use your current location, or search for a location:

Search location to find food safety problems around

See the list of food safety problems around your search area:

See the list of food safety problems

Tap an entry to see details of the food safety problem:

Tap to see details

Data sources

Each state and territory publishes their data sets differently: from nothing, to HTML, to artisanally hand crafted PDFs for each breach.

NT, Tasmania, and Queensland don't publish their data.

State Format URL Scraper
New South Wales HTML and
Victoria HTML
Queensland nil
South Australia HTML
Western Australia PDF
Tasmania nil
Australian Capital Territory PDF
Northern Territory nil


Calls to /metrics will return information about how Got Gastro is currently running:

  "businesses": 2117,
  "offences": 4104,
  "imports": {
    "count": 270,
    "last_7_days_count": 5,
    "last_import": {
      "started_at": "2017-07-11T10:54:32.000+00:00",
      "finished_at": "2017-07-11T10:55:02.000+00:00",
      "duration": 30
    "last_import_human": {
      "started_at": "15 hours and 51 minutes ago",
      "finished_at": "15 hours and 51 minutes ago",
      "duration": "30 seconds"
  • businesses, offences, and imports.count show counts of each of those data types.
  • imports.last_7_days_count is the number of times imports have been done in the last 7 days.
  • imports.last_import.* contains raw timestamps and numerical duration of the last import.
  • imports.last_import_human.* contains human readable timestamps and the numerical duration of the last import.

If imports.last_import.duration is -1, this means a reset started and has not finished. This can indicate that a reset is currently running, or it has failed.

Health checks

Calls to /health_checks will return information about Got Gastro's performance:

    "type": "CheckImportsCountInLastWeek",
    "status": "ok",
    "message": "There were 5 imports in the last week: 2652, 2662, 2672, 2682, 2692"
    "type": "CheckLastImportStatus",
    "status": "ok",
    "message": "Last import (#2692, starting at 2017-07-11 10:54:32 +0000) ran for 30.0 seconds"
  • CheckImportsCountInLastWeek errors if there have been 0 imports in the last 7 days.
  • CheckLastImportStatus errors if the last import failed.


CircleCI build status


Got Gastro is continuously deployed, using using CircleCI.

Builds and deploys are controlled by bin/ and bin/

Got Gastro runs on Pivotal Web Services.


Ensure you have Git, Ruby, Node, MySQL, and Redis:

git clone
cd gastro
rake db:create
npm install

Then add a .env file so the app can talk to Morph:

# Used to trigger an import by hitting /reset?token=where_is_the_pizza

# Used to fetch a dataset from Morph. Get your Morph API key from

You can find an example configuration at .env.example.


MySQL is required due to OGC spatial analysis functions. In theory it should work with Postgres too, but it is untested.

The db:create and db:destroy Rake tasks assume your MySQL root user with no password set.


Redis is required for queueing jobs. It's started by Foreman automatically with the commands below in Running.

Foreman assumes you have redis-server on your path.


Serve the app locally:

bundle exec foreman start -f Procfile.development

Then visit http://localhost:9292/


Got Gastro depends on data pulled in from Morph.

The gotgastro_scraper normalises data from all the dependent scrapers, converting it to a standard format that the Got Gastro app can consume.

The gotgastro_scraper uses the webhook functionality of Morph to trigger a data reset in the Got Gastro app whenever data is updated.

The update process looks like this:

  1. Individual scrapers (like the NSW Penalty Notices) run once a day on Morph. These collect data from the various state registries.
  2. The gotgastro_scraper runs once a day on Morph.
  3. When the gotgastro_scraper finishes, it makes a call to with a ?token=secret query parameter.
  4. The Got Gastro app fetches the latest data from the gotgastro_scraper, and ingests it.

For this multi-step process to work, you need to set two environment variables:

  • MORPH_API_KEY, your API key on Morph, for the Got Gastro app to query the Morph API for the latest data.
  • GASTRO_RESET_TOKEN, a private token that the /reset URL needs to be called with, to trigger a reset. Calls to /reset without the ?token= query parameter will return a with a HTTP status code of 404.

For local development, set the MORPH_API_KEY to your own Morph API key, and set GASTRO_RESET_TOKEN to something easy to remember like wheresthepizza.

MORPH_API_KEY='something' GASTRO_RESET_TOKEN=wheresthepizza bundle exec foreman start -f Procfile.development

Then, to trigger a data import:

curl http://localhost:9292/reset?token=wheresthepizza


We minify CSS and JavaScript so they load faster for users:

rake assets

This is automatically run in development under Foreman.


Setting the CDN_BASE environment variable will cause assets to be linked to a CDN:

export CDN_BASE=

This significantly speeds up serving of JS, CSS, images, and fonts.


Setting the FB_APP_ID environment variable allows for better Facebook Open Graph integration:

export FB_APP_ID=17246080911111112

You can create a new Facebook app to get an app id.


Mail in development is handled by MailCatcher.

MailCatcher is automatically started when you run the app in development (through Procfile.development), and is accessible at http://localhost:1080.

Mail in production is handled by SendGrid.

To configure mail in production, sign up for a SendGrid account, then set the SENDGRID_USERNAME and SENDGRID_PASSWORD environment variables.



Application performance management is handled by New Relic.

To set a license key, set the NEWRELIC_LICENSE_KEY environment variable:

export NEWRELIC_LICENSE_KEY=b1946ac92492d2347c6235b4d2611184


Run the tests with:

bundle exec rake


Got Gastro is MIT licensed.