<s> from datetime import date , timedelta <EOL> import re <EOL> from corehq . apps . reports . standard . cases . data_sources import CaseDisplay <EOL> from casexml . apps . case . models import CommCareCase <EOL> from django . utils . translation import ugettext as _ <EOL> import logging <EOL> from corehq . util . dates import iso_string_to_datetime <EOL> from custom . bihar . calculations . utils . xmlns import BP , NEW , MTB_ABORT , DELIVERY , REGISTRATION , PNC <EOL> from couchdbkit . exceptions import ResourceNotFound <EOL> from corehq . apps . users . models import CommCareUser , CouchUser <EOL> EMPTY_FIELD = "<STR_LIT>" <EOL> def get_property ( dict_obj , name , default = None ) : <EOL> if name in dict_obj : <EOL> if type ( dict_obj [ name ] ) is dict : <EOL> return dict_obj [ name ] [ "<STR_LIT>" ] <EOL> return dict_obj [ name ] <EOL> else : <EOL> return default if default is not None else EMPTY_FIELD <EOL> class MCHDisplay ( CaseDisplay ) : <EOL> def __init__ ( self , report , case ) : <EOL> try : <EOL> self . user = CommCareUser . get_by_user_id ( case [ "<STR_LIT>" ] ) <EOL> if self . user is None : <EOL> self . user = CommCareUser . get_by_user_id ( case [ "<STR_LIT>" ] ) <EOL> except CouchUser . AccountTypeError : <EOL> self . user = None <EOL> if self . user : <EOL> setattr ( self , "<STR_LIT>" , get_property ( self . user . user_data , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , self . user . full_name if get_property ( self . user . user_data , "<STR_LIT>" ) . upper ( ) == "<STR_LIT>" else get_property ( self . user . user_data , "<STR_LIT>" ) ) <EOL> if get_property ( self . user . user_data , "<STR_LIT>" ) . upper ( ) == "<STR_LIT>" : <EOL> setattr ( self , "<STR_LIT>" , self . user . default_phone_number if self . user . default_phone_number else EMPTY_FIELD ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , get_property ( self . user . user_data , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , "<STR_LIT>" % ( get_property ( self . user . user_data , "<STR_LIT>" ) , get_property ( self . user . user_data , "<STR_LIT>" ) ) ) <EOL> setattr ( self , "<STR_LIT>" , self . user . full_name if get_property ( self . user . user_data , "<STR_LIT>" ) . upper ( ) == "<STR_LIT>" else get_property ( self . user . user_data , "<STR_LIT>" ) ) <EOL> if get_property ( self . user . user_data , "<STR_LIT>" ) . upper ( ) == "<STR_LIT>" : <EOL> setattr ( self , "<STR_LIT>" , self . user . phone_numbers [ <NUM_LIT:0> ] if len ( self . user . phone_numbers ) > <NUM_LIT:0> else EMPTY_FIELD ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , get_property ( self . user . user_data , "<STR_LIT>" ) ) <EOL> super ( MCHDisplay , self ) . __init__ ( report , case ) <EOL> @ property <EOL> def village ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def asha_name ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def asha_number ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def awc_code_name ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def aww_name ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def aww_number ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def chw_name ( self ) : <EOL> if self . user : <EOL> return "<STR_LIT>" % ( self . user . username , self . user . full_name ) <EOL> else : <EOL> return _ ( "<STR_LIT>" ) <EOL> @ property <EOL> def home_sba_assist ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def caste ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> def parse_date ( self , date_string ) : <EOL> if date_string != EMPTY_FIELD and date_string != '<STR_LIT>' and date_string is not None : <EOL> try : <EOL> return str ( self . report . date_to_json ( iso_string_to_datetime ( date_string ) ) ) <EOL> except AttributeError : <EOL> return _ ( "<STR_LIT>" ) <EOL> except TypeError : <EOL> return _ ( "<STR_LIT>" ) <EOL> else : <EOL> return EMPTY_FIELD <EOL> class MCHMotherDisplay ( MCHDisplay ) : <EOL> def __init__ ( self , report , case_dict ) : <EOL> case = CommCareCase . get ( case_dict [ "<STR_LIT>" ] ) <EOL> forms = case . get_forms ( ) <EOL> jsy_beneficiary = None <EOL> jsy_money = None <EOL> pnc_on_time_statuses = [ ] <EOL> for form in forms : <EOL> form_dict = form . form <EOL> form_xmlns = form_dict [ "<STR_LIT>" ] <EOL> if NEW in form_xmlns : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> elif DELIVERY in form_xmlns : <EOL> if get_property ( form_dict , "<STR_LIT>" ) != '<STR_LIT>' : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> if '<STR_LIT>' in form_dict and '<STR_LIT>' in form_dict [ '<STR_LIT>' ] : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] , "<STR_LIT>" ) ) <EOL> jsy_money = get_property ( form_dict , "<STR_LIT>" ) <EOL> children_count = int ( get_property ( form_dict , "<STR_LIT>" , <NUM_LIT:0> ) ) <EOL> if children_count == <NUM_LIT:0> : <EOL> setattr ( self , "<STR_LIT>" , '<STR_LIT>' ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , children_count ) <EOL> child_list = [ ] <EOL> if children_count == <NUM_LIT:1> and "<STR_LIT>" in form_dict : <EOL> child_list . append ( form_dict [ "<STR_LIT>" ] ) <EOL> elif children_count > <NUM_LIT:1> and "<STR_LIT>" in form_dict : <EOL> child_list = form_dict [ "<STR_LIT>" ] <EOL> for idx , child in enumerate ( child_list ) : <EOL> case_child = { } <EOL> if "<STR_LIT>" in child : <EOL> case_child = CommCareCase . get ( child [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) <EOL> setattr ( self , "<STR_LIT>" % ( idx + <NUM_LIT:1> ) , str ( get_property ( child , "<STR_LIT>" ) ) ) <EOL> setattr ( self , "<STR_LIT>" % ( idx + <NUM_LIT:1> ) , get_property ( child , "<STR_LIT>" ) ) <EOL> if case_child : <EOL> setattr ( self , "<STR_LIT>" % ( idx + <NUM_LIT:1> ) , get_property ( case_child , "<STR_LIT:name>" ) ) <EOL> setattr ( self , "<STR_LIT>" % ( idx + <NUM_LIT:1> ) , get_property ( case_child , "<STR_LIT>" ) ) <EOL> elif REGISTRATION in form_xmlns : <EOL> jsy_beneficiary = get_property ( form_dict , "<STR_LIT>" ) <EOL> elif PNC in form_xmlns : <EOL> child_list = [ ] <EOL> if isinstance ( form_dict [ "<STR_LIT>" ] , list ) : <EOL> child_list . extend ( form_dict [ "<STR_LIT>" ] ) <EOL> else : <EOL> child_list . append ( form_dict [ "<STR_LIT>" ] ) <EOL> for child in child_list : <EOL> pnc_on_time_status = None <EOL> if ( get_property ( child , '<STR_LIT>' ) == '<STR_LIT:yes>' or get_property ( child , '<STR_LIT>' ) == '<STR_LIT:yes>' ) and get_property ( child , '<STR_LIT>' ) == '<STR_LIT:yes>' : <EOL> pnc_on_time_status = '<STR_LIT:yes>' <EOL> else : <EOL> pnc_on_time_status = '<STR_LIT>' <EOL> pnc_on_time_statuses . append ( pnc_on_time_status ) <EOL> elif BP in form_xmlns : <EOL> if "<STR_LIT>" in form_dict : <EOL> bp = form_dict [ "<STR_LIT>" ] <EOL> for i in range ( <NUM_LIT:1> , <NUM_LIT:5> ) : <EOL> if "<STR_LIT>" % i in bp : <EOL> anc = bp [ "<STR_LIT>" % i ] <EOL> if "<STR_LIT>" % i in anc : <EOL> if anc [ "<STR_LIT>" % i ] == '<STR_LIT>' : <EOL> anc [ "<STR_LIT>" % i ] = '<STR_LIT>' <EOL> setattr ( self , "<STR_LIT>" % i , anc [ "<STR_LIT>" % i ] ) <EOL> if "<STR_LIT>" % i in anc : <EOL> setattr ( self , "<STR_LIT>" % i , str ( anc [ "<STR_LIT>" % i ] ) ) <EOL> if "<STR_LIT>" % i in anc and i == <NUM_LIT:1> : <EOL> setattr ( self , "<STR_LIT>" , anc [ "<STR_LIT>" % i ] ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( bp , "<STR_LIT>" ) ) <EOL> if "<STR_LIT>" in form_dict : <EOL> bp = form_dict [ "<STR_LIT>" ] <EOL> setattr ( self , "<STR_LIT>" , get_property ( bp , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> elif MTB_ABORT in form_xmlns : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> if jsy_beneficiary is not None and jsy_beneficiary != EMPTY_FIELD : <EOL> setattr ( self , "<STR_LIT>" , jsy_beneficiary ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , jsy_money ) <EOL> if len ( pnc_on_time_statuses ) > <NUM_LIT:0> : <EOL> if '<STR_LIT:yes>' in pnc_on_time_statuses : <EOL> setattr ( self , "<STR_LIT>" , '<STR_LIT:yes>' ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , '<STR_LIT>' ) <EOL> super ( MCHMotherDisplay , self ) . __init__ ( report , case_dict ) <EOL> @ property <EOL> def mother_name ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def husband_name ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def ward_number ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def mobile_number ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def mobile_number_whose ( self ) : <EOL> number = get_property ( self . case , "<STR_LIT>" ) <EOL> if re . match ( r"<STR_LIT>" , number ) : <EOL> r = re . compile ( r"<STR_LIT>" , re . IGNORECASE ) <EOL> return r . sub ( "<STR_LIT>" , number ) <EOL> else : <EOL> return number <EOL> @ property <EOL> def mcts_id ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def dob_age ( self ) : <EOL> if "<STR_LIT>" in self . case and self . case [ "<STR_LIT>" ] : <EOL> try : <EOL> mother_dob = self . case [ "<STR_LIT>" ] <EOL> if type ( mother_dob ) is dict : <EOL> mother_dob = mother_dob [ "<STR_LIT>" ] <EOL> days = ( date . today ( ) - CaseDisplay . parse_date ( self , mother_dob ) . date ( ) ) . days <EOL> mother_dob = self . parse_date ( mother_dob ) <EOL> return "<STR_LIT>" % ( mother_dob , days / <NUM_LIT> ) <EOL> except AttributeError : <EOL> return _ ( "<STR_LIT>" ) <EOL> else : <EOL> return EMPTY_FIELD <EOL> @ property <EOL> def lmp ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def edd ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def anc_date_1 ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def anc_date_2 ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def anc_date_3 ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def anc_date_4 ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def tt1_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def tt2_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def tt_booster ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def ifa_tablets ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def add ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def first_pnc_time ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def status ( self ) : <EOL> return get_property ( self . case , "<STR_LIT:status>" ) <EOL> @ property <EOL> def jsy_beneficiary ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def delivery_nature ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def discharge_date ( self ) : <EOL> return self . parse_date ( str ( getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) ) ) <EOL> @ property <EOL> def jsy_money_date ( self ) : <EOL> return self . parse_date ( str ( getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) ) ) <EOL> @ property <EOL> def delivery_complications ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def family_planning_type ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def anemia ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def complications ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def rti_sti ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def abortion_type ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def blood_pressure_1 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def blood_pressure_2 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def blood_pressure_3 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def blood_pressure_4 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def weight_1 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def weight_2 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def weight_3 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def weight_4 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def hemoglobin ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def anc_completed ( self ) : <EOL> lmp = self . lmp <EOL> anc_date_1 = self . anc_date_1 <EOL> if lmp != EMPTY_FIELD and anc_date_1 != EMPTY_FIELD : <EOL> try : <EOL> return _ ( "<STR_LIT:yes>" ) if CaseDisplay . parse_date ( self , self . anc_date_1 ) < ( CaseDisplay . parse_date ( self , self . lmp ) + timedelta ( days = <NUM_LIT:12> * <NUM_LIT:7> ) ) else _ ( "<STR_LIT>" ) <EOL> except AttributeError : <EOL> return _ ( "<STR_LIT>" ) <EOL> else : <EOL> return EMPTY_FIELD <EOL> @ property <EOL> def all_pnc_on_time ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def num_children ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def case_name_1 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def case_name_2 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def case_name_3 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def case_name_4 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def gender_1 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def gender_2 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def gender_3 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def gender_4 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def first_weight_1 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def first_weight_2 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def first_weight_3 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def first_weight_4 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def breastfed_hour_1 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def breastfed_hour_2 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def breastfed_hour_3 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def breastfed_hour_4 ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> class MCHChildDisplay ( MCHDisplay ) : <EOL> def __init__ ( self , report , case_dict ) : <EOL> if len ( case_dict [ "<STR_LIT>" ] ) > <NUM_LIT:0> : <EOL> try : <EOL> parent_case = CommCareCase . get ( case_dict [ "<STR_LIT>" ] [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) <EOL> forms = parent_case . get_forms ( ) <EOL> parent_json = parent_case . case_properties ( ) <EOL> setattr ( self , "<STR_LIT>" , "<STR_LIT>" % ( get_property ( parent_json , "<STR_LIT>" ) , get_property ( parent_json , "<STR_LIT>" ) ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( parent_json , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( parent_json , "<STR_LIT>" ) ) <EOL> setattr ( self , "<STR_LIT>" , get_property ( parent_case , '<STR_LIT>' ) ) <EOL> number = get_property ( parent_case , "<STR_LIT>" ) <EOL> if re . match ( r"<STR_LIT>" , number ) : <EOL> r = re . compile ( r"<STR_LIT>" , re . IGNORECASE ) <EOL> setattr ( self , "<STR_LIT>" , r . sub ( "<STR_LIT>" , number ) ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , number ) <EOL> for form in forms : <EOL> form_dict = form . form <EOL> form_xmlns = form_dict [ "<STR_LIT>" ] <EOL> if NEW in form_xmlns : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> elif DELIVERY in form_xmlns : <EOL> if get_property ( form_dict , "<STR_LIT>" ) != '<STR_LIT>' : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> else : <EOL> setattr ( self , "<STR_LIT>" , get_property ( form_dict , "<STR_LIT>" ) ) <EOL> except ResourceNotFound : <EOL> logging . error ( "<STR_LIT>" + case_dict [ "<STR_LIT>" ] [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) <EOL> super ( MCHChildDisplay , self ) . __init__ ( report , case_dict ) <EOL> @ property <EOL> def child_name ( self ) : <EOL> return get_property ( self . case , "<STR_LIT:name>" ) <EOL> @ property <EOL> def father_mother_name ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def mcts_id ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def ward_number ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def gender ( self ) : <EOL> return get_property ( self . case , "<STR_LIT>" ) <EOL> @ property <EOL> def mobile_number ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def mobile_number_whose ( self ) : <EOL> return getattr ( self , "<STR_LIT>" , EMPTY_FIELD ) <EOL> @ property <EOL> def bcg_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def opv_0_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def hep_b_0_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def dpt_1_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def opv_1_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def hep_b_1_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def dpt_2_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def opv_2_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def hep_b_2_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def dpt_3_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def opv_3_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def hep_b_3_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def measles_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def vit_a_1_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def date_measles_booster ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def dpt_booster_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def opv_booster_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def vit_a_2_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def vit_a_3_date ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def date_je ( self ) : <EOL> return self . parse_date ( get_property ( self . case , "<STR_LIT>" ) ) <EOL> @ property <EOL> def dob_age ( self ) : <EOL> if "<STR_LIT>" in self . case and self . case [ "<STR_LIT>" ] : <EOL> try : <EOL> dob = self . case [ "<STR_LIT>" ] <EOL> if type ( dob ) is dict : <EOL> dob = dob [ "<STR_LIT>" ] <EOL> days = ( date . today ( ) - CaseDisplay . parse_date ( self , dob ) . date ( ) ) . days <EOL> dob = self . parse_date ( dob ) <EOL> return "<STR_LIT>" % ( dob , int ( days / <NUM_LIT> ) ) <EOL> except AttributeError : <EOL> return _ ( "<STR_LIT>" ) <EOL> else : <EOL> return EMPTY_FIELD </s>
