[][src]Struct transit_model::model::Collections

pub struct Collections {
    pub contributors: CollectionWithId<Contributor>,
    pub datasets: CollectionWithId<Dataset>,
    pub networks: CollectionWithId<Network>,
    pub commercial_modes: CollectionWithId<CommercialMode>,
    pub lines: CollectionWithId<Line>,
    pub routes: CollectionWithId<Route>,
    pub vehicle_journeys: CollectionWithId<VehicleJourney>,
    pub frequencies: Collection<Frequency>,
    pub physical_modes: CollectionWithId<PhysicalMode>,
    pub stop_areas: CollectionWithId<StopArea>,
    pub stop_points: CollectionWithId<StopPoint>,
    pub stop_locations: CollectionWithId<StopLocation>,
    pub feed_infos: BTreeMap<String, String>,
    pub calendars: CollectionWithId<Calendar>,
    pub companies: CollectionWithId<Company>,
    pub comments: CollectionWithId<Comment>,
    pub equipments: CollectionWithId<Equipment>,
    pub transfers: Collection<Transfer>,
    pub trip_properties: CollectionWithId<TripProperty>,
    pub geometries: CollectionWithId<Geometry>,
    pub admin_stations: Collection<AdminStation>,
    pub stop_time_headsigns: HashMap<(String, u32), String>,
    pub stop_time_ids: HashMap<(String, u32), String>,
    pub stop_time_comments: HashMap<(String, u32), String>,
    pub prices_v1: Collection<PriceV1>,
    pub od_fares_v1: Collection<ODFareV1>,
    pub fares_v1: Collection<FareV1>,
    pub tickets: CollectionWithId<Ticket>,
    pub ticket_uses: CollectionWithId<TicketUse>,
    pub ticket_prices: Collection<TicketPrice>,
    pub ticket_use_perimeters: Collection<TicketUsePerimeter>,
    pub ticket_use_restrictions: Collection<TicketUseRestriction>,
    pub pathways: CollectionWithId<Pathway>,
    pub levels: CollectionWithId<Level>,
    pub grid_calendars: CollectionWithId<GridCalendar>,
    pub grid_exception_dates: Collection<GridExceptionDate>,
    pub grid_periods: Collection<GridPeriod>,
    pub grid_rel_calendar_line: Collection<GridRelCalendarLine>,
}

The set of collections representing the model.

Fields

contributors: CollectionWithId<Contributor>datasets: CollectionWithId<Dataset>networks: CollectionWithId<Network>commercial_modes: CollectionWithId<CommercialMode>lines: CollectionWithId<Line>routes: CollectionWithId<Route>vehicle_journeys: CollectionWithId<VehicleJourney>frequencies: Collection<Frequency>physical_modes: CollectionWithId<PhysicalMode>stop_areas: CollectionWithId<StopArea>stop_points: CollectionWithId<StopPoint>stop_locations: CollectionWithId<StopLocation>feed_infos: BTreeMap<String, String>calendars: CollectionWithId<Calendar>companies: CollectionWithId<Company>comments: CollectionWithId<Comment>equipments: CollectionWithId<Equipment>transfers: Collection<Transfer>trip_properties: CollectionWithId<TripProperty>geometries: CollectionWithId<Geometry>admin_stations: Collection<AdminStation>stop_time_headsigns: HashMap<(String, u32), String>stop_time_ids: HashMap<(String, u32), String>stop_time_comments: HashMap<(String, u32), String>prices_v1: Collection<PriceV1>od_fares_v1: Collection<ODFareV1>fares_v1: Collection<FareV1>tickets: CollectionWithId<Ticket>ticket_uses: CollectionWithId<TicketUse>ticket_prices: Collection<TicketPrice>ticket_use_perimeters: Collection<TicketUsePerimeter>ticket_use_restrictions: Collection<TicketUseRestriction>pathways: CollectionWithId<Pathway>levels: CollectionWithId<Level>grid_calendars: CollectionWithId<GridCalendar>grid_exception_dates: Collection<GridExceptionDate>grid_periods: Collection<GridPeriod>grid_rel_calendar_line: Collection<GridRelCalendarLine>

Implementations

impl Collections[src]

pub fn restrict_period(
    &mut self,
    start_date: NaiveDate,
    end_date: NaiveDate
) -> Result<()>
[src]

Restrict the validity period of the current Collections with the start_date and end_date

pub fn sanitize(&mut self) -> Result<()>[src]

Keep the collections consistent for the new model by purging unreferenced data by calendars

pub fn enhance_with_co2(&mut self)[src]

Physical mode should contains CO2 emissions. If the values are not present in the NTFS, some default values will be used.

pub fn enhance_line_opening_time(&mut self)[src]

Sets the opening and closing times of lines (if they are missing).

pub fn enhance_pickup_dropoff(&mut self)[src]

Forbid pickup on last stop point of vehicle journeys and forbid dropoff on first stop point of vehicle journeys.

However, there is an exception to this rule for authorized stay-in between vehicle journeys. It is possible to get in the last stop point of a vehicle journey or get out on the first stop point of a vehicle journey, if and only if the 2 stop points are different and times do not overlap.

WARNING: The current implementation does not handle stay-in for vehicle journeys with different validity patterns.

Here is examples explaining the different stay-in situations (for pick-up and drop-off, XX means forbidden, ―▶ means authorized).

Example 1: ########## out in out in X SP1 | ▲ SP2 X X ▼ | X VJ:1 08:00-09:00 10:00-11:00 VJ:2 10:00-11:00 14:00-15:00 X ▲ | X X | ▼ SP3 X out in out in |- Stay-In -|

Example 2: ########## out in out in X SP1 | ▲ SP2 X X ▼ | X VJ:1 08:00-09:00 10:00---------12:00 VJ:2 11:00----------13:00 13:00-14:00 X ▲ | X X SP3 | ▼ SP4 X out in out in |--------- Stay In ---------|

Note the overlap between the departure time of the last stop point SP2 of VJ:1 and the arrival time of the first stop point SP3 of VJ:2. In this case, we still apply the default rule.

Example 3: ########## out in out in out in out in X SP1 | ▲ SP2 | ▲ SP3 | ▲ SP4 X X ▼ | ▼ | | | X VJ:1 08:00-09:00 10:00-11:00 | ▼ | X VJ:2 12:00-13:00 14:00-15:00 |---------- Stay In ---------|

Example 3 is the only case were we allow specific pick-up and drop-off.

Example 4: ########## SP0 SP1 SP2 SP3

VJ:1 (Mon-Sun) 09:00-10:00 10:00-11:00
VJ:2 (Mon-Fri) 12:00-13:00 14:00-15:00 VJ:3 (Sat-Sun) 12:30-13:30 14:30-15:30

Example 4 might be a valid use case of stay-in but is not handled in the current implementation since the validity patterns are different; this is undefined behavior (most likely, some stay-in will be forbidden by the default rule).

pub fn enhance_trip_headsign(&mut self)[src]

Trip headsign can be derived from the name of the stop point of the last stop time of the associated trip.

pub fn calendar_deduplication(&mut self)[src]

Many calendars are identical and can be deduplicate

pub fn comment_deduplication(&mut self)[src]

Some comments are identical and can be deduplicated

pub fn clean_comments(&mut self)[src]

Remove comments with empty message from the model

pub fn enhance_route_names(
    &mut self,
    routes_to_vehicle_journeys: &impl Relation<From = Route, To = VehicleJourney>
)
[src]

If the route name is empty, it is derived from the most frequent stop_area origin and stop_area destination of all the associated trips. The stop_area name is used to create the following String: [most frequent origin] - [most frequent destination]

If 2 stops have equal frequency, the biggest stop_area (biggest number of stop_point) is chosen.

If still equality between multiple stop_area, then alphabetical order of stop_area's name is used.

route.destination_id is also replaced with the destination stop area found with the above rules.

pub fn enhance_route_directions(&mut self)[src]

If a route direction is empty, it's set by default with the "forward" value

pub fn calculate_validity_period(&self) -> Result<(Date, Date)>[src]

Calculate the validity period in the 'Model'. The calculation is based on the minimum start date and the maximum end date of all the datasets. If no dataset is found, an error is returned.

Trait Implementations

impl AddPrefix for Collections[src]

impl Debug for Collections[src]

impl Default for Collections[src]

impl<'de> Deserialize<'de> for Collections[src]

impl Serialize for Collections[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,