import csv
import json
import math
import sys

results = {
    'n': {
        '2009': 0,
        '2010': 0,
        '2011': 0,
        '2012': 0,
        '2013': 0,
        '2015': 0,
        '2016': 0
    },
    'demographics': {
        'age': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
            '2016': {}
        },
        'biological_sex': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
        },
        'gender_identity': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
            '2016': {}
        },
        'gender_alignment': {
            '2016': {},
        },
        'sexual_orientation': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
            '2016': {}
        },
        'race': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
            '2016': {}
        },
        'relationship_status': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
            '2016': {}
        },
        'polyamory': {
            'sexuality': {
                '2013': {},
                #'2015': {},
            },
            'romantic': {
                '2013': {},
                #'2015': {},
            }
        },
        'political_views': {
            'social': {
                '2010': {},
                '2011': {},
                '2012': {},
                '2013': {},
                '2015': {},
                '2016': {}
            },
            'economic': {
                '2010': {},
                '2011': {},
                '2012': {},
                '2013': {},
                '2015': {},
                '2016': {}
            },
        }
    },
    'furry_metadata': {
        'furry_status': {
            '2015': {},
            '2016': {}
        },
        'partner_is_furry': {
            '2009': {},
            '2010': {},
            '2011': {},
            '2012': {},
            '2013': {},
            '2015': {},
            '2016': {}
        },
    },
    'perception_of_fandom': {
        'importance_of_sex': {
            'self': {
                '2009': {},
                '2010': {},
                '2011': {},
                '2012': {},
                '2013': {},
                '2015': {},
                '2016': {}
            },
            'others': {
                '2009': {},
                '2010': {},
                '2011': {},
                '2012': {},
                '2013': {},
                '2015': {},
                '2016': {}
            },
            'public': {
                '2009': {},
                '2010': {},
                '2011': {},
                '2012': {},
                '2013': {},
                '2015': {},
                '2016': {}
            },
        }
    },
}

with open(sys.argv[1], 'rb') as f:
    """
    Pertinent Columns:
    year,furry_status,birthdate,biosex,gender,orientation,race_white,race_black,race_hispanic,race_asian,race_native,religion,politics_social,politics_economic,occupation,education,relationship,partner_is_furry,polyamorous_romantic,polyamorous_sexual,seximportance_overall,seximportance_personal,seximportance_others,seximportance_public
    """
    reader = csv.DictReader(f)
    for row in reader: