def test_find_in_header(self): self.assertEqual(etl.find_in_header(ref, 'TESTINGCOL'), 'J')
def get_locs(ws): """find column headers in advance so we don't have to call each time""" ret = {} ret["priority"]=column_index_from_string(etl.find_in_header(ws,"Priority")) ret["access_method"]=column_index_from_string(etl.find_in_header(ws,"Hard to Reach Access Methods")) ret["hub"]=column_index_from_string(etl.find_in_header(ws,"Shelter Cluster Hub")) ret["as_of"]=column_index_from_string(etl.find_in_header(ws,"Last Update")) ret["dist_code"]=column_index_from_string(etl.find_in_header(ws,"District HLCIT Code")) ret["vdc_code"]=column_index_from_string(etl.find_in_header(ws,"VDC / Municipality HLCIT Code")) ret["act_cat"]=column_index_from_string(etl.find_in_header(ws,"UNOCHA Activity Categories")) ret["imp_agency"]=column_index_from_string(etl.find_in_header(ws,"Implementing agency")) ret["source_agency"]=column_index_from_string(etl.find_in_header(ws,"Sourcing Agency")) ret["local_partner"]=column_index_from_string(etl.find_in_header(ws,"Local partner agency")) ret["contact_name"]=column_index_from_string(etl.find_in_header(ws,"Agency / Local Contact Name")) ret["contact_email"]=column_index_from_string(etl.find_in_header(ws,"Agency / Local Contact Email")) ret["contact_phone"]=column_index_from_string(etl.find_in_header(ws,"Agency / Local Contact Phone #")) ret["district"]=column_index_from_string(etl.find_in_header(ws,"District")) ret["vdc"]=column_index_from_string(etl.find_in_header(ws,"VDC / Municipalities")) ret["ward"]=column_index_from_string(etl.find_in_header(ws,"Municipal Ward")) ret["act_type"]=column_index_from_string(etl.find_in_header(ws,"Action type")) ret["act_desc"]=column_index_from_string(etl.find_in_header(ws,"Action description")) ret["targeting"]=column_index_from_string(etl.find_in_header(ws,"Targeting")) ret["quantity"]=column_index_from_string(etl.find_in_header(ws,"# Items / # Man-hours / NPR")) ret["total_hh"]=column_index_from_string(etl.find_in_header(ws,"Total Number Households")) ret["avg_hh_cost"]=column_index_from_string(etl.find_in_header(ws,"Average cost per households (NPR)")) ret["fem_hh"]=column_index_from_string(etl.find_in_header(ws,"Female headed households")) ret["vuln_hh"]=column_index_from_string(etl.find_in_header(ws,"Vulnerable Caste / Ethnicity households")) ret["act_status"]=column_index_from_string(etl.find_in_header(ws,"Activity Status")) #ret["start_dt"]=column_index_from_string(etl.find_in_header(ws,"Start date")) ret["start_day"]=column_index_from_string(etl.find_in_header(ws,"DD - Start")) ret["start_month"]=column_index_from_string(etl.find_in_header(ws,"MM - Start")) ret["start_year"]=column_index_from_string(etl.find_in_header(ws,"YYYY - Start")) #ret["comp_dt"]=column_index_from_string(etl.find_in_header(ws,"Completion Date")) ret["comp_day"]=column_index_from_string(etl.find_in_header(ws,"DD - End")) ret["comp_month"]=column_index_from_string(etl.find_in_header(ws,"MM - End")) ret["comp_year"]=column_index_from_string(etl.find_in_header(ws,"YYYY - End")) ret["comments"]=column_index_from_string(etl.find_in_header(ws,"Additional Comments")) return ret
def get_locs(ws): """find column headers in advance so we don't have to call each time""" ret = {} ret["priority"] = column_index_from_string(etl.find_in_header(ws, "Priority")) ret["access_method"] = column_index_from_string(etl.find_in_header(ws, "Hard to Reach Access Methods")) ret["hub"] = column_index_from_string(etl.find_in_header(ws, "Shelter Cluster Hub")) ret["as_of"] = column_index_from_string(etl.find_in_header(ws, "Last Update")) ret["dist_code"] = column_index_from_string(etl.find_in_header(ws, "District HLCIT Code")) ret["vdc_code"] = column_index_from_string(etl.find_in_header(ws, "VDC / Municipality HLCIT Code")) ret["uid"] = column_index_from_string(etl.find_in_header(ws, "UID")) ret["imp_agency"] = column_index_from_string(etl.find_in_header(ws, "Implementing agency")) ret["source_agency"] = column_index_from_string(etl.find_in_header(ws, "Sourcing Agency")) ret["local_partner"] = column_index_from_string(etl.find_in_header(ws, "Local partner agency")) ret["contact_name"] = column_index_from_string(etl.find_in_header(ws, "Contact Name")) ret["contact_email"] = column_index_from_string(etl.find_in_header(ws, "Contact Email")) ret["contact_phone"] = column_index_from_string(etl.find_in_header(ws, "Contact Phone Number")) ret["district"] = column_index_from_string(etl.find_in_header(ws, "District")) ret["vdc"] = column_index_from_string(etl.find_in_header(ws, "VDC / Municipalities")) ret["ward"] = column_index_from_string(etl.find_in_header(ws, "Municipal Ward")) ret["train_sub"] = column_index_from_string(etl.find_in_header(ws, "Training Subject")) ret["audience"] = column_index_from_string(etl.find_in_header(ws, "Audience")) ret["train_title"] = column_index_from_string(etl.find_in_header(ws, "Training Title")) ret["demo_inc"] = column_index_from_string(etl.find_in_header(ws, "Demonstration Construction Included?")) ret["iec_dist"] = column_index_from_string(etl.find_in_header(ws, "IEC Materials Distributed")) ret["dur_session"] = column_index_from_string(etl.find_in_header(ws, "Duration of each session (hours)")) ret["amt_parti"] = column_index_from_string(etl.find_in_header(ws, "Amount Paid to Participants (NPR per participant)")) ret["total_cost"] = column_index_from_string(etl.find_in_header(ws, "Total Cost Per Training")) ret["total_parti"] = column_index_from_string(etl.find_in_header(ws, "Total Participants (Individuals)")) ret["males"] = column_index_from_string(etl.find_in_header(ws, "Males")) ret["females"] = column_index_from_string(etl.find_in_header(ws, "Females")) ret["third_gen"] = column_index_from_string(etl.find_in_header(ws, "Third Gender")) ret["elderly"] = column_index_from_string(etl.find_in_header(ws, "Elderly (60+)")) ret["children"] = column_index_from_string(etl.find_in_header(ws, "Children (under 18)")) ret["person_dis"] = column_index_from_string(etl.find_in_header(ws, "Persons with Disabilities")) ret["vuln_hh"] = column_index_from_string(etl.find_in_header(ws, "Vulnerable Caste or Ethnicity")) ret["fem_hh"] = column_index_from_string(etl.find_in_header(ws, "Female Headed Households (if applicable)")) ret["act_status"] = column_index_from_string(etl.find_in_header(ws, "Activity Status")) #ret["start_dt"]=column_index_from_string(etl.find_in_header(ws,"Start date")) ret["start_day"]=column_index_from_string(etl.find_in_header(ws,"DD - Start")) ret["start_month"]=column_index_from_string(etl.find_in_header(ws,"MM - Start")) ret["start_year"]=column_index_from_string(etl.find_in_header(ws,"YYYY - Start")) #ret["comp_dt"]=column_index_from_string(etl.find_in_header(ws,"Completion Date")) ret["comp_day"]=column_index_from_string(etl.find_in_header(ws,"DD - End")) ret["comp_month"]=column_index_from_string(etl.find_in_header(ws,"MM - End")) ret["comp_year"]=column_index_from_string(etl.find_in_header(ws,"YYYY - End")) ret["comments"] = column_index_from_string(etl.find_in_header(ws, "Additional Comments")) return ret