项目作者: gary-rafferty

项目描述 :
API for planning applications parsed using Cranson gem
高级语言: Ruby
项目地址: git://github.com/gary-rafferty/cranson-app.git
创建时间: 2016-12-13T21:40:33Z
项目社区:https://github.com/gary-rafferty/cranson-app

开源协议:

下载


Cranson-App

Description

This is a Rails API application that will be used to serve up planning applications parsed using Cranson.

The purpose is to expose an intuitive interface to query and retrieve planning applications.
Ideally, I’d like to be able to query things like

  • Show me all applications submitted last month.
  • Show me all pending applications within 5 kilometres of my house.
  • Show me recently decided applications.

For now, I’ve only looked into the Fingal’s dataset (because that’s my local authority) but ideally, this could extend to other authorities.
To get an idea of how we parse the Fingal dataset, see the Cranson repository.

Usage

Full documentation can be found here.
Some high-level usage can be found below.

  1. # /plans will return all plans in batches of 50. Uses link-header pagination
  2. $ curl localhost:3000/plans
  3. [
  4. {
  5. "id":14939,
  6. "status":"Decided",
  7. "decision_date":"2017-01-27",
  8. "description":"Two storey extension to existing two storey two bedroom dwelling...",
  9. "link":"http://planning.fingalcoco.ie/swiftlg/apas/run/WPHAPPDETAIL.DisplayURL?theApnID=FW16A/0147",
  10. "reference":"FW16A/0147",
  11. "registration_date":"2016-12-29",
  12. "address":"The Wren's Nest, R121, Westmanstown, Clonsilla, Dublin 15"
  13. }
  14. // snipped
  15. ]
  16. # /plans/:id will return a single plan resource
  17. $ curl localhost:3000/plans/14939
  18. # /plans/search?query=str will return all plans with addresses containing str
  19. $ curl localhost:3000/plans/search?query=raheny
  20. # /plans/within?kilometres=n&latlng=xxx,yyy will returns all plans within n kilometres of latlng
  21. $ curl localhost:3000/plans/within?kilometres=1&latlng=53.3841296,-6.0731679
  22. # /plans/decided will return all decided plans
  23. $ curl localhost:3000/plans/decided
  24. # /plans/invalid will return all invalid plans
  25. $ curl localhost:3000/plans/invalid
  26. # /plans/unknown will return all unknown plans
  27. $ curl localhost:3000/plans/unknown
  28. # /plans/pending will return all pending plans
  29. $ curl localhost:3000/plans/pending
  30. # /plans/on_appeal will return all on_appeal plans
  31. $ curl localhost:3000/plans/on_appeal
  32. # /plans/recently_registered will return all plans registered in the last month
  33. $ curl localhost:3000/plans/recently_registered
  34. # /plans/recently_decided will return all plans decided in the last month
  35. $ curl localhost:3000/plans/recently_decided

Importing data

Run ./bin/rake planning_applications:import to retrieve/parse/insert the remote dataset.

As we include other authorities, it will probably make sense to namespace these tasks e.g fingal:import.

The import task accepts an optional false flag that disables auditing during import.
This is useful if you are expecting data to change, but do not want the audits to be created.

./bin/rake planning_applications:import[false].

Testing

Run ./bin/rake spec to run the current specs

TODOs

  • Can we derive / access any other resources not exposed in the dataset?
  • Add support for new authorities as the become parseable by Cranson

Contributing

Please do. Usual guidelines :)