from _manipulation import *

years = [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024]
months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

year_data = {'2013': 0, '2014': 0, '2015': 0, '2016': 0, '2017': 0, '2018': 0, '2019': 0, '2020': 0, '2021': 0, '2022': 0, '2023': 0, '2024': 0}
month_data = {'2013': {}, '2014': {}, '2015': {}, '2016': {}, '2017': {}, '2018': {}, '2019': {}, '2020': {}, '2021': {}, '2022': {}, '2023': {}, '2024': {}}
for year in years:
    y_result = deviation_in_period(year)
    year_data[str(year)] = {}
    year_data[str(year)]['average'] = y_result[0]
    year_data[str(year)]['deviation'] = y_result[1]
    for month in months:
        month_data[str(year)][str(month)] = {}
        m_result = deviation_in_period(year, month)
        month_data[str(year)][str(month)]['average'] = m_result[0]
        month_data[str(year)][str(month)]['deviation'] = m_result[1]



full_data = {'years': year_data, 'months': month_data}
with open('averages.json', 'w') as f:
    json.dump(full_data, f, indent=4)