Skip to content

Commit

Permalink
v3.4.0 quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
answerquest committed Mar 18, 2019
1 parent e642fe7 commit 3f792fd
Show file tree
Hide file tree
Showing 43 changed files with 1,339 additions and 60,782 deletions.
Binary file modified GTFSManager.exe
Binary file not shown.
43 changes: 27 additions & 16 deletions GTFSManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@
import csv
import numpy as np
import io # used in hyd csv import
import requests, platform # used to log user stats

# setting constants
root = os.path.dirname(__file__) # needed for tornado
uploadFolder = 'uploads/'
xmlFolder = 'xml_related/'
logFolder = 'logs/'
configFolder = 'config/'
dbFolder = 'db/' # 12.5.18 new pandas DB storage
exportFolder = 'export/' # 4.9.18 putting exports here now

sequenceDBfile = 'db/sequence.json'
passwordFile = 'pw/rsa_key.bin'
uploadFolder = os.path.join(root,'uploads/')
xmlFolder = os.path.join(root,'xml_related/')
logFolder = os.path.join(root,'logs/')
configFolder = os.path.join(root,'config/')
dbFolder = os.path.join(root,'db/') # 12.5.18 new pandas DB storage
exportFolder = os.path.join(root,'export/') # 4.9.18 putting exports here now

sequenceDBfile = os.path.join(root,'db/sequence.json')
passwordFile = os.path.join(root,'pw/rsa_key.bin')
chunkRulesFile = 'chunkRules.json'
configFile = 'config.json'
thisURL = ''
Expand All @@ -62,9 +63,9 @@


# importing GTFSserverfunctions.py, embedding it inline to avoid re-declarations etc
exec(open("./GTFSserverfunctions.py", encoding='utf8').read())
exec(open("./xml2GTFSfunction.py", encoding='utf8').read())
exec(open("./hydCSV2GTFS.py", encoding='utf8').read())
exec(open(os.path.join(root,"GTFSserverfunctions.py"), encoding='utf8').read())
exec(open(os.path.join(root,"xml2GTFSfunction.py"), encoding='utf8').read())
exec(open(os.path.join(root,"hydCSV2GTFS.py"), encoding='utf8').read())

logmessage('Loaded dependencies, starting static GTFS Manager program.')

Expand Down Expand Up @@ -633,6 +634,7 @@ def get(self):
self.write(json.dumps(stats))
end = time.time()
logmessage("stats GET call took {} seconds.".format( round(end-start, 2) ) )
logUse('stats')


class gtfsImportZip(tornado.web.RequestHandler):
Expand All @@ -655,6 +657,7 @@ def post(self):

end = time.time()
logmessage("gtfsImportZip POST call took {} seconds.".format( round(end-start,2) ))
logUse('gtfsImportZip')

class commitExport(tornado.web.RequestHandler):
def get(self):
Expand All @@ -673,6 +676,7 @@ def get(self):
self.write(finalmessage)
end = time.time()
logmessage("commitExport GET call took {} seconds.".format(round(end-start,2)))
logUse('commitExport')


class pastCommits(tornado.web.RequestHandler):
Expand Down Expand Up @@ -731,6 +735,7 @@ def post(self):
self.write(json.dumps(returnJson))
end = time.time()
logmessage("XMLUpload POST call took {} seconds.".format(round(end-start,2)))
logUse('XMLUpload')

class XMLDiagnose(tornado.web.RequestHandler):
def get(self):
Expand Down Expand Up @@ -763,6 +768,7 @@ def get(self):
self.write(json.dumps(returnJson))
end = time.time()
logmessage("XMLDiagnose GET call took {} seconds.".format(round(end-start,2)))
logUse('XMLDiagnose')


class stations(tornado.web.RequestHandler):
Expand Down Expand Up @@ -854,7 +860,7 @@ def post(self):
self.write(json.dumps(returnJson))
end = time.time()
logmessage("fareChartUpload POST call took {} seconds.".format(round(end-start,2)))

logUse('fareChartUpload')

class xml2GTFS(tornado.web.RequestHandler):
def post(self):
Expand All @@ -878,7 +884,7 @@ def post(self):
self.write(returnMessage)
end = time.time()
logmessage("xml2GTFS POST call took {} seconds.".format(round(end-start,2)))

logUse('xml2GTFS')

class gtfsBlankSlate(tornado.web.RequestHandler):
def get(self):
Expand All @@ -904,6 +910,7 @@ def get(self):
self.write(finalmessage)
end = time.time()
logmessage("gtfsBlankSlate GET call took {} seconds.".format(round(end-start,2)))
logUse('gtfsBlankSlate')

class translations(tornado.web.RequestHandler):
def get(self):
Expand Down Expand Up @@ -1281,6 +1288,7 @@ def get(self):

self.write(dataJson)
end = time.time()
logUse('{}_read'.format(table))
logmessage("tableReadSave GET call for table={} took {} seconds.".format(table,round(end-start,2)))

def post(self):
Expand Down Expand Up @@ -1316,6 +1324,7 @@ def post(self):
self.set_status(400)
self.write("Error: Could not save to DB.")
end = time.time()
logUse('{}_write'.format(table))
logmessage("tableReadSave POST call for table={} took {} seconds.".format(table,round(end-start,2)))

class tableColumn(tornado.web.RequestHandler):
Expand Down Expand Up @@ -1344,6 +1353,7 @@ def get(self):
returnList.sort()
self.write(json.dumps(returnList))
end = time.time()
logUse('{}_column'.format(table))
logmessage("tableColumn GET call took {} seconds.".format(round(end-start,2)))


Expand Down Expand Up @@ -1409,12 +1419,13 @@ def signal_term_handler(signal, frame):
except OSError:
portnum += 1
if portnum > 9999:
print('Thats it I give up! Even port 9999 isn\'t free!')
print('Can\'t launch as no port number from 5000 through 9999 is free.')
sys.exit()

thisURL = "http://localhost:" + str(port)
webbrowser.open(thisURL)
logmessage("Open {} in your Web Browser if you don't see it opening automatically in 5 seconds.\nNote: If this is through docker, then it's not going to auto-open in browser, don't wait.".format(thisURL))
logmessage("\n\nOpen {} in your Web Browser if you don't see it opening automatically in 5 seconds.\n\nNote: If this is through docker, then it's not going to auto-open in browser, don't wait.".format(thisURL))
logUse()
tornado.ioloop.IOLoop.current().start()


Expand Down
24 changes: 21 additions & 3 deletions GTFSserverfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ def geoJson2shape(route_id, shapefile, shapefileRev=None):
newrow['shape_dist_traveled'] = dist_traveled
i = i + 1
newrow['shape_pt_sequence'] = i
output_array.append(newrow)
output_array.append(newrow.copy())
prevlat = item[1]
prevlon = item[0]

Expand Down Expand Up @@ -961,7 +961,7 @@ def geoJson2shape(route_id, shapefile, shapefileRev=None):
newrow['shape_dist_traveled'] = dist_traveled
i = i + 1
newrow['shape_pt_sequence'] = i
output_array.append(newrow)
output_array.append(newrow.copy())
prevlat = item[1]
prevlon = item[0]

Expand Down Expand Up @@ -1652,4 +1652,22 @@ def calendarCurrent():
today = float( '{:%Y%m%d}'.format(datetime.datetime.now()) )
logmessage(today)
calendarDF.end_date = calendarDF.end_date.astype(float)
return calendarDF[ calendarDF.end_date >= today ]
return calendarDF[ calendarDF.end_date >= today ]

def logUse(action='launch'):
payload = {'idsite': 3, 'rec': 1, 'send_image':0}
payload['action_name'] = action
cvar = {}
cvar['1'] = ['OS', platform.system()]
cvar['2'] = ['processor',platform.processor()]
if cvar['1'][1] == 'Linux':
cvar['1'][1] = platform.linux_distribution()[0]
cvar['3'] = ['version', platform.linux_distribution()[1] ]
else:
cvar['3'] = ['version', platform.release() ]
payload['_cvar'] = json.dumps(cvar)
try:
r = requests.get('http://nikhilvj.co.in/tracking/piwik.php', params=payload, verify=False, timeout=1)
except requests.exceptions.RequestException as e:
# print('exception',e)
pass
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

A browser-based user interface for creating, editing, exporting of static GTFS (General Transit Feed Specification Reference) feeds for a public transit authority.

**Development Status** : V 3.3.0
**Development Status** : V 3.4.0
Download from [Releases page](https://github.com/WRI-Cities/static-GTFS-manager/releases/).
- Windows binary is available in the repo itself, just double-click GTFSManager.exe to start the program.
- Mac, Ubuntu users can run by first installing docker, then double-clicking two scripts. See [Running with Docker on any OS](https://github.com/WRI-Cities/static-GTFS-manager/wiki/Running-with-Docker-on-any-OS)
Expand Down
4 changes: 2 additions & 2 deletions config/hmrl-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"routes": [
{
"route_id" : "RED",
"route_sequence" : ["AME","SRN","ESI","ERA","BTN","MSP", "BLR","KUK","KPH","JNT","MYP"],
"route_sequence" : ["AME","SRN","ESI","ERA","BTN","MSP","BLR","KUK","KPH","JNT","MYP"],
"direction_suffix" : ["2","1"],
"route_short_name" : "Red",
"route_long_name" : "Red Line, Ameerpet to Miyapur",
Expand All @@ -13,7 +13,7 @@

{
"route_id" : "BLU",
"route_sequence" : ["AME","BEG","PRN","ROP","PAR","PRG","SEC", "MET","TAR","HSG","NGR","SOI","UPL","NAG"],
"route_sequence" : ["AME","BEG","PRN","ROP","PAR","PRG","SEC","MET","TAR","HSG","NGR","SOI","UPL","NAG"],
"direction_suffix" : ["2","1"],
"route_short_name" : "Blue",
"route_long_name" : "Blue Line, Ameerpet to Nagole",
Expand Down
2 changes: 1 addition & 1 deletion config/settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// from commonfuncs.js

const VERSION = 'v3.3.0';
const VERSION = 'v3.4.0';
const APIpath = 'API/';
const CURRENCY = 'INR';
// this flag tells whether it is mandatory for all UIDs to be in capitals or not.
Expand Down
Binary file modified db/agency.h5
Binary file not shown.
Binary file modified db/calendar.h5
Binary file not shown.
Binary file renamed db/calendar_dates.h5 → db/fare_attributes.h5
Binary file not shown.
Binary file added db/fare_rules.h5
Binary file not shown.
Binary file modified db/routes.h5
Binary file not shown.
Binary file added db/shapes_1.h5
Binary file not shown.
4 changes: 4 additions & 0 deletions db/shapes_lookup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"R1_0": "shapes_1.h5",
"R1_1": "shapes_1.h5"
}
Binary file modified db/stop_times_1.h5
Binary file not shown.
Binary file removed db/stop_times_2.h5
Binary file not shown.
Binary file removed db/stop_times_3.h5
Binary file not shown.
Binary file removed db/stop_times_4.h5
Binary file not shown.
Binary file removed db/stop_times_5.h5
Binary file not shown.
Binary file removed db/stop_times_6.h5
Binary file not shown.
Loading

0 comments on commit 3f792fd

Please sign in to comment.