def _expecting_soon(case): return is_pregnant_mother(case) and get_edd(case) and _in_timeframe(case.edd, -30)
def _mother_due_in_window(case, days): get_visitduedate = lambda case: case.edd - dt.timedelta(days=days) + GRACE_PERIOD return is_pregnant_mother(case) and get_edd(case) and _in_last_month(get_visitduedate(case))
def sortkey(self): return lambda case: get_edd(case) or dt.datetime.max.date()