Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests to arrival time algorithms #403

Open
Eochs opened this issue Nov 7, 2019 · 3 comments
Open

Add unit tests to arrival time algorithms #403

Eochs opened this issue Nov 7, 2019 · 3 comments
Labels
Backend Python and API stuff Data Science Pandas, Numpy, Scipy, and Jupyter stuff

Comments

@Eochs
Copy link
Contributor

Eochs commented Nov 7, 2019

Add tests to "data science" functions to allow newcomers to get better grasp of what functions are doing, shape of data input/output, and to allow easier changing/fixing of functions.

Functions to test are in:
backend/models/eclipses.py
backend/models/wait_times.py
backend/models/trip_times.py

Any questions about the functions or data should be directed to @youngj (Jesse Young on Slack).

@Eochs Eochs added Good First Issue Good for newcomers Data Science Pandas, Numpy, Scipy, and Jupyter stuff labels Nov 7, 2019
@Eochs Eochs added PDX Portland Team and removed PDX Portland Team labels Nov 7, 2019
@jimtyhurst
Copy link

For example, there should be a unit test for find_arrivals in eclipses.py to verify the algorithm works correctly when a vehicle goes two directions on a street during one run of a route. There needs to be test data like for the SF Muni 39-Coit line which runs east, then west on Union Street when inbound to Fisherman's Wharf. The problem is that currently a westbound bus might be associated with an eastbound stop when calculating an arrival time. This error is visible in the UI where the Travel time along route plot is discontinuous with some decreasing sections. Whereas for other "normal" routes without any backtracking along the route, the plot is non-decreasing. It would be great if we could replicate this type of backtracking scenario in a unit test of find_arrivals to verify that it handles these conditions correctly.

@exxonvaldez
Copy link
Contributor

Another interesting test case is the SF Muni 29 Sunset inbound. The Gilman and 3rd St stop is so close to the starting stop that no complete trips on the route are recorded. Notice the absence of speed data going into Gilman and 3rd St.

Screen Shot 2019-11-26 at 4 58 01 PM

@katrinasperry katrinasperry removed the Good First Issue Good for newcomers label Jan 16, 2020
@youngj
Copy link
Contributor

youngj commented Feb 22, 2020

Some routes that would be good to have unit tests for:

  • TriMet route 50 (figure 8 loop)
  • Muni 36-Teresita (optional Myra Way branch that is sometimes bypassed)
  • Muni 39-Coit (contains backtracking and twisty segments)
  • Portland Streetcar B Loop (11th and Marshall terminal close to 10th and Northrup stop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Python and API stuff Data Science Pandas, Numpy, Scipy, and Jupyter stuff
Projects
None yet
Development

No branches or pull requests

6 participants