<commit_before>from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter

class Command(BaseXpressDemocracyClubCsvImporter):
    council_id = 'E09000031'
    addresses_name = 'local.2018-05-03/Version 1/Democracy_Club__03May2018 Waltham Forest.tsv'
    stations_name = 'local.2018-05-03/Version 1/Democracy_Club__03May2018 Waltham Forest.tsv'
    elections = ['local.2018-05-03']
    csv_delimiter = '\t'

    def station_record_to_dict(self, record):

        # Postcode supplied for Downsell Primary School is incorrect
        if record.polling_place_id == '2989':
            record = record._replace(polling_place_postcode='E15 2BS')

        rec = super().station_record_to_dict(record)

        # better point for Mission Grove South Site
        if record.polling_place_id == '2820':
            rec['location'] = Point(-0.025035, 51.581813, srid=4326)

        return rec

    def address_record_to_dict(self, record):

        uprn = record.property_urn.strip().lstrip('0')

        if uprn == '10091187735':
            rec = super().address_record_to_dict(record)
            rec['postcode'] = 'E11 4ED'
            return rec<commit_msg>update Waltham Forest import script<commit_after>from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter

class Command(BaseXpressDemocracyClubCsvImporter):
    council_id = 'E09000031'
    addresses_name = 'local.2018-05-03/Version 2/Democracy_Club__03May2018 (1) Waltham Forest.tsv'
    stations_name = 'local.2018-05-03/Version 2/Democracy_Club__03May2018 (1) Waltham Forest.tsv'
    elections = ['local.2018-05-03']
    csv_delimiter = '\t'

    def station_record_to_dict(self, record):
        rec = super().station_record_to_dict(record)

        # better point for Mission Grove South Site
        if record.polling_place_id == '2820':
            rec['location'] = Point(-0.025035, 51.581813, srid=4326)

        return rec

    def address_record_to_dict(self, record):

        uprn = record.property_urn.strip().lstrip('0')

        if uprn == '10091187735':
            rec = super().address_record_to_dict(record)
            rec['postcode'] = 'E11 4ED'
            return rec
{'fraction_non_alphanumeric': 0.10105448154657294, 'fraction_numerical': 0.07776801405975395, 'mean_word_length': 3.328897338403042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5399591', 'n_tokens_mistral': 856, 'n_tokens_neox': 724, 'n_words': 143}