Skip to content
jwhitlock edited this page Oct 4, 2011 · 1 revision

Incidents (traffic accidents and collisions) are different enough from Road Closures (due to special events, road construction, or highway construction) that they deserve different feeds. However, they are combined into an Alert feed, useful for constructing a single map or summary page.

Sitemap

Here's the proposed sitemap of the pages for end-users:

  • / - Map of all alerts (incidents and closures), links to sub-pages. Synonyms are /index.html, alerts.html.
  • /alerts/incidents.html - A map of traffic incidents
  • /alerts/incident/in100.html - A map of incident #100
  • /alerts/closures.html - A map of road and highway closures
  • /alerts/closure/cl78.html - A map of closure #78

For developers, there are variants of the pages. For page.html, there is also:

  • page.dev.html - A page describing variants and filtering options
  • page.xml - An Atom-formatted feed
  • page.json - A JSON-formatted

For developers, there are versioned APIs as well. /versions.html lists the different versions available. /version/v1/alerts.json would be the version 1 variant of the alerts JSON. The current version is duplicated at /alerts.json.

Atom Feeds

The Atom feeds could be used for subscribing to data type. The format depends on the data type.

Incidents Feed

The incidents feed is located at /alerts/incidents.xml. Here is a sample:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">
  <id>tag:trif.tulsawebdevs.org,2011-10-07,3</id>
  <title>Tulsa Road Accidents</title>
  <subtitle>Road Accidents in Tulsa, OK</subtitle>
  <link href="http://trif.tulsawebdevs.org/incidents.xml" rel="self"/>
  <updated>2011-10-03T17:43:32.216-05:00</updated>
  <author>
    <name>Tulsa Web Devs</name>
    <uri>http://tulsawebdevs.org</uri>
  </author>
  <entry>
    <id>tag:trif.tulsawebdevs.org,2011-10-07,3:incident/in101</id>
    <title>Non-Injury Collision at 6500 S HWY75 SB/ INVOLVED</title>
    <updated>2011-10-03T21:48:44.0-05:00</updated>
    <summary>Non-Injury Accident at 6500 S HWY75 SB/ INVOLVED</summary>
    <category term="type:incident" label="Incident" />
    <category term="incident_type:Non-Injury" label="Non-Injury" />
    <category term="incident_road_type:highway" label="Highway" />
    <category term="incident_highway:75" label="Highway 75" />
    <category term="incident_road_direction:SB" label="South-Bound" />
    <published>2011-10-03T21:48:44.0-05:00</published>
    <georss:point>36.0621788 -95.8600714</georss:point>
    <link href="http://trif.tulsawebdevs.org/incident/in101.html" rel="self"/>
    <link href="http://www.cityoftulsa.org/live-traffic-report.aspx" rel="via"/>
    <content type="html">
      &lt;dl&gt;
        &lt;dt&gt;Type:&lt;/dt&gt;
        &lt;dd&gt;Non-Injury&lt;/dd&gt;
        &lt;dt&gt;Description:&lt;/dt&gt;
        &lt;dd&gt;NON-INJURY COLLISION&lt;/dd&gt;
        &lt;dt&gt;Date:&lt;/dt&gt;
        &lt;dd&gt;10/03/11&lt;/dd&gt;
        &lt;dt&gt;Time:&lt;/dt&gt;
        &lt;dd&gt;9:48:44 PM&lt;/dd&gt;
        &lt;dt&gt;Location:&lt;/dt&gt;
        &lt;dd&gt;6500 S HWY75SB/ INVOLVED&lt;/dd&gt;
        &lt;dt&gt;Number:&lt;/dt&gt;
        &lt;dd&gt;1&lt;/dd&gt;
      &lt;/dl&gt;
    </content>
 </entry>

The feed is derived from data parsed from http://cityoftulsa.org/rss/accident.aspx. If time allows, an attempt is made to trace an incident as data changes. In this case, the <updated> time is changed, but the incident ID (in101 in this case) stays the same. The content is the <Incident> XML element and children, converted to an HTML definition list.

The <category> elements are nice-to-haves. The City of Tulsa description is parsed, and different terms are populated.

The <georss:point> is the pin location for the map.

Options

TODO: list options to filter incidents

Closures Feed

TODO: specify, add sample, notes, options

Alerts Feed

The Alerts feed combines the Incidents and Closures feeds. Here is a sample:

TODO: add sample

JSON Feeds

TODO: Specify JSON feeds

Clone this wiki locally