augur.util_support.date_disambiguator module

class augur.util_support.date_disambiguator.DateDisambiguator(uncertain_date, fmt='%Y-%m-%d', min_max_year=None)

Bases: object

Transforms a date string with uncertainty into the range of possible dates.


Raise an exception if a constrained digit appears in a less-significant place than an uncertain digit.

Assuming %Y-%m-%d, these patterns are valid:

2000-01-01 2000-01-XX 2000-XX-XX

but this is invalid, because month is uncertain but day is constrained:


These invalid cases are assumed to be unintended use of the tool.

property fmt_components
property regex

Returns regex defined by the format string. Currently only supports %Y, %m, and %d.

property uncertain_date_components
augur.util_support.date_disambiguator.max_day_for_year_month(year, month)
augur.util_support.date_disambiguator.resolve_uncertain_int(uncertain_string, min_or_max)

Takes a string representation of an integer with uncertain places occupied by the character X. Returns the minimum or maximum possible integer.

augur.util_support.date_disambiguator.tuple_to_date(year, month, day)