-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
127 lines (101 loc) · 3.51 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# coding: utf-8
from sqlalchemy import Column, Float, Integer, String, Time, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class Agency(Base):
__tablename__ = u'agency'
agency_id = Column(String(255), primary_key=True, index=True)
agency_name = Column(String(255))
agency_url = Column(String(255))
agency_timezone = Column(String(255))
agency_lang = Column(String(255))
agency_phone = Column(String(255))
class Calendar(Base):
__tablename__ = u'calendar'
service_id = Column(Integer(), primary_key=True, index=True)
monday = Column(Boolean())
tuesday = Column(Boolean())
wednesday = Column(Boolean())
thursday = Column(Boolean())
friday = Column(Boolean())
saturday = Column(Boolean())
sunday = Column(Boolean())
start_date = Column(Integer())
end_date = Column(Integer())
class Link(Base):
__tablename__ = u'links'
id = Column(Integer(), primary_key=True, index=True)
mode = Column(String(255))
from_stop_id = Column(String(255))
to_stop_id = Column(String(255))
link_secs = Column(Integer())
start_time = Column(Time())
end_time = Column(Time())
priority = Column(Integer())
start_date = Column(Integer())
end_date = Column(Integer())
monday = Column(Integer())
tuesday = Column(Integer())
wednesday = Column(Integer())
thursday = Column(Integer())
friday = Column(Integer())
saturday = Column(Integer())
sunday = Column(Integer())
class Route(Base):
__tablename__ = u'routes'
route_id = Column(Integer(), primary_key=True, index=True)
agency_id = Column(String, ForeignKey('agency.agency_id'))
agency = relationship('Agency')
route_short_name = Column(String(255))
route_long_name = Column(String(255))
route_type = Column(Integer())
class StopTime(Base):
__tablename__ = u'stop_times'
id = Column(Integer(), primary_key=True, index=True)
trip_id = Column(Integer, ForeignKey('trips.trip_id'))
trip = relationship('Trip')
arrival_time = Column(Time())
departure_time = Column(Time())
stop_id = Column(String, ForeignKey('stops.stop_id'))
stop = relationship('Stop')
stop_sequence = Column(Integer())
pickup_type = Column(Integer())
drop_off_type = Column(Integer())
scheduled_arrival = Column(Time())
scheduled_departure = Column(Time())
platform = Column(Integer())
line = Column(String(255))
path = Column(String(255))
activity = Column(String(255))
engineering_allowance = Column(String(255))
pathing_allowance = Column(String(255))
performance_allowance = Column(String(255))
class Stop(Base):
__tablename__ = u'stops'
stop_id = Column(String(255), primary_key=True, index=True)
stop_code = Column(String(255))
stop_name = Column(String(255))
stop_lat = Column(Float(asdecimal=True))
stop_lon = Column(Float(asdecimal=True))
stop_url = Column(String(255))
location_type = Column(Integer())
parent_station = Column(String(255))
wheelchair_boarding = Column(Integer())
cate_type = Column(Integer())
tiploc = Column(String(255))
class Transfer(Base):
__tablename__ = u'transfers'
id = Column(Integer(), primary_key=True, index=True)
from_stop_id = Column(String(255))
to_stop_id = Column(String(255))
transfer_type = Column(Integer())
min_transfer_time = Column(Integer())
class Trip(Base):
__tablename__ = u'trips'
route_id = Column(Integer, ForeignKey('routes.route_id'))
route = relationship('Route')
service_id = Column(Integer, ForeignKey('calendar.service_id'))
service = relationship('Calendar')
trip_id = Column(Integer(), primary_key=True, index=True)