<commit_before>from data_collection.management.commands import (
    BaseXpressDCCsvInconsistentPostcodesImporter,
)


class Command(BaseXpressDCCsvInconsistentPostcodesImporter):
    council_id = "E06000056"
    addresses_name = "parl.2017-06-08/Version 1/Democracy_Club__08June2017 (2).tsv"
    stations_name = "parl.2017-06-08/Version 1/Democracy_Club__08June2017 (2).tsv"
    elections = ["parl.2017-06-08"]
    csv_delimiter = "\t"<commit_msg>import Central Bedfordshire (closes #1773)<commit_after>from data_collection.management.commands import (
    BaseXpressDCCsvInconsistentPostcodesImporter,
)


class Command(BaseXpressDCCsvInconsistentPostcodesImporter):
    council_id = "E06000056"
    addresses_name = "local.2019-05-02/Version 2/Democracy_Club__02May2019CB.CSV"
    stations_name = "local.2019-05-02/Version 2/Democracy_Club__02May2019CB.CSV"
    elections = ["local.2019-05-02"]
    csv_delimiter = ","

    def station_record_to_dict(self, record):

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

        return super().station_record_to_dict(record)

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

        if uprn in [
            "100081004693",  # LU55DZ -> LU55DX : 4 Bunch O`nuts, The Green, Houghton Regis, Dunstable, Beds.
            "100081004692",  # LU55DZ -> LU55DX : 3 Bunch O`nuts, The Green, Houghton Regis, Dunstable, Beds.
        ]:
            rec["accept_suggestion"] = True

        if uprn in [
            "10000861447",  # MK430LN -> MK430LP : 110B Lower Shelton Road, Marston Moretaine, Beds
            "10000799231",  # MK430LN -> MK430LP : 110 Lower Shelton Road, Marston Moretaine, Beds
            "100081000463",  # MK453QT -> MK452AZ : Apple Tree Cottage, Maulden Woods, Maulden, Bedford
            "10002278170",  # LU63RG -> LU63JH : Aveldone House, 70-74 Common Road, Kensworth, Dunstable, Beds.
            "10001023325",  # LU55AD -> LU55ES : 48A Houghton Road, Dunstable, Beds.
            "100081006449",  # LU79PU -> LU79PY : Tudor Cottage, 2 Dunstable Road, Tilsworth, Leighton Buzzard, Beds.
        ]:
            rec["accept_suggestion"] = False

        if record.addressline6 == "SG18 OJS":
            rec["postcode"] = "SG180JS"

        return rec
{'fraction_non_alphanumeric': 0.10672097759674135, 'fraction_numerical': 0.10468431771894093, 'mean_word_length': 3.2054794520547945, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, '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': '423734', 'n_tokens_mistral': 1034, 'n_tokens_neox': 815, 'n_words': 162}