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

Suggest converting OSM approximate date to EDTF #188

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

1ec5
Copy link
Member

@1ec5 1ec5 commented Dec 17, 2023

Detect an OSM approximate date pattern and suggest a fix to replace it with an EDTF tag.

Tag as c. 1833 1833~

Fixes OpenHistoricalMap/issues#547 and fixes OpenHistoricalMap/issues#657. Depends on #187.

@1ec5 1ec5 self-assigned this Dec 17, 2023
@1ec5 1ec5 force-pushed the 1ec5-date-validate-edtf-657 branch from f5ff76f to 5d0bf09 Compare December 18, 2023 06:45
let end;
[match, end] = osm.match(/^before (\d{4}(?:-\d\d)?(?:-\d\d)?)$/) || [];
if (match) {
return `[..${end}]`;
Copy link
Member Author

Choose a reason for hiding this comment

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

Based on OpenHistoricalMap/issues#547 (comment), I’ve been going with the set notation in EDTF level 2 instead of the extended interval notation in EDTF level 1. However, EDTF.js rejects qualifiers in sets, which prevents us from translating early/mid/late modifiers with approximation qualifiers. Academic systems such as the Bayou City DAMS apparently rely on approximation in intervals for this purpose.

@1ec5 1ec5 marked this pull request as ready for review December 19, 2023 18:28
@1ec5
Copy link
Member Author

1ec5 commented Dec 19, 2023

This is ready for review. I’ve added conversions for all the patterns listed in this documentation with the exception of the j: and jd: namespaces for Julian dates and day numbers. I’ll split out the calendrical notations as a separate task, since we may want to coin a new key to store the original date as specified in the source.

Between this documentation and the original proposal, there are a number of underspecified edge cases, which I’ve left out of the conversion code for simplicity. The openstreetmap-date-parser is somewhat more robust in the combinations of notations that it supports. Down the line, I’d like to integrate this functionality with that library (as long as @plepe is open to it) instead of maintaining the conversions here. That will benefit OSM as well as OHM.

Also moved date utilities to a separate file.
@1ec5 1ec5 force-pushed the 1ec5-date-validate-edtf-657 branch from d19635b to 4d5cb19 Compare December 19, 2023 18:40
Base automatically changed from 1ec5-edtf-fields-645 to staging December 20, 2023 22:28
@erictheise erictheise merged commit 74c9bcf into staging Dec 20, 2023
2 checks passed
@erictheise erictheise deleted the 1ec5-date-validate-edtf-657 branch December 20, 2023 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iD should warn about OSM approximate date format Approximative dates in start_date tag are not working
2 participants