add district offices to sweep.py tool and run it

This commit is contained in:
Joshua Tauberer
2017-12-05 11:58:20 -05:00
parent b1e4019414
commit fa1a797aca
2 changed files with 9 additions and 25 deletions

View File

@@ -1997,31 +1997,6 @@
latitude: 34.3671955
longitude: -89.5213847
phone: 662-236-1018
- id:
bioguide: C000714
govtrack: 400080
thomas: '00229'
offices:
- id: C000714-detroit
address: 231 W. Lafayette
building: 669 Federal Bldg
city: Detroit
state: MI
zip: '48226'
latitude: 42.3303626
longitude: -83.0496208
fax: 313-226-2085
phone: 313-961-5670
- id: C000714-westland
address: 33300 Warren Rd.
suite: Suite 13
city: Westland
state: MI
zip: '48185'
latitude: 42.339678
longitude: -83.3701998
fax: 734-675-4218
phone: 734-675-4084
- id:
bioguide: C000754
govtrack: 400081

View File

@@ -31,5 +31,14 @@ def run():
socialmedia_current.remove(member)
save_data(socialmedia_current, "legislators-social-media.yaml")
# remove out-of-office people from district offices
print("Sweeping district offices...")
district_offices = load_data("legislators-district-offices.yaml")
for member in list(district_offices):
if member["id"]["bioguide"] not in current_bioguide:
print("\t[%s] Ding ding ding! (%s)" % (member["id"]["bioguide"], member["offices"]))
district_offices.remove(member)
save_data(district_offices, "legislators-district-offices.yaml")
if __name__ == '__main__':
run()