Giter VIP home page Giter VIP logo

coronavirus-service-directory's Introduction

Coronavirus response service directory

Deploy

A simple directory of services that can help residents cope if they're staying at home due to the coronavirus pandemic.

Originally commissioned by Camden Borough Council. There are alternate skins for different councils on branches. Read about the project here.

It has:

  • ๐Ÿ•ต๏ธโ€โ™€๏ธ A simple search page where the user selects the kind of help they need and gives their postcode
  • ๐Ÿ“ A results page showing relevant services, nearest first
  • ๐Ÿ‘ฉโ€๐Ÿ’ป A read-only JSON API for other applications to consume. Available at /api/services

It uses the geocoder gem and Google's geocoding API to power geographical functionality.

Configuration

The list of categories that can be searched by are defined in app/model/service.rb. Make sure the data source matches these.

The following environment variables can be set:

  • GOOGLE_API_KEY: an API key from google with the geocoding API enabled
  • DATASOURCE: optional, public URL to a csv data source, see below
  • GA_PROPERTY_ID: optional, for Google Analytics tracking

Running it locally

You need ruby, rails, node.js, npm and a local postgresql server ready.

bundle install
npm install

# create database and run migrations
rails db:setup

# populate initial database
rails db:seed

rails s

It will be on localhost:3000.

If you're using Docker, docker-compose up will set up a local database for you.

Running it on the web

Deploy

Suitable for 12-factor compliant hosting like Heroku.

Don't forget to run the database migrations:

rails db:migrate

Seeding the production database

You can consume data straight from a Google Sheet, if it's formatted in the right way.

We think this is a good way to get new products up and running fast, because there are no new admin tools to train people on.

  1. Get your data into the right format. Here's an example sheet to get you started.
  2. Make sure your sheet is publicly sharable
  3. Add /export?format=csv to the end of the URL to get a link to a CSV version, and save that as an environment variable called DATASOURCE.
  4. Run rails csv using the Heroku console or your hosting's equivalent

It should pull in all the rows from your data sheet and geocode postcodes into latitudes and longitudes.

If your data schema is different, you might need to adjust the rails csv task a little. You can see what the task does in lib/tasks/csv.rake.

You can use Heroku's Scheduler add on to run the task regularly - for example, every hour.

Roadmap

Over the next few weeks to months, we're looking to add:

  • an optional map view
  • a recommended service feature, which bumps one service per category to the top of the list
  • admin user accounts and a proper admin panel
  • a form for the public to submit their own service suggestions

coronavirus-service-directory's People

Contributors

jamiebuckley avatar userman123 avatar danblundell avatar

Watchers

James Cloos avatar

Forkers

uk-gov-mirror

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.