<commit_before>from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter


class Command(BaseXpressDemocracyClubCsvImporter):
    council_id = "E06000047"
    addresses_name = "europarl.2019-05-23/Version 1/Democracy_Club__23May2019Durham.CSV"
    stations_name = "europarl.2019-05-23/Version 1/Democracy_Club__23May2019Durham.CSV"
    elections = ["europarl.2019-05-23"]
    csv_delimiter = ","

    def address_record_to_dict(self, record):
        rec = super().address_record_to_dict(record)
        uprn = record.property_urn.strip().lstrip("0")

        if uprn == "10000806992":
            rec["postcode"] = "DH8 9UN"

        return rec<commit_msg>Import script for Durham (closes #2408)<commit_after>from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter


class Command(BaseXpressDemocracyClubCsvImporter):
    council_id = "E06000047"
    addresses_name = "parl.2019-12-12/Version 1/Democracy_Club__12December2019dur.CSV"
    stations_name = "parl.2019-12-12/Version 1/Democracy_Club__12December2019dur.CSV"
    elections = ["parl.2019-12-12"]
    csv_delimiter = ","
    allow_station_point_from_postcode = False

    def address_record_to_dict(self, record):
        rec = super().address_record_to_dict(record)
        uprn = record.property_urn.strip().lstrip("0")

        if uprn == "10000806992":
            rec["postcode"] = "DH8 9UN"

        if uprn in [
            "100110501314",
            "10014556896",
            "100110519859",
            "10094408615",
            "200002972415",
        ]:
            return None

        return rec

    def station_record_to_dict(self, record):

        if record.polling_place_id == "46013":
            record = record._replace(polling_place_postcode="")
            record = record._replace(polling_place_easting="0")
            record = record._replace(polling_place_northing="0")

        return super().station_record_to_dict(record)
{'fraction_non_alphanumeric': 0.10376398779247202, 'fraction_numerical': 0.09613428280773144, 'mean_word_length': 3.221030042918455, 'pattern_counts': {'":': 3, '<': 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': '3837431', 'n_tokens_mistral': 785, 'n_tokens_neox': 637, 'n_words': 94}