Skip to content

Commit

Permalink
Don't create mappings for counties that don't have results
Browse files Browse the repository at this point in the history
Don't create mappings for counties that didn't produce results
in the 2009 Washington Primary election.

Addresses #212
  • Loading branch information
ghing committed Oct 11, 2014
1 parent 4783184 commit 9d65696
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
19 changes: 19 additions & 0 deletions openelex/us/wa/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 2 additions & 15 deletions openelex/us/wa/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 9d65696

Please sign in to comment.