-
Notifications
You must be signed in to change notification settings - Fork 83
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
Construction check #358
Construction check #358
Conversation
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.
This looks pretty good, I just had a few comments. The configurable time values are great.
// 1 January 2020 | ||
DateTimeFormatter.ofPattern("d MMMM yyyy")); | ||
private static final LocalDate TODAYS_DATE = LocalDate.now(); | ||
private static final List<String> DATE_TAGS = Arrays.asList("opening_date", "open_date", |
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.
It would be great if these could be added as tag classed here.
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.
Waiting on this: osmlab/atlas#679
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 didn't add "date_on" because it has no mention of it in the OSM wiki, should it still be included?
private static final LocalDate TODAYS_DATE = LocalDate.now(); | ||
private static final List<String> DATE_TAGS = Arrays.asList("opening_date", "open_date", | ||
"construction:date", "temporary:date_on", "date_on"); | ||
private static final List<String> CONSTRUCTION_TAGS = List.of("highway", "landuse", "building"); |
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.
private static final List<String> CONSTRUCTION_TAGS = List.of("highway", "landuse", "building"); | |
private static final List<String> CONSTRUCTION_TAGS = List.of(HighwayTag.KEY.toString(), LandUseTag.KEY.toString(), BuildingTag.KEY.toString()); |
private boolean isConstruction(final Map<String, String> tags) | ||
{ | ||
return tags.keySet().stream() | ||
.anyMatch(tag -> tag.equals("construction") |
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.
.anyMatch(tag -> tag.equals("construction") | |
.anyMatch(tag -> tag.equals(ConstructionTag.KEY.toString()) |
or if you pass in the atlas object:
.anyMatch(tag -> tag.equals("construction") | |
.anyMatch(tag -> Validators.hasValueFor(object, ConstructionTag.class) |
return Optional | ||
.of(createFlag(object, this.getLocalizedInstruction(0, dateTag.get()))); |
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.
If the object is an Edge we will want to flag all the master edges with the same OSM ID (see InvalidTagsCheck for an example).
df92d3f
to
9763668
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
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.
Looks good to me!
@@ -189,6 +189,16 @@ | |||
"tags": "highway" | |||
} | |||
}, | |||
"ConstructionCheck": { | |||
"oldConstructionDays": 730.0, |
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.
Just curious - whats the reasoning behind these values? Is 2 years a recommend length of time for checking these highways?
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.
Osmose uses 2 years as the limit for something to have been in construction when no date tags are available
https://github.com/osm-fr/osmose-backend/blob/master/plugins/Construction.py#L36
And the 6 month check_date was also from their check, though someone would have to update the check_date each time it gets flagged instead of marking as false positive:
https://github.com/osm-fr/osmose-backend/blob/master/plugins/Construction.py#L98
* String representation of a date from a tag. | ||
* @return the parsed date. | ||
*/ | ||
private Optional<LocalDate> parseDate(final String tagDate) |
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.
This could be useful in atlas 😄
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.
Looks good
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.
LGTM! 👍
4070 ConstructionCheck
Description
This check checks if a features construction tag has not been updated for more than 2 years or the opening date has been exceeded.
Test Results
Yes, DMA did only have one flagged object.
Also tested on CMY but had no results.
Resolves #353