cal-itp / data-infra

Cal-ITP data infrastructure
https://docs.calitp.org/data-infra
GNU Affero General Public License v3.0
47 stars 12 forks source link

Bug: LA Metro Rail Routes not present in tbl.gtfs_schedule #837

Closed edasmalchi closed 2 years ago

edasmalchi commented 2 years ago

Describe the bug LA Metro's rail services don't appear in any tbl.gtfs_schedule view

To Reproduce

rail_routes = (tbl.gtfs_schedule.routes()
               >> filter((_.route_type == '0') |  ## light rail
                        (_.route_type == '1') |   ## heavy rail
                        (_.route_type == '2'))    ## commuter/intercity rail
               >> filter(_.calitp_itp_id == 182) ## LA Metro
               >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)
               >> collect()
              )
blue_line_trips = (tbl.gtfs_schedule.trips() 
    >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.trip_id)
    >> filter(_.calitp_itp_id == 182) ## LA Metro
    >> filter(_.route_id == '801') ## Metro A Line (Blue) LRT
    >> collect()
)

(both queries return an empty df)

Expected behavior Rail routes query returning a df with a row for each LA Metro rail service (6 in total)

Trips query returning a df with a row for each Metro A Line (Blue) trip

Additional context

This may have something to do with LA Metro bus and rail service being two separate feeds -- it seems like we've assigned the bus feed calitp_url_number == 0 and the rail feed calitp_url_number == 1 but the rail feed doesn't seem to make it into tbl.gtfs_schedule?

The equivalent query on tbl.views.gtfs_schedule_dim_routes() does return rail route data.

rail_routes = (tbl.views.gtfs_schedule_dim_routes()
               >> filter((_.route_type == '0') |
                        (_.route_type == '1') |
                        (_.route_type == '2'))
               >> filter(_.calitp_itp_id == 182)
               >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)
               >> collect()
              )
edasmalchi commented 2 years ago

Fixed by PR 872