transport-accessibility/transport_accessibility/pt_map/models.py
2024-06-01 01:28:32 +02:00

138 lines
5.9 KiB
Python

from django.db import models
class Agency(models.Model):
agency_id = models.BigAutoField(primary_key=True)
agency_name = models.CharField(max_length=250)
agency_url = models.URLField()
agency_phone = models.CharField(max_length=15)
agency_email = models.EmailField()
agency_fare_url = models.URLField()
class Stop(models.Model):
stop_id = models.BigAutoField(primary_key=True)
stop_code = models.CharField(max_length=50)
stop_name = models.CharField(max_length=250)
tts_stop_name = models.CharField(max_length=250)
stop_desc = models.CharField(max_length=500)
stop_lat = models.IntegerField()
stop_lon = models.IntegerField()
zone_id = models.IntegerField(unique=True)
stop_url = models.URLField(blank=True, null=True)
location_type = models.IntegerField(blank=True, null=True)
parent_station = models.ForeignKey('self', on_delete=models.SET_NULL, blank=True, null=True)
stop_timezone = models.CharField(max_length=255, blank=True, null=True)
wheelchair_boarding = models.IntegerField(blank=True, null=True)
level_id = models.CharField(max_length=255, blank=True, null=True)
platform_code = models.CharField(max_length=255, blank=True, null=True)
class Route(models.Model):
route_id = models.BigAutoField(primary_key=True)
agency = models.ForeignKey(Agency, on_delete=models.CASCADE)
route_short_name = models.CharField(max_length=255)
route_long_name = models.CharField(max_length=255)
route_desc = models.TextField(blank=True, null=True)
route_type = models.IntegerField()
route_url = models.URLField(blank=True, null=True)
route_color = models.CharField(max_length=6, blank=True, null=True)
route_text_color = models.CharField(max_length=6, blank=True, null=True)
class Trip(models.Model):
trip_id = models.BigAutoField(primary_key=True)
route = models.ForeignKey(Route, on_delete=models.CASCADE)
service_id = models.CharField(max_length=255)
trip_headsign = models.CharField(max_length=255, blank=True, null=True)
trip_short_name = models.CharField(max_length=255, blank=True, null=True)
direction_id = models.IntegerField(blank=True, null=True)
block_id = models.CharField(max_length=255, blank=True, null=True)
shape_id = models.CharField(max_length=255, blank=True, null=True)
wheelchair_accessible = models.IntegerField(blank=True, null=True)
bikes_allowed = models.IntegerField(blank=True, null=True)
class StopTime(models.Model):
trip = models.ForeignKey(Trip, on_delete=models.CASCADE)
arrival_time = models.TimeField()
departure_time = models.TimeField()
stop = models.ForeignKey(Stop, on_delete=models.CASCADE)
stop_sequence = models.IntegerField()
stop_headsign = models.CharField(max_length=255, blank=True, null=True)
pickup_type = models.IntegerField(blank=True, null=True)
drop_off_type = models.IntegerField(blank=True, null=True)
shape_dist_traveled = models.FloatField(blank=True, null=True)
timepoint = models.IntegerField(blank=True, null=True)
class Meta:
unique_together = (('trip', 'stop_sequence'),)
class Calendar(models.Model):
service_id = models.BigAutoField(primary_key=True)
monday = models.BooleanField()
tuesday = models.BooleanField()
wednesday = models.BooleanField()
thursday = models.BooleanField()
friday = models.BooleanField()
saturday = models.BooleanField()
sunday = models.BooleanField()
start_date = models.DateField()
end_date = models.DateField()
class CalendarDate(models.Model):
service_id = models.ForeignKey(Calendar, on_delete=models.CASCADE)
date = models.DateField()
exception_type = models.IntegerField()
class Meta:
unique_together = (('service_id', 'date'),)
class FareAttribute(models.Model):
fare_id = models.BigAutoField(primary_key=True)
price = models.FloatField()
currency_type = models.CharField(max_length=255)
payment_method = models.IntegerField()
transfers = models.IntegerField()
agency = models.ForeignKey(Agency, on_delete=models.CASCADE, blank=True, null=True)
transfer_duration = models.IntegerField(blank=True, null=True)
class FareRule(models.Model):
fare = models.ForeignKey(FareAttribute, on_delete=models.CASCADE)
route = models.ForeignKey(Route, on_delete=models.CASCADE, blank=True, null=True)
origin_id = models.CharField(max_length=255, blank=True, null=True)
destination_id = models.CharField(max_length=255, blank=True, null=True)
contains_id = models.CharField(max_length=255, blank=True, null=True)
class Shape(models.Model):
shape_id = models.CharField(max_length=255)
shape_pt_lat = models.FloatField()
shape_pt_lon = models.FloatField()
shape_pt_sequence = models.IntegerField()
shape_dist_traveled = models.FloatField(blank=True, null=True)
class Meta:
unique_together = (('shape_id', 'shape_pt_sequence'),)
class Frequency(models.Model):
trip = models.ForeignKey(Trip, on_delete=models.CASCADE)
start_time = models.TimeField()
end_time = models.TimeField()
headway_secs = models.IntegerField()
exact_times = models.IntegerField(blank=True, null=True)
class Transfer(models.Model):
from_stop = models.ForeignKey(Stop, on_delete=models.CASCADE, related_name='transfers_from')
to_stop = models.ForeignKey(Stop, on_delete=models.CASCADE, related_name='transfers_to')
transfer_type = models.IntegerField()
min_transfer_time = models.IntegerField(blank=True, null=True)
class Meta:
unique_together = (('from_stop', 'to_stop'),)
class FeedInfo(models.Model):
feed_publisher_name = models.CharField(max_length=255)
feed_publisher_url = models.URLField()
feed_lang = models.CharField(max_length=255)
feed_start_date = models.DateField(blank=True, null=True)
feed_end_date = models.DateField(blank=True, null=True)
feed_version = models.CharField(max_length=255, blank=True, null=True)
feed_id = models.BigAutoField(primary_key=True)