3 import glob, datetime, json
5 out_file = 'masterlist.csv'
6 base_fp = 'out/2020_singles'
7 files = glob.glob('{}/*.json'.format(base_fp))
9 with open(out_file, 'w') as write_f:
10 write_f.write('prop_type|parcel_num|municipality|property_address|bill_num|net_mill_rate|lottery_claims_num|lottery_claims_date|lottery_claims_amount|gross_tax|school_credit|total_tax|first_dollar_credit|lottery_credit_amount|net_tax|net_tax_paid|net_tax_due|special_assessments|special_assessments_paid|special_assessments_due|special_charges|special_charges_paid|special_charges_due|delinquent_utility|delinquent_utility_paid|delinquent_utility_due|private_forest_crop|private_forest_crop_paid|private_forest_crop_due|woodland_tax_law|woodland_tax_law_paid|woodland_tax_law_due|managed_forest_land|managed_forest_land_paid|managed_forest_land_due|other_charges|other_charges_paid|other_charges_due|interest_paid|interest_due|penalty_paid|penalty_due|total_taxes|total_paid|total_due|installments|payments|tax_history|details|created_on|owner_1|owner_2|address_1|city|state|zip\n')
14 with open(fp, 'r') as read_f:
15 contents = json.loads(read_f.read())
19 raise Exception('Contents cannot be none for {}'.format(fp))
22 owner_info = contents.pop('owner_info')
24 row = list(map(lambda x: str(x), contents.values()))
25 row.append(owner_info['owner_1'])
27 if owner_info['owner_2']:
28 row.append(owner_info['owner_2'])
32 row.append(owner_info['address_1'])
33 row.append(owner_info['city'])
34 row.append(owner_info['state'])
35 row.append(owner_info['zip'])
38 write_f.write('{}\n'.format(row))