Skip to content

Commit

Permalink
Use JSON ImageMask if RecordId is redacted
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalderm committed Jun 4, 2024
1 parent faf0a90 commit bb44e22
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions DVSorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""
import os
import ntpath
import sys
import csv
import json
Expand Down Expand Up @@ -182,7 +183,12 @@ def read_json_zip_batches(input_filename):
if name.startswith('CvrExport') and name.endswith('.json'):
obj = json.loads(source_zip.read(name))
for cvr in obj['Sessions']:
tab_id, bat_id, rec_id, model = cvr['TabulatorId'], cvr['BatchId'], cvr['RecordId'], tab_models[cvr['TabulatorId']]
tab_id, bat_id, rec_id, model = cvr['TabulatorId'], cvr['BatchId'], cvr.get('RecordId','X'), tab_models[cvr['TabulatorId']]
if rec_id == 'X' and 'ImageMask' in cvr:
name = ntpath.basename(cvr['ImageMask'])
if name.endswith('*.*'):
name=name[:-3]
rec_id = int(name.split("_")[2])
if (tab_id, bat_id, model) not in batches:
batches[(tab_id, bat_id, model)] = []
if rec_id == 'X':
Expand Down Expand Up @@ -236,7 +242,7 @@ def multi_file_reader(filenames, use_images):
for result in batch_reader(filename):
yield result

def process_files(filenames, use_images=False, show_unshuffled=True):
def process_files(filenames, use_images=False, show_unshuffled=False):
"""
Processes ballots from a specified file.
Expand Down

0 comments on commit bb44e22

Please sign in to comment.