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

Construction check #358

Merged
merged 17 commits into from
Oct 7, 2020
Merged

Construction check #358

merged 17 commits into from
Oct 7, 2020

Conversation

brianjor
Copy link
Collaborator

@brianjor brianjor commented Sep 8, 2020

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

Country Total Objects Checked False Positives FP %
AUS 120 0 0%
TUR 120 0 0%
NZL 137 0 0%
DMA 1 0 0%

Yes, DMA did only have one flagged object.
Also tested on CMY but had no results.

Resolves #353

@brianjor brianjor marked this pull request as ready for review September 11, 2020 19:53
Copy link
Collaborator

@Bentleysb Bentleysb left a 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",
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.anyMatch(tag -> tag.equals("construction")
.anyMatch(tag -> tag.equals(ConstructionTag.KEY.toString())

or if you pass in the atlas object:

Suggested change
.anyMatch(tag -> tag.equals("construction")
.anyMatch(tag -> Validators.hasValueFor(object, ConstructionTag.class)

Comment on lines 123 to 124
return Optional
.of(createFlag(object, this.getLocalizedInstruction(0, dateTag.get())));
Copy link
Collaborator

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).

@danielduhh danielduhh added the new integrity check Any new Integrity Check label Sep 22, 2020
@sonarcloud
Copy link

sonarcloud bot commented Oct 1, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

90.4% 90.4% Coverage
0.0% 0.0% Duplication

Copy link
Collaborator

@danielduhh danielduhh left a 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,
Copy link
Collaborator

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?

Copy link
Collaborator Author

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)
Copy link
Collaborator

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 😄

Copy link
Collaborator

@Bentleysb Bentleysb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Collaborator

@sayas01 sayas01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@ameliaewatts ameliaewatts merged commit ca31530 into osmlab:dev Oct 7, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new integrity check Any new Integrity Check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConstructionCheck (Osmose 4070)
5 participants