2424 get_table_data ,
2525 get_paragraphs_data ,
2626 parse_disaster_category ,
27- parse_contact_information
27+ parse_contact_information ,
28+ parse_people ,
29+ parse_country ,
30+ parse_currency ,
2831)
2932
3033
@@ -134,17 +137,17 @@ def f(r, c, i=0, as_list=False):
134137
135138 cells = get_table_cells (0 )
136139 data ['appeal_code' ] = cells (1 , 0 )
137- data ['amount_requested' ] = parse_string_to_int (cells (1 , 1 , 1 ))
140+ data ['amount_requested' ] = parse_currency (cells (1 , 1 ))
138141 data ['disaster_category' ] = parse_disaster_category (cells (1 , 2 ))
139142 data ['disaster_type' ] = parse_disaster_type (cells (1 , 4 ))
140143 data ['glide_code' ] = cells (3 , 0 )
141- data ['num_affected' ] = parse_string_to_int (cells (3 , 1 ))
142- data ['num_assisted' ] = parse_string_to_int (cells (3 , 2 ))
144+ data ['num_affected' ] = parse_people (cells (3 , 1 ))
145+ data ['num_assisted' ] = parse_people (cells (3 , 2 ))
143146 data ['type_of_onset' ] = parse_type_of_onset (cells (5 , 0 ))
144147 data ['date_of_approval' ] = parse_date (cells (5 , 1 ))
145148 data ['end_date' ] = parse_date (cells (5 , 2 ))
146- data ['operation_timeframe' ] = parse_int (cells (5 , 3 ))
147- country = Country .objects .filter (name__icontains = cells (6 , 0 , 1 )).first ()
149+ data ['operation_timeframe' ] = parse_people (cells (5 , 3 ))
150+ country = Country .objects .filter (name__icontains = parse_country ( cells (6 , 0 ) )).first ()
148151 if country is None :
149152 raise serializers .ValidationError ('A valid country name is required' )
150153 data ['country' ] = country
@@ -156,7 +159,7 @@ def f(r, c, i=0, as_list=False):
156159 for d in new_district :
157160 try :
158161 district = District .objects .filter (
159- country__name__icontains = cells (6 , 0 , 1 ),
162+ country__name__icontains = parse_country ( cells (6 , 0 ) ),
160163 name__icontains = d
161164 ).first ()
162165 except District .DoesNotExist :
@@ -225,13 +228,13 @@ def f(r, c, i=0, as_list=False):
225228 cells = get_table_cells (3 )
226229 data ['government_requested_assistance' ] = parse_boolean (cells (0 , 1 ))
227230
228- national_authorities = cells (1 , 2 , as_list = True )
231+ national_authorities = cells (1 , 1 , as_list = True )
229232 data ['national_authorities' ] = '' .join (national_authorities ) if national_authorities else None
230233
231- un_and_other_actors = cells (2 , 2 , as_list = True )
234+ un_and_other_actors = cells (2 , 0 , as_list = True )
232235 data ['un_or_other_actor' ] = '' .join (un_and_other_actors ) if un_and_other_actors else None
233236
234- coordination_mechanism = cells (4 , 0 , as_list = True )
237+ coordination_mechanism = cells (3 , 1 , as_list = True )
235238 data ['major_coordination_mechanism' ] = '' .join (coordination_mechanism ) if coordination_mechanism else None
236239
237240 # Operational Strategy
@@ -396,7 +399,6 @@ def f(r, c, i=0, as_list=False):
396399 dref = Dref .objects .create (** data )
397400 dref .planned_interventions .add (* planned_intervention )
398401 dref .national_society_actions .add (* national_societies )
399- print (district_list )
400402 dref .risk_security .add (* mitigation_list )
401403 if len (district_list ) > 0 and None not in district_list :
402404 dref .district .add (* district_list )
0 commit comments