# import subprocess
# import logging

# exer_1 = subprocess.run('python zha_enum.py && python zha_frac.py && python zha_collect.py', shell=True, capture_output=True, text=True)

# logging.basicConfig(filename='zha_logging.py', level=logging.INFO, format='%(asctime)s : %(levelname)s : %(name)s :  %(message)s', filemode='w')

# logging.info(exer_1.stdout)

import arrow
import json
new_data = {"birthdays":[]}
with open('class_record.json') as fp:
    data = json.load(fp)
    for bd in data['birthdays']:
        fmt_bd = arrow.get(bd['bday_timestamp']).format('MMMM DD, YYYY')
        age = int((arrow.now() - arrow.get(bd['bday_timestamp'])).days / 365)
        bd["age"] = age
        bd["birthday"] = fmt_bd
        new_data['birthdays'].append(bd)
with open('barbs_output.json', 'w') as fo:
    json.dump(new_data, fo, indent = 2)