openaustralia/planningalerts

View on GitHub
app/views/atdis/_section_6_4.html.haml

Summary

Maintainability
Test Coverage
:markdown
  <h3 id="section6.4">6.4 Paging</h3>

  In some circumstances, the data for a particular ATDIS query might be
  larger than is sensible to return in a single response. In this case,
  the feed can use *paging* to indicate to the client that the server has
  more data available. For example, a paged response to a request for all
  items within a postcode might look like this:

      {
        "response": [
          {
            "application": {
              "info": {
                "dat_id": "DA2013-0381",
                “last_modified_date”: “2013-04-20T02:01:07Z”,
                "description": "New pool plus deck",
                "authority": "Example Council Shire Council",
                "lodgement_date": "2013-04-20T02:01:07Z",
                "determination_date": "2013-06-20T02:01:07Z",
                "notification_start_date": "2013-04-20T02:01:07Z",
                "notification_end_date": "2013-05-20T02:01:07Z",
                "status": "OPEN"
              },
              "reference": {
                "more_info_url": "http://www.examplecouncil.nsw.gov.au/atdis/1.0/applications/DA2013-0381"
              },
              "locations": [
                {
                  "address": "123 Fourfivesix Street Neutral Bay NSW 2089",
                  "land_title_ref": {
                    "lot": "10",
                    "section": "ABC",
                    "dpsp_id": "DP2013-0381"
                  }
                }
              ]
            }     
          },
          {
            "application": {
            ...
            }
          }
        ],
        "count": 2,
        "pagination": {
          "previous": null,
          "next": null,
          "current": 1,
          "per_page": 25,
          "count": 100,
          "pages": 1
        }
      }

  In this format, the returned data is split up into three sections: 

  * `response`: contains the raw data of the response, paged according to the
  pagination block
  * `count`: the number of items returned in this response
  * `pagination`: information about how the returned data was paged relative
  to the full set of data available for that query. Within the `pagination`
  block, the following items indicate *how* the data was paged:
    * `previous`: the page number of the immediately preceding page, or null if
  this is the first page
    * `next`: the page number of the immediately following page, or null if this
  is the last page
    * `current`: the page number of the current page
    * `per_page`: the number of paged items returned per page
    * `count`: the total number of items available from the underlying data,
      unpaged
    * `pages`: the total number of pages available from the underlying data

  **Notes**

  * Paged data is at the discretion of the feed producer.
  * In all cases, the `response` block must be provided by the feed producer,
  regardless of whether or not the feed is producing paged data.
  * In a feed cannot handle pagination, then it can leave out the `count` and
  `pagination` blocks

  Because back-end systems page data in a variety of different ways,
  specification of paging has been set at L2 for the ATDIS-1.0.2 version of the specification.
  However, Vendors should be aware that the paging specification would be
  promoted to L1 for the next point release, and that all responses should
  include the `response` block when returning data to the consuming system.