Fault tolerant parsing of names in subscriber dict

Fixed a multitute of problems with the existence of and formatting of name data at radioid, caused mostly by GDPR
This commit is contained in:
n0mjs710 2020-08-25 12:22:52 -05:00
parent 7858f566b1
commit 787c862b93
2 changed files with 171149 additions and 1 deletions

171138
dmr_utils3/test.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -139,10 +139,20 @@ def mk_full_id_dict(_path, _file, _type):
pass
elif _type == 'subscriber':
for record in records:
# Try to craete a string name regardless of existing data
if (('surname' in record.keys()) and ('fname'in record.keys())):
_name = str(record['fname']) + ' ' + str(record['surname'])
elif 'fname' in record.keys():
_name = str(record['fname'])
elif 'surname' in record.keys():
_name = str(record['surname'])
else:
_name = 'NO NAME'
# Make dictionary entry, if any of the information below isn't in the record, it wil be skipped
try:
_dict[int(record['id'])] = {
'CALLSIGN': record['callsign'],
'NAME': (record['fname'] + ' ' + record['surname']),
'NAME': _name,
'CITY': record['city'],
'STATE': record['state'],
'COUNTRY': record['country']