compass.utilities.parsing.extract_ord_year_from_doc_attrs#
- extract_ord_year_from_doc_attrs(doc_attrs)[source]#
Extract the ordinance year stored in document attributes
- Parameters:
doc_attrs (
dict) – Document meta information about the jurisdiction. Must have a “date” key in the attrs that is a tuple corresponding to the (year, month, day) of the ordinance to extract year successfully. If this key is missing, this function returnsNone.- Returns:
intorNone– Parsed ordinance year orNonewhen unavailable or invalid.
Examples
>>> extract_ord_year_from_doc_attrs({"date": (2024, 5, 17)}) 2024 >>> extract_ord_year_from_doc_attrs({"date": (None, None, None)}) None