Skip to content
vtiffenberg edited this page Sep 8, 2014 · 1 revision

Resource Map exposes a way for other services and programs to subscribe to changes and events.

This allows, for example:

  • Another application can 'listen' for changes to a facility list and import facility data when a new facility is added, or update its information when a facility gets updated or deleted.
  • A service-oriented architecture environment can trigger business processes and other services based on a facility opening, or closing
  • A data collection tool can listen for changes in layers and definitions of forms, to update its internal form definitions
  • Someone can create an alert so that when permissions change for a collection, they can go and review how they have changed to make sure only authorized folks have the right sort of access
  • An application can show a nice 'Audit Log' of who has done what
  • You could customize alerts and actions to happen based on general tools that subscribe to RSS feeds such as If-This-Then-That (http://ifttt.com/)

In order to do this, an application can subscribe to the activity RSS feed.

The RSS feed is accessible here:

http://resmap-stg.instedd.org/api/activity.rss

There is also a user interface you can browse here

http://resmap-stg.instedd.org/activity

Example

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:rm="http://resourcemap.instedd.org/api/1.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Activity</title>
    <lastBuildDate>Sat, 11 May 2013 18:59:12 +0000</lastBuildDate>
    <atom:link rel="next" href="http://resmap-stg.instedd.org/api/activity.rss?collection_ids%5B%5D=26&amp;page=2"/>
    <item>
      <title>[In collection 'Rwanda Health Facility Registry' by user 'demo@instedd.org'] Site 'ANUPHIL' changed: 'admin2' changed from (nothing) to '01' </title>
      <pubDate>Sat, 11 May 2013 18:59:12 +0000</pubDate>
      <guid>60320</guid>
      <rm:collection>Rwanda Health Facility Registry</rm:collection>
      <rm:itemtype>site</rm:itemtype>
      <rm:itemid>13121</rm:itemid>
      <rm:action>changed</rm:action>
      <rm:user>demo@instedd.org</rm:user>
    </item>
    <item>
      <title>[In collection 'Rwanda Health Facility Registry' by user 'edjez@instedd.org'] Layer 'Adminsitrative Information' changed: date field 'Date d'ouverture 2' (dateOpened2) was added </title>
      <pubDate>Thu, 02 May 2013 20:13:29 +0000</pubDate>
      <guid>60167</guid>
      <rm:collection>Rwanda Health Facility Registry</rm:collection>
      <rm:itemtype>layer</rm:itemtype>
      <rm:itemid>22</rm:itemid>
      <rm:action>changed</rm:action>
      <rm:user>edjez@instedd.org</rm:user>
    </item>
    <item>
      <title>[In collection 'Rwanda Health Facility Registry' by user 'edjez@instedd.org'] Site 'AAAAAAA' changed: location changed from (9.841262, 26.925865) to (9.840818, 26.921284), '' changed from '13120' to  </title>
      <pubDate>Wed, 01 May 2013 00:52:24 +0000</pubDate>
      <guid>60166</guid>
      <rm:collection>Rwanda Health Facility Registry</rm:collection>
      <rm:itemtype>site</rm:itemtype>
      <rm:itemid>89457</rm:itemid>
      <rm:action>changed</rm:action>
      <rm:user>edjez@instedd.org</rm:user>
    </item>

Information

  • Title: a human-readable verbose description of the event in English
  • pubDate: Timestamp of the event
  • rm:collection: Name of the Collection
  • rm:itemtype: Name of the type of item affected (site, collection, layer)
  • rm:itemid: ID of the affected item
  • rm:action: Type of activity or "verb" done on the item
  • rm:user: User alias/email for the user performing the action

Security

The activity will be filtered by the collections, layers, sites etc. that the current user has access to. The feed is authenticated with HTTP Basic authentication.

Filtering

The activity feed supports parameters for filtering it across action/verbs and collections. Further filtering and refinement has to be done by clients.

To filter for a collection:

http://resmap-stg.instedd.org/api/activity.rss?collection_ids%5B%5D=777

To filter by a type of change:

http://resmap-stg.instedd.org/api/activity.rss?&collection_ids%5B%5D=777&kinds%5B%5D=site%2Ccreated

The following kinds of verbs can be filtered for:

  • Collection created
  • Collection imported
  • Collection CSV imported
  • Site created
  • Site changed
  • Site deleted
  • Layer created
  • Layer changed
  • Layer deleted