"""
Import Bournemouth Council
"""
from django.contrib.gis.geos import Point

from data_collection.management.commands import BaseCsvStationsJsonDistrictsImporter

class Command(BaseCsvStationsJsonDistrictsImporter):
    """
    Imports the Polling station/district data from Bournemouth Council
    """
    council_id     = 'E06000028'
    districts_name = 'Bournemouth_Polling_Districts.geojson'
    stations_name  = 'Polling Stations.csv'
    elections      = ['parl.2015-05-07']

    def district_record_to_dict(self, record):

        properties = record['properties']

        if properties['Polling_Districts'] is None:
            return None
        return dict(
            council=self.council,
            internal_council_id=properties['Polling_Districts'],
            name="%s - %s" % (properties['Ward'], properties['Polling_Districts']),
            polling_station_id=properties['Polling_Districts']
        )

    def station_record_to_dict(self, record):
        location = Point(float(record.easting), float(record.northing), srid=self.srid)
        return dict(
            council=self.council,
            internal_council_id=record.polling_station_code,
            postcode=None,
            address=record.location,
            location=location,
            polling_district_id=record.polling_station_code
        )

@@ -1,82 +1,4 @@
-%22%22%22%0AImport Bournemouth Council%0A%22%22%22%0Afrom django.contrib.gis.geos import Point%0A%0A
 from
@@ -49,32 +49,19 @@
 Base
-CsvStationsJsonDistricts
+HalaroseCsv
 Impo
@@ -88,129 +88,29 @@
 Base
-CsvStationsJsonDistrictsImporter):%0A    %22%22%22%0A    Imports the Polling station/district data from Bournemouth Council%0A    %22%22%22
+HalaroseCsvImporter):
 %0A   
@@ -125,16 +125,17 @@
 _id     
+ 
 = 'E0600
@@ -148,131 +148,26 @@
     
-districts_name = 'Bournemouth_Polling_Districts.geojson'%0A    stations_name  = 'Polling Stations.csv'%0A    elections      = %5B
+addresses_name  = 
 'par
@@ -175,875 +175,228 @@
 .201
-5-05-07'%5D%0A%0A    def district_record_to_dict(self, record):%0A%0A        properties = record%5B'properties'%5D%0A%0A        if properties%5B'Polling_Districts'%5D is None:%0A            return None%0A        return dict(%0A            council=self.council,%0A            internal_council_id=properties%5B'Polling_Districts'%5D,%0A            name=%22%25s - %25s%22 %25 (properties%5B'Ward'%5D, properties%5B'Polling_Districts'%5D),%0A            polling_station_id=properties%5B'Polling_Districts'%5D%0A        )%0A%0A    def station_record_to_dict(self, record):%0A        location = Point(float(record.easting), float(record.northing), srid=self.srid)%0A        return dict(%0A            council=self.council,%0A            internal_council_id=record.polling_station_code,%0A            postcode=None,%0A            address=record.location,%0A            location=location,%0A            polling_district_id=record.polling_station_code%0A        )
+7-06-08/Version 1/polling_station_export-2017-05-09.csv'%0A    stations_name   = 'parl.2017-06-08/Version 1/polling_station_export-2017-05-09.csv'%0A    elections       = %5B'parl.2017-06-08'%5D%0A    csv_encoding    = 'windows-1252'
 %0A

update import script for Bournemouth for parl.2017-06-08