Draft
Conversation
| FullStopPair = namedtuple("FullStopPair", ["fr", "to", "fr_order", "to_order", "direction"]) | ||
|
|
||
|
|
||
| # TODO: We're using SlowZones data for now, we may want our own dataset or to rename the SlowZones dataset |
Contributor
There was a problem hiding this comment.
⚪ Code Quality Violation
Suggested change
| # TODO: We're using SlowZones data for now, we may want our own dataset or to rename the SlowZones dataset | |
| # TODO(<owner>): We're using SlowZones data for now, we may want our own dataset or to rename the SlowZones dataset |
comments must have ownership (...read more)
When using TODO or FIXME, specify who write the annotation. It's a best practice to remind you who created the annotation and have potential context and information about this issue.
| tts.set_index("date", inplace=True) | ||
|
|
||
| tts = (tts["50%"]).dropna() | ||
| tts = tts.rename("travel_time") |
Contributor
There was a problem hiding this comment.
|
|
||
| tts = (tts["50%"]).dropna() | ||
| tts = tts.rename("travel_time") | ||
| tts = tts.to_frame() |
Contributor
There was a problem hiding this comment.
| return tts | ||
|
|
||
| tts.columns = tts.columns.str.strip() | ||
| tts = tts.rename(columns={"service_date": "date"}) |
Contributor
There was a problem hiding this comment.
| tts["date"] = pd.to_datetime(tts["date"]).dt.date | ||
| tts.set_index("date", inplace=True) | ||
|
|
||
| tts = (tts["50%"]).dropna() |
Contributor
There was a problem hiding this comment.
|
|
||
|
|
||
| def download(key: str | pathlib.Path): | ||
| key = str(key) # in case it's a pathlib.Path |
Contributor
There was a problem hiding this comment.
| url = f"https://dashboard-api.labs.transitmatters.org/api/aggregate/traveltimes?from_stop={fr}&to_stop={to}&start_date={ago}&end_date={today}" | ||
| if verbose: | ||
| print(url) | ||
| resp = requests.get(url) |
Contributor
There was a problem hiding this comment.
🔴 Code Vulnerability
Suggested change
| resp = requests.get(url) | |
| resp = requests.get(url, timeout=5) |
timeout not defined (...read more)
Access to remote resources should always use a timeout and appropriately handle the timeout and recovery. When using requests.get, requests.put, requests.patch, etc. - we should always use a timeout as an argument.
Learn More
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order to build up transitmatters/t-performance-dash#1045, we need a median travel time for each station pair for the map
This stores the median travel time per day per time in DynamoDB