CAP datasource
Using this datasource requires advanced knowledge.
CAP feeds lack a universally agreed-upon format, resulting in the presence of differently formatted XML feeds. While RSS and ATOM feed formats are common, there are also entirely unique XML formats in use.
It is important to know what kind of format the feed has for the setup to work properly.
To know more about the CAP protocol itself here is the official documentation
Create datasource
Go to the Datasources > Click on the Add new
inside the External datasource tab > Choose the CAP
type.
1. You have to decide how your datasource updates from the original source, either by selecting a Refresh Frequency
or by specifying a Cron Expression
2. Feed URL
is a mandatory field. This field tells the server where to fetch the XML from.
For example: http://alert-feed.worldweather.org/af-andma-en/rss.xml which is an RSS format
feed.
3. Alert URL Selector
is an optional field that must be filled out for feeds that work with a unique type of xml structure. This selector tells where the alerts are located in the feed structure.
In our example we used RSS format
feed, therefore you do not need to set this field, our system parses it automatically.
Here is a snippet from the feed's xml file
<?xml version="1.0" encoding="UTF-8" ?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<link rel="alternate" title="RSS" href="http://alert-feed.worldweather.org/af-andma-en/rss.xml" type="application/rss+xml"/>
<title>Latest Official Public alerts for Afghanistan: National Disaster Management Authority</title>
<link>http://alert-feed.worldweather.org/af-andma-en/rss.xml</link>
<description>This feed lists the most recent Official Public alerts for Afghanistan: National Disaster Management Authority uploaded to the Filtered Alert Hub.</description>
<language>en</language>
<copyright>public domain</copyright>
<pubDate>Tue, 12 Jul 2022 14:48:10 GMT</pubDate>
<lastBuildDate>Mon, 11 Jan 2021 09:13:00 GMT</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<image>
<title>Latest Official Public alerts for Afghanistan: National Disaster Management Authority</title>
<url>http://alert-feed.worldweather.org/af-andma-en/capLogo.jpg</url>
<link>http://alert-feed.worldweather.org/af-andma-en/rss.xml</link>
</image>
<item>
<title>Flood warning for Badghis, faryab, Herat, Farah, Ghor, Dykundi provincess of Afghanistan</title>
<link>https://alert-hub-hko.s3.amazonaws.com/af-andma-en/2022/07/12/14/42/2022-07-12-14-42-10-435-d9af2.xml</link>
<description>According to NOAA rainfall prediction for Afghanstan, satellite imagery, GLOFAS,GFMS and iMMAP Heavy rainf in Badghis, Faryab, Herat, Farah, Ghor, Dykundi, Urizgan provincess Province of Afghanistan will lead to flooding, with likely extensive damage to houses and property.</description>
<category>Met</category>
<pubDate>Tue, 26 Mar 2019 08:24:39 +0000</pubDate>
<guid isPermaLink="false">urn:oid:2.49.0.1.4.1.2019.3.26.8.24.39</guid>
<dc:creator>noorimet@gmail.com (Andma)</dc:creator>
<dc:date>2019-03-26T08:24:39+00:00</dc:date>
</item>
</channel>
</rss>
In this case <rss>
is the base feed. The <channel>
contains information regarding the whole feed such as title, description. It also contains the feed <item>
elements, and those elements contain the information regarding each individual alert.
In the background the parser automatically fills the Alert URL Selector
as rss.channel.item.link
in the case of our example feed.
Advanced caching
Advanced caching
is a feature that helps minimalising network traffic.
If Advanced Caching is not configured, then a request is always sent for every alert; however, these requests, in the case of alerts (not applicable to feeds), employ the conditional GET technique. If conditional GET is not possible, then all alerts are polled.
The settings below are optional. If you are unsure in what type of feed you've got leave these configurations empty!
4. Feed last updated selector
if the feed works in such a way that the updated field not only indicates the freshness of the feed, but it also changes when individual feed items update, then enabling this setting can help prevent unnecessary server requests for alerts.
In our example rss.channel.pubDate
could potentially indicate that the whole feed got updated, along with the feed items. If we would set this selector, then it would only poll all the items if this field changes.
But because we do not know if this is the case we will not set this selector for the example feed
5. Feed item last updated selector
if the feed element contains a field which indicates the freshness of it, using this setting can avoid unnecessary server requests for unchanged alerts.
In our example rss.channel.item.pubDate
could potentially indicate that an individual item got updated. If we would set this selector, then it would only poll the items where this field changed.
But because we do not know if this is the case we will not set this selector for the example feed
Screen identification
Screen identification
these settings allow for connecting the alerts coming from the external feed and the screens in our system.
This identification currently is only applicable to such feeds that are custom developed for our system in mind. A general feed such as our example feed will not contain such information.
6. Tag based matching
helps our server identify which alerts need to be played on which device. This requires that the appropriate identifiers are placed in the alerts.
Tag attribute
: Currently, four options are provided for placing the tags necessary for the identification of screens in the alerts. One of these four options must be chosen:AUDIENCE
,NOTE
,ADDRESSES
,AREA_DESC
.Tag separator
: The character that separates the tagsTag filter type
: The tag filter type tells the relationship between the tags. The options are:All match
orAny match
.Any match
: Any tag that is present in the alert and in the screen will result in the given alert being played.All match
: Only if all the tags present on the alert are present on the screen will the alert be played.
Emergency state management
Emergency state management
can only be enabled after the screen identification is configured, since identification currently is only applicable to such feeds that are custom developed for our system in mind you will not be able to use this option with a generic feed.
7. Set screen emergency state automatically
setting allows our server to automatically set the emergency state of the devices.
Include screens with tag setting
tells the server which devices it is allowed to handle. If the user decides to leave the setting of the emergency state of all devices to the server, then this field can be left empty. If the user only wants the server to perform the handling of the emergency state for only certain devices, then any unique identifier can be given here. That identifier must be present on the screens too.
Additional datasource settings
8. You also have the option to configure alternative settings for how the datasource will behave in our editor
Cache external resources
Remove broken external resource references
Rotate cache on every update
Exchange internal resource references
Request settings