diff --git a/DMR_Net_Check_In.py b/DMR_Net_Check_In.py index 8518b85..1df5a7c 100644 --- a/DMR_Net_Check_In.py +++ b/DMR_Net_Check_In.py @@ -88,18 +88,18 @@ checkins_df["Date"] = pd.to_datetime(checkins_df["Date"]).dt.strftime('%Y-%m-%d' callinfo_df = pd.read_excel(xls, "Call_Data", dtype=str) #print("callinfo_df:") #print(callinfo_df) -hh_dir_df = pd.read_excel(xls, "Hamshack_Hotline", dtype=str) -#print("hh_dir_df:") -#print(hh_dir_df) +hoip_dir_df = pd.read_excel(xls, "hoip_subscribers", dtype=str) +#print("hoip_dir_df:") +#print(hoip_dir_df) # build dictionary of HH phone numbers -hh_phone_dict = {"Callsign" : "HH Number"} -for i,row in hh_dir_df.iterrows(): +hoip_phone_dict = {"Callsign" : "HH Number"} +for i,row in hoip_dir_df.iterrows(): callsign = row.iloc[1] - hh_num = row.iloc[7] - # we only add the hh number first seen for a unique callsign - if callsign not in hh_phone_dict.keys(): - hh_phone_dict.update({callsign : hh_num}) + hoip_num = row.iloc[0] + # we only add the hoip number first seen for a unique callsign + if callsign not in hoip_phone_dict.keys(): + hoip_phone_dict.update({callsign : hoip_num}) # fill in any missing data (NAN's) with default text callinfo_df.fillna({'Name' : ''}, inplace=True) @@ -127,27 +127,27 @@ for i,row in checkins_df.iterrows(): # build dictionary of call info indexed by callsign call_data_dict = {} for i,row in callinfo_df.iterrows(): - # row of data is call, name, state, district, county, affiliation, hh_num - # dictionary becomes: { call: [name[0], state[1], district[2], county[3], affiliation[4]], hh_num[5]} + # row of data is call, name, state, district, county, affiliation, hoip_num + # dictionary becomes: { call: [name[0], state[1], district[2], county[3], affiliation[4]], hoip_num[5]} callsign = row.iloc[0] - if callsign in hh_phone_dict.keys(): - hh_num = hh_phone_dict[callsign] + if callsign in hoip_phone_dict.keys(): + hoip_num = hoip_phone_dict[callsign] else: - hh_num = "" - call_data_dict.update({callsign:[row.iloc[1],row.iloc[2],row.iloc[3],row.iloc[4],row.iloc[5],hh_num]}) + hoip_num = "" + call_data_dict.update({callsign:[row.iloc[1],row.iloc[2],row.iloc[3],row.iloc[4],row.iloc[5],hoip_num]}) # build checkin_form_dict dictionary checkin_form_dict = blank_checkin_form_dict for call in call_data_dict.keys(): #print("Looking at:", call) - #if call in hh_phone_dict.keys(): - #print("Call "+call+" has HH VOIP #"+hh_phone_dict[call]) + #if call in hoip_phone_dict.keys(): + #print("Call "+call+" has HOIP #"+hoip_phone_dict[call]) call_state = call_data_dict[call][1] call_dist = call_data_dict[call][2] call_county = call_data_dict[call][3] call_affil = call_data_dict[call][4] - call_hh_num = call_data_dict[call][5] - #print("State, Dist, Cnty, Affil, HH Num: ", call_state, call_dist, call_county, call_affil, call_hh_num) + call_hoip_num = call_data_dict[call][5] + #print("State, Dist, Cnty, Affil, HH Num: ", call_state, call_dist, call_county, call_affil, call_hoip_num) # sanity check the data - error if not found in dictionary keys... # print("Verifying at: ", call, call_state, call_dist, call_county) @@ -218,8 +218,8 @@ with open(output_file,"w") as outfile: checkin_str = "" if checkin_count > 0: outfile.write(" "+call+", "+call_name+checkin_str) - if call in hh_phone_dict.keys(): - outfile.write(", HH VOIP #"+hh_phone_dict[call]) + if call in hoip_phone_dict.keys(): + outfile.write(", HOIP #"+hoip_phone_dict[call]) if call_affil != "": outfile.write(", "+call_affil+"\n") else: @@ -237,8 +237,8 @@ with open(output_file,"w") as outfile: checkin_str = "" if checkin_count > 0: outfile.write(" "+call+", "+call_data_dict[call][0]+checkin_str) - if call in hh_phone_dict.keys(): - outfile.write(", HH VOIP #"+hh_phone_dict[call]) + if call in hoip_phone_dict.keys(): + outfile.write(", HOIP #"+hoip_phone_dict[call]) affil = call_data_dict[call][4] if affil != '': outfile.write(", "+affil+"\n") @@ -263,8 +263,8 @@ with open(output_file,"w") as outfile: checkin_count = 0 checkin_str = "" outfile.write(" "+call+", "+call_data_dict[call][0]+checkin_str) - if call in hh_phone_dict.keys(): - outfile.write(", HH VOIP #"+hh_phone_dict[call]) + if call in hoip_phone_dict.keys(): + outfile.write(", HOIP #"+hoip_phone_dict[call]) affil = call_data_dict[call][4] if affil != '': outfile.write(", "+affil+"\n") @@ -367,8 +367,10 @@ for net_day in net_day_list: cur_call_list.sort() for call in cur_call_list: affil = call_data_dict[call][4] - hh_num = call_data_dict[call][5] + hoip_num = call_data_dict[call][5] outfile.write(" "+call+", "+call_data_dict[call][0]) + if hoip_num != '': + outfile.write(", HOIP #"+hoip_num) if affil != '': outfile.write(", "+affil+"\n") else: @@ -380,8 +382,10 @@ for net_day in net_day_list: cur_call_list.sort() for call in cur_call_list: affil = call_data_dict[call][4] - hh_num = call_data_dict[call][5] + hoip_num = call_data_dict[call][5] outfile.write(" "+call+", "+call_data_dict[call][0]) + if hoip_num != '': + outfile.write(", HOIP #"+hoip_num) if affil != '': outfile.write(", "+affil+"\n") else: @@ -397,8 +401,10 @@ for net_day in net_day_list: cur_call_list.sort() for call in cur_call_list: affil = call_data_dict[call][4] - hh_num = call_data_dict[call][5] + hoip_num = call_data_dict[call][5] outfile.write(" "+call+", "+call_data_dict[call][0]) + if hoip_num != '': + outfile.write(", HOIP #"+hoip_num) if affil != '': outfile.write(", "+affil+"\n") else: