<commit_before>from data_importers.management.commands import BaseHalaroseCsvImporter


class Command(BaseHalaroseCsvImporter):
    council_id = "SRI"
    addresses_name = (
        "2021-03-09T23:18:28.806724/South Ribble polling_station_export-2021-03-09.csv"
    )
    stations_name = (
        "2021-03-09T23:18:28.806724/South Ribble polling_station_export-2021-03-09.csv"
    )
    elections = ["2021-05-06"]

    def address_record_to_dict(self, record):
        if record.housepostcode in ["PR5 5AU", "PR5 4TB"]:
            return None
        return super().address_record_to_dict(record)<commit_msg>Import script for South Ribble (2022-05-05) (closes #4511)<commit_after>from data_importers.management.commands import BaseHalaroseCsvImporter


class Command(BaseHalaroseCsvImporter):
    council_id = "SRI"
    addresses_name = (
        "2022-05-05/2022-03-30T11:37:35.084389/polling_station_export-2022-03-24-2.csv"
    )
    stations_name = (
        "2022-05-05/2022-03-30T11:37:35.084389/polling_station_export-2022-03-24-2.csv"
    )
    elections = ["2022-05-05"]

    def station_record_to_dict(self, record):
        # Warning for BUCKSHAW VILLAGE COMMUNITY CENTRE (2-buckshaw-village-community-centre)
        # being outside the target council area, but it's fine.

        # COUPE GREEN PRIMARY SCHOOL, COUPE GREEN, HOGHTON, PRESTON
        if record.pollingstationnumber == "62":
            record = record._replace(pollingstationpostcode="PR5 0JR")  # was PR5 OJR

        # HIGHER  WALTON COMMUNITY CENTRE, OFF HIGHER  WALTON ROAD, <NAME>, PRESTON
        if record.pollingstationnumber == "64":
            record = record._replace(pollingstationpostcode="PR5 4HU")  # was PR5 4HV

        return super().station_record_to_dict(record)

    def address_record_to_dict(self, record):
        if record.housepostcode in ["PR5 5AU", "PR5 4TB"]:
            return None  # split
        return super().address_record_to_dict(record)
{'fraction_non_alphanumeric': 0.10531697341513292, 'fraction_numerical': 0.09100204498977506, 'mean_word_length': 3.2729257641921397, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, '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': '536781', 'n_tokens_mistral': 803, 'n_tokens_neox': 684, 'n_words': 124}