Open nickevansuk opened 6 years ago
Now depends on https://github.com/openactive/opportunity-api/issues/10
Just to note that schema.org has since introduced https://schema.org/DataFeed and https://schema.org/DataFeedItem, which are both applicable here.
A suggested mapping of the current RPDE terms to schema.org (also picking up on the points in https://github.com/openactive/realtime-paged-data-exchange/issues/54), is as follows:
RPDE 1.0 | Class | Property | Type |
---|---|---|---|
next |
oa:RealtimePagedDataFeed |
oa:nextUrl |
schema:URL |
items |
oa:RealtimePagedDataFeed |
schema:dataFeedElement |
Array of schema:DataFeedItem |
license |
oa:RealtimePagedDataFeed |
schema:license |
schema:URL |
oa:RealtimePagedDataFeed |
schema:schemaVersion |
schema:URL |
|
state |
schema:DataFeedItem |
oa:itemDeleted |
schema:Boolean |
kind |
schema:DataFeedItem |
schema:item.@type |
schema:Property |
id |
schema:DataFeedItem |
schema:identifier |
schema:Text OR schema:Integer |
modified |
schema:DataFeedItem |
schema:version |
schema:Integer |
data |
schema:DataFeedItem |
schema:item |
schema:Thing |
A few notes on this mapping:
oa:RealtimePagedDataFeed
subclasses schema:DataFeed
to indicate the specific type of data feed this represents, which aids validation and tooling.state
is replaced by a boolean oa:itemDeleted
, as RPDE only specifies two states - so this is a more compact representation. Note that oa:itemDeleted
defaults to false, so is not required to be present in the scenario that was previously described as state
of updated
.identifier
would still be used within RealtimePagedDataFeedItem
rather than using item.@id
in order to maintain the ?afterId=
parameter behaviour without require full URL encoding (and also in line with https://github.com/openactive/realtime-paged-data-exchange/issues/87). ?afterId=
should also be renamed to ?afterIdentifier=
.schemaVersion
could additionally be added to reference the model in use by the feed (building on suggestions in https://github.com/openactive/realtime-paged-data-exchange/issues/86).Content-Type
header, in line with the tooling - although this feed would be fully compatible with application/ld+json
and the root @type
of RealtimePagedDataFeed
infers RPDE, the underlying transport mechanism of RPDE should still be specified via Content-Type
ala application/atom+xml
.ordering
remains an integer to allow it to be compatible with both afterId
and afterChangeNumber
ordering strategies.version
is preferred to modified
as it does not imply any relationship to time, and respects the invariant (https://github.com/openactive/realtime-paged-data-exchange/issues/80#issuecomment-367261937) - this maintains the simplicity of implementation as data consumers can treat both ordering strategies in the exactly the same way. ?afterChangeNumber=
and ?afterTimestamp=
parameters should not be renamed to ?afterVersion=
, as their separation is useful for validation and debugging.kind
is replaced by item.@type
, as there is no need to duplicate the property within DataFeedItem
when it is mandatory within Thing
contained in the item
. This means that deleted items require an empty Thing
with only @type
specified, to preserve the ability to combine multiple kind
s within one feed, and for the data consumer to easily store these in separate places.expires
and Cache-Control
headers to hint at data consumer polling frequency and inform the CDN, as per https://github.com/openactive/realtime-paged-data-exchange/issues/79. Such practices are already in use in production, so this is just formalising this into the spec.{
"@context": "https://openactive.io/",
"@type": "RealtimePagedDataFeed",
"nextUrl": "http://www.example.com/api/rpde/sessions?afterTimestamp=1453931925&afterIdentifier=%7Bd97f73fb-4718-48ee-a6a9-9c7d717ebd85%7D",
"dataFeedElement": [
{
"@type": "DataFeedItem",
"identifier": "{c15814e5-8931-470c-8a16-ef45afedaece}",
"version": 1453931101,
"item": {
"@type": "Event",
"@id": "https://bookingsystem.com/hulahoop/e/ev-ssyp-20160509191500",
"identifier": "session-01jz93i3k1p3",
"startDate": "2016-05-09T18:15:00Z",
"endDate": "2016-05-09T19:15:00Z",
"remainingAttendeeCapacity": 0,
"url": "https://bookingsystem.com/hulahoop/e/ev-ssyp-20160509191500?r=oa",
"attendanceCount": 29,
"location": {
"@type": "Place",
"identifier": "location-jbnentuhxsnp",
"url": "https://leisurecentre.org.uk/leisure-centre/camden/kentish-town-sports-centre",
"name": "Kentish Town Sports Centre",
"address": {
"@type": "PostalAddress",
"addressLocality": "Camden",
"addressRegion": "London West",
"postalCode": "NW5 3DU",
"streetAddress": "Kentish Town Sports Centre"
}
}
}
},
{
"@type": "DataFeedItem",
"identifier": "{c15814e5-8931-470c-8a16-ef45afedaece}",
"version": 1453931925,
"itemDeleted": true,
"item": {
"@type": "Event"
}
}
],
"schemaVersion": "https://www.openactive.io/modelling-opportunity-data/2.0",
"license": "https://creativecommons.org/licenses/by/4.0/"
}
Proposer
ODI
Requirements
Proposal
"kind"
with JSON-LD"@type"
"@id"
"@modified"
to allow any entity to have a modified date"@deleted"
to allow any entity to have a "deleted" state (using a boolean instead of the currentupdated|deleted
field as there are only two possible values for that field).@
fortype
,id
,modified
anddeleted
, to distinguish between control properties and data properties."@deleted": true
MUST only include"@id"
,"@modified"
and"@deleted"
properties (note that the Opportunity API could also return such small response for objects that have been deleted, for consistency)."@id"
and"@modified"
are also used in the Opportunity API to allow items retrieved to be comparable to the those in the feed."items"
singular in line with schema.org naming contentions"type": "RealtimePage"
and"@context": "https://openactive.io/"
to the base of the feed"@modified"
MUST use ISO 8601 format with sub-millisecond precisionExample
Open questions