-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support incidents for OSRM responses #358
Conversation
00b5679
to
1520125
Compare
@@ -126,6 +133,7 @@ impl Route { | |||
step, | |||
step_geometry, | |||
annotation_slice, | |||
incident_items.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i need to fix this - this shouldn't be all the items, just the items relevant to this step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, but please see the discussion below for some trade-offs.
2d1161b
to
93b0995
Compare
@ianthetechie would appreciate your input here, since we have a few possible solutions that we were discussing internally, each with their set of pros and cons (we chose one of the solutions for this PR) - but want to know what you'd recommend. The ProblemMapbox's SDK emits Possible SolutionsIncidents on LegsKeep
Incidents on RoutesKeep
|
also, i am not sure why
|
Ahh... yeah, that's because of a (semi-controversial) CI step I added a while ago. I think it's annoying when CI rejects changes it can fix for you, so I added a step that runs swiftfmt (EDIT: And checks Package.swift for local development configurations and commits changes you forgot about in ferrostar.swift) and commits any changes rather than failing, but this just fails with a confusing error on cross-org forks 💀 I guess I'll probably revert that eventually and make the author push a fix. |
540e606
to
ad53720
Compare
This parses incidents on the OSRM response route leg, and splits the incidents across the corresponding route step. Since an incident may span multiple steps, this will duplicate an incident and adjust the indices accordingly whenever that happens. Clients can de-duplicate these if necessary based on the incident identifier.
ad53720
to
d1f1062
Compare
I updated the PR to use Also, took a look at TomTom's results - they have: {
"startPointIndex": 3,
"endPointIndex": 4,
"sectionType": "TRAFFIC",
"simpleCategory": "JAM",
"effectiveSpeedInKmh": 40,
"delayInSeconds": 158,
"magnitudeOfDelay": 1,
"tec": {
"effectCode": 4,
"causes": [
{
"mainCauseCode": 1
},
{
"mainCauseCode": 26,
"subCauseCode": 2
}
]
}
}, so while there are common points with the OSRM api, it's quite far from it, since that structure itself is in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... I agree with your assessment. Sorry it took me a while to get back to this; was buried in geocoding pipelines last week 😅
I think that we can go ahead and merge this + figure out any refinements/generalizations to the data models later once someone has a motivating use case. You're currently using Mapbox or a compatible API, and we would probably be doing the same at Stadia Maps. And since most things are optional, I think that we can go with the "superset" model approach and don't actually need the full dynamism that we built for annotations (annotations could be pretty arbitrary and use case-specific; incidents, not so much).
|
||
let incident: OsrmIncident = serde_json::from_str(data).expect("Failed to parse Incident"); | ||
|
||
// help me finish this test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify all this manual work with a snapshot test; I'll handle that real quick.
This parses incidents on the OSRM response route leg, and splits the
incidents across the corresponding route step. Since an incident may
span multiple steps, this will duplicate an incident and adjust the
indices accordingly whenever that happens. Clients can de-duplicate
these if necessary based on the incident identifier.