
from database.database_access import get_dao
from gtfslib.model import Route
from gtfsplugins import decret_2015_1610
from database.database_access import get_dao

def get_routes(agency_id):
	dao = get_dao(agency_id)
	parsedRoutes = list()

	for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
		parsedRoute = dict()
		parsedRoute["name"] = route.route_long_name
		parsedRoutes.append(parsedRoute)

	return parsedRoutes



from database.database_access import get_dao
from gtfslib.model import Route
from services.check_urban import check_urban_category

def get_routes(agency_id):
	dao = get_dao(agency_id)
	parsedRoutes = list()

	for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
		print(route)
		parsedRoute = dict()
		parsedRoute["id"] = route.route_id
		parsedRoute["name"] = route.route_long_name
		parsedRoute["category"] = check_urban_category(route.trips)
		parsedRoutes.append(parsedRoute)

	return parsedRoutes


Add id & category to routes list
Add id & category to routes list

  
  from database.database_access import get_dao
  from gtfslib.model import Route
+ from services.check_urban import check_urban_category
- from gtfsplugins import decret_2015_1610
- from database.database_access import get_dao
  
  def get_routes(agency_id):
  	dao = get_dao(agency_id)
  	parsedRoutes = list()
  
  	for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
+ 		print(route)
  		parsedRoute = dict()
+ 		parsedRoute["id"] = route.route_id
  		parsedRoute["name"] = route.route_long_name
+ 		parsedRoute["category"] = check_urban_category(route.trips)
  		parsedRoutes.append(parsedRoute)
  
  	return parsedRoutes
  
  
Add id & category to routes list
## Code Before:

from database.database_access import get_dao
from gtfslib.model import Route
from gtfsplugins import decret_2015_1610
from database.database_access import get_dao

def get_routes(agency_id):
	dao = get_dao(agency_id)
	parsedRoutes = list()

	for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
		parsedRoute = dict()
		parsedRoute["name"] = route.route_long_name
		parsedRoutes.append(parsedRoute)

	return parsedRoutes


## Instruction:
Add id & category to routes list
## Code After:

from database.database_access import get_dao
from gtfslib.model import Route
from services.check_urban import check_urban_category

def get_routes(agency_id):
	dao = get_dao(agency_id)
	parsedRoutes = list()

	for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
		print(route)
		parsedRoute = dict()
		parsedRoute["id"] = route.route_id
		parsedRoute["name"] = route.route_long_name
		parsedRoute["category"] = check_urban_category(route.trips)
		parsedRoutes.append(parsedRoute)

	return parsedRoutes

