From 35e12e48697a20310fd222dad0cab5a287a577f7 Mon Sep 17 00:00:00 2001 From: James Turk Date: Fri, 28 Feb 2014 12:54:20 -0500 Subject: [PATCH] this is done in verify --- scripts/discrepancies.py | 44 ---------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 scripts/discrepancies.py diff --git a/scripts/discrepancies.py b/scripts/discrepancies.py deleted file mode 100644 index d4094447..00000000 --- a/scripts/discrepancies.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# Copyright BSD-3 Sunlight Labs, 2013, under the terms of the BSD-3 license. -# Paul Tagliamonte - -import sys -import csv - -# This will help us find out when we have entries that need to be -# matched up. This assumes identifiers are correct. - - -if len(sys.argv) != 4: - print "Need the idfile and mapping" - print " discrepancies.py identifiers/... mappings/... ocd-division/country:us/state:ma" - sys.exit(1) - -_, idfile, mapping, filter_ = sys.argv - - -def get_divids(fp): - with open(fp, 'rb') as csvfile: - reader = csv.reader(csvfile, delimiter=',', quotechar='"') - for divid, _ in reader: - if not divid.startswith(filter_): - continue - yield divid - - -ids = set(get_divids(idfile)) -mappings = set(get_divids(mapping)) - - -discrepancies = mappings - ids -for bad_entry in discrepancies: - print "INVALID", bad_entry - - -discrepancies = ids - mappings -for bad_entry in discrepancies: - print "MISSING", bad_entry - -print "" -print " checked %s total IDs" % (len(ids)) -print " against %s mappings" % (len(mappings))