Iso date
DateTerm
Bases: BaseModel
Model for Date terms with format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_term
|
str
|
Term to run method on. |
required |
format
|
str
|
Format of the date. |
'%Y-%m-%dT%H:%M:%SZ'
|
output_key
|
str
|
Key to output to. |
'datetime'
|
Source code in extraction_methods/plugins/iso_date.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
ISODateExtract
Bases: ExtractionMethod
Takes the source dict and the key to access the date and converts the date to ISO 8601 Format.
e.g.
YYYY-MM-DDTHH:MM:SS.ffffff, if microsecond is not 0
YYYY-MM-DDTHH:MM:SS, if microsecond is 0
If the date format cannot be parsed, it is removed from the source dict with an error logged.
Method name: iso_date
Example Configuration
.. code-block:: yaml
- method: iso_date
inputs:
dates:
- key: $datetime
output_key: date
format: "%Y-%m-%dT%H:%M:%S"
- key: 2012-12-12
format: "%Y-%m-%d"
Source code in extraction_methods/plugins/iso_date.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
ISODateInput
Bases: Input
Model for ISO Date Input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_terms
|
list[DateTerm]
|
List of date terms. |
[]
|
Source code in extraction_methods/plugins/iso_date.py
40 41 42 43 44 45 46 47 48 | |