@@ -0,0 +1,2114 @@
+%22%22%22%0AImport Neath Port Talbot%0A%0Anote: this script takes quite a long time to run%0A%22%22%22%0Afrom django.contrib.gis.geos import Point%0Afrom data_collection.management.commands import (%0A    BaseAddressCsvImporter,%0A    import_polling_station_shapefiles%0A)%0A%0Aclass Command(BaseAddressCsvImporter):%0A    %22%22%22%0A    Imports the Polling Station data from Neath Port Talbot%0A    %22%22%22%0A    council_id       = 'W06000012'%0A    addresses_name   = 'polling_properties.csv'%0A    stations_name    = 'polling_stations.shp'%0A    srid             = 27700%0A    elections        = %5B%0A        'pcc.2016-05-05',%0A        'naw.c.2016-05-05',%0A        'naw.r.2016-05-05',%0A        'ref.2016-06-23'%0A    %5D%0A%0A    # polling stations provided as shape files, not csv%0A    def import_polling_stations(self):%0A        import_polling_station_shapefiles(self)%0A%0A    def station_record_to_dict(self, record):%0A%0A        # format address%0A        address_parts = %5B%5D%0A        address_parts.append(record%5B2%5D)%0A        for i in range(4,8):%0A            if record%5Bi%5D.strip():%0A                address_parts.append(record%5Bi%5D.strip())%0A        address = %22%5Cn%22.join(address_parts)%0A%0A        return %7B%0A            'internal_council_id': record%5B1%5D,%0A            'postcode'           : record%5B8%5D,%0A            'address'            : address%0A        %7D%0A%0A    def address_record_to_dict(self, record):%0A%0A        # format address%0A        if record.substreetn:%0A            address1 = %22%25s %25s %25s%22 %25 (record.housename, record.housenumbe, record.substreetn)%0A            address1 = address1.strip()%0A            address2 = record.streetname%0A        else:%0A            address1 = %22%25s %25s %25s%22 %25 (record.housename, record.housenumbe, record.streetname)%0A            address1 = address1.strip()%0A            address2 = %22%22%0A%0A        address = %22%5Cn%22.join(%5B%0A            address1,%0A            address2,%0A            record.locality,%0A            record.town%0A        %5D)%0A        while %22%5Cn%5Cn%22 in address:%0A            address = address.replace(%22%5Cn%5Cn%22, %22%5Cn%22)%0A%0A        return %7B%0A            'address'           : address,%0A            'postcode'          : record.housepostc,%0A            'polling_station_id': record.pollingdis%0A        %7D%0A

Add import script for Neath Port Talbot