-
Notifications
You must be signed in to change notification settings - Fork 0
Warnings feature - configuration part #5
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
base: add-warnings
Are you sure you want to change the base?
Conversation
… identifiers by BExpression
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.
Brouter is unknown code base to me ... thus giving only some generic code style ideas / questions.
// ... | ||
// ---context:node | ||
// assign warnings = identifier1&identifier2&identifier3 | ||
String[] samples = new String[]{null, "", " ", " ", " w", " w ", "w1&w2", " w1&w2 ", " w1&w1 ", "&&&", " &", "& & & ", "&w1&", "w1,w2", "walk-hike.difficult.very"}; |
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.
For better readability it would be nice to have input and expected output closer together. E.g. using list of Pair
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.
Will do!
.collect(Collectors.groupingBy(this::isValidWarningToken)); | ||
List<String> invalid = validityGroups.get(false); | ||
if (invalid != null) { | ||
System.out.println("Invalid warning identifier(s): " + invalid); |
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.
Is this standard approach to log? ... no logging system used at all? :)
// Always returns a set, maybe an empty set | ||
public Set<String> parseWarnings() { | ||
if (warnings == null) { | ||
return new HashSet<>(); |
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.
[minor] Probably no need to create new instance? Collections.emptySet()
.of(warnings.split(WARNINGS_DELIMITERS_REGEX_PATTERN)) | ||
.collect(Collectors.groupingBy(this::isValidWarningToken)); | ||
List<String> invalid = validityGroups.get(false); | ||
if (invalid != null) { |
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.
Is it desired to continue processing if warning rule is invalid?
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 want to continue. Another question is: Do we need validation of warning identifiers at all? Explanation: We say for example assign warnings = walk.danger.exposure&walk.danger.slippery&walk.access.seasonal. This or similar expression is hard-coded in many profile files. Now we find there is an error in (possibly complex) implementation of seasonal access warning functionality. Here we can disable warnings for seasonal access all at once. (Ignore it, but log it). That was my reasoning.
Sorry for the delay but please be patient and let us go step by step. You placed some warning definitions into the sample profile. So at the end you have two sets of warnings.
I guess you like to add the warnings conditional way by way? Something like
What happens on negative value? Do you add an else part?
Conditional placement doesn't work at the moment, is that correct? |
Yes, some explanation is needed. My fault, my apology.
Thanks to your attention, I may be slower to respond this week (off work), but i will. |
Thanks for the clearing.
As calling client you know what you want to see as warnings. You don't have to place it all around the profile. Your samples contains a lot of conditional tag - that is not part of the lookups.dat at the moment. So please lets discuss the easy/used tags for now. We will not forget the conditional tags.
Yes
That is the way it could go. But not in the moment, currently 'only' floating point values are possible. One more comment: Please see this little step sample I do this in my AFTrack - nearly the sample above. |
Thanks for the suggestions. We do use geojson export. Parsing it client side is something we considered. But the problem is we need to serve 3 client side platforms plus one offline routing solution - so there would have to be 3 versions of a possibly complex functionality, or some multi-platform solution. Also i don't like the notion of configuration being the responsibility of client. (There would have to be 3 tables saying "for walking, warn about this, this, this", all kept in sync with some source of parent-truth). Not a good separation of concern imho. However, there is another way how to achieve what we need without changing brouter code: A proxy or a wrapper, working directly with computed OSMTrack server-side, managing all needed configurations. I will stop developing the solution suggested here for now and explore the other way. Thanks. |
Ok, did you try the csv export in this case? |
Hello all, this is how I approach the feature of warnings: Here is the configuration part:
Here is a simple flowchart explaining how data flow from the low-level BExpression upwards to RoutingContext
I assume there will be specific talks so I keep this intro simple.