Transport Accessibility documentation master file, created by
sphinx-quickstart on Mon Jun  3 13:49:21 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

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

reversed_file_mapping : dict(str,str)
Map CamelCased filenames to '_'-separated

class_names : dict{str,str}
Map CamelCase, singularized class names to pluralized, snake_cased file names

primary_keys : dict{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_delta : int
Unix time for Jan 1, 2024. To be used to calculate time prefix strings.

to_camel_case(s):
Converts '_'-separated str to CamelCase with capital first letter

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

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.

db_to_gtfs(q: list[~django.db.models.query.QuerySet], folder_path: str = '')

q: list[~django.db.models.query.QuerySet], folder_path: str = ''

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

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

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

False -- Otherwise

*True* -- If v is either a str representing NaN or NaN as an object

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

Converted str -- If m.f is a DateField or a TimeField

Unchanged str -- Otherwise

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

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

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.

GTFS(folder_path: str = '', dfs: dict[str, ~pandas.core.frame.DataFrame] = None)

folder_path: str = '', dfs: dict[str, ~pandas.core.frame.DataFrame] = None

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.

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

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.

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

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

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

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

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

Check if a Stop is correctly mapped using geographical coordinates.

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

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

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

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

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

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

Dict of dataframes mapped to the corresponding file names. If given, the corresponding DataFrame is returned if the key exists else an empty DataFrame

path (str) -- parent directory where to save the files, defaults to the objects folder_path property

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.

If specified, subdirectory to create or use inside path. Default behaviour is to save directly to path.

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

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

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

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

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

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

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

Check Attributions object for compliance with the GTFS reference.

Check BookingRules object for compliance with the GTFS reference.

Check CalendarDates object for compliance with the GTFS reference.

Check FareAttributes object for compliance with the GTFS reference.

Check FareLegRules object for compliance with the GTFS reference.

Check FareProducts object for compliance with the GTFS reference.

Check FareTransferRules object for compliance with the GTFS reference.

Check Frequencies object for compliance with the GTFS reference.

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

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

Prefix to be used for coordinate fileds. Expands to {prefix}_lat and {prefix}_lon

Check LocationGroupStops object for compliance with the GTFS reference.

Check Agency LocationGroups for compliance with the GTFS reference.

Check LocationsGeojson object for compliance with the GTFS reference.

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

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

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

Check RouteNetworks object for compliance with the GTFS reference.

Check Translations object for compliance with the GTFS reference.

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

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

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

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

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 built by 

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

docstring of pt_map.models.BookingRule.booking_rule_instructions

Calendar.get_next_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=True, **kwargs)

(*, field=<django.db.models.fields.DateField: end_date>, is_next=True, **kwargs)

Calendar.get_next_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=True, **kwargs)

(*, field=<django.db.models.fields.DateField: start_date>, is_next=True, **kwargs)

Calendar.get_previous_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=False, **kwargs)

(*, field=<django.db.models.fields.DateField: end_date>, is_next=False, **kwargs)

Calendar.get_previous_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=False, **kwargs)

(*, field=<django.db.models.fields.DateField: start_date>, is_next=False, **kwargs)

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

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

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

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

docstring of pt_map.models.FareLegRule.fare_leg_rule_description

from_timeframe_group_id_id (pt_map.models.FareLegRule attribute)

fare_transfer_rule_description (pt_map.models.FareTransferRule attribute)

docstring of pt_map.models.FareTransferRule.fare_transfer_rule_description

fare_transfer_rule_id (pt_map.models.FareTransferRule attribute)

docstring of pt_map.models.FareTransferRule.fare_transfer_rule_id

fare_transfer_rule_name (pt_map.models.FareTransferRule attribute)

docstring of pt_map.models.FareTransferRule.fare_transfer_rule_name

location_group_id_id (pt_map.models.LocationGroupStop attribute)

location_group_stop_id (pt_map.models.LocationGroupStop attribute)

docstring of pt_map.models.LocationGroupStop.location_group_stop_id

Timeframe.get_next_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=True, **kwargs)

Timeframe.get_next_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=True, **kwargs)

Timeframe.get_previous_by_end_date(*, field=<django.db.models.fields.DateField: end_date>, is_next=False, **kwargs)

Timeframe.get_previous_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=False, **kwargs)

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

"Stops": Json Representation of all stops found in the database
"Routes": Json Representation of all routes found in the database

“Stops”: Json Representation of all stops found in the database
“Routes”: Json Representation of all routes found in the database

Module to handle database IO while abstracting the specific SQL and django model filtering.

get_field_names(model: django.db.models.base.ModelBase) -> list[str]:
Return all the model's field names as a list of strings

get_pks_from_get(req_get: dict[str,str]) -> dict[django.db.models.base.ModelBase, list[str]]:
For given GET data return the primary keys requested mapped to the model classes

get_obj_by_pk(mdl: django.db.models.base.ModelBase, pks: list[str]) -> list[mdl]:
For a given model class and list of primary keys of that class, return the corresponding model objects.

obj_from_get(req_get: django dict-like request.GET) -> dict[django.db.base.models.ModelBase, list[models.Model]):
For given GET data, return a dict mapping the model classes to the requested instances.

get_trips(routes: list[pt_map.models.Route]) -> dict[str, list[pt_map.models.Trip]]:
For a list of Routes, return a dict mapping a list of all Trips associated with an individual Route, mapped to its route_id.

get_stop_sequences(routes: list[pt_map.models.Route], [trips: dict[str, list[pt_map.models.Trip]]]) -> dict[str, list[pt_map.models.Stop]]:
For a list of routes, return a dict mapping an ordered sequence of stops to the Routes route_id. If a dict of lists trips mapped to the respective route_ids is given, the first elements of each of those lists is used, otherwise it is calculated. If the trips argument is given, it is expected to hold a value for all the Routes in routes.

get_timetable(r: pt_map.models.Route, [trips_r: list[pt_map.models.Trip]], [stop_sequence: list[pt_map.models.Stop]]) -> :
Calculate a timetable for a Route r. If a list of trips for that route and/or a stop sequence is given, their first elements are used, otherwise all are calculated and the first elements are used.

get_all_stops() -> dict[str, dict[str, str]]:
Return a dict mapping all stop_ids in the database to a dict of relevant values.

get_all_routes() -> list[dict[str,str]]:
Return a list of dicts containing route_ids and other relevant values of all Routes in the database.

[
        {
            'route_id': pt_map.models.Route.route_id,
            'route_type': pt_map.models.Route.route_type,
            'route_name': pt_map.models.Route.route_short_name if set else pt_map.models.Route.route_long_name,
            'agency_id': pt_map.models.Route.agency_id.agency_id,
        }
]

{
    stop_id (str): {
            'stop_name': pt_map.models.Stop.stop_name,
            'stop_lat': pt_map.models.Stop.stop_lat,
            'stop_lon': pt_map.models.Stop.stop_lon,
        }
}

get_field_names(model: ~django.db.models.base.Model) -> list[str]

Given a model, returns a list of the name strings of all the model's fields.

Given a model, returns a list of the name strings of all the model’s fields.

get_obj_by_pk(mdl: ~django.db.models.base.ModelBase, pks: list[str]) -> list[~django.db.models.base.Model]

Given a model, and a list of corresponding primary keys, return a list of objects of the given model identified by the given primary keys.

mdl (django.db.models.base.ModelBase) -- Model class to look for

Exception -- mdl.DoesNotExist:: If at least one object from the list of pks could not be found.

mdl.DoesNotExist:: If at least one object from the list of pks could not be found.

get_pks_from_get(req_get: dict[str, str]) -> dict[~django.db.models.base.ModelBase, list[str]]

Extract primary keys from a request.GET dict-like and find the corresponding classes.

req_get (dict[str, str]) -- dict-like object, a HTTP Requests GET data.

get_stop_sequences(routes: list[~pt_map.models.Route], trips: dict[str, list[~pt_map.models.Trip]] = None) -> dict[str, list[str]]

routes: list[~pt_map.models.Route], trips: dict[str, list[~pt_map.models.Trip]] = None

For all given routes, return a list of stops in the order of appearance along the route. The first trip in the list of trips is used to define the sequence.

routes (list[pt_map.models.Route]) -- List of pt_map.models.Route to find stop sequences for.

trips (dict[str,list[pt_map.models.Trip]]) -- List of at least one trip for each Route in routes. If none, all are calculated and the first used for the sequence.

List of at least one trip for each Route in routes. If none, all are calculated and the first used for the sequence.

Keys:

route_ids.

Values:

Lists of stop_ids in the order of appearance in the first Trip in the routes' trips list given.

Values:

Lists of stop_ids in the order of appearance in the first Trip in the routes’ trips list given.

get_timetable(r: ~pt_map.models.Route, trips_r: list[~pt_map.models.Trip] = None, stop_sequence: list[str] = None)

r: ~pt_map.models.Route, trips_r: list[~pt_map.models.Trip] = None, stop_sequence: list[str] = None

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

r (pt_map.models.Route) -- Route the timetable should be calculated for.

trips_r (list[pt_map.models.Trip]) -- Optional.
List of trips travelling on the Route r.

stop_sequence (list[str]) -- Optional.
List of stop_ids the Route r serves.
Currently the first trip is taken as reference for stops and sequence.

Optional.

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.

"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.

dict{"stop_sequence": list(str), "stop_times": dict[str, list(str)]}

get_trips(routes: list[~pt_map.models.Route]) -> dict[str, list[~pt_map.models.Trip]]

Return a list of all Trips associated with a Route in the argument.

routes (list[str]:) -- List of primary keys for the Routes to search the trips for.

Keys: route_ids from parameter.
Values: lists of corresponding trip objects.

obj_from_get(req_get: dict[str, str]) -> dict[~django.db.models.base.ModelBase, list[~django.db.models.base.Model]]

Given the GET data of a HTTP Request, return a dict with the requested model classes as keys and lists of the requested model objects as values.

dependencies (pt_map.migrations.0001_initial.Migration attribute)

dependencies (pt_map.migrations.0002_initial.Migration attribute)

[<CreateModel  name='Agency', fields=[('agency_id', <django.db.models.fields.CharField>), ('agency_name', <django.db.models.fields.CharField>), ('agency_url', <django.db.models.fields.URLField>), ('agency_timezone', <django.db.models.fields.CharField>), ('agency_lang', <django.db.models.fields.CharField>), ('agency_phone', <django.db.models.fields.CharField>), ('agency_fare_url', <django.db.models.fields.URLField>), ('agency_email', <django.db.models.fields.EmailField>)]>, <CreateModel  name='FareProduct', fields=[('fare_product_id', <django.db.models.fields.BigAutoField>), ('fare_product_name', <django.db.models.fields.CharField>), ('fare_product_description', <django.db.models.fields.TextField>), ('amount', <django.db.models.fields.FloatField>), ('curreny', <django.db.models.fields.CharField>)]>, <CreateModel  name='FeedInfo', fields=[('feed_id', <django.db.models.fields.BigAutoField>), ('feed_publisher_name', <django.db.models.fields.CharField>), ('feed_publisher_url', <django.db.models.fields.URLField>), ('feed_lang', <django.db.models.fields.CharField>), ('default_lang', <django.db.models.fields.CharField>), ('feed_start_date', <django.db.models.fields.DateField>), ('feed_end_date', <django.db.models.fields.DateField>), ('feed_version', <django.db.models.fields.CharField>), ('feed_contact_email', <django.db.models.fields.EmailField>), ('feed_contact_url', <django.db.models.fields.URLField>)]>, <CreateModel  name='FareAttribute', fields=[('fare_id', <django.db.models.fields.CharField>), ('price', <django.db.models.fields.FloatField>), ('currency_type', <django.db.models.fields.CharField>), ('payment_method', <django.db.models.fields.IntegerField>), ('transfers', <django.db.models.fields.IntegerField>), ('transfer_duration', <django.db.models.fields.IntegerField>), ('agency_id', <django.db.models.fields.related.ForeignKey>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='FareTransferRule', fields=[('fare_transfer_rule_id', <django.db.models.fields.CharField>), ('fare_transfer_rule_name', <django.db.models.fields.CharField>), ('fare_transfer_rule_description', <django.db.models.fields.TextField>), ('from_leg_group_id', <django.db.models.fields.IntegerField>), ('to_leg_group_id', <django.db.models.fields.IntegerField>), ('fare_product_id', <django.db.models.fields.related.ForeignKey>)]>, <AddField  model_name='fareproduct', name='feed_info_id', field=<django.db.models.fields.related.ForeignKey>>, <CreateModel  name='FareMedium', fields=[('fare_media_id', <django.db.models.fields.CharField>), ('fare_media_name', <django.db.models.fields.CharField>), ('fare_media_description', <django.db.models.fields.TextField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Calendar', fields=[('service_id', <django.db.models.fields.CharField>), ('monday', <django.db.models.fields.BooleanField>), ('tuesday', <django.db.models.fields.BooleanField>), ('wednesday', <django.db.models.fields.BooleanField>), ('thursday', <django.db.models.fields.BooleanField>), ('friday', <django.db.models.fields.BooleanField>), ('saturday', <django.db.models.fields.BooleanField>), ('sunday', <django.db.models.fields.BooleanField>), ('start_date', <django.db.models.fields.DateField>), ('end_date', <django.db.models.fields.DateField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Area', fields=[('area_id', <django.db.models.fields.CharField>), ('area_name', <django.db.models.fields.CharField>), ('area_description', <django.db.models.fields.TextField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <AddField  model_name='agency', name='feed_info_id', field=<django.db.models.fields.related.ForeignKey>>, <CreateModel  name='Level', fields=[('level_id', <django.db.models.fields.CharField>), ('level_index', <django.db.models.fields.FloatField>), ('level_name', <django.db.models.fields.CharField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='LocationGroup', fields=[('location_group_id', <django.db.models.fields.CharField>), ('location_group_name', <django.db.models.fields.CharField>), ('location_group_type', <django.db.models.fields.CharField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='LocationsGeojson', fields=[('location_id', <django.db.models.fields.CharField>), ('location_name', <django.db.models.fields.CharField>), ('location_lat', <django.db.models.fields.FloatField>), ('location_lon', <django.db.models.fields.FloatField>), ('location_type', <django.db.models.fields.CharField>), ('parent_location_id', <django.db.models.fields.CharField>), ('wheelchair_boarding', <django.db.models.fields.BooleanField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Network', fields=[('network_id', <django.db.models.fields.CharField>), ('network_name', <django.db.models.fields.CharField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Route', fields=[('route_id', <django.db.models.fields.CharField>), ('route_short_name', <django.db.models.fields.CharField>), ('route_long_name', <django.db.models.fields.CharField>), ('route_desc', <django.db.models.fields.TextField>), ('route_type', <django.db.models.fields.IntegerField>), ('route_url', <django.db.models.fields.URLField>), ('route_color', <django.db.models.fields.CharField>), ('route_text_color', <django.db.models.fields.CharField>), ('route_sort_order', <django.db.models.fields.IntegerField>), ('continuous_pickup', <django.db.models.fields.IntegerField>), ('continuous_drop_off', <django.db.models.fields.IntegerField>), ('agency_id', <django.db.models.fields.related.ForeignKey>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='FareRule', fields=[('fare_rule_id', <django.db.models.fields.BigAutoField>), ('origin_id', <django.db.models.fields.IntegerField>), ('destination_id', <django.db.models.fields.CharField>), ('contains_id', <django.db.models.fields.CharField>), ('fare_id', <django.db.models.fields.related.ForeignKey>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('route_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='RouteNetwork', fields=[('route_network_id', <django.db.models.fields.CharField>), ('route_network_name', <django.db.models.fields.CharField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('network_id', <django.db.models.fields.related.ForeignKey>), ('route_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Shape', fields=[('shape_pk', <django.db.models.fields.BigAutoField>), ('shape_id', <django.db.models.fields.CharField>), ('shape_pt_lat', <django.db.models.fields.FloatField>), ('shape_pt_lon', <django.db.models.fields.FloatField>), ('shape_pt_sequence', <django.db.models.fields.IntegerField>), ('shape_dist_traveled', <django.db.models.fields.FloatField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)], options={'unique_together': {('shape_id', 'shape_pt_sequence')}}>, <CreateModel  name='Stop', fields=[('stop_id', <django.db.models.fields.CharField>), ('stop_code', <django.db.models.fields.CharField>), ('stop_name', <django.db.models.fields.CharField>), ('stop_desc', <django.db.models.fields.TextField>), ('stop_lat', <django.db.models.fields.FloatField>), ('stop_lon', <django.db.models.fields.FloatField>), ('zone_id', <django.db.models.fields.CharField>), ('stop_url', <django.db.models.fields.URLField>), ('location_type', <django.db.models.fields.IntegerField>), ('stop_timezone', <django.db.models.fields.CharField>), ('wheelchair_boarding', <django.db.models.fields.IntegerField>), ('platform_code', <django.db.models.fields.CharField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('level_id', <django.db.models.fields.related.ForeignKey>), ('parent_station', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Pathway', fields=[('pathway_id', <django.db.models.fields.CharField>), ('pathway_mode', <django.db.models.fields.IntegerField>), ('is_bidirectional', <django.db.models.fields.IntegerField>), ('length', <django.db.models.fields.FloatField>), ('traversal_time', <django.db.models.fields.IntegerField>), ('stair_count', <django.db.models.fields.IntegerField>), ('max_slope', <django.db.models.fields.FloatField>), ('min_width', <django.db.models.fields.FloatField>), ('signposted_as', <django.db.models.fields.CharField>), ('reversed_signposted_as', <django.db.models.fields.CharField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('from_stop_id', <django.db.models.fields.related.ForeignKey>), ('to_stop_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='LocationGroupStop', fields=[('location_group_stop_id', <django.db.models.fields.BigAutoField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('location_group_id', <django.db.models.fields.related.ForeignKey>), ('stop_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='StopArea', fields=[('stop_area_id', <django.db.models.fields.CharField>), ('stop_area_name', <django.db.models.fields.CharField>), ('stop_area_description', <django.db.models.fields.TextField>), ('area_id', <django.db.models.fields.related.ForeignKey>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('stop_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Timeframe', fields=[('timeframe_group_id', <django.db.models.fields.CharField>), ('service_id', <django.db.models.fields.IntegerField>), ('start_date', <django.db.models.fields.DateField>), ('end_date', <django.db.models.fields.DateField>), ('start_time', <django.db.models.fields.TimeField>), ('end_time', <django.db.models.fields.TimeField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='FareLegRule', fields=[('fare_leg_rule_id', <django.db.models.fields.CharField>), ('fare_leg_rule_name', <django.db.models.fields.CharField>), ('fare_leg_rule_description', <django.db.models.fields.TextField>), ('from_area_id', <django.db.models.fields.related.ForeignKey>), ('to_area_id', <django.db.models.fields.related.ForeignKey>), ('fare_product_id', <django.db.models.fields.related.ForeignKey>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('network_id', <django.db.models.fields.related.ForeignKey>), ('from_timeframe_group_id', <django.db.models.fields.related.ForeignKey>), ('to_timeframe_group_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Translation', fields=[('translation_id', <django.db.models.fields.BigAutoField>), ('table_name', <django.db.models.fields.CharField>), ('field_name', <django.db.models.fields.CharField>), ('language', <django.db.models.fields.CharField>), ('translation', <django.db.models.fields.TextField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Trip', fields=[('trip_id', <django.db.models.fields.CharField>), ('service_id', <django.db.models.fields.IntegerField>), ('trip_headsign', <django.db.models.fields.CharField>), ('trip_short_name', <django.db.models.fields.CharField>), ('direction_id', <django.db.models.fields.IntegerField>), ('block_id', <django.db.models.fields.CharField>), ('wheelchair_accessible', <django.db.models.fields.IntegerField>), ('bikes_allowed', <django.db.models.fields.IntegerField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('route_id', <django.db.models.fields.related.ForeignKey>), ('shape_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Frequency', fields=[('frequency_id', <django.db.models.fields.BigAutoField>), ('start_time', <django.db.models.fields.TimeField>), ('end_time', <django.db.models.fields.TimeField>), ('headway_secs', <django.db.models.fields.IntegerField>), ('exact_times', <django.db.models.fields.IntegerField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('trip_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='BookingRule', fields=[('booking_rule_id', <django.db.models.fields.CharField>), ('start_time', <django.db.models.fields.TimeField>), ('end_time', <django.db.models.fields.TimeField>), ('booking_type', <django.db.models.fields.CharField>), ('rule_criteria', <django.db.models.fields.TextField>), ('booking_rule_instructions', <django.db.models.fields.TextField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('trip_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='Attribution', fields=[('attribution_id', <django.db.models.fields.BigAutoField>), ('attribution_name', <django.db.models.fields.CharField>), ('attribution_url', <django.db.models.fields.URLField>), ('attribution_email', <django.db.models.fields.EmailField>), ('attribution_phone', <django.db.models.fields.CharField>), ('agency_id', <django.db.models.fields.related.ForeignKey>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('route_id', <django.db.models.fields.related.ForeignKey>), ('trip_id', <django.db.models.fields.related.ForeignKey>)]>, <CreateModel  name='CalendarDate', fields=[('calendar_date_id', <django.db.models.fields.BigAutoField>), ('service_id', <django.db.models.fields.CharField>), ('date', <django.db.models.fields.DateField>), ('exception_type', <django.db.models.fields.IntegerField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>)], options={'unique_together': {('service_id', 'date')}}>, <CreateModel  name='Transfer', fields=[('transfer_id', <django.db.models.fields.BigAutoField>), ('transfer_type', <django.db.models.fields.IntegerField>), ('min_transfer_time', <django.db.models.fields.IntegerField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('from_route_id', <django.db.models.fields.related.ForeignKey>), ('from_stop_id', <django.db.models.fields.related.ForeignKey>), ('to_route_id', <django.db.models.fields.related.ForeignKey>), ('to_stop_id', <django.db.models.fields.related.ForeignKey>), ('from_trip_id', <django.db.models.fields.related.ForeignKey>), ('to_trip_id', <django.db.models.fields.related.ForeignKey>)], options={'unique_together': {('from_stop_id', 'to_stop_id')}}>, <CreateModel  name='StopTime', fields=[('stop_time_id', <django.db.models.fields.BigAutoField>), ('arrival_time', <django.db.models.fields.TimeField>), ('departure_time', <django.db.models.fields.TimeField>), ('stop_sequence', <django.db.models.fields.IntegerField>), ('stop_headsign', <django.db.models.fields.CharField>), ('pickup_type', <django.db.models.fields.IntegerField>), ('drop_off_type', <django.db.models.fields.IntegerField>), ('shape_dist_traveled', <django.db.models.fields.FloatField>), ('timepoint', <django.db.models.fields.IntegerField>), ('feed_info_id', <django.db.models.fields.related.ForeignKey>), ('location_group_id', <django.db.models.fields.related.ForeignKey>), ('location_id', <django.db.models.fields.related.ForeignKey>), ('stop_id', <django.db.models.fields.related.ForeignKey>), ('trip_id', <django.db.models.fields.related.ForeignKey>)], options={'unique_together': {('trip_id', 'stop_sequence')}}>]

Migration (class in pt_map.migrations.0003_faretransferrule_feed_info_id)

[<AddField  model_name='faretransferrule', name='feed_info_id', field=<django.db.models.fields.related.ForeignKey>, preserve_default=False>]

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/

https://docs.djangoproject.com/en/5.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/

It exposes the WSGI callable as a module-level variable named ``application``.

https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/

data
Serves api/models/
GET:
Fetches models given their primary keys
PUT:
Creates new model objects or updates them with complete representations. If object with the given primary keys exist, they will be deleted and replaced.
PATCH:
Updates models, identified by their primary keys without deleting them. Can be incomplete representations.
DELETE:
Deletes models, identified by their primary keys.

GET:
PUT:
PATCH:
DELETE:

Handle database requests from the frontend. Using Http semantics to specify what to do with the data.

PUT
Create a new object if no object with the given primary key exists in the database or delete and replace an existing object.
Body must be a json dict of lists of fully specified, valid models. Primary keys can be omitted and will be ignored if the element does not exist in the database.
If primary keys are given, the elements are deleted and replaced. Note that if there is an error in creating the new object, the object to replace will still probably already have been deleted.
Successful response is 200 with a list of primary keys of the created and replaced objects.

PATCH
Modify an existing objects given the instructions in the body.
Body must be a json dict of lists of fields to change and their valid values existing objects in the database, identified by their valid primary keys.
Responds 400 if any of the primary keys given does not exist.
Successful response is 200 with a list of the primary keys of the modified objects.

GET
Return json of models identified by primary keys.
Responds 400 if any of the requested pks does not exist.

DELETE
Delete models with given primary keys if they exist.
Responds 400 if any of the primary keys given does not exist in the database.
Successful response is 200 and the number of deleted models.

GET:
Find timetables for all routes passed via GET.
Successful response is a Json representation of a dict of timetables in the following form:

{
    route_id (from GET): {
        'stop_sequence': [stop_ids for all stops the route server, in order],
        'stop_times': {
    stop_id (from stop_sequence): [str in the format HH:MM representing stop times]
    }
}