Skip to main content

AtoM Event Date Parser

Date parser for eventDates, eventStartDates, eventEndDates in AtoM CSV templates.

Installation

Install with pip from PyPi:

pip install atomdateparser

Usage

Use the EventDateParser class to parse dates. When possible, the Event date parser will try to construct a start and an end date for the given date, as opposed to parsing a single date for the specified date, as most date parsers do.

from atomdateparser.parser import EventDateParser

parser = EventDateParser(
    unknown_date='Date Unknown',
    unknown_start_date='2000-01-01',
    unknown_end_date='2010-01-01',
    timid=True,
    dateparser_kwargs={
        'languages': ['en', 'fr'],
        'settings': {
            'PREFER_DAY_OF_MONTH': 'first',
            'PREFER_DATES_FROM': 'past',
        }
    },
)

parsed = parser.parse_event_dates('Circa 2001')

''' Returns:
{
    'eventDates': '2001',
    'eventStartDates': '2001-01-01',
    'eventEndDates': '2001-12-31',
}
'''

EventDateParser Options

  • unknown_date: The text to return for eventDates when the date is not known
  • unknown_start_date: The date to return for eventStartDates when the date is not known
  • unknown_end_date: The date to return for eventEndDates when the date is not known
  • timid: True if an exception should be thrown if the entire date cannot be parsed, or False if no date could be found, and no year could be found from the date being parsed. Note that if timid is False, some date information may be lost.
  • dateparser_kwargs: The dateparser library is used as a fallback method to parse the input date in the event that none of the other date parsing handlers are able to parse the date. Controlling dateparser is done using this keyword argument. Keyword arguments are passed to dateparser.parse(). For more information, visit dateparser on GitHub or visit the dateparser settings docs.

Metadata

Release files for atomdateparser 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atomdateparser 0.0.2
File Size Uploaded Provenance
atomdateparser-0.0.2.tar.gz 13.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for atomdateparser 0.0.2
File Interpreter ABI Platform
atomdateparser-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / atomdateparser-0.0.2.tar.gz

Download URL atomdateparser-0.0.2.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7c9673d8c865d71bc83f0725a97364f63892f059f71e09725dd2f8980676044e
BLAKE2b-256 checksum
How to use checksums
8601302e762d87fab5da995a409d99879ecf973e44d4c2f8bdc779ee951533e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / atomdateparser-0.0.2-py3-none-any.whl

Download URL atomdateparser-0.0.2-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c9228dee37128186f6dd554a5ef0d622cae2e68d8cbfabdd74d12f557840e0b
BLAKE2b-256 checksum
How to use checksums
59d5cdc994c79f54b30daa90a50b592731b4a14fee8f77e0d9216abf5fa65af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for atomdateparser 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page