def create_gtfs(date=datetime.datetime.today()): BuildTrips.feed, BuildStopTimes.feed = load(date) clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass) for cls in clsmembers: if re.search('Build', cls[0]) and re.search('__main__', str(cls[1])): cls[1].create_feed() shape_kml.process() validate_shape_kml.validate()
def create_gtfs(date=datetime.datetime.today()): BuildTrips.feed, BuildStopTimes.feed = load(date) classes = [ 'Agency', 'Calendar', 'Holidays', 'Routes', 'Stops', 'StopTimes', 'Trips' ] for cls in classes: exec('Build{}.create_feed()'.format(cls)) shape_kml.process() validate_shape_kml.validate()
import datetime DATE = datetime.datetime.today() # (year, month, day) -> this should be the first day of the GTFS you wish to publish RIDERSHIP = False # toggle to run ridership and produce reports...download is VERY slow ROUTES = True # toggle to run updated route planning (GTFS, website, and timepoints) # Ridership; once ALL data is in final database remember to modify rider/ridership.py and use rider/bulk_upload.py if RIDERSHIP: from src.scripts.rider.ridership import process process() # Route planning; remember to put the current shapes.kml file in data/route/kml before running to ensure shapes are # properly represented. After running validate shapes conversion by viewing the report/gtfs/test folder if ROUTES: from src.scripts.route.route import create, load create(DATE) load(DATE) from src.scripts.gtfs.gtfs import create_gtfs from src.scripts.route.timepoint import publish_timepoints from src.scripts.web.web_pages import publish create_gtfs(DATE) publish(DATE) publish_timepoints(DATE)