def process_data(data):
    member_dict = {}

    def process_post(post):
        if ('comments' in post):
            for comment in post['comments']['data']:
                commenter_id = comment['from']['id']
                if (commenter_id not in member_dict):
                    member_dict[commenter_id] = comment['from']
                    member_dict[commenter_id]['comment_count'] = 1
                    member_dict[commenter_id]['like_count'] = comment['like_count']
                else:
                    member_dict[commenter_id]['comment_count'] += 1
                    member_dict[commenter_id]['like_count'] += comment['like_count']
                process_post(comment)
    for post in data:
        process_post(post)
    activity_dict = {}
    for member_id in member_dict:
        member = member_dict[member_id]
        activity_score = 0
        if ('comment_count' in member):
            activity_score += member['comment_count']
        if ('like_count' in member):
            activity_score += (2 * member['like_count'])
        activity_dict[member['id']] = {'facebook_id': member_id, 'activity_score': activity_score, 'name': member['name'], 'like_count': member['like_count'], 'comment_count': member['comment_count']}
    return activity_dict
def process_data(data):
    member_dict = {}

    def process_post(post):
        if ('comments' in post):
            for comment in post['comments']['data']:
                commenter_id = comment['from']['id']
                if (commenter_id not in member_dict):
                    member_dict[commenter_id] = comment['from']
                    member_dict[commenter_id]['comment_count'] = 1
                    member_dict[commenter_id]['like_count'] = comment['like_count']
                else:
                    member_dict[commenter_id]['comment_count'] += 1
                    member_dict[commenter_id]['like_count'] += comment['like_count']
                process_post(comment)
    for post in data:
        process_post(post)
    activity_dict = {}
    for member_id in member_dict:
        member = member_dict[member_id]
        activity_score = 0
        if ('comment_count' in member):
            activity_score += member['comment_count']
        if ('like_count' in member):
            activity_score += (2 * member['like_count'])
        activity_dict[member['id']] = {'facebook_id': member_id, 'activity_score': activity_score, 'name': member['name'], 'like_count': member['like_count'], 'comment_count': member['comment_count']}
    return activity_dict