Expand description
§the destination
crate
A library providing types and methods for managing physical addresses in a municipality.
Logo art created using Gemini AI.
§Project Goals
Critical public and private services depend upon reliable and accurate address information, from emergency response to sewer lines and internet. Historic address information is often poorly standardized, and as a result, modern address databases can present a challenge for parsing, comparison and search. The motivation for this project stemmed from the difficulty our staff experienced reconciling our address database with our emergency dispatch provider. The tools developed in response have helped us to assign and reduce discrepancies and improve accuracy. While developed for use in Grants Pass, Oregon, the core logic is designed to work with any municipality. Users can import their address data by implementing the Address
trait on their own types, or by adhering to one of the current supported formats (e.g. the common
format).
The purpose of this library is to facilitate the classification and organization of addresses for physical locations. We categorize addresses using elements from the FGDC and NENA specifications. The crate facilitates reconciliation of address databases through the compare
module. Some functionality, such as the generation of LexisNexis tables, is tailored for local use by our staff, and not intended for wider use. This library is under active development, and may experience breaking changes in API.
Use this library to:
- Parse unstructured text to validated address data.
- Identify matching, divergent and missing addresses between two datasets.
- Geolocate records by address (business licenses, fire inspections, etc.).
- Compare the distance between matching addresses in two datasets.
- Identify duplicate addresses within a dataset.
- Generate the LexisNexis table for an address dataset.
Structs§
- Address
Delta - Deltas - Measuring the distance between points based upon matching values.
The
label
field ofAddressDelta
holds the matching value and thedelta
field holds the distance between matching points. - Address
Deltas - The
AddressDeltas
struct holds arecords
field that contains a vector of typeAddressDelta
. - Address
Error - The
AddressError
struct serves as the main error type for theaddress
library. - Address
Match - The
AddressMatch
is an intermediary data structure used internally to aggregate match information from comparing types that implementcrate::Addresses
, for the purpose of producingMatchRecords
. - Address
Points - The
AddressPoints
struct holds a vector of type [AddressPoint
]. - Builder
- The
Builder
struct contains error information about failure to construct a type from a builder. - Business
- The
Business
struct holds query information for active business licenses, for access in GIS. - Business
License - The
BusinessLicense
struct is designed to deserialize CSV data produced by querying the EnerGov SQL database for active business licenses. If the structure of the SQL query changes, this function will need to change to match the resulting fields in the CSV. - Business
Licenses - The
BusinessLicenses
struct holds arecords
field containing a vector of typeBusinessLicense
. - Business
Match Record - The
BusinessMatchRecord
struct holds match data for a licensed business. - Business
Match Records - The
BusinessMatchRecords
struct holds a vector ofBusinessMatchRecord
objects. - Businesses
- The
Businesses
struct is a wrapper around a vector of typeBusiness
. This struct contains business licenses that have mapped to valid addresses. - Cli
- The
Cli
struct provides the command-line interface for theaddress
library. - Common
Address - The
CommonAddress
struct defines the fields of a valid address, following the FGDC standard, with the inclusion of NENA-required fields for emergency response. - Common
Addresses - The
CommonAddresses
struct holds a vector of typeCommonAddress
. - Csv
- The
Csv
struct contains error information associated with thecsv
crate. - Decode
- The
Decode
struct contains decode error information associated with thebincode
crate. - Encode
- The
Encode
struct contains encoding error information associated with thebincode
crate. - Fire
Inspection - The
FireInspection
struct contains fields from a fire inspection record, with the business address mapped to aPartialAddress
. Built from aFireInspectionRaw
. - Fire
Inspection Match - The
FireInspectionmatch
struct holds aFireInspection
in theinspection
field, and aMatchPartialRecord
in therecord
field. Therecord
matches the partial business address against a set of fully-specified addresses. - Fire
Inspection Match Record - The
FireInspectionMatchRecord
struct holds a selection of fields from the fire inspection record and the partial address match, designed to export to csv for visualization in GIS. - Fire
Inspection Match Records - The
FireInspectionMatchRecords
struct is wrapper for a vector of typeFireInspectionMatchRecord
. - Fire
Inspection Matches - The
FireInspectionMatches
struct is a wrapper for a vector of typeFireInspectionMatch
. - Fire
Inspection Raw - The
FireInspectionRaw
struct functions as a builder for aFireInspection
struct. The fields correspond to the csv of fire inspection data from the fire department. A raw inspection represents the address a String, as opposed to aPartialAddress
. - Fire
Inspections - The
FireInspections
struct is a wrapper around a vector of typeFireInspection
. - GeoAddress
- The
GeoAddress
struct defines a common address that has associated geographic coordinates. - GeoAddresses
- The
GeoAddresses
struct holds a vector of typeGeoAddress
. - Grants
Pass Address - The
GrantsPassSpatialAddress
struct represents an address site point for the City of Grants Pass. - Grants
Pass Addresses - The
GrantsPassAddresses
struct holds a vector of type [‘GrantsPassAddress’]. - Grants
Pass Spatial Address - The
GrantsPassSpatialAddress
struct represents an address site point for the City of Grants Pass that includes geographic and projected coordinate information. - Grants
Pass Spatial Addresses - The
GrantsPassSpatialAddresses
struct holds a vector of type [‘GrantsPassSpatialAddress’]. - Io
- The
Io
struct contains error information associated with input/output calls. - Josephine
County Address - The
JosephineCountyAddress
struct represents an address site point for Josephine County, prior to the schema adopted by the agency in April of 2024. - Josephine
County Address2024 - The
JosephineCountyAddress2024
struct represents an address site point for Josephine County, consistent with the schema adopted by the agency in April of 2024. - Josephine
County Addresses - The
JosephineCountyAddresses
struct holds a vector of type [‘JosephineCountyAddress’]. - Josephine
County Addresses2024 - The
JosephineCountyAddresses2024
struct holds a vector of type [‘JosephineCountyAddress2024’]. - Josephine
County Spatial Address - The
JosephineCountySpatialAddress
struct represents an address site point for Josephine County that includes geographic and projected coordinate information, prior to the schema adopted by the agency in April of 2024. - Josephine
County Spatial Address2024 - The
JosephineCountySpatialAddress2024
struct represents an address site point for Josephine County that includes geographic and projected coordinate information, consistent with the schema adopted by the agency in April of 2024. - Josephine
County Spatial Addresses - The
JosephineCountySpatialAddresses
struct holds a vector of type [‘JosephineCountySpatialAddress’]. - Josephine
County Spatial Addresses2024 - The
JosephineCountySpatialAddresses2024
struct holds a vector of type [‘JosephineCountySpatialAddress2024’]. - Lexis
Nexis - The
LexisNexis
struct holds a vector ofLexisNexisItem
objects, for serialization into a .csv file. - Lexis
Nexis Item - The
LexisNexisItem
struct contains the required fields in the LexisNexis spreadsheet. - Lexis
Nexis Item Builder - The
LexisNexisItemBuilder
struct provides a framework to create and modify the required fields in the LexisNexis spreadsheet. - Lexis
Nexis Range - The
LexisNexisRange
struct holds a vector of address number observations associated with a given complete street name. Theinclude
field is true for addresses within the city limits or with a public safety agreement, and false for addresses outside of city limits or without a public safety agreement. Used to produce valid ranges of addresses in the city service area. - Lexis
Nexis Range Item - The
LexisNexisRangeItem
represents an address numbernum
, and whether to include the number in the range selection. - Match
Partial Record - The
MatchPartialRecord
struct contains match data for aPartialAddress
. - Match
Partial Records - The
MatchPartialRecords
struct holds a vector of typeMatchPartialRecord
. - Match
Record - A
MatchRecord
reports the match results for a single address compared against a set of addresses. Designed to plot and diagnose missing and divergent addresses. - Match
Records - The
MatchRecords
struct holds a vector of typeMatchRecord
. - Nom
- The
Nom
struct contains error information associated with thenom
crate. - Parse
- The
Parser
struct holds methods for parsing addresses. - Partial
Address - The
PartialAddress
struct contains optional fields so that incomplete or missing data can be compared againstAddresses
orPartialAddresses
for potential matches. Used to help match address information that does not parse into a full valid address. - Partial
Addresses - The
PartialAddresses
struct holds arecords
field that contains a vector of typePartialAddress
. - Spatial
Address - The
SpatialAddress
struct defines a common address that has both associated geographic coordinates and projected cartesian coordinates. - Spatial
Addresses - The
SpatialAddresses
struct holds a vector of typeSpatialAddress
. - Spatial
Addresses Raw - The
SpatialAddressesRaw
struct holds a vector of type [SpatialAddressRaw
].
Enums§
- Address
Error Kind - The
AddressErrorKind
enum contains the individual error type associated with the library operation. - Address
Status - The
AddressStatus
enum represents the address status, used by City of Grants Pass staff. - Match
Status - The
MatchStatus
enum delineates whether a given address has a match (theMatching
variant), has a match but differs in some descriptive fields (theDivergent
variant), or does not have a match in the comparison set (theMissing
variant). - Mismatch
- The
Mismatch
enum tracks the fields of an address that can diverge while still potentially referring to the same location. - Postal
Community - The
PostalCommunity
enum holds valid variants for the postal community field of an address. The list of valid postal communities is limited to the set of communities encountered locally, and we add new variants as needed. - State
- The
State
enum holds variants for state and territory names in the US used by the FAA. https://www.faa.gov/air_traffic/publications/atpubs/cnt_html/appendix_a.html - Street
Name Post Type - The
StreetNamePostType
represents the street name post type of an address. Acceptable post types include the list of recognized street suffix names in Appendix C1 of the United States Postal Service (USPS) Publication 28 - Postal Addressing Standards. - Street
Name PreDirectional - The
StreetNamePreDirectional
enum represents the street name predirectional component of the complete street name. Predirectionals in the City consist of NW, NE, SW and SE, but County roads annexed by the City can contain N, E, S and W. - Street
Name PreModifier - The
StreetNamePreModifier
is the pre-modifier element of a complete street name. - Street
Name PreType - The
StreetNamePreType
is the pre-type element of a complete street name. - Street
Separator - The
StreetNamePreType
is the pre-type element of a complete street name. - Subaddress
Type - The
SubaddressType
enum represents the subaddress type of an address. Valid type designations include the list of secondary unit designators in Appendix C2 of the United States Postal Service (USPS) Publication 28 - Postal Addressing Standards.
Traits§
- Address
- The
Address
trait enables the data to function as well-formed address. The methods of the trait define values for constituent components of an address. The address components follow the FGDC classification. - Addresses
- The
Addresses
trait enables methods that act on vectors of typeAddress
. - Cartesian
- The type can produce cartesian coordinates.
- Geographic
- The type can produce geographic coordinates.
- IntoBin
- The
IntoBin
trait indicates the type can be read from and to a binary file. - IntoCsv
- The
IntoCsv
trait indicates the type can be read from and to a csv file.
Functions§
- deserialize_
arcgis_ data - Function for deserailizing ArcGIS data that may contain either empty (Null) fields, or fields
with string value “<Null>”, either of which should translate to
None
. - deserialize_
phone_ number - The
deserialize_phone_number
function deserializes text input into an integer representation of a phone number. Strips parentheses around the area code, as well as periods or a hyphen used as a separator. - from_
bin - The
from_bin
function loads the contents of a file at locationpath
into aVec<u8>
. May error reading the file, for example if the location is invalid, or when deserializing the binary if the format is invalid. - from_
csv - Generic function to deserialize data types from a CSV file. Called by methods to avoid code duplication.
- parse_
phone_ number - The parse_phone_number function expects a phone number that may optionally include parenthesis around the area code, and the use of periods or a hyphen as a separator.
- to_bin
- The
save
method serializes the contents of self into binary and writes to a file at locationpath
. Errors bubble up from serialization inbincode
or file system access during write. - to_csv
- Generic function to serialize data types into a CSV file. Called by methods to avoid code duplication.
- trace_
init - The
trace_init
function initializing the tracing subscriber. - zero_
floor - Deserialization function for the
floor
field of County addresses. The County records single floor buildings as floor zero, whereas the City records floor numbers for multistory buildings and leaves the floor field empty for single story structures.