pt_map package

Subpackages

Submodules

pt_map.admin module

pt_map.apps module

class pt_map.apps.PtMapConfig(app_name, app_module)

Bases: AppConfig

default_auto_field = 'django.db.models.BigAutoField'
name = 'pt_map'

pt_map.bridge module

Bridge

Bridge between Django with its models and database and gtfs.GTFS as intermediate object for File IO.

Contents

Constants

reversed_file_mappingdict(str,str)

Map CamelCased filenames to ‘_’-separated

class_namesdict{str,str}

Map CamelCase, singularized class names to pluralized, snake_cased file names

primary_keysdict{str, (str or None)}

For all pt_map.models, map primary keys if applicable

foreign_keys

For all pt_map.models, map foreign keys if any. Also ordered for model creation without foreign reference conflicts.

time_deltaint

Unix time for Jan 1, 2024. To be used to calculate time prefix strings.

Functions

to_camel_case(s):

Converts ‘_’-separated str to CamelCase with capital first letter

standardize_time(time_str):

Converts str in unicode time format to %H:%M:%S format with normalized 24 hour time

is_NaN(v):

Checks if given variable is either a str expressing NaN or NaN as object

stdz(v):

Standardize date and time formats

gtfs_to_db(g):

Write an existing gtfs.GTFS object to the database using the GTFS compliant models

db_to_gtfs(q, folder_path):

Convert list of query sets to gtfs.GTFS object and write to specified folder if validation for GTFS compliance passes.

pt_map.bridge.db_to_gtfs(q: list[QuerySet], folder_path: str = '')

Convert given list of query sets to gtfs.GTFS object

Parameters:
  • q (list[django.db.models.query.QuerySet]) – List of QuerySets containing the retrieved data to be Converted

  • folder_path (str) – path to be set as the results folder_path instance variable

Returns:

object containing the queried data

Return type:

gtfs.GTFS

pt_map.bridge.gtfs_to_db(g: GTFS)

Given a gtfs.GTFS object, write GTFS-compliantly to db by creating the correct models

Parameters:

g (gtfs.GTFS) – GTFS object to be saved to db

pt_map.bridge.is_NaN(v)
Returns:

  • True – If v is either a str representing NaN or NaN as an object

  • False – Otherwise

pt_map.bridge.standardize_time(time_str: str)

Convert time str to standardized %H:%M:%S format.

Parameters:

time_str (str) – str encoding time

Returns:

str in format ‘%H

Return type:

%M:%S’

pt_map.bridge.stdz(v, m: Model, f: str)

If f is a time or date field, convert to a format our db can easily work with. If f is a foreign key

Parameters:
  • v (object) – object to be standardized

  • m (django.db.models.Model) – model to be written to

  • f (str) – field name in question

Returns:

  • Converted str – If m.f is a DateField or a TimeField

  • Unchanged str – Otherwise

pt_map.bridge.toCamelCase(s: str)

Convert ‘_’-separated str to CamelCase with the first letter capitalized.

Parameters:

s (str) – ‘_’-separated string

Returns:

CamelCased str, first letter capitalized

Return type:

str

pt_map.bridge.to_snake_case(name)

Convert CamelCase to snake_case.

Parameters:

name (str) – str in CamelCase

Return type:

Str in snake_case

pt_map.bridge.unqfk(ts, fk)

Primary keys of imported data and in the database are likely to overlap. To avoid this, the current time in seconds since Jan 1, 2024 is added as a prefix. Foreign key references must know of this new key so they are processed in the same way. To make this possible, we use the same time in seconds for all objects.

Parameters:
  • ts (str) – time in seconds to be prepended

  • fk (primary or foreign key to be processed.)

Return type:

Str with prefix

pt_map.gtfs module

class pt_map.gtfs.GTFS(folder_path: str = '', dfs: dict[str, DataFrame] = None)

Bases: object

DataFrame based representation of the GTFS standard, able to read folder of GTFS files, validate a GTFS object for accordance with the standard and write its data to a GTFS folder.

folder_path

Path to folder where the data is read from and/or to be written to

Type:

str

agency, stops, routes, trips, stop_times, calendar, calendar_dates, fare_attributes, fare_rules, timeframes, fare_media, fare_products, fare_leg_rules, fare_transfer_rules, areas, stop_areas, networks, route_networks, shapes, frequencies, transfers, pathways, levels, location_groups, location_group_stops, locations_geojson, booking_rules, translations, feed_info, attributions

Objects representing the data in the corresponding .txt/.geojson files in the GTFS Reference.

Type:

GTFSFile

errors

Human readable messages explaining why a validation failed if it did.

Type:

list[str]

get_files():

Return all member objects of type GTFSFile

get_fields(name):

Return all fields present in a given instance of a GTFSFile

export(path, dirname):

Save all GTFS data represented by the current instance as a folder of files corresponding to the GTFS Reference.

validate():

For all GTFSFile member objects, validate if they individually conmply with GTFS.

validate_required_fields(df, required_fields):

Check if a DataFrame contains all required fields according to the GTFS reference for the file it represents.

validate_optional_fields(df, optional_fields):

Check if a DataFrame does not contain any unexpected fields, not compliant with the GTFS reference for the file it represents.

validate_lat_lon(df):

Check if a Stop is correctly mapped using geographical coordinates.

class Agency(folder_path, dfs)

Bases: GTFSFile

Represents agency.txt from the GTFS reference

class Areas(folder_path, dfs)

Bases: GTFSFile

Represents areas.txt from the GTFS reference

class Attributions(folder_path, dfs)

Bases: GTFSFile

Represents attributions.txt from the GTFS reference

class BookingRules(folder_path, dfs)

Bases: GTFSFile

Represents booking_rules.txt from the GTFS reference

class Calendar(folder_path, dfs)

Bases: GTFSFile

Represents calendar.txt from the GTFS reference

class CalendarDates(folder_path, dfs)

Bases: GTFSFile

Represents calendar_dates.txt from the GTFS reference

class FareAttributes(folder_path, dfs)

Bases: GTFSFile

Represents fare_attributes.txt from the GTFS reference

class FareLegRules(folder_path, dfs)

Bases: GTFSFile

Represents fare_leg_rules.txt from the GTFS reference

class FareMedia(folder_path, dfs)

Bases: GTFSFile

Represents fare_media.txt from the GTFS reference

class FareProducts(folder_path, dfs)

Bases: GTFSFile

Represents fare_products.txt from the GTFS reference

class FareRules(folder_path, dfs)

Bases: GTFSFile

Represents fare_rules.txt from the GTFS reference

class FareTransferRules(folder_path, dfs)

Bases: GTFSFile

Represents fare_transfer_rules.txt from the GTFS reference

class FeedInfo(folder_path, dfs)

Bases: GTFSFile

Represents feed_info.txt from the GTFS reference

class Frequencies(folder_path, dfs)

Bases: GTFSFile

Represents frequencies.txt from the GTFS reference

class GTFSFile(folder_path, file_name, dfs)

Bases: object

All given fields and their corresponding values are stored as a DataFrame.

file_name

Extension-less name of the corresponding .txt file from the GTFS Reference

Type:

str

folder_path

Folder to read data from or potentially write it to

Type:

str

data

All csv data from the corresponding .txt file represented as a Pandas DataFrame

Type:

pd.DataFrame

load_data(dfs):

Load data from list of DataFrames if given else read it from the corresponding .txt file in csv format.

load_data(dfs)

Fill the data attribute with GTFS data either with a given DataFrame or from the corresponding csv

Parameters:

dfs (dict[str, pd.DataFrame]) – Dict of dataframes mapped to the corresponding file names. If given, the corresponding DataFrame is returned if the key exists else an empty DataFrame

class Levels(folder_path, dfs)

Bases: GTFSFile

Represents levels.txt from the GTFS reference

class LocationGroupStops(folder_path, dfs)

Bases: GTFSFile

Represents location_group_stops.txt from the GTFS reference

class LocationGroups(folder_path, dfs)

Bases: GTFSFile

Represents location_groups.txt from the GTFS reference

class LocationsGeojson(folder_path, dfs)

Bases: GTFSFile

Represents locations.geojson from the GTFS reference

load_data()

Fill the data attribute with GTFS data either with a given DataFrame or from the corresponding csv

Parameters:

dfs (dict[str, pd.DataFrame]) – Dict of dataframes mapped to the corresponding file names. If given, the corresponding DataFrame is returned if the key exists else an empty DataFrame

class Networks(folder_path, dfs)

Bases: GTFSFile

Represents networks.txt from the GTFS reference

class Pathways(folder_path, dfs)

Bases: GTFSFile

Represents pathways.txt from the GTFS reference

class RouteNetworks(folder_path, dfs)

Bases: GTFSFile

Represents route_networks.txt from the GTFS reference

class Routes(folder_path, dfs)

Bases: GTFSFile

Represents routes.txt from the GTFS reference

class Shapes(folder_path, dfs)

Bases: GTFSFile

Represents shapes.txt from the GTFS reference

class StopAreas(folder_path, dfs)

Bases: GTFSFile

Represents stop_areas.txt from the GTFS reference

class StopTimes(folder_path, dfs)

Bases: GTFSFile

Represents stop_times.txt from the GTFS reference

class Stops(folder_path, dfs)

Bases: GTFSFile

Represents stops.txt from the GTFS reference

class Timeframes(folder_path, dfs)

Bases: GTFSFile

Represents timeframes.txt from the GTFS reference

class Transfers(folder_path, dfs)

Bases: GTFSFile

Represents transfers.txt from the GTFS reference

class Translations(folder_path, dfs)

Bases: GTFSFile

Represents translations.txt from the GTFS reference

class Trips(folder_path, dfs)

Bases: GTFSFile

Represents trips.txt from the GTFS reference

export(path=None, dirname='')

Save this object’s data to files as specified by GTFS.

Parameters:
  • path (str) – parent directory where to save the files, defaults to the objects folder_path property

  • dirname (str) – If specified, subdirectory to create or use inside path. Default behaviour is to save directly to path.

get_fields(name)

Given the name of a file specified in the GTFS specification, return all fields present in the data.

Parameters:

name (str) – name of a file as specified by GTFS (ommiting the .txt/.geojson extension)

Returns:

a list of all the fields present in the datastream of the specified file

Return type:

list[pd.core.indexes.range.RangeIndex]

get_files()

Get all GTFSFile object

Returns:

All member objects of type GTFSFile

Return type:

list[GTFSFile]

validate()

Check this object’s data for compliance with the GTFS reference. Resets self.errors and stores human readable error messages to it.

Returns:

List of human readable error messages, also saved to self.errors, if any, else None.

Return type:

list[str]

validate_agency()

Check Agency object for compliance with the GTFS reference.

validate_areas()

Check Areas object for compliance with the GTFS reference.

validate_attributions()

Check Attributions object for compliance with the GTFS reference.

validate_booking_rules()

Check BookingRules object for compliance with the GTFS reference.

validate_calendar()

Check Calendar object for compliance with the GTFS reference.

validate_calendar_dates()

Check CalendarDates object for compliance with the GTFS reference.

validate_fare_attributes()

Check FareAttributes object for compliance with the GTFS reference.

validate_fare_leg_rules()

Check FareLegRules object for compliance with the GTFS reference.

validate_fare_media()

Check FareMedia object for compliance with the GTFS reference.

validate_fare_products()

Check FareProducts object for compliance with the GTFS reference.

validate_fare_rules()

Check FareRules object for compliance with the GTFS reference.

validate_fare_transfer_rules()

Check FareTransferRules object for compliance with the GTFS reference.

validate_feed_info()

Check FeedInfo object for compliance with the GTFS reference.

validate_frequencies()

Check Frequencies object for compliance with the GTFS reference.

validate_lat_lon(df, file_name='stops.txt', prefix='stop')

Check if a DataFrame contains either no coordinates of a given prefix or both latitude and longitude.

Parameters:
  • df (pd.DataFrame) – DataFrame to be checked

  • file_name (str) – Name to be printed in error message if validation fails

  • prefix (str) – Prefix to be used for coordinate fileds. Expands to {prefix}_lat and {prefix}_lon

validate_levels()

Check Levels object for compliance with the GTFS reference.

validate_location_group_stops()

Check LocationGroupStops object for compliance with the GTFS reference.

validate_location_groups()

Check Agency LocationGroups for compliance with the GTFS reference.

validate_locations_geojson()

Check LocationsGeojson object for compliance with the GTFS reference.

validate_networks()

Check Networks object for compliance with the GTFS reference.

validate_optional_fields(df, optional_fields, file_name)

Check if DataFrame contains fields not specified in the GTFS Reference.

Parameters:
  • df (pd.DataFrame) – DataFrame to be checked

  • optional_fields (list[str]) – list of field names allowed in df

  • file_name (str) – Name to be printed in error message if validation fails

validate_pathways()

Check Pathways object for compliance with the GTFS reference.

validate_required_fields(df, required_fields, file_name)

Check if a DataFrame contains all required fields according to the GTFS reference for the file it represents.

Parameters:
  • df (pd.DataFrame) – DataFrame to be checked

  • required_fields (list[str]) – list of field names to check for inclusion in df

  • file_name (str) – Name to be printed in error message if validation fails

validate_route_networks()

Check RouteNetworks object for compliance with the GTFS reference.

validate_routes()

Check Routes object for compliance with the GTFS reference.

validate_shapes()

Check Shapes object for compliance with the GTFS reference.

validate_stop_areas()

Check StopAreas object for compliance with the GTFS reference.

validate_stop_times()

Check StopTimes object for compliance with the GTFS reference.

validate_stops()

Check Stops object for compliance with the GTFS reference.

validate_timeframes()

Check Timeframes object for compliance with the GTFS reference.

validate_transfers()

Check Transfers object for compliance with the GTFS reference.

validate_translations()

Check Translations object for compliance with the GTFS reference.

validate_trips()

Check Trips object for compliance with the GTFS reference.

pt_map.models module

Models

Django database models representing the files of the GTFS Reference with all their fields

pt_map.models.Classes
-------
Agency, Stop, Route, Trip, StopTime, Calendar, CalendarDate, FareAttribute, FareRule, Shape, Frequency, Transfer, Pathway, Level, FeedInfo, LocationsGeojson, BookingRule, Translation, Attribution, LocationGroup, LocationGroupStop, RouteNetwork, Network, StopArea, Area, FareMedium, FareProduct, FareLegRule, FareTransferRule, Timeframe

Different files as described in the GTFS Reference

class pt_map.models.Agency(*args, **kwargs)

Bases: Model

Represents agency.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

agency_email

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_fare_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_lang

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_phone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_timezone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

agency_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

attribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

fareattribute_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
route_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.Area(*args, **kwargs)

Bases: Model

Represents area.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

area_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

area_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

area_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

farelegrule_from_area

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

farelegrule_to_area

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
stoparea_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.Attribution(*args, **kwargs)

Bases: Model

Represents attribution.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

agency_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

agency_id_id
attribution_email

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

attribution_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

attribution_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

attribution_phone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

attribution_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
route_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

route_id_id
trip_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

trip_id_id
class pt_map.models.BookingRule(*args, **kwargs)

Bases: Model

Represents booking_rule.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

booking_rule_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

booking_rule_instructions

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

booking_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
rule_criteria

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trip_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

trip_id_id
class pt_map.models.Calendar(*args, **kwargs)

Bases: Model

Represents calendar.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

end_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

friday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=True, **kwargs)
get_next_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=True, **kwargs)
get_previous_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=False, **kwargs)
get_previous_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=False, **kwargs)
monday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
saturday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

service_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sunday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

thursday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tuesday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

wednesday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.CalendarDate(*args, **kwargs)

Bases: Model

Represents calendar_date.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=True, **kwargs)
get_previous_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
service_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.FareAttribute(*args, **kwargs)

Bases: Model

Represents fare_attribute.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

agency_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

agency_id_id
currency_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

farerule_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
payment_method

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

price

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

transfer_duration

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

transfers

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.FareLegRule(*args, **kwargs)

Bases: Model

Represents fare_legRule.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

fare_leg_rule_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_leg_rule_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_leg_rule_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_product_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

fare_product_id_id
from_area_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

from_area_id_id
from_timeframe_group_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

from_timeframe_group_id_id
network_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

network_id_id
objects = <django.db.models.manager.Manager object>
to_area_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

to_area_id_id
to_timeframe_group_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

to_timeframe_group_id_id
class pt_map.models.FareMedium(*args, **kwargs)

Bases: Model

Represents fare_medium.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

fare_media_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_media_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_media_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
class pt_map.models.FareProduct(*args, **kwargs)

Bases: Model

Represents fare_product.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curreny

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_product_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_product_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_product_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

farelegrule_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

faretransferrule_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
class pt_map.models.FareRule(*args, **kwargs)

Bases: Model

Represents fare_rule.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

contains_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

destination_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

fare_id_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
origin_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

route_id_id
class pt_map.models.FareTransferRule(*args, **kwargs)

Bases: Model

Represents faretransfer_rule.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

fare_product_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

fare_product_id_id
fare_transfer_rule_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_transfer_rule_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fare_transfer_rule_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

from_leg_group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
to_leg_group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.FeedInfo(*args, **kwargs)

Bases: Model

Represents feed_info.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

default_lang

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_contact_email

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_contact_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_end_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_lang

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_publisher_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_publisher_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_start_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

feed_version

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
class pt_map.models.Frequency(*args, **kwargs)

Bases: Model

Represents frequency.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exact_times

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

headway_secs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trip_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

trip_id_id
class pt_map.models.Level(*args, **kwargs)

Bases: Model

Represents level.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

level_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

level_index

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

level_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
stop_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.LocationGroup(*args, **kwargs)

Bases: Model

Represents location_group.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

location_group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_group_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_group_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

locationgroupstop_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
stoptime_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.LocationGroupStop(*args, **kwargs)

Bases: Model

Represents location_groupStop.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_group_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

location_group_id_id
objects = <django.db.models.manager.Manager object>
stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

stop_id_id
class pt_map.models.LocationsGeojson(*args, **kwargs)

Bases: Model

Represents locations.geojson from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

location_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_lat

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_lon

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
parent_location_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stoptime_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

wheelchair_boarding

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.Network(*args, **kwargs)

Bases: Model

Represents network.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

farelegrule_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

network_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

network_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
routenetwork_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.Pathway(*args, **kwargs)

Bases: Model

Represents lathway.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

from_stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

from_stop_id_id
is_bidirectional

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

length

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_slope

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

min_width

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
pathway_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

pathway_mode

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reversed_signposted_as

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

signposted_as

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stair_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

to_stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

to_stop_id_id
traversal_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.Route(*args, **kwargs)

Bases: Model

Represents route.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

agency_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

agency_id_id
attribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

continuous_drop_off

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

continuous_pickup

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

farerule_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
route_color

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_desc

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_long_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_short_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_sort_order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_text_color

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

routenetwork_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transfers_from_route

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transfers_to_route

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

trip_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.RouteNetwork(*args, **kwargs)

Bases: Model

Represents route_network.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

network_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

network_id_id
objects = <django.db.models.manager.Manager object>
route_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

route_id_id
route_network_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

route_network_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.Shape(*args, **kwargs)

Bases: Model

Represents shape.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
shape_dist_traveled

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shape_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shape_pt_lat

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shape_pt_lon

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shape_pt_sequence

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trip_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class pt_map.models.Stop(*args, **kwargs)

Bases: Model

Represents stop.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

level_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

level_id_id
location_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

locationgroupstop_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
parent_station

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

parent_station_id
pathways_from

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

pathways_to

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

platform_code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_desc

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_lat

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_lon

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

stop_timezone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stoparea_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

stoptime_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transfers_from_stop

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transfers_to_stop

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

wheelchair_boarding

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

zone_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.StopArea(*args, **kwargs)

Bases: Model

Represents stop_area.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

area_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

area_id_id
objects = <django.db.models.manager.Manager object>
stop_area_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_area_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_area_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

stop_id_id
class pt_map.models.StopTime(*args, **kwargs)

Bases: Model

Represents stop_time.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

arrival_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

departure_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

drop_off_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_group_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

location_group_id_id
location_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

location_id_id
objects = <django.db.models.manager.Manager object>
pickup_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shape_dist_traveled

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_headsign

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

stop_id_id
stop_sequence

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

timepoint

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trip_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

trip_id_id
class pt_map.models.Timeframe(*args, **kwargs)

Bases: Model

Represents timeframe.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

end_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

farelegrule_from_timeframe

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

farelegrule_to_timeframe

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_next_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=True, **kwargs)
get_next_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=True, **kwargs)
get_previous_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=False, **kwargs)
get_previous_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=False, **kwargs)
objects = <django.db.models.manager.Manager object>
service_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

timeframe_group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.Transfer(*args, **kwargs)

Bases: Model

Represents transfer.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

from_route_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

from_route_id_id
from_stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

from_stop_id_id
from_trip_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

from_trip_id_id
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

min_transfer_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
to_route_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

to_route_id_id
to_stop_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

to_stop_id_id
to_trip_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

to_trip_id_id
transfer_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.Translation(*args, **kwargs)

Bases: Model

Represents translation.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

field_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

language

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
table_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

translation

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class pt_map.models.Trip(*args, **kwargs)

Bases: Model

Represents trip.txt from the GTFS Reference.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

as_dict()
attribution_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

bikes_allowed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

block_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

bookingrule_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

direction_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

frequency_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
route_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

route_id_id
service_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shape_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shape_id_id
stoptime_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transfers_from_trip

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transfers_to_trip

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

trip_headsign

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trip_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trip_short_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

wheelchair_accessible

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

pt_map.tests module

pt_map.urls module

Redirecting HTTP requests destined for the app pt_map to the correct views

pt_map.views module

Views

Views reacting to Http Requests by interfacing between backend and frontend.

Functions

index(request)

Home page

pt_map.views.get_timetable(r, trips, stop_sequences)

Given a pt_map.models.Route, calculate the timetable for all its stops.

Parameters:
  • r (pt_map.models.Route) – Route, the timetable should be calculated for

  • trips (dict(str, list(pt_map.Trip))) – Dictionary mapping all trips to route_ids they travel on

  • stop_sequences (dict(str, list(str))) – Dict mapping route_ids to lists of stop_ids they serve. Currently the first trip is taken as reference for stops and sequence.

Returns:

dict{“stop_sequence”

Dict containing two elements:
”stop_sequence”list(str)

list of stop_ids the route serves

”stop_times”dict(str, list(str))

dict mapping stop_ids from stop_sequence to time strings the route is serving the stop at

Return type:

list(str), “stop_times”: dict(str, list(str)}

pt_map.views.index(request)

Module contents