Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GtfsAlert [New Entity Request] [GTFS-RT] #24

Closed
youngsdeveloper opened this issue Apr 21, 2023 · 5 comments
Closed

GtfsAlert [New Entity Request] [GTFS-RT] #24

youngsdeveloper opened this issue Apr 21, 2023 · 5 comments

Comments

@youngsdeveloper
Copy link

The GTFS specification has an entity that models public transport service alerts.

These entities are part of the GTFS-RT Service Alerts feed.

I am using this feed and I think it is interesting that it appears in SmartDataModels.

This entity has the following attributes:

  • Active period (start and end timestamp)
  • Information with which the notice is related (agency_id, route_id, route_type, direction_id, stop_id, trip)
  • Cause
  • Effect
  • URL with additional information
  • Header text
  • Description text

Here is a link to the official Google specification with an example: https://developers.google.com/transit/gtfs-realtime/examples/alerts?hl=es-419

@albertoabellagarcia
Copy link
Contributor

We have designed the schema based on the specfication, but we need an example of payload.
Could you provide one and then make the PR ?
"{
""$schema"": ""http://json-schema.org/schema#"",
""$schemaVersion"": ""0.0.1"",
""$id"": ""https://smart-data-models.github.io/dataModel.UrbanMobility/GTFSAlert/schema.json,"",
""title"": ""Alert compliant with GTFS standard"",
""description"": ""An alert, indicating some sort of incident in the public transit network."",
""modelTags"": """",
""derivedFrom"": """",
""required"": [
""id"",
""type""
],
""license"": ""https://smart-data-models.github.io/dataModel.UrbanMobility/GTFSAlert/LICENSE.md"",
""type"": ""object"",
""properties"": {
""id"": {
""type"": ""string"",
""format"": ""uri""
},
""type"": {
""type"": ""string""
},
""active_period"": {
""type"": ""string"",
""format"": ""date-time"",
""description"": ""Property. Time when the alert should be shown to the user. If missing, the alert will be shown as long as it appears in the feed. If multiple ranges are given, the alert will be shown during all of them.""
},
""informed_entity"": {
""type"": ""string"",
""description"": ""Property. Entities whose users we should notify of this alert. At least one informed_entity must be provided""
},
""cause"": {
""type"": ""string"",
""description"": ""Property. Cause of this alert.""
""Enum"": [""UNKNOWN_CAUSE"",
""OTHER_CAUSE"",
""TECHNICAL_PROBLEM"",
""STRIKE"",
""DEMONSTRATION"",
""ACCIDENT"",
""HOLIDAY"",
""WEATHER"",
""MAINTENANCE"",
""CONSTRUCTION"",
""POLICE_ACTIVITY"",
""MEDICAL_EMERGENCY""]
},
""effect"": {
""type"": ""string"",
""description"": ""Property. The effect of this problem on the affected entity."",
""enum"": [""NO_SERVICE"",
""REDUCED_SERVICE"",
""SIGNIFICANT_DELAYS"",
""DETOUR"",
""ADDITIONAL_SERVICE"",
""MODIFIED_SERVICE"",
""OTHER_EFFECT"",
""UNKNOWN_EFFECT"",
""STOP_MOVED""]
},
""url"": {
""type"": ""string"",
""description"": ""Property. The URL which provides additional information about the alert.""
},
""header_text"": {
""type"": ""string"",
""description"": ""Property. Header for the alert. This plain-text string will be highlighted, for example in boldface.""
},
""description_text"": {
""type"": ""string"",
""description"": ""Property. Description for the alert. This plain-text string will be formatted as the body of the alert (or shown on an explicit ""expand"" request by the user). The information in the description should add to the information of the header.""
}
}
}"

@youngsdeveloper
Copy link
Author

Here is an example of the Payload that i have used for Murcia case.

{ "id": "urn:ngsi-ld:GtfsAlert:Spain:Murcia:2", "type": "GtfsAlert", "start": 1680083097, "end": 1682754297, "trip_id": "urn:ngsi-ld:GtfsTrip:Spain:Murcia:20230329_2087_17050_1", "url": "https://www.tranviademurcia.es/horarios-especiales-de-agosto/", "header_text": "Nuevos horarios de Agosto", "description_text": "Consulta los nuevos horarios de Tranvía de Murcia en Agosto" }

@albertoabellagarcia
Copy link
Contributor

Where the entity name GtfsAlert is defined? I am finding 'Service Alerts' but not the precise name of the real time entity.

@albertoabellagarcia
Copy link
Contributor

I am going to close the issue.
Feel free to reopen when we can progress on it
thanks

@youngsdeveloper
Copy link
Author

I named it "GtfsAlert" but i refeer to the same concept.

This entity is defined in the URL that i linked in the first message.

Entity description: https://developers.google.com/transit/gtfs-realtime/examples/alerts?hl=es-419

# header information
header {
  # version of speed specification. Currently "2.0".
  gtfs_realtime_version: "2.0"

  # DIFFERENTIAL is unsupported. use FULL_DATASET only
  incrementality: FULL_DATASET

  # the moment where this dataset was generated on the server
  timestamp: 1658283241
}
# multiple entities can be included in the feed
entity {
  # unique identifier for the entity within the feed
  id: "0"

  # "type" of the entity
  alert {
    # multiple periods can be defined. active_period defines
    # the time period that the alert is applied to the selectors
    active_period {
      # either start time or end time must be present
      # one of them can be omitted but not both
      # start time in seconds after epoch
      start: 1658283241
      # end time in seconds after epoch
      end: 1658293845
    }

    # multiple selectors can be given to select the affected entities
    # selectors are applied with a logical OR relationship across
    # informed_entity messages along with a logical AND relationship
    # for parameters in each informed_entity
    informed_entity {
      # valid parameters:
      # agency_id, route_id, route_type, direction_id, stop_id, trip
      route_id: "219"
      stop_id: "16130"
    }
    informed_entity {
      stop_id: "16230"
    }

    # system may use the cause and effect to judge the alert severity
    # see https://support.google.com/transitpartners/answer/10104458
    # cause of the alert - see gtfs-realtime.proto for valid values
    cause: CONSTRUCTION
    # effect of the alert - see gtfs-realtime.proto for valid values
    effect: DETOUR

    # the given url provides additional information
    url {
      # multiple languages/translations supported
      translation {
        # the link points to a webpage with more details of the alert
        text: "http://www.sometransitagency/alerts"
        # language code must be BCP-47, if defined
        language: "en"
      }
    }

    # header of the alert
    header_text {
      # multiple languages/translations supported
      translation {
        text: "Stop at Elm street is closed, temporary stop at Oak street"
        language: "en"
      }
    }

    # alert description. additional info to the header text
    description_text {
      # multiple languages/translations supported
      translation {
        text: "Due to construction at Elm street the stop is closed. The temporary stop can be found 300 meters north at Oak street"
        language: "en"
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants