@@ -83,7 +83,7 @@ async def get_route_summary(msa_id: str, route: str):
83
83
SELECT
84
84
agencies_serviced
85
85
FROM public.stop_features
86
- WHERE '{ route } ' = any(public.stop_features.routes_serviced )
86
+ WHERE '{ route } ' = any(string_to_array( public.stop_features.routes_serviced_str, ',') )
87
87
AND public.stop_features.city = '{ msa_id } '
88
88
"""
89
89
cursor .execute (agency_query )
@@ -96,7 +96,7 @@ async def get_route_summary(msa_id: str, route: str):
96
96
SELECT
97
97
{ col } , count({ col } )
98
98
FROM public.stop_features
99
- WHERE '{ route } ' = any(routes_serviced )
99
+ WHERE '{ route } ' = any(string_to_array(public.stop_features.routes_serviced_str, ',') )
100
100
AND city = '{ msa_id } '
101
101
GROUP BY { col }
102
102
"""
@@ -123,14 +123,14 @@ async def stops_on_route(cities: Union[List[str], None] = Query(default=None), r
123
123
routes_serviced
124
124
FROM public.stop_features
125
125
WHERE
126
- '{ routes [0 ]} '::text = ANY(routes_serviced )
126
+ '{ routes [0 ]} '::text = ANY(string_to_array(public.stop_features.routes_serviced_str, ',') )
127
127
AND
128
128
'{ cities [0 ]} ' = city
129
129
"""
130
130
131
131
for i in range (1 , len (cities )):
132
132
stops_query += f"""
133
- OR ('{ routes [i ]} '::text = ANY(routes_serviced ) AND '{ cities [i ]} ' = city)
133
+ OR ('{ routes [i ]} '::text = ANY(string_to_array(public.stop_features.routes_serviced_str, ',') ) AND '{ cities [i ]} ' = city)
134
134
"""
135
135
136
136
cursor .execute (stops_query )
@@ -149,7 +149,7 @@ async def get_all_available_routes():
149
149
150
150
routes_query = f"""
151
151
SELECT
152
- DISTINCT unnest(public.stop_features.routes_serviced ) AS route,
152
+ DISTINCT unnest(string_to_array( public.stop_features.routes_serviced_str, ',') ) AS route,
153
153
public.stop_features.route_type,
154
154
public.cities.msa_name,
155
155
public.stop_features.city as msa_id
0 commit comments