From 9d656963810f524cf076ea803adbe98d6fc13d3a Mon Sep 17 00:00:00 2001 From: Geoff Hing Date: Fri, 10 Oct 2014 22:49:46 -0500 Subject: [PATCH] Don't create mappings for counties that don't have results Don't create mappings for counties that didn't produce results in the 2009 Washington Primary election. Addresses https://github.com/openelections/core/issues/212 --- openelex/us/wa/datasource.py | 19 +++++++++++++++++++ openelex/us/wa/load.py | 17 ++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/openelex/us/wa/datasource.py b/openelex/us/wa/datasource.py index cbf9383..5750b83 100644 --- a/openelex/us/wa/datasource.py +++ b/openelex/us/wa/datasource.py @@ -6,6 +6,21 @@ from openelex.lib.text import ocd_type_id class Datasource(BaseDatasource): + NO_2009_PRIMARY_RESULTS_COUNTIES = [ + 'Pierce', + 'Ferry', + 'Wahkiakum', + 'Whatcom', + 'Pend Oreille', + 'Kitsap', + 'Kittitas', + ] + """ + Counties that don't have 2009 primary election results. + + See https://github.com/openelections/core/issues/212 + """ + def mappings(self, year=None): mappings = [] for yr, elecs in self.elections(year).items(): @@ -148,6 +163,10 @@ def _build_metadata_state_county(self, election, extra_statewide=None, meta_entries = [] for county in self._counties(): + if (election['slug'] == "wa-2009-08-18-primary" and + county['name'] in self.NO_2009_PRIMARY_RESULTS_COUNTIES): + continue + generated_filename = self._standardized_filename(election, extension=".csv", reporting_level='county', jurisdiction=county['name'], office=office) diff --git a/openelex/us/wa/load.py b/openelex/us/wa/load.py index be93694..562a5f9 100644 --- a/openelex/us/wa/load.py +++ b/openelex/us/wa/load.py @@ -76,9 +76,8 @@ def run(self, mapping): election = mapping['election'] """ - bad_filenames[] holds the list of files who have content that's not - actual information (e.g. a mess of HTML from a file that moved on the - remote server) or are hard to use (e.g. an .xls file with 10 sheets). + bad_filenames[] holds the list of files who have content that's + hard to use (e.g. an .xls file with 10 sheets). The edge cases will be taken care of later. The cases where there is zero actual usable data will have to be rectified outside of the @@ -87,18 +86,6 @@ def run(self, mapping): """ bad_filenames = [ - - # These files are missing from the state's webserver - # See https://github.com/openelections/core/issues/212 - - '20090818__wa__primary__pierce__county.csv', - '20090818__wa__primary__ferry__county.csv', - '20090818__wa__primary__wahkiakum__county.csv', - '20090818__wa__primary__whatcom__county.csv', - '20090818__wa__primary__pend_oreille__county.csv', - '20090818__wa__primary__kitsap__county.csv', - '20090818__wa__primary__kittitas__county.csv', - # The below are Excel (.xls) files that have results spread across # multiple worksheets and in different structures from each other