Expand description
§the destination crate
A library providing types and methods for managing physical addresses in a municipality.

§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. Grants Pass or Josephine County).
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.
Structs§
- Address
Delta - Deltas - Measuring the distance between points based upon matching values.
The
labelfield ofAddressDeltaholds the matching value and thedeltafield holds the distance between matching points. - Address
Deltas - The
AddressDeltasstruct holds arecordsfield that contains a vector of typeAddressDelta. - Address
Error - The
AddressErrorstruct serves as the main error type for theaddresslibrary. - Address
Match - The
AddressMatchis an intermediary data structure used internally to aggregate match information from comparing types that implementcrate::Addresses, for the purpose of producingMatchRecords. - Bincode
- The
Bincodestruct contains error information associated with thebincodecrate. - Builder
- The
Builderstruct contains error information about failure to construct a type from a builder. - Business
- The
Businessstruct holds query information for active business licenses, for access in GIS. - Business
License - The
BusinessLicensestruct 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
BusinessLicensesstruct holds arecordsfield containing a vector of typeBusinessLicense. - Business
Match Record - The
BusinessMatchRecordstruct holds match data for a licensed business. - Business
Match Records - The
BusinessMatchRecordsstruct holds a vector ofBusinessMatchRecordobjects. - Businesses
- The
Businessesstruct is a wrapper around a vector of typeBusiness. This struct contains business licenses that have mapped to valid addresses. - Cli
- The
Clistruct provides the command-line interface for theaddresslibrary. - Common
Address - The
CommonAddressstruct defines the fields of a valid address, following the FGDC standard, with the inclusion of NENA-required fields for emergency response. - Common
Addresses - The
CommonAddressesstruct holds a vector of typeCommonAddress. - Csv
- The
Csvstruct contains error information associated with thecsvcrate. - Fire
Inspection - The
FireInspectionstruct contains fields from a fire inspection record, with the business address mapped to aPartialAddress. Built from aFireInspectionRaw. - Fire
Inspection Match - The
FireInspectionmatchstruct holds aFireInspectionin theinspectionfield, and aMatchPartialRecordin therecordfield. Therecordmatches the partial business address against a set of fully-specified addresses. - Fire
Inspection Match Record - The
FireInspectionMatchRecordstruct 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
FireInspectionMatchRecordsstruct is wrapper for a vector of typeFireInspectionMatchRecord. - Fire
Inspection Matches - The
FireInspectionMatchesstruct is a wrapper for a vector of typeFireInspectionMatch. - Fire
Inspection Raw - The
FireInspectionRawstruct functions as a builder for aFireInspectionstruct. 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
FireInspectionsstruct is a wrapper around a vector of typeFireInspection. - GeoAddress
- The
GeoAddressstruct defines a common address that has associated geographic coordinates. - GeoAddresses
- The
GeoAddressesstruct holds a vector of typeGeoAddress. - Grants
Pass Address - The
GrantsPassSpatialAddressstruct represents an address site point for the City of Grants Pass. - Grants
Pass Addresses - The
GrantsPassAddressesstruct holds a vector of type [‘GrantsPassAddress’]. - Grants
Pass Spatial Address - The
GrantsPassSpatialAddressstruct represents an address site point for the City of Grants Pass that includes geographic and projected coordinate information. - Grants
Pass Spatial Addresses - The
GrantsPassSpatialAddressesstruct holds a vector of type [‘GrantsPassSpatialAddress’]. - Io
- The
Iostruct contains error information associated with input/output calls. - Josephine
County Address - The
JosephineCountyAddressstruct represents an address site point for Josephine County, prior to the schema adopted by the agency in April of 2024. - Josephine
County Address2024 - The
JosephineCountyAddress2024struct represents an address site point for Josephine County, consistent with the schema adopted by the agency in April of 2024. - Josephine
County Addresses - The
JosephineCountyAddressesstruct holds a vector of type [‘JosephineCountyAddress’]. - Josephine
County Addresses2024 - The
JosephineCountyAddresses2024struct holds a vector of type [‘JosephineCountyAddress2024’]. - Josephine
County Spatial Address - The
JosephineCountySpatialAddressstruct 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
JosephineCountySpatialAddress2024struct 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
JosephineCountySpatialAddressesstruct holds a vector of type [‘JosephineCountySpatialAddress’]. - Josephine
County Spatial Addresses2024 - The
JosephineCountySpatialAddresses2024struct holds a vector of type [‘JosephineCountySpatialAddress2024’]. - Lexis
Nexis - The
LexisNexisstruct holds a vector ofLexisNexisItemobjects, for serialization into a .csv file. - Lexis
Nexis Item - The
LexisNexisItemstruct contains the required fields in the LexisNexis spreadsheet. - Lexis
Nexis Item Builder - The
LexisNexisItemBuilderstruct provides a framework to create and modify the required fields in the LexisNexis spreadsheet. - Lexis
Nexis Range - The
LexisNexisRangestruct holds a vector of address number observations associated with a given complete street name. Theincludefield 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
LexisNexisRangeItemrepresents an address numbernum, and whether to include the number in the range selection. - Match
Partial Record - The
MatchPartialRecordstruct contains match data for aPartialAddress. - Match
Partial Records - The
MatchPartialRecordsstruct holds a vector of typeMatchPartialRecord. - Match
Record - A
MatchRecordreports 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
MatchRecordsstruct holds a vector of typeMatchRecord. - Nom
- The
Nomstruct contains error information associated with thenomcrate. - Parse
- The
Parserstruct holds methods for parsing addresses. - Partial
Address - The
PartialAddressstruct contains optional fields so that incomplete or missing data can be compared againstAddressesorPartialAddressesfor potential matches. Used to help match address information that does not parse into a full valid address. - Partial
Addresses - The
PartialAddressesstruct holds arecordsfield that contains a vector of typePartialAddress. - Spatial
Address - The
SpatialAddressstruct defines a common address that has both associated geographic coordinates and projected cartesian coordinates. - Spatial
Addresses - The
SpatialAddressesstruct holds a vector of typeSpatialAddress. - Spatial
Addresses Raw - The
SpatialAddressesRawstruct holds a vector of type [SpatialAddressRaw].
Enums§
- Address
Error Kind - The
AddressErrorKindenum contains the individual error type associated with the library operation. - Address
Status - The
AddressStatusenum represents the address status, used by City of Grants Pass staff. - Match
Status - The
MatchStatusenum delineates whether a given address has a match (theMatchingvariant), has a match but differs in some descriptive fields (theDivergentvariant), or does not have a match in the comparison set (theMissingvariant). - Mismatch
- The
Mismatchenum tracks the fields of an address that can diverge while still potentially referring to the same location. - Postal
Community - The
PostalCommunityenum 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
Stateenum 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
StreetNamePostTyperepresents 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
StreetNamePreDirectionalenum 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
StreetNamePreModifieris the pre-modifier element of a complete street name. - Street
Name PreType - The
StreetNamePreTypeis the pre-type element of a complete street name. - Street
Separator - The
StreetNamePreTypeis the pre-type element of a complete street name. - Subaddress
Type - The
SubaddressTypeenum 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
Addresstrait 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
Addressestrait enables methods that act on vectors of typeAddress. - Cartesian
- The type can produce cartesian coordinates.
- Geographic
- The type can produce geographic coordinates.
- IntoBin
- The
IntoBintrait indicates the type can be read from and to a binary file. - IntoCsv
- The
IntoCsvtrait 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_numberfunction 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_binfunction loads the contents of a file at locationpathinto 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
savemethod serializes the contents of self into binary and writes to a file at locationpath. Errors bubble up from serialization inbincodeor 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_initfunction initializing the tracing subscriber. - zero_
floor - Deserialization function for the
floorfield 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.