[OPEN-ILS-DEV] Utilities to make zips.txt from your patron database

Ben Ostrowsky ben at esilibrary.com
Wed May 11 13:35:02 EDT 2011


elect_zips will find the most popular city/state combination for each
ZIP code in your database.

enrich_zips will add county names (given a copy of the Geonames
database, which is at http://download.geonames.org/export/zip/US.zip)
and spit out data in zips.txt format, warning you about mismatches and
non-matches.

http://git.esilibrary.com/?p=migration-tools.git;a=blob;f=elect_zips
http://git.esilibrary.com/?p=migration-tools.git;a=blob;f=enrich_zips

Usage:

psql -U evergreen -A -t -F $'\t' -c 'SELECT city, state, post_code
FROM actor.usr_address' | elect_zips | enrich_zips --warn --makezips
--db US.txt > zips.txt 2> warnings.txt

I'd like to add support for inserting an area code (where there is a
known and unambiguous area code for a ZIP), but I haven't found a
database to use.

Share and enjoy!
Ben


More information about the Open-ils-dev mailing list