<commit_before>import time
import datetime
import subprocess
from xml.dom import minidom
import os
import csv
import json
import moment


seat_dict = open("seat_map.json").read()
seat_map = json.loads(seat_dict)

seat_name_dict = open("seat_name_map.json").read()
seat_name_map = json.loads(seat_name_dict)

old = open("old_data.json").read()
old_data = json.loads(old)

live_data = {}

parties = ["conservative", "labour", "libdems", "ukip", "snp", "plaidcymru", "green", "uu", "sdlp", "dup", "sinnfein", "alliance", "other", "others"]

party_map = {
    "Conservative": "conservative",
    "Labour" : "labour",
    "Labour and Co-operative" : "labour",
    "Liberal Democrat" : "libdems",
    "UK Independence Party" : "ukip",
    "Scottish National Party": "snp",
    "Green" : "green",
    "Plaid Cymru" : "plaidcymru",
    "Alliance" : "alliance",
    "Ulster Unionist Party" : "uu",
    "Democratic Unionist Party" :  "dup",
    "<NAME>in" : "sinnfein",
    "Social Democratic and Labour Party" : "sdlp"
}

winners_map = {
    "C" : "conservative",
    "Lab" : "labour",
    "Lab Co-op" :  "labour",
    "SDLP" : "sdlp",
    "Alliance" : "alliance",
    "UUP" : "uu",
    "LD" : "libdems",
    "SNP" : "snp",
    "Speaker" : "other",
    "UKIP" : "ukip",
    "PC" : "plaidcymru",
    "SF" : "sinnfein",
    "DUP" : "dup",
    "Green" : "green",
    "BNP" : "other",
    "Ind" : "other"
}

seat_list = []

def get_data(file):

    if "result" in file:

        file_dir = path + file
        xmldoc = minidom.parse(file_dir)

        declaration = xmldoc.getElementsByTagName('FirstPastThePostResult')

        declaration_time = (declaration[0].attributes['declarationTime'].value)

        itemlist = xmldoc.getElementsByTagName('Constituency')


        seat_name = itemlist[0].attributes['name'].value
        seat_id = itemlist[0].attributes['number'].value

        my_seat_name = seat_name_map[seat_name]
        my_seat_id = seat_map[seat_id]

        time_string = declaration_time[0:-6]
        m = moment.date(time_string, '%Y-%m-%dT%H:%M:%S' )


        minutes = str(m.minute)
        hours = str(m.hours)
<commit_msg>full_election_update<commit_after>import time
import datetime
import subprocess
from xml.dom import minidom
import os
import csv
import json
import moment


seat_dict = open("seat_map.json").read()
seat_map = json.loads(seat_dict)

seat_name_dict = open("seat_name_map.json").read()
seat_name_map = json.loads(seat_name_dict)

old = open("old_data.json").read()
old_data = json.loads(old)

live_data = {}

parties = ["conservative", "labour", "libdems", "ukip", "snp", "plaidcymru", "green", "uu", "sdlp", "dup", "sinnfein", "alliance", "other", "others"]

party_map = {
    "Conservative": "conservative",
    "Labour" : "labour",
    "Labour and Co-operative" : "labour",
    "Liberal Democrat" : "libdems",
    "UK Independence Party" : "ukip",
    "Scottish National Party": "snp",
    "Green" : "green",
    "Plaid Cymru" : "plaidcymru",
    "Alliance" : "alliance",
    "Ulster Unionist Party" : "uu",
    "Democratic Unionist Party" :  "dup",
    "<NAME>" : "sinnfein",
    "Social Democratic and Labour Party" : "sdlp"
}

winners_map = {
    "C" : "conservative",
    "Lab" : "labour",
    "Lab Co-op" :  "labour",
    "SDLP" : "sdlp",
    "Alliance" : "alliance",
    "UUP" : "uu",
    "LD" : "libdems",
    "SNP" : "snp",
    "Speaker" : "other",
    "UKIP" : "ukip",
    "PC" : "plaidcymru",
    "SF" : "sinnfein",
    "DUP" : "dup",
    "Green" : "green",
    "BNP" : "other",
    "Ind" : "other"
}

seat_list = []

def get_data(file):

    if "result" in file:

        file_dir = path + file
        xmldoc = minidom.parse(file_dir)

        declaration = xmldoc.getElementsByTagName('FirstPastThePostResult')

        declaration_time = (declaration[0].attributes['declarationTime'].value)

        itemlist = xmldoc.getElementsByTagName('Constituency')


        seat_name = itemlist[0].attributes['name'].value
        seat_id = itemlist[0].attributes['number'].value

        my_seat_name = seat_name_map[seat_name]
        print my_seat_name
        my_seat_id = seat_map[seat_id]

        time_string = declaration_time[0:-6]
        m = moment.date(time_string, '%Y-%m-%dT%H:%M:%S' )


        minutes = str(m.minute)
        hours = str(m.hours)

{'fraction_non_alphanumeric': 0.1691449814126394, 'fraction_numerical': 0.0023234200743494425, 'mean_word_length': 3.3353474320241694, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3193301', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1612, 'n_words': 318}