UNPKG

@tmlmobilidade/types

Version:
52 lines (51 loc) 2.13 kB
import { type GTFS_Binary, type GTFS_PickupDropoffType } from './common.js'; /** * Represents a stop time in the GTFS (General Transit Feed Specification) format. * A stop time is a record of when a transit vehicle arrives at and departs from a specific stop. * It includes information such as the arrival and departure times, the stop ID, the trip ID, * and various pickup and drop-off types. This information is crucial for scheduling and * coordinating transit services, allowing passengers to know when a vehicle will be at a particular stop * and what type of service is available at that stop. */ export interface GTFS_StopTime { arrival_time: string; continuous_drop_off?: GTFS_PickupDropoffType; continuous_pickup?: GTFS_PickupDropoffType; departure_time: string; drop_off_type?: GTFS_PickupDropoffType; pickup_type?: GTFS_PickupDropoffType; shape_dist_traveled: number; stop_headsign?: string; stop_id: string; stop_sequence: number; timepoint: GTFS_Binary; trip_id: string; } /** * Represents a raw stop time in the GTFS format. * This interface is used to parse raw data from GTFS files, where fields may be optional * or represented as strings. It is typically used for data ingestion before validation * and transformation into the `GTFS_Stop` format. */ export interface GTFS_StopTime_Raw { arrival_time?: string; continuous_drop_off?: string; continuous_pickup?: string; departure_time?: string; drop_off_type?: string; pickup_type?: string; shape_dist_traveled?: string; stop_headsign?: string; stop_id?: string; stop_sequence?: string; timepoint?: string; trip_id?: string; } /** * Validates and transforms a raw GTFS stop time into the GTFS_StopTime format. * This function checks the types of fields, converts boolean strings to boolean values, * and ensures that required fields are present. * @param rawData The raw trip data to validate and transform. * @returns A validated GTFS_StopTime object. */ export declare function validateGtfsStopTime(rawData: GTFS_StopTime_Raw): GTFS_StopTime;