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

Date parsing/conversion #615

Closed
koeaw opened this issue Feb 8, 2024 · 4 comments
Closed

Date parsing/conversion #615

koeaw opened this issue Feb 8, 2024 · 4 comments
Labels
app-entities Anything to do with entities – the models central to an APIS app feature-request Request for adaptation of existing functionality or new feature question For any kind of question, whether about usage, contributing or the project in general

Comments

@koeaw
Copy link
Contributor

koeaw commented Feb 8, 2024

We need to introduce a date parsing mechanism to our project because some incoming date data does not (have to) follow strict formatting rules.

Given that the current DateParser.py code is old and convoluted – see also PR #125, which sadly didn't make it into the code base – should we continue to use this or is there a better solution?

We don't need very fancy date parsing, meaning we're currently only dealing with dates from the 20th century to now and incoming dates won't contain vague textual descriptions (e.g. "approx. 20-30 years B.C.") but will be number-based and use date formats/variations commonly used in AT (+ maybe ISO format). Examples: 1.5.1970, 02.04.85, 23/12/1999, 2024-01-01.

@koeaw koeaw added question For any kind of question, whether about usage, contributing or the project in general app-entities Anything to do with entities – the models central to an APIS app feature-request Request for adaptation of existing functionality or new feature labels Feb 8, 2024
@b1rger
Copy link
Contributor

b1rger commented Feb 8, 2024

I guess the date should be stored in a field and the original input string can be thrown away? You can use DateParser.py, but you might have better luck with dateparser

The advantage of DateParser.py is, that it calculates timespans of date (i.e. if you only know the year of a date), but that does not seem to be needed in this case

@koeaw
Copy link
Contributor Author

koeaw commented Feb 8, 2024

I guess the date should be stored in a field and the original input string can be thrown away?

Almost! We're planning to keep the original input strings around and editable by content managers and further updates/corrections to them should get propagated to the (non-editable) field for the streamlined date.

Hmm, we don't need to handle time spans per se, but ah, should have clarified above that we indeed will also have to deal with year-only dates. I'll look at dateparser to see if it can handle incomplete dates as well, thank you!

@koeaw
Copy link
Contributor Author

koeaw commented Feb 8, 2024

I'll look at dateparser to see if it can handle incomplete dates as well, thank you!

Yup, seems to be the case: https://dateparser.readthedocs.io/en/latest/introduction.html#incomplete-dates

@koeaw
Copy link
Contributor Author

koeaw commented Feb 12, 2024

Closing this as the question was answered. Thx, @b1rger!

@koeaw koeaw closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-entities Anything to do with entities – the models central to an APIS app feature-request Request for adaptation of existing functionality or new feature question For any kind of question, whether about usage, contributing or the project in general
Projects
None yet
Development

No branches or pull requests

2 participants