def _get_tob(case): # only guaranteed to be accurate within 24 hours import couchdbkit tob = get_related_prop(case, "time_of_birth") or '00:00:00' tob = couchdbkit.schema.TimeProperty().to_python(tob) tob = datetime.datetime.combine(get_add(case), tob) # convert date to dt.datetime return tob
def numerator(self, case): dtf = _get_prop_from_forms(case, 'date_time_feed') tob = get_related_prop(case, 'time_of_birth') if dtf and tob: if dtf - tob <= datetime.timedelta(hours=1): yield case.add
def live_birth(self, case): return ( get_related_prop(case, 'birth_status') == "live_birth" or get_related_prop(case, 'where_born') is not None )
def is_newborn(case): return is_pregnant_mother(case) and ( is_recently_delivered(case) or get_related_prop(case, 'birth_status') == "live_birth" ) and get_add(case)