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

Add warning for features without start date #193

Merged
merged 6 commits into from
Mar 22, 2024

Conversation

pedromml
Copy link

@pedromml pedromml commented Mar 17, 2024

This PR adds the empty_start_date validation, that shows a warning on ID if a feature does not have start_date or start_date:edtf tags.
Features that have no tags do not get this warning, as they already have another.
Features that have the natural, waterway or water tags also don't get this warning, as these features usually lack a rigorous start date.
image

@1ec5 1ec5 linked an issue Mar 18, 2024 that may be closed by this pull request
Copy link
Member

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

You’re off to a good start!

data/core.yaml Outdated
title: Empty start date
feature:
message: "Start date shouldn't be empty"
reference: "Features should have a start date"
Copy link
Member

Choose a reason for hiding this comment

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

A reference should explain why the user should care about the validation warning. It appears below the warning as help text. This wiki documentation could be a good starting point, but it needs to be more concise here.

We could also use this opportunity to inform the user of the EDTF field, in case they don’t know the precise date. Mappers sometimes feel pressured to resolve warnings that pop up, but we would rather have start_date:edtf express a guesstimate than have an arbitrary value in start_date just to silence the warning. If you can think of a way to hook up a dynamic fix to open that field, that would be swell, but just mentioning it here would get the job done too.

Copy link
Author

Choose a reason for hiding this comment

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

I changed the text to explain the reason better. I also tried to add a dynamic fix to focus on the EDTF date field, but i couldn't figure out how. It can be done using document.getElementById(), but I believe that doesn't fit the project's style properly. There should be an easy way to do it using context.ui(), I will keep trying for a while

modules/validations/empty_start_date.js Outdated Show resolved Hide resolved
modules/validations/empty_start_date.js Outdated Show resolved Hide resolved
data/core.yaml Outdated Show resolved Hide resolved
data/core.yaml Outdated Show resolved Hide resolved
modules/validations/empty_start_date.js Outdated Show resolved Hide resolved
@1ec5
Copy link
Member

1ec5 commented Mar 21, 2024

Unfortunately, there’s a minor merge conflict in tags.js because #194 synchronized this fork with the upstream repository. The changes in openstreetmap/iD@9779f32 and openstreetmap#9424 are unrelated to the changes you’re making, so hopefully it’s a straightforward conflict to resolve, but let me know if you’d like more guidance on how to resolve it.

@1ec5
Copy link
Member

1ec5 commented Mar 22, 2024

#195 should address the unrelated test failures you’ve been running into. If you need to get around the failures in the meantime, you can temporarily cherry-pick the commits or modify this path to include only the specs you want to run. However, I recommend testing the full suite anyways, to avoid making the same mistakes I made.

Copy link
Member

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

Thanks for iterating on this PR. It’s in great shape now. Since we’ve been getting by without this warning for so long, there will be a lot of issues to fix. Some mappers may feel overwhelmed and ask us to make the rule more lenient, but I think this will be good motivation for the community to clean up the database. If it really becomes a problem, we can always tweak the rule in a separate PR.

data/core.yaml Outdated Show resolved Hide resolved
});

it('ignores way with start_date:edtf tag', function() {
createWay({ 'start_date:edtf': '1950' });
Copy link
Member

Choose a reason for hiding this comment

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

Eventually, we may decide to warn about a missing start_date in this case as well, since the map renderer doesn’t know anything about start_date:edtf yet. Typically, we’ve been considering start_date:edtf to be a complement to start_date rather than a replacement for it. However, I think what you have currently is correct. I also made the same assumption in #188: the suggested fix for that warning only sets start_date:edtf but not start_date.

modules/osm/tags.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants