Example #1
0
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
Example #2
0
def is_newborn(case):
    return is_pregnant_mother(case) and (
        is_recently_delivered(case)
        or get_related_prop(case, 'birth_status') == "live_birth"
    )
Example #3
0
 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
Example #4
0
 def live_birth(self, case):
     return (
         get_related_prop(case, 'birth_status') == "live_birth" or
         get_related_prop(case, 'where_born') is not None
     )