<commit_before>from data_collection.management.commands import BaseShpStationsShpDistrictsImporter

class Command(BaseShpStationsShpDistrictsImporter):
    srid = 27700
    council_id = 'W06000009'
    districts_name = 'PollingDistrictWithStation Pembrokeshire for 2017/PollingDistrictWithStation'
    stations_name = 'PollingDistrictWithStation Pembrokeshire for 2017/PollingDistrictWithStation.shp'
    elections = [
        'local.pembrokeshire.2017-05-04',
        #'parl.2017-06-08'
    ]

    def district_record_to_dict(self, record):
        return {
            'internal_council_id': str(record[1]).strip(),
            'name': str(record[2]).strip()
        }

    def station_record_to_dict(self, record):
        station = {
            'internal_council_id': str(record[1]).strip(),
            'postcode': '',
            'address': str(record[4]).strip(),
            'polling_district_id': str(record[1]).strip(),
        }

        """
        This file doesn't actually have points for stations
        and we want to ensure that we don't try to insert
        the polygon data into the location field
        """
        station ['location'] = None

        return station<commit_msg>update Pembrokeshire import script<commit_after>from data_collection.morph_importer import BaseMorphApiImporter

class Command(BaseMorphApiImporter):

    srid = 4326
    districts_srid  = 4326
    council_id = 'W06000009'
    elections = ['parl.2017-06-08']
    scraper_name = 'wdiv-scrapers/DC-PollingStations-Pembrokeshire'
    geom_type = 'geojson'

    def district_record_to_dict(self, record):
        poly = self.extract_geometry(record, self.geom_type, self.get_srid('districts'))
        return {
            'internal_council_id': record['DistrictID'],
            'name': record['DistrictName'],
            'area': poly,
            'polling_station_id': record['StationID'],
        }

    def station_record_to_dict(self, record):
        location = self.extract_geometry(record, self.geom_type, self.get_srid('stations'))
        return {
            'internal_council_id': record['StationID'],
            'postcode': '',
            'address': record['StationName'],
            'location': location,
        }
{'fraction_non_alphanumeric': 0.10887096774193548, 'fraction_numerical': 0.02956989247311828, 'mean_word_length': 2.8633217993079585, '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': '2408309', 'n_tokens_mistral': 733, 'n_tokens_neox': 662, 'n_words': 124}