Documentation ¶
Index ¶
Constants ¶
const (
// The value of the language field in the description string containing the metadata.
MetadataLanguage = "github.com/cedarbaum/gtfs/extensions/nyctalerts/Metadata"
)
Variables ¶
This section is empty.
Functions ¶
func Extension ¶
func Extension(opts ExtensionOpts) extensions.Extension
Extension returns the NYCT alerts extension with the provided options applied.
Types ¶
type ElevatorAlertsDeduplicationPolicy ¶
type ElevatorAlertsDeduplicationPolicy string
ElevatorAlertsDeduplicationPolicy is an enum that specifies how elevator alerts should be deduplicated.
The MTA publishes duplicate alerts for elevator outages. For each elevator and each affected platform (e.g. A27N) there is a separate alert with ID `<platform_id>#<elevator_id>`. This extension supports deduplicating these alerts either by combining alerts for the station (A27N, A27S) or the same station complex (A27N, A27S, E01N, E01S) into one. The value of this enum in the ExtensionOpts determines which type of deduplication to perform. See the constants values of this enum for possible options.
const ( // Do not deduplicate any elevator alerts. This is the default. NoDeduplication ElevatorAlertsDeduplicationPolicy = "NO_DEDUPLICATION" // Deduplicate alerts for the same station. Remember that in the subway's GTFS static design a station // is two platforms like the L train platforms at Union Square. To deduplicate across the whole // physical station use [DeduplicateComplex] instead. // // With this option, the ID of the combined alert will be `<station_id>#<elevator_id>`. DeduplicateInStation ElevatorAlertsDeduplicationPolicy = "DEDUPLICATE_IN_STATION" // Deduplicate alerts for the same station complex. // // With this option, the ID of the combined alert will be `elevator:<elevator_id>`. DeduplicateInComplex ElevatorAlertsDeduplicationPolicy = "DEDUPLICATE_IN_COMPLEX" )
type ExtensionOpts ¶
type ExtensionOpts struct { // The deduplication policy to apply. See the enum type's documentation for guidance. ElevatorAlertsDeduplicationPolicy ElevatorAlertsDeduplicationPolicy `yaml:"elevatorAlertsDeduplicationPolicy"` // The MTA's elevator alerts use the platform (e.g. L03N) for the affected entity. This makes // sense in some cases because an elevator may only serve one platform if the station does not offer a transfer // between platforms (for example, the 14th and 6av station). However for regular stations this results in // essentially duplicate informed entities because both platforms get an alert (e.g., A27N and A27S). // In this case it makes sense to use the station ID A27 as the informed enttiy. // // If true, platform IDs are replaced by station IDs in the informed entities. ElevatorAlertsInformUsingStationIDs bool `yaml:"elevatorAlertsInformUsingStationIDs"` // When there are no trains running for a route due to the standard timetable (e.g., there are no C trains // overnight), the MTA publishes an alert. Arguably this is not really an alert becuase this information is // already in the timetable. // // If true, these alerts are skipped. SkipTimetabledNoServiceAlerts bool `yaml:"skipTimetabledNoServiceAlerts"` // The NYCT alerts extension contains many fields like "time alert created at" that don't map to fields in // the standard GTFS realtime proto. If true, all of these fields are placed in a metadata struct of // type [Metadata], serialized to a string, and then included in the GTFS realtime message as a description // string with language set to [MetadataLanguage]. AddNyctMetadata bool `yaml:"addNyctMetadata"` }
ExtensionOpts contains the options for the NYCT alerts extension.
type InformedEntityMetadata ¶
type InformedEntityMetadata struct { SortOrder string Priority gtfsrt.MercuryEntitySelector_Priority }
InformedEntityMetadata contains some NYCT-specific information on the informed entity in an alert.
type Metadata ¶
type Metadata struct { CreatedAt time.Time UpdatedAt time.Time DisplayBeforeActive time.Duration HumanReadableActivePeriod string InformedEntitiesMetadata []InformedEntityMetadata }
Metadata contains some NYCT-specific information on the alert that cannot be mapped to standard GTFS realtime alerts feeds.