lots of small tweaks..

This commit is contained in:
Johnson Chetty 2012-04-30 09:50:40 +02:00
parent 343dd334f1
commit b3f704c913
11 changed files with 521 additions and 73523 deletions

View File

@ -6,7 +6,7 @@ import csv
import sys
import datetime
from itertools import dropwhile
import copy
def routeWithLocationData(route):
@ -102,7 +102,8 @@ def getCompleteRoutes():
rset = set()
for rs in RouteSchedule.objects.select_related():
if not( rs.runtime1 and rs.runtime2 and rs.runtime3 and rs.runtime4 and rs.headway1 and rs. headway2 and rs.headway3 and rs.headway4 and rs.headway5 and rs.first_from and rs.first_to and rs.last_from and rs.last_to):
#if rs.runtime1 is None or rs.runtime2 is None or rs.runtime3 is None or rs.runtime4 is None or rs.headway1 is None or rs. headway2 is None or rs.headway3 is None or rs.headway4 is None or rs.headway5 is None or rs.first_from is None or rs.first_to is None or rs.last_from is None or rs.last_to is None:
#if rs.runtime1 is None or rs.runtime2 is None or rs.runtime3 is None or rs.runtime4 is None or rs.headway1 is None or rs. headway2 is None or rs.headway3 is None or rs.headway4 is None or rs.headway5 is None or rs.first_from is None or rs.first_to is None or rs.last_from is None or rs.last_to is None:
try:
rset.remove(rs.unique_route.route)
except KeyError:
@ -153,16 +154,22 @@ def rindex(lst, item):
def make_csv_writer(filename):
return csv.writer(open(join(PROJECT_ROOT, "gtfs", "gtfs_mumbai_bus", filename), "w"), delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL)
def export_feed_info():
f = make_csv_writer("feed_info.txt")
f.writerow(["feed_publisher_name","feed_publisher_url","feed_lang","feed_start_date","feed_end_date","feed_version"])
f.writerow(["ChaloBEST","http://chalobest.in","en","20120301","20120630","0.31"])
def export_routes(routebeer):
#routebeer = getRoutesHavingAlLocs()
f = make_csv_writer("routes.txt")
f.writerow(["route_id" ,"route_short_name","route_long_name","route_type"])
f.writerow(["route_id","agency_id","route_short_name","route_long_name","route_type"])
for route in routebeer:
try:
# data checks here
f.writerow([route.code,route.alias[0:3],route.from_stop_txt + " - " + route.to_stop_txt,3])
f.writerow([route.code,"BEST",route.alias[0:3],route.from_stop_txt + " - " + route.to_stop_txt,3])
except:
pass
@ -182,7 +189,7 @@ def export_stops(routelist):
# data checks here
# stop_code is used for stop_id as its BEST specfic
if stop.point:
f.writerow([stop.code,stop.name,stop.point.coords[1],stop.point.coords[0]])
f.writerow([str(stop.code),stop.name,stop.point.coords[1],stop.point.coords[0]])
except:
print "error for writerow", stop.__dict__, stop.point.coords
@ -193,7 +200,7 @@ def export_agency():
# also
f.writerow(["agency_id", "agency_name","agency_url","agency_timezone","agency_lang"])
f.writerow(["BEST","BrihanMumbai Electric Supply & Transport Undertaking","http://www.bestundertaking.com/","Asia/Kolkata","en"])
f.writerow(["BEST","BEST","http://www.bestundertaking.com/","Asia/Kolkata","en"])
#f.writerow(["agency_id" ,"agency_name","agency_url","agency_timezone"])
#f.writerow([1 ,"BEST","www.chalobest.in","Asia/Kolkata"])
@ -238,6 +245,8 @@ def export_calendar():
try:
# data checks here
running = [1 if day in ss['days'] else 0 for day in range(1,8)]
#if 8 in ss['days']:
# add_caldate(service_id)
# ternary operation :::: ('false','true')[condition]
f.writerow([ss['code']] + running + [start_date,end_date])
except:
@ -274,25 +283,44 @@ def generate_trips_unr(n=None):
days = schedule.schedule_type
for direction in ("UP","DOWN"):
trip_id = "%s_%s_%s_%s" %(route.code,unr.id,days, direction)
trip_id = "%s_%s_%s_%s" %(route.code,schedule.id,days, direction)
#triplist.append([schedule, route, direction, trip_id])
yield schedule, unr, route, direction, trip_id
def getOverlappingSchedules():
ret = []
for unr in UniqueRoute.objects.all().select_related():
sched_types = unr.routeschedule_set.values('schedule_type').distinct()
for s in sched_types:
qset = unr.routeschedule_set.filter(schedule_type=s['schedule_type'])
if qset.count() > 1:
rows = [schedule.__dict__ for schedule in qset]
ret.append(rows)
return ret
def getRoutesWOverlappingSchedules():
count = 0
rslist=[]
cnt=0
#return a list of unrs and rs's which have colliding schedule_type
for unr in UniqueRoute.objects.all():
ulist = unr.routeschedule_set.all()
stlist=[]
rslst = []
for rs in ulist:
if rs.schedule_type:
rslst.append((rs, rs.schedule_type))
stlist.append(rs.schedule_type)
else:
cnt+=1
rsset=[]
for rs in ulist:
if rs.schedule_type and (rs, rs.schedule_type) not in rsset:
rsset.append((rs, rs.schedule_type))
@ -345,7 +373,7 @@ def export_trips(routelist):
def getserial(rdlist,stop,getFirstStop=True):
#check if rdlist is of a ring route..
if rdlist[0].route.code[3] in ['R','4'] :
if rdlist[0].route.code[3] in ['R','4']:
# write ring specific code here. rings have multiple occuring stops, which one to choose??
pass
#return None
@ -353,100 +381,133 @@ def getserial(rdlist,stop,getFirstStop=True):
if(rd.stop==stop):
return rdlist.index(rd)
def get_routedetail_subset(unr, direction,rdlist):
"""
1. rdlist is mandatory as up down routes have diff orderings as per trip
"""
reversed_rds=[]
mismatched_unrs={"from":[], "to":[]}
multiple_to_stops=[]
def get_routedetail_subset(unr, direction):
"""
"""
from_stop = unr.from_stop
to_stop = unr.to_stop
code= str(unr.route.code)[3]
"""
# Sometimes to_stop comes before from_stop in RouteDetail.
# So reverse the list if that happens.. so a from_stop will always come before a to_stop
for detail in details:
if detail.stop.id == from_stop: break
if detail.stop.id == to_stop:
details.reverse()
break
if direction == "UP":
rdlist = list(RouteDetail.objects.filter(route=route).order_by("serial"))
lst = []
for rd in rdlist:
if rd.stop.dbdirection == '' or rd.stop.dbdirection == 'U' or rd.stop==unr.from_stop or rd.stop==unr.to_stop :
lst.append(rd)
rdlist = lst
details = get_routedetail_subset(unr, direction, rdlist)
else:
rdlist = list(RouteDetail.objects.filter(route=route).order_by("-serial"))
lst = []
for rd in rdlist:
if rd.stop.dbdirection == '' or rd.stop.dbdirection == 'D' or rd.stop==unr.from_stop or rd.stop==unr.to_stop:
lst.append(rd)
rdlist = lst
code=str(unr.route.code)[3]
rdlist = list(RouteDetail.objects.filter(route=unr.route).order_by("serial"))
if direction in ["UP", "up", "U"]:
lst = []
for rd in rdlist:
if rd.stop.dbdirection == '' or rd.stop.dbdirection == 'U' or rd.stop==unr.from_stop or rd.stop==unr.to_stop:
lst.append(rd)
else:
lst = []
for rd in rdlist:
if rd.stop.dbdirection == '' or rd.stop.dbdirection == 'D' or rd.stop==unr.from_stop or rd.stop==unr.to_stop:
lst.append(rd)
# shorten the route if its a subset.
details = get_routedetail_subset(unr, direction, rdlist)
"""
from_index = 0
to_index= 0
rdlist = list(rdlist)
# from stop
for rd in rdlist:
if(rd.stop==from_stop):
from_index = rdlist.index(rd)
rdlist = lst
# Sometimes to_stop comes before from_stop in RouteDetail.
# So reverse the list if that happens.. so a from_stop will always come before a to_stop
for detail in rdlist:
if detail.stop.id == from_stop.id: break
if detail.stop.id == to_stop.id:
rdlist.reverse()
reversed_rds.append({"unr":unr, "dir":direction})
break
# to stop
# get indexes
from_index = -1
to_index= -1
from_stop_found = 0
to_stop_found = 0
# from stop index
for rd in rdlist:
if(rd.stop.id==from_stop.id):
from_index = rdlist.index(rd)
from_stop_found=1
break
if from_stop_found == 0:
print "From-Stop not found in Route Details for unr.id", unr.id, "unr.from_stop_txt=", unr.from_stop_txt , str(unr.__dict__)
mismatched_unrs['from'].append({"unr":str(unr.__dict__), "route":unr.route})
# to stop index
for rd in rdlist:
#go to the last iteration, gets last occurence of stop
if(rd.stop==to_stop):
to_index = rdlist.index(rd)
# override any calculations if unique route is full, needed for ring
if not unr.is_full:
rd_subset = rdlist[from_index:to_index+1]
else:
rd_subset = rdlist
to_stop_found+=1
# for ring routes there will be two occurences of the stop, so for
# remove break to see multiple occurences in g.multiple_to_stops
break
# direction is being taken care of in
#if direction == "UP":
# pass
#else:
# rd_subset.reverse()
if to_stop_found>1:
multiple_to_stops.append({"unr":unr,"count":to_stop_found,"to_stop":unr.to_stop})
if to_stop_found == 0:
print "To-Stop not found in Route Details for unr.id", unr.id , " unr.to_stop_txt=", unr.to_stop_txt, str(unr.__dict__)
mismatched_unrs['to'].append({"unr":str(unr.__dict__), "route":unr.route})
rd_subset = rdlist[from_index:to_index+1]
if code == 'R' or code == '4':
# ring specific code here.
# converts the given ring route subset to double size.
if not unr.is_full:
import copy
#import pdb
#pdb.set_trace()
rd_temp = copy.deepcopy(rd_subset)
rd_temp.reverse()
rd_subset.extend(rd_temp[1:])
# if ring route subset
#if False:# not (unr.from_stop.id !=rdlist[0].stop.id and unr.to_stop.id !=rdlist[len(rdlist)-1]).stop.id:
#if not unr.is_full:
rd_temp = copy.deepcopy(rd_subset)
rd_temp.reverse()
rd_subset.extend(rd_temp[1:])
# if route indexing is funny, then alert
if not direction in ["UP", "up", "U"]:
rd_subset.reverse()
# if route indexing is anything less than 5 or negative, then alert
if (to_index - from_index) < 5:
print "Route::",unr.route.code , "from pos", from_index, " to pos ", to_index
return rd_subset
def make_is_full():
fn=[]
for unr in UniqueRoute.objects.select_related().all():
maxdist = max(unr.route.uniqueroute_set.values_list('distance'))[0]
"""
if unr.distance==maxdist and not unr.is_full:
unr.is_full=True
unr.save()
if unr.distance==unr.route.distance and not unr.is_full:
unr.is_full=True
unr.save()
# imp bug in BEST data, if the max_distance of the atlas entries do not
# match the route.distance one of those is wrong
#if maxdist != unr.route.distance
# fn.append(unr)
"""
if unr.distance==maxdist:
unr.is_full=True
unr.save()
else:
unr.is_full=False
unr.save()
return fn
def runtime_in_minutes(schedule):
"""
runtime returned is a single value and maybe would be more refined it would consider timespan.
"""
runtime = schedule.runtime1 or schedule.runtime2 or schedule.runtime3 or schedule.runtime4
if runtime: return runtime
t_from, t_to = schedule.first_from, schedule.first_to
@ -455,7 +516,23 @@ def runtime_in_minutes(schedule):
return abs(t_from.hour * 60 + t_from.minute -
(t_to.hour * 60 + t_to.minute))
noLocsStops = []
def export_shapes():
f = make_csv_writer("shapes.txt")
f.writerow(["shape_id","shape_pt_lat","shape_pt_lon","shape_pt_sequence"])
for road in Road.objects.all():
ss = road.stop_set.all()
# --FIXME counter is giving a step count, stops however must be ordered by position in road before
counter = 1
for s in ss:
if s.point:
f.writerow(['road'+str(road.id),s.point.coords[1], s.point.coords[0],counter])
counter+=1
else:
noLocsStops.append(s.__dict__)
def export_stop_times(routelist):
print "Exporting stop times.."
@ -473,33 +550,20 @@ def export_stop_times(routelist):
for schedule, unr, route, direction, trip_id in generate_trips_unr():
if route not in routelist: continue
#if not unr.is_full: continue
#get route in sort_order based on UP or DOWN route
if direction == "UP":
rdlist = list(RouteDetail.objects.filter(route=route).order_by("serial"))
lst = []
for rd in rdlist:
if rd.stop.dbdirection == '' or rd.stop.dbdirection == 'U' or rd.stop==unr.from_stop or rd.stop==unr.to_stop:
lst.append(rd)
rdlist = lst
details = get_routedetail_subset(unr, direction, rdlist)
details = get_routedetail_subset(unr, direction)
else:
rdlist = list(RouteDetail.objects.filter(route=route).order_by("serial"))
lst = []
for rd in rdlist:
if rd.stop.dbdirection == '' or rd.stop.dbdirection == 'D' or rd.stop==unr.from_stop or rd.stop==unr.to_stop:
lst.append(rd)
rdlist = lst
# shorten the route if its a subset.
details = get_routedetail_subset(unr, direction, rdlist)
details = get_routedetail_subset(unr, direction)
# use interpolated distances
#details = parseDistancesForDetails(details, parse_stages=True)
if len(rdlist) < 5:
if len(details) < 5:
print "rdlist not populated"
rdlistempty+=1
continue
@ -529,7 +593,7 @@ def export_stop_times(routelist):
tooslows+=1
#avgspeed=12.0/60.0
if avgspeed > 50.0/60.0:
if avgspeed > 30.0/60.0:
toofasts+=1
#avgspeed=50.0/60.0
@ -566,7 +630,7 @@ def export_stop_times(routelist):
# Add 10 seconds to departure time
dt = datetime.datetime.combine(today, arrival_time) + datetime.timedelta(seconds=10)
departure_time = dt.time()
f.writerow([trip_id,arrival_time.__str__().split(".")[0],departure_time.__str__().split(".")[0],detail.stop.code,sequence])
f.writerow([trip_id,arrival_time.__str__().split(".")[0],departure_time.__str__().split(".")[0],str(detail.stop.code),sequence+1])
blankstops=1
prevstage = sequence
@ -588,20 +652,20 @@ def export_stop_times(routelist):
# first stop
if sequence == 0:
f.writerow([trip_id,initial_time,initial_time,detail.stop.code,sequence])
f.writerow([trip_id,initial_time,initial_time,str(detail.stop.code),sequence+1])
else:
# if this is the last stop in the route, then
if sequence == len(details) - 1:
arrival = initial_time.hour * 60 + initial_time.minute + runtime_in_minutes(schedule) + 5
arrival = initial_time.hour * 60 + initial_time.minute + runtime_in_minutes(schedule) + 7
arrival_time = "%02d:%02d:00" % (int(arrival/60), arrival % 60)
departure_time = "%02d:%02d:00" % (int(arrival/60), arrival % 60)
f.writerow([trip_id,arrival_time,departure_time,detail.stop.code,sequence])
f.writerow([trip_id,arrival_time,departure_time,str(detail.stop.code),sequence+1])
else:
# if any other stop
f.writerow([trip_id,"","",detail.stop.code,sequence])
f.writerow([trip_id,"","",str(detail.stop.code),sequence+1])
print "Trips too fast::", toofasts
@ -1031,14 +1095,25 @@ def export_frequencies2(routelist):
f.writerow([trip_id,st_str, et_str, headway[span]*60])
def makeStopList():
import codecs
f =codecs.open(join(PROJECT_ROOT, "gtfs", "Stops.csv"), "w", "utf-8")
f.write("stop_id,stop_code,stop_name,marathi_name")
for s in Stop.objects.all():
if s.name_mr is None:
s.name_mr= ''
line = str(s.id) +"\t"+ str(s.code)+"\t" + str(s.name) + "\t" + s.name_mr
f.write(line+ "\n")
f.close()
def fire_up(routelist):
if not routelist:
routelist = getCompleteRoutes2()
export_feed_info()
export_routes(routelist)
export_stops(routelist)
export_frequencies2(routelist)

View File

@ -1,2 +1,2 @@
agency_id,agency_name,agency_url,agency_timezone,agency_lang
BEST,BrihanMumbai Electric Supply & Transport Undertaking,http://www.bestundertaking.com/,Asia/Kolkata,en
BEST,BEST,http://www.bestundertaking.com/,Asia/Kolkata,en

View File

@ -1,19 +1,19 @@
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
MS,1,1,1,1,1,1,0,20000101,20500101
HOL,0,0,0,0,0,0,1,20000101,20500101
SUN,0,0,0,0,0,0,1,20000101,20500101
MF&HOL,1,1,1,1,1,0,0,20000101,20500101
SAT,0,0,0,0,0,1,0,20000101,20500101
MF,1,1,1,1,1,0,0,20000101,20500101
SH,0,0,0,0,0,0,1,20000101,20500101
AD,1,1,1,1,1,1,1,20000101,20500101
SAT&SUN,0,0,0,0,0,1,1,20000101,20500101
MS&HOL,1,1,1,1,1,1,0,20000101,20500101
FW,1,1,1,1,1,1,1,20000101,20500101
SAT/SH,0,0,0,0,0,1,1,20000101,20500101
SAT&HOL,0,0,0,0,0,1,0,20000101,20500101
SAT&SH,0,0,0,0,0,1,1,20000101,20500101
SAT/SUND&HOL,0,0,0,0,0,1,1,20000101,20500101
S/H,0,0,0,0,0,0,1,20000101,20500101
"SAT,SUN&HOL",0,0,0,0,0,1,1,20000101,20500101
FH,0,0,0,0,1,0,0,20000101,20500101
MS,1,1,1,1,1,1,0,20120401,20120701
HOL,0,0,0,0,0,0,1,20120401,20120701
SUN,0,0,0,0,0,0,1,20120401,20120701
MF&HOL,1,1,1,1,1,0,0,20120401,20120701
SAT,0,0,0,0,0,1,0,20120401,20120701
MF,1,1,1,1,1,0,0,20120401,20120701
SH,0,0,0,0,0,0,1,20120401,20120701
AD,1,1,1,1,1,1,1,20120401,20120701
SAT&SUN,0,0,0,0,0,1,1,20120401,20120701
MS&HOL,1,1,1,1,1,1,0,20120401,20120701
FW,1,1,1,1,1,1,1,20120401,20120701
SAT/SH,0,0,0,0,0,1,1,20120401,20120701
SAT&HOL,0,0,0,0,0,1,0,20120401,20120701
SAT&SH,0,0,0,0,0,1,1,20120401,20120701
SAT/SUND&HOL,0,0,0,0,0,1,1,20120401,20120701
S/H,0,0,0,0,0,0,1,20120401,20120701
"SAT,SUN&HOL",0,0,0,0,0,1,1,20120401,20120701
FH,0,0,0,0,1,0,0,20120401,20120701

File diff suppressed because it is too large Load Diff

View File

@ -1,314 +1,2 @@
route_id,route_short_name,route_long_name,route_type
0010,1,R.C.CHURCH - BND RECLAMATION BUS STN.,3
0011,1LT,COLABA BUS STN. - SANTACRUZ DEPOT,3
0017,AS-,BACKBAY DEPOT - CADBURY JN.(THANE),3
0021,2LT,R.C.CHURCH - MAROL DEPOT,3
0027,AS-,BACKBAY DEPOT - DAHISAR BUS STN.,3
0030,3,NAVY NGR. - JIJAMATA UDN.,3
0032,3-E,NAVY NGR. - JIJAMATA UDN.,3
0037,AS-,NEHRU PLANETARIUM - CADBURY JN.(THANE),3
0041,4LT,HUTATMA CHK./MUMBAI UNIVERSITY - OSHIWARA DEPOT,3
0043,4LT,HUTATMA CHK./MUMBAI UNIVERSITY - VESAVA-YARI RD.BUS STN.,3
0047,AS-,BACKBAY DEPOT - OSHIWARA DEPOT,3
0050,5,MANTRALAYA - KURLA BUS STN (E),3
0057,AS-,BKC TEL.EXCHANGE - CADBURY JN.(THANE),3
0071,7LT,DR.SHAMAPRASAD MUKHERJI CHK. - VIKHROLI PARK SITE,3
0090,9,COLABA BUS STN. - NADKARNI PARK,3
0097,AS-,DR.SHAMAPRASAD MUKHERJI CHK. - GHATKOPAR STN.(E)-1,3
0116,SPA,NAVY NGR. - RANI LAXMIBAI CHK.,3
0138,A-1,BACKBAY DEPOT - HIRANANDANI EST.,3
0139,A-1,BACKBAY DEPOT - LODHA COMPLEX,3
0140,14,DR.SHAMAPRASAD MUKHERJI CHK. - PRATIKSHA NGR.DEPOT,3
0150,15,MANTRALAYA - PRATIKSHA NGR.DEPOT,3
0171,17L,BACKBAY DEPOT - VIDYA VIHAR BUS STN(W),3
0172,17 ,BACKBAY DEPOT - VIDYA VIHAR BUS STN(W),3
0201,20L,DR.SHAMAPRASAD MUKHERJI CHK. - SHIVAJI NGR.DEPOT,3
0221,22L,COLABA DEPOT - MAROL MAROSHI BUS STN.,3
0261,26L,MUMBAI CENTRAL DEPOT - MAHUL VILLAGE,3
0280,28,DR.SHAMAPRASAD MUKHERJI CHK. - J.V.P.D.BUS STN.,3
0301,30L,MUMBAI CENTRAL DEPOT - VIKHROLI DEPOT,3
0324,32 ,GOREGAON BUS STN(W) - GOREGAON BUS STN(W),3
0330,33,PT.PALUSKAR CHK. - GOREGAON BUS STN(W),3
0332,33-,WORLI DEPOT - GOREGAON BUS STN(W),3
0350,35,COM.P.K.KURNE CHK. - MAROL MAROSHI BUS STN.,3
0370,37,J.MEHTA MARG - KURLA STN (W),3
0401,40L,P.THAKRE UDN.BUS STN. - BORIVLI STN(E),3
0410,41,FERRY WHARF - KAMLA NEHRU PARK,3
0420,42,FERRY WHARF - KAMLA NEHRU PARK,3
0426,C-4,RANI LAXMIBAI CHK. - DADLANI PARK (THANE-W),3
0430,43,MAHARANA PRATAP CHK. - PRATIKSHA NGR.DEPOT,3
0436,C-4,RANI LAXMIBAI CHK. - MUMBRA POLICE STN.,3
0440,44,COLABA DEPOT - WORLI DEPOT,3
0442,44-,COLABA BUS STN. - FERRY WHARF,3
0460,46,FERRY WHARF - DHARAVI DEPOT,3
0480,48,FERRY WHARF - AUGUST KRANTI MAIDAN,3
0490,49,SWAMI D.SARASWATI CHK. - NADKARNI PARK,3
0510,51,COLABA BUS STN. - SANTACRUZ DEPOT,3
0526,C-5,WADALA DEPOT - KALAMBOLI BUS STN,3
0530,53,WORLI DEPOT - LOKMANYA TILAK TERMINUS,3
0541,54-,COLABA BUS STN. - SANTACRUZ DEPOT,3
0556,C-5,G.S.CLY. - JALVAYU VIHAR(KHARGHAR),3
0560,56,WORLI VILLAGE - VESAVA-YARI RD.BUS STN.,3
0580,58,WADALA TRUCK TERMINAL - KURLA BUS STN (E),3
0590,59,VEER KOTWAL UDN. (PLAZA) - KURLA BUS STN (E),3
0600,60,MAHARANA PRATAP CHK. - KURLA BUS STN (E),3
0606,C-6,DEONAR DEPOT - BORIVLI STN(E),3
0610,61,BALLARD PIER - MAHIM MACHHIMAR NGR.,3
0616,C-6,MULUND DEPOT - MIRA RD.STN.(E),3
0620,62,MUMBAI CENTRAL DEPOT - KURLA STN (W),3
0626,C-6,MULUND-W CHECK NAKA BUS STN. - GORAI DEPOT,3
0630,63,J.MEHTA MARG - CHUNABHATTI BUS TERMINUS,3
0640,64,BABULNATH - MAHESHWARI UDN.,3
0660,66,BALLARD PIER - RANI LAXMIBAI CHK.(BUS STN.),3
0661,66L,COLABA DEPOT - DHARAVI DEPOT,3
0680,68,NAVY NGR. - WORLI DEPOT,3
0690,69,DR.SHAMAPRASAD MUKHERJI CHK. - P.THAKRE UDN.BUS STN.,3
0708,A-7,NEHRU PLANETARIUM - MIRA RD.STN.(E),3
0710,71,BYCULLA STN.(W) - RAM GANESH GADKARI CHK.,3
0716,C-7,MAHIM BUS STN. - MIRA RD.STN.(E),3
0726,C-7,RANI LAXMIBAI CHK. - BHAYANDER STN.(E),3
0740,74,DR.SHAMAPRASAD MUKHERJI CHK. - MAHIM BUS STN.,3
0748,A-7,COLABA DEPOT - GOREGAON DEPOT,3
0758,A-7,COLABA DEPOT - HIRANANDANI GARDEN,3
0760,76,MANTRALAYA - DHARAVI DEPOT,3
0768,A-7,COLABA DEPOT - GORAI DEPOT,3
0778,A-7,BKC TEL.EXCHANGE - GORAI DEPOT,3
0801,80L,KAMLA NEHRU PARK - J.V.P.D.BUS STN.,3
0811,81L,MANTRALAYA - SANTACRUZ DEPOT,3
0820,82,MANTRALAYA - WORLI DEPOT,3
0841,84L,PT.PALUSKAR CHK. - OSHIWARA DEPOT,3
0850,85,WORLD TRADE CENTRE - KURLA BUS STN (E),3
0852,85-,HUTATMA CHK./MUMBAI UNIVERSITY - CHUNABHATTI BUS TERMINUS,3
0860,86,BACKBAY DEPOT - BANDRA BUS STN(W),3
0880,88,MANTRALAYA - PRATIKSHA NGR.DEPOT,3
0890,89,MANTRALAYA - WORLI DEPOT,3
0911,91L,MUMBAI CENTRAL DEPOT - KURLA STN (W),3
1004,100,"AHILYABAI HOLKAR CHK.,EROSS CINEMA - AHILYABAI HOLKAR CHK.",3
1010,101,COLABA DEPOT - WALKESHWAR,3
1030,103,R.C.CHURCH - KAMLA NEHRU PARK,3
1044,104,J.MEHTA MARG - J.MEHTA MARG,3
1060,106,R.C.CHURCH - KAMLA NEHRU PARK,3
1062,106,R.C.CHURCH - AHILYABAI HOLKAR CHK.,3
1100,110,COM.P.K.KURNE CHK. - SANGAM NGR.,3
1114,111,CHH. SHIVAJI TERMINUS(BHATIA) - CHH. SHIVAJI TERMINUS(BHATIA),3
1200,120,DAVA BAZAR(KALBADEVI) - PT.PALUSKAR CHK.,3
1210,121,BACKBAY DEPOT - J.MEHTA MARG,3
1220,122,BALLARD PIER - J.MEHTA MARG,3
1240,124,COLABA BUS STN. - WORLI DEPOT,3
1250,125,NAVY NGR. - WORLI VILLAGE,3
1260,126,MANTRALAYA - JIJAMATA UDN.,3
1300,130,DR.SHAMAPRASAD MUKHERJI CHK. - VASANTRAO NAIK CHK.,3
1324,132,COLABA BUS STN. - COLABA BUS STN.,3
1350,135,FERRY WHARF - J.MEHTA MARG,3
1372,137,NAVY NGR. - NAVY NGR.,3
1380,138,BACKBAY DEPOT - CHH. SHIVAJI TERMINUS(BHATIA),3
1510,151,J.MEHTA MARG - WADALA DEPOT,3
1540,154,BYCULLA STN.(W) - NEHRU PLANETARIUM,3
1554,155,GRANT RD STN.(W) - GRANT RD STN.(W),3
1574,157,GRANT RD STN.(W) - GRANT RD STN.(W),3
1630,163,P.THAKRE UDN.BUS STN. - WORLI DEPOT,3
1640,164,MAHARANA PRATAP CHK. - DHARAVI DEPOT,3
1680,168,LAL BAHADDUR SHASTRI COLLEGE - WADALA DEPOT,3
1700,170,ANTOP HILL EXTN. - RANI LAXMIBAI CHK.,3
1720,172,SANT GADGE MAHARAJ CHK. - PRATIKSHA NGR.DEPOT,3
1740,174,VEER KOTWAL UDN. (PLAZA) - BHARANI NAKA (ANTOP HILL),3
1800,180,RANI LAXMIBAI CHK.(BUS STN.) - MALVANI DEPOT/ GAIKWAD NGR.,3
1824,182,BANDRA RLY.TERMINUS - BANDRA RLY.TERMINUS,3
1827,AS-,BANDRA RLY.TERMINUS - BANDRA RLY.TERMINUS,3
2000,200,SHRAWAN YESHWANTE CHK. - SANTACRUZ DEPOT,3
2044,204,GOREGAON BUS STN(W) - GOREGAON BUS STN(W),3
2054,205,JOGESHWARI BUS STN - JOGESHWARI BUS STN,3
2060,206,POISAR DEPOT - I.C.CLY.,3
2101,210,VESAVA-YARI RD.BUS STN. - DAHISAR BRIDGE,3
2120,212,P.THAKRE UDN.BUS STN. - BANDRA BUS STN(W),3
2130,213,P.THAKRE UDN.BUS STN. - SANTACRUZ STN (E),3
2180,218,KURLA STN (W) - BANDRA RLY.TERMINUS,3
2200,220,BANDRA BUS STN(W) - KHAR STN (W),3
2210,221,ANDHERI STN.(W) (KUMKUM) - VESAVA-YARI RD.BUS STN.,3
2220,222,BANDRA BUS STN(W) - VESAVA-YARI RD.BUS STN.,3
2231,223,SEVEN BUNGALOWS BUS STN. - SAMATA NGR.BUS STN.(KANDIVLI-E),3
2240,224,SHASTRI NGR. - BORIVLI BUS STN(W),3
2290,229,SANTACRUZ DEPOT - SHANTI ASHRAM,3
2300,230,P.THAKRE NGR.BUS STN. - SAMBHAJI NGR.(DAHISAR-E),3
2344,234,JOGESHWARI BUS STN - JOGESHWARI BUS STN,3
2354,235,ANDHERI BUS STN.(W) - ANDHERI BUS STN.(W),3
2370,237,CHARKOP SECT.NO.8 - BORIVLI BUS STN(W),3
2390,239,POISAR DEPOT - CHARKOP SEC.NO.9/AKSHARA VIDYALAYA,3
2410,241,WADALA DEPOT - MALVANI DEPOT/ GAIKWAD NGR.,3
2424,242,ANDHERI BUS STN.(W) - ANDHERI BUS STN.(W),3
2444,244,KANDIVLI STN.(W) - KANDIVLI STN.(W),3
2464,246,KANDIVLI STN.(W) - KANDIVLI STN.(W),3
2474,247,BORIVLI BUS STN(W) - BORIVLI BUS STN(W),3
2490,249,ANDHERI STN.(W) (KUMKUM) - VESAVA-YARI RD.BUS STN.,3
2510,251,ANDHERI STN.(W) (KUMKUM) - VESAVA-YARI RD.BUS STN.,3
2540,254,ANDHERI STN.(W) ( M.A ) - VEERA DESAI RD.,3
2551,255,PRATIKSHA NGR.DEPOT - VESAVA-YARI RD.BUS STN.,3
2560,256,JUHU BEACH - MALVANI DEPOT/ GAIKWAD NGR.,3
2570,257,ANDHERI BUS STN.(W) - J.V.P.D.BUS STN.,3
2590,259,ANDHERI STN.(W) (KUMKUM) - GORAI DEPOT,3
2622,262,GOREGAON BUS STN(W) - GOREGAON BUS STN(W),3
2630,263,SADBHAKTI MANDIR - SEEPZ BUS STN.,3
2660,266,ANDHERI BUS STN.(W) - SHREE SWAMI SAMARTH NGR.EXT.,3
2710,271,MALAD STN-W(ANAND MARG CHKY) - MADH JETTY,3
2760,276,KANDIVLI STN.(W) - CHARKOP SECT.NO.8,3
2770,277,KANDIVLI STN.(W) - BORIVLI STN(W),3
2790,279,KANDIVLI STN.(W) - GORAI DEPOT,3
2820,282,KANDIVLI BUS STN.( E ) - DAMU NGR.EXTN.,3
2830,283,KANDIVLI STN.(W) - SANTOSH NGR.(KANDIVALI-W),3
2860,286,KANDIVLI STN.(W) - CHARKOP VILLAGE,3
2944,294,BORIVLI BUS STN(W) - BORIVLI BUS STN(W),3
3020,302,PRATIKSHA NGR.DEPOT - MAHARANA PRATAP CHK.(MULUND),3
3027,AS-,MAHIM BUS STN. - CADBURY JN.(THANE),3
3050,305,TARDEO BUS STN/RUSHI MEHTA CHK. - GHATKOPAR BUS STN./GKD,3
3061,306,SANTACRUZ STN (E) - MULUND RLY.STN.(W),3
3080,308,VIDYA VIHAR BUS STN(W) - MAJAS DEPOT/SHYAM NGR.,3
3082,308,VIDYA VIHAR BUS STN(W) - SAHAR CARGO COMPLEX,3
3091,309,KURLA STN (W) - GORAI DEPOT,3
3100,310,KURLA STN (W) - BANDRA RLY.TERMINUS,3
3120,312,PRATIKSHA NGR.DEPOT - SEEPZ BUS STN.,3
3130,313,KURLA STN (W) - SANTACRUZ STN (E),3
3200,320,KURLA STN (W) - FILTER PADA,3
3211,321,MAHIM BUS STN. - BARVE NGR.,3
3230,323,VIDYA VIHAR BUS STN(W) - SANGHARSH NGR.(CHANDIVLI),3
3290,329,SHIVAJI NGR.DEPOT - AGARKAR CHK.,3
3301,330,KURLA STN (W) - SEVEN BUNGALOWS BUS STN.,3
3320,332,KURLA STN (W) - MAJAS DEPOT/SHYAM NGR.,3
3330,333,NEW QTRS( CHAKALA CIGARETTE FACTORY - KONDIVTE CAVES/MAHAKALI CAVES,3
3340,334,GHATKOPAR STN.(W) - MAROL DEPOT,3
3350,335,AGARKAR CHK. - SANGHARSH NGR.(CHANDIVLI),3
3360,336,J.V.P.D.BUS STN. - VIDYA VIHAR BUS STN(W),3
3380,338,AGARKAR CHK. - SAHAR CARGO COMPLEX,3
3400,340,GHATKOPAR STN.(W) - AGARKAR CHK.,3
3402,340,BARVE NGR. - AGARKAR CHK.,3
3481,348,CHUNABHATTI BUS TERMINUS - DAHISAR BUS STN.,3
3490,349,KURLA STN (W) - SANTOSH NGR.EXTN.,3
3500,350,KURLA BUS STN (E) - SHIVAJI NGR.DEPOT,3
3520,352,TROMBAY - RANI LAXMIBAI CHK.,3
3551,355,TROMBAY - VESAVA-YARI RD.BUS STN.,3
3570,357,MUMBAI CENTRAL DEPOT - SHIVAJI NGR.DEPOT,3
3600,360,TROMBAY - KURLA BUS STN (E),3
3610,361,MAHUL VILLAGE - KURLA BUS STN (E),3
3620,362,DR.AMBEDKAR GARDEN/CHEMBUR STN. - KURLA BUS STN (E),3
3630,363,KURLA BUS STN (E) - MAHUL VILLAGE,3
3640,364,MAHUL VILLAGE - TROMBAY,3
3650,365,KURLA STN (W) - SAHAR CARGO COMPLEX,3
3660,366,KURLA BUS STN (E) - SHIVAJI NGR.TERMINUS,3
3670,367,GADKARI QUARRY - KURLA BUS STN (E),3
3681,368,P.THAKRE UDN.BUS STN. - MULUND DEPOT,3
3690,369,KURLA BUS STN (E) - VASHINAKA M.M.R.D.A.CLY.,3
3720,372,SHIVAJI NGR.TERMINUS - SHIVAJI NGR.DEPOT,3
3736,SPA,BND RECLAMATION BUS STN. - GAWANPADA,3
3780,378,TROMBAY - MANKHURD STN.(SOUTH),3
3790,379,SHIVAJI NGR.TERMINUS - GHATKOPAR STN.(E)-2,3
3800,380,TROMBAY - AMRUT NGR.,3
3810,381,GHATKOPAR BUS STN./GKD - TATA POWER CENTRE(CHEMBUR),3
3821,382,ANUSHAKTI NGR.BUS STN. - SAHAR CARGO COMPLEX,3
3830,383,GADKARI QUARRY - SHIVAJI NGR.DEPOT,3
3840,384,BANDRA BUS STN(W) - GHATKOPAR BUS STN./GKD,3
3850,385,TARDEO BUS STN/RUSHI MEHTA CHK. - GHATKOPAR BUS STN./GKD,3
3887,AS-,GHATKOPAR BUS STN./GKD - POISAR DEPOT,3
3904,390,GHATKOPAR STN.(W) - GHATKOPAR STN.(W),3
3920,392,VIKHROLI DEPOT - MAJAS DEPOT/SHYAM NGR.,3
3930,393,GHATKOPAR BUS STN./GKD - AAMCHI SHALA,3
3950,395,SANTACRUZ STN (E) - BAMANDAYA PADA,3
3961,396,MULUND-W CHECK NAKA BUS STN. - AGARKAR CHK.,3
3981,398,MULUND-W CHECK NAKA BUS STN. - DINDOSHI BUS STN.,3
3991,399,TROMBAY - MARATHON CHK.(TEEN HATH NAKA),3
4020,402,MULUND RLY.STN.(W) - VAISHALI NGR.,3
4040,404,GHATKOPAR STN.(E)-1 - SHIVAJI NGR.DEPOT,3
4060,406,GHATKOPAR STN.(E)-1 - RAILWAY POLICE CLY.(GHATKOPAR,3
4070,407,KELKAR COLLEGE - NIMKAR SCTY.,3
4080,408,MAHIM BUS STN. - MULUND RLY.STN.(W),3
4091,409,MULUND DEPOT - SAHAR CARGO COMPLEX,3
4100,410,VIKHROLI DEPOT - KONDIVTE CAVES/MAHAKALI CAVES,3
4141,414,MUMBAI CENTRAL DEPOT - MAJAS DEPOT/SHYAM NGR.,3
4150,415,AGARKAR CHK. - MAJAS DEPOT/SHYAM NGR.,3
4160,416,GHATKOPAR STN.(W) - AMRUT NGR.,3
4170,417,VIKHROLI PARK SITE - SURYA NGR.,3
4190,419,GHATKOPAR BUS STN./GKD - SANGHARSH NGR.(CHANDIVLI),3
4210,421,GHATKOPAR BUS STN./GKD - FILTER PADA,3
4212,421,GHATKOPAR BUS STN./GKD - MHADA CLY.(CHANDIVLI),3
4227,AS-,MULUND-W CHECK NAKA BUS STN. - AGARKAR CHK.,3
4230,423,MANGATRAM PETROLPUMP - MAROL DEPOT,3
4250,425,MANGATRAM PETROLPUMP - SEVEN BUNGALOWS BUS STN.,3
4260,426,VIDYA VIHAR BUS STN(W) - FILTER PADA,3
4290,429,GHATKOPAR STN.(W) - MILIND NGR.,3
4300,430,MAHUL VILLAGE - GHATKOPAR BUS STN./GKD,3
4310,431,KURLA BUS STN (E) - TATA POWER CENTRE(CHEMBUR),3
4330,433,VIDYA VIHAR BUS STN(W) - SANTACRUZ STN (E),3
4380,438,DINDOSHI BUS STN. - DAHISAR BUS STN.,3
4401,440,WADALA DEPOT - BORIVLI STN(E),3
4407,AS-,WADALA DEPOT - BORIVLI STN(E),3
4420,442,SADBHAKTI MANDIR - MHADA CLY.(MAJAS),3
4430,443,AGARKAR CHK. - BAMANDAYA PADA,3
4460,446,KURLA STN (W) - BAMANDAYA PADA,3
4481,448,PRATIKSHA NGR.DEPOT - BORIVLI STN(E),3
4491,449,DHARAVI DEPOT - KANDIVLI BUS STN.( E ),3
4504,450,GOREGAON STN(E) - GOREGAON STN(E),3
4587,AS-,MULUND DEPOT - P.THAKRE NGR.BUS STN.,3
4591,459,MULUND RLY.STN.(W) - MALVANI DEPOT/ GAIKWAD NGR.,3
4601,460,MULUND RLY.STN.(W) - GORAI DEPOT,3
4611,461,MULUND-W CHECK NAKA BUS STN. - P.THAKRE NGR.BUS STN.,3
4617,AS-,MULUND-W CHECK NAKA BUS STN. - BORIVLI BUS STN(W),3
4630,463,WORLI DEPOT - CHEMBUR CLY.,3
4641,464,MAROL DEPOT - P.THAKRE NGR.BUS STN.,3
4703,470,GHATKOPAR STN.(W) - AGARKAR CHK.,3
4781,478,VIKHROLI DEPOT - BORIVLI STN(E),3
4810,481,GHATKOPAR BUS STN./GKD - VASHINAKA M.M.R.D.A.CLY.,3
4841,484,MHADA CLY.BUS STN.(MULUND-E) - PAWAR NGR.BUS STN.(THANE),3
4881,488,SHIVAJI NGR.DEPOT - DINDOSHI DEPOT,3
4891,489,SHIVAJI NGR.DEPOT - DAHISAR BRIDGE,3
4911,491,SEEPZ BUS STN. - BRAHMAND AZAD NGR.BUS STN,3
4921,492,SEEPZ BUS STN. - WAGHBILGAON,3
4931,493,ANUSHAKTI NGR.BUS STN. - DADLANI PARK (THANE-W),3
4941,494,VIKHROLI DEPOT - RETI BUNDER - KHARIGAON(KALWA),3
4950,495,GAWANPADA FIRE BRIGADE(MULUND-E) - THANE STN.(E),3
4961,496,MARATHON CHK.(TEEN HATH NAKA) - AGARKAR CHK.,3
4971,497,GHATKOPAR BUS STN./GKD - LOKMANYA NGR.(THANE),3
4981,498,SANGHARSH NGR.(CHANDIVLI) - BORIVLI STN(E),3
4991,499,GHATKOPAR BUS STN./GKD - VRINDAVAN SCTY.(THANE),3
5001,500,VIKHROLI DEPOT - AIROLI BUS STN.,3
5011,501,KURLA BUS STN (E) - AIROLI BUS STN.,3
5021,502,WADALA DEPOT - NERUL SECT.-46/48,3
5037,AS-,WADALA DEPOT - KALAMBOLI BUS STN,3
5057,AS-,SANTACRUZ DEPOT - C.B.D. BELAPUR BUS STN.,3
5071,507,SANTACRUZ STN (E) - NERUL BUS STN.,3
5081,508,DR.AMBEDKAR GARDEN - NERUL SECT.-46/48,3
5111,511,MAHARANA PRATAP CHK.(MULUND) - NERUL BUS STN.,3
5121,512,MULUND-W CHECK NAKA BUS STN. - NERUL BUS STN.,3
5127,AS-,MULUND-W CHECK NAKA BUS STN. - NERUL RLY. STN.,3
5131,513,GAWANPADA FIRE BRIGADE(MULUND-E) - VASHI RAILWAY STN.,3
5157,AS-,SANTACRUZ DEPOT - C.B.D. BELAPUR BUS STN.,3
5161,516,DEONAR DEPOT - JALVAYU VIHAR(KHARGHAR),3
5171,517,SANTACRUZ STN (E) - VASHI SECT.19,3
5181,518,SHIVAJI NGR.DEPOT - GHANSOLI VILLAGE,3
5191,519,DEONAR DEPOT - GHANSOLI VILLAGE,3
5201,520,DEONAR DEPOT - AIROLI BUS STN.,3
5221,522,MAROL DEPOT - VASHI RAILWAY STN.,3
5231,523,DINDOSHI BUS STN. - MILLENNIUM BUSINESS PARK,3
5241,524,BORIVLI STN(E) - VASHI SECT.19,3
5251,525,DINDOSHI BUS STN. - VASHI SECT.19,3
5259,AS-,DINDOSHI BUS STN. - KOPAR KHAIRANE,3
5331,533,ANDHERI BUS STN.(W) - VASHI SECT.19,3
5517,AS-,AGARKAR CHK. - VASHI BUS STN.,3
6020,602,KANJUR MARG STN.(W) - HIRANANDANI POWAI BUS STN.,3
6080,608,KANJUR MARG STN.(W) - HANUMAN NGR.,3
6100,610,KURLA BUS STN (E) - BUNTARA BHAVAN,3
6110,611,MALAD STN-E(PODDAR PARK) - DINDOSHI BUS STN.,3
6150,615,RANI LAXMIBAI CHK. - SANTACRUZ STN (E),3
6240,624,MALAD STN-E(PODDAR PARK) - ANAND NAGAR (APPAPADA MALAD-E),3
6250,625,MALAD STN-E(PODDAR PARK) - ALIKA NGR.,3
6300,630,KHAR STN (W) - SANTACRUZ STN (W),3
6630,663,MAHUL VILLAGE - TROMBAY,3
7007,AS-,MAGATHANE DEPOT - THANE STN.(E),3
7021,702,BORIVLI STN(E) - GHODBUNDER VILLAGE,3
7071,707,SANTACRUZ DEPOT - BHAYANDER PHATAK(POLICE CHKY),3
7101,710,JAY MAHARASHTRANGR. - BHAYANDER RLY.STN.(W),3
7111,711,GORAI DEPOT - GORAI CREEK-W,3
8021,SPL,CHH. SHIVAJI TERMINUS(BHATIA) - WORLD TRADE CENTRE,3
8031,SPL,COLABA BUS STN. - MAHATMA PHULE MARKET,3
8041,SPL,CHH. SHIVAJI TERMINUS(BHATIA) - FREE PRESS HOUSE,3
8081,SPL,AHILYABAI HOLKAR CHK. - AHILYABAI HOLKAR CHK.,3
8111,811,BREACH CANDY HOSPITAL - BYCULLA STN.(W),3
8126,812,CHH. SHIVAJI TERMINUS - CHH. SHIVAJI TERMINUS,3
8136,813,CHH. SHIVAJI TERMINUS - CHH. SHIVAJI TERMINUS,3
route_id,agency_id,route_short_name,route_long_name,route_type
0010,BEST,1,R.C.CHURCH - BND RECLAMATION BUS STN.,3

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,8 @@ def fix_distances():
# Sometimes to_stop comes before from_stop in RouteDetail. What is there to say.
# so reverse the list if that happens.. so a from_stop will always come before a to_stop
for detail in details:
if detail.stop.id == from_stop: break
if detail.stop.id == to_stop:
if detail.stop.id == from_stop.id: break
if detail.stop.id == to_stop.id:
details.reverse()
break
@ -86,6 +86,7 @@ def fix_missing_runtimes():
prev_runtime = getattr(schedule, columns[col_idx-1])
if prev_runtime:
setattr(schedule, column, prev_runtime)
schedule.save()
continue
# ... or the next column, if it comes to that.
@ -93,6 +94,7 @@ def fix_missing_runtimes():
next_runtime = getattr(schedule, columns[col_idx+1])
if next_runtime:
setattr(schedule, column, next_runtime)
schedule.save()
continue
# otherwise, go through the other schedules for this subroute and
@ -101,6 +103,7 @@ def fix_missing_runtimes():
sibling_runtime = getattr(sibling, column)
if sibling_runtime:
setattr(schedule, column, sibling_runtime)
schedule.save()
# print "OK fix_missing_runtimes: %s %s fixed to %s" % (schedule, column, sibling)
break
@ -121,6 +124,7 @@ def fix_missing_runtimes():
partial_runtime = related_runtime*float(schedule.unique_route.distance)/float(related_schedule.unique_route.distance)
# print "OK fix_missing_runtimes: %s %s adjusted to parent %s" % (schedule, column, related_schedule)
setattr(schedule, column, partial_runtime)
schedule.save()
break
# did we find a runtime? great, use it
@ -138,6 +142,7 @@ def fix_missing_runtimes():
partial_runtime = related_runtime*float(schedule.unique_route.distance)/float(related_schedule.unique_route.distance)
# print "OK fix_missing_runtimes: %s %s adjusted to parent %s" % (schedule, column, related_schedule)
setattr(schedule, column, partial_runtime)
schedule.save()
break
if column != "runtime4":
@ -165,6 +170,7 @@ def fix_missing_headways():
prev_headway = getattr(schedule, columns[col_idx-1])
if prev_headway:
setattr(schedule, column, prev_headway)
schedule.save()
continue
# ... or the next column, if it comes to that.
@ -172,6 +178,7 @@ def fix_missing_headways():
next_headway = getattr(schedule, columns[col_idx+1])
if next_headway:
setattr(schedule, column, next_headway)
schedule.save()
continue
#try any headway in the current row:
@ -179,6 +186,7 @@ def fix_missing_headways():
headway = getattr(schedule, hcol)
if headway:
setattr(schedule, column, headway)
schedule.save()
break
if getattr(schedule, column):
@ -189,6 +197,7 @@ def fix_missing_headways():
sibling_headway = getattr(sibling, column)
if sibling_headway:
setattr(schedule, column, sibling_headway)
schedule.save()
# print "OK fix_missing_headways: %s %s fixed to %s" % (schedule, column, sibling)
break
@ -202,6 +211,7 @@ def fix_missing_headways():
headway = getattr(sibling, hcol)
if headway:
setattr(schedule, column, headway)
schedule.save()
break_loop = True
break
@ -222,10 +232,10 @@ def fix_missing_headways():
break
if headway:
setattr(schedule, column, headway)
schedule.save()
break_loop = True
break
if getattr(schedule, column):
continue

View File

@ -108,7 +108,7 @@ class StopAdmin(admin.OSMGeoAdmin):
class RouteDetailAdmin(admin.ModelAdmin):
list_display = ("route_code","serial","stop","stage","km")
list_display = ("route_code","serial","stop","stop_dir", "stage","km")
readonly_fields = ("route_code","serial","stop","stage","km")
search_fields = ("route_code","stop__name")
formfield_overrides = {

View File

@ -260,6 +260,8 @@ class RouteDetail(models.Model):
def __unicode__(self):
return str(self.route) + " : " + str(self.serial)
def stop_dir(self):
return str(self.stop.dbdirection)
class UniqueRoute(models.Model):
route = models.ForeignKey(Route)