# Duplicate Informed\_Entity values for stations

**URL:** <https://opendataforum.transport.nsw.gov.au/t/duplicate-informed-entity-values-for-stations/1558>\
**Category:** Real-time Public Transport\
**Created:** [February 28, 2019, 8:53am UTC](https://opendataforum.transport.nsw.gov.au/t/duplicate-informed-entity-values-for-stations/1558 "2019-02-28T08:53:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andymacjones](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@andymacjones](https://opendataforum.transport.nsw.gov.au/u/andymacjones)\
**Post date:** [February 28, 2019, 8:53am UTC](https://opendataforum.transport.nsw.gov.au/t/duplicate-informed-entity-values-for-stations/1558/1 "2019-02-28T08:53:38Z")

</div>

In this morning’s Alert feed for SydneyTrains we see two alerts for Stop\_ID=213510 (as shown below for reference). I can understand why if you were just providing a list of data but this in effect causes problems for anybody who needs to update their own data model. Surely the data should be created as either 1 alert with the text saying "The lifts between the concourse and platforms 3/4 and 5/6 are temporarily out of service, or it should have 4 separate informed\_entity values for the individual stop\_id’s of the individual platforms.

We need to know if these duplicate id’s are specific to stops or if we might have to consider duplicate id’s for routes or trips.

If anybody has an example of a completely full Alert feed that has every type of informed\_entity that could be generated that would also be hugely helpful.

Thanks, Andy

— copy —  
entity {  
id: “134”  
alert {  
informed\_entity {  
agency\_id: “SydneyTrains”  
stop\_id: “213510”  
}  
cause: OTHER\_CAUSE  
effect: UNKNOWN\_EFFECT  
url {  
translation {  
text: “[Travel alerts | transportnsw.info](https://transportnsw.info/alerts#/train)”  
language: “en”  
}  
}  
header\_text {  
translation {  
text: “Lift Availability - Strathfield”  
language: “en”  
}  
}  
description\_text {  
translation {  
text: “The lift between the concourse and platforms 3/4 is temporarily out of service. If you require assistance, please ask staff or phone 97528431.”  
language: “en”  
}  
}  
}  
}  
entity {  
id: “135”  
alert {  
informed\_entity {  
agency\_id: “SydneyTrains”  
stop\_id: “213510”  
}  
cause: OTHER\_CAUSE  
effect: UNKNOWN\_EFFECT  
url {  
translation {  
text: “[Travel alerts | transportnsw.info](https://transportnsw.info/alerts#/train)”  
language: “en”  
}  
}  
header\_text {  
translation {  
text: “Lift Availability - Strathfield”  
language: “en”  
}  
}  
description\_text {  
translation {  
text: “The lift between the concourse and platforms 5/6 is temporarily out of service. If you require assistance, please ask staff or phone 9752 8431.”  
language: “en”  
}  
}  
}  
}  
— end —

---

<div class="post-metadata">

**Author:** ![jxeeno](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/jxeeno/32/210_2.png) [@jxeeno](https://opendataforum.transport.nsw.gov.au/u/jxeeno)\
**Post date:** [February 28, 2019, 9:24am UTC](https://opendataforum.transport.nsw.gov.au/t/duplicate-informed-entity-values-for-stations/1558/2 "2019-02-28T09:24:48Z")

</div>

> [@andymacjones](#):
>
> We need to know if these duplicate id’s are specific to stops or if we might have to consider duplicate id’s for routes or trips.

Alerts are linked by informed entities to the specific entities in a many to many relationship, as per the GTFS real-time spec. There’s no restriction on how many alerts can be associated with a particular entity. For example, there could be a “Delays” alert showing for a particular set of routes and a “Special Events” alert that applies to all routes. Example below from around 6:18pm today:

```auto
entity {
  id: "1"
  alert {
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "IWL_1a"
    }
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "IWL_1b"
    }
    ...
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "IWL_2j"
    }
    url {
      translation {
        text: "https://transportnsw.info/alerts#/train"
        language: "en"
      }
    }
    header_text {
      translation {
        text: "Inner West & Leppington Line - Delays"
        language: "en"
      }
    }
    description_text {
      translation {
        text: "Due to a train requiring mechanical repairs at Liverpool. Please listen to announcements, check indicator boards and real-time apps as stopping patterns and departure platforma may change at short notice."
        language: "en"
      }
    }
  }
}
entity {
  id: "21"
  alert {
    ...
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "IWL_1g"
    }
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "IWL_2a"
    }
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "IWL_2b"
    }
    informed_entity {
      agency_id: "SydneyTrains"
      route_id: "BNK_1a"
    }
    ...
    url {
      translation {
        text: "https://transportnsw.info/alerts#/train"
        language: "en"
      }
    }
    header_text {
      translation {
        text: "Special Events - 28th February 2019"
        language: "en"
      }
    }
    description_text {
      translation {
        text: "Cup of Nations - Leichhardt Oval, Lilyfield\nGates open 16:15 \nMatch 1 - Argentina v Korea Republic 16:35 \nMatch 2 - Australia v New Zealand 19:30 \nFinish 21:00\n- The best station for connections to Leichhardt Oval is Central. Change at Central for a Light rail service to Leichhardt North or catch a bus route 440 from Railway Square to Leichhardt."
        language: "en"
      }
    }
  }
}

```

> [@andymacjones](#):
>
> If anybody has an example of a completely full Alert feed that has every type of informed\_entity that could be generated that would also be hugely helpful.

You can’t go wrong if you cater for all the entities [described in the spec](https://developers.google.com/transit/gtfs-realtime/reference/#message-entityselector) 🙂

In terms of the Sydney Trains feed, I’ve seen:

- `agency_id` and `route_id`
- `agency_id` and `trip` (i.e. a trip entity with `trip_id`), and
- `agency_id` and `stop_id`.

---

<div class="post-metadata">

**Author:** ![andymacjones](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@andymacjones](https://opendataforum.transport.nsw.gov.au/u/andymacjones)\
**Post date:** [March 1, 2019, 12:03pm UTC](https://opendataforum.transport.nsw.gov.au/t/duplicate-informed-entity-values-for-stations/1558/3 "2019-03-01T12:03:33Z")

</div>

Hi,  
in the example you’ve given I presume the … is to indicate not having to paste all the routes inbetween so you’re suggesting that there is an overlap between the two sets of routes, one for Delays and another for Special Events.  
The GTFS-R spec suggests agency\_id, route\_id, route\_type, trip and Trip\_id for messageEntitySelector in the messageAlert. Not sure I know what route type covers but we’re covering agency\_id, route\_id, trip and Trip\_id so I think that’s all covered.

Really useful to know that there can be multiple alerts for the same entity - and we’ll therefore have to design around it.

cheers, Andy

---

<div class="post-metadata">

**Author:** ![jxeeno](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/jxeeno/32/210_2.png) [@jxeeno](https://opendataforum.transport.nsw.gov.au/u/jxeeno)\
**Post date:** [March 2, 2019, 4:44am UTC](https://opendataforum.transport.nsw.gov.au/t/duplicate-informed-entity-values-for-stations/1558/4 "2019-03-02T04:44:36Z")

</div>

> [@andymacjones](#):
>
> in the example you’ve given I presume the … is to indicate not having to paste all the routes inbetween so you’re suggesting that there is an overlap between the two sets of routes, one for Delays and another for Special Events.

That’s right, truncated for brevity. The full alert feed if you’re interested: [alerts\_1551338287.txt.zip](https://opendataforum.transport.nsw.gov.au/uploads/short-url/mGGEX8SqKHRyFr8L5fQQnf9Q87Q.zip) (2.7 KB)

> [@andymacjones](#):
>
> Not sure I know what route type covers but we’re covering agency\_id, route\_id, trip and Trip\_id so I think that’s all covered.

Whilst this isn’t implemented in the Sydney Trains feed, imagine an agency who wants to issue an alert for a particular mode of transport (say ferries), they could use:

```auto
informed_entity {
    agency_id: "SomeAgency"
    route_type: 4
}

```
