Crate destination

Source
Expand description

§the destination crate

A library providing types and methods for managing physical addresses in a municipality.

Destination Logo 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§

AddressDelta
Deltas - Measuring the distance between points based upon matching values. The label field of AddressDelta holds the matching value and the delta field holds the distance between matching points.
AddressDeltas
The AddressDeltas struct holds a records field that contains a vector of type AddressDelta.
AddressError
The AddressError struct serves as the main error type for the address library.
AddressMatch
The AddressMatch is an intermediary data structure used internally to aggregate match information from comparing types that implement crate::Addresses, for the purpose of producing MatchRecords.
AddressPoints
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.
BusinessLicense
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.
BusinessLicenses
The BusinessLicenses struct holds a records field containing a vector of type BusinessLicense.
BusinessMatchRecord
The BusinessMatchRecord struct holds match data for a licensed business.
BusinessMatchRecords
The BusinessMatchRecords struct holds a vector of BusinessMatchRecord objects.
Businesses
The Businesses struct is a wrapper around a vector of type Business. This struct contains business licenses that have mapped to valid addresses.
Cli
The Cli struct provides the command-line interface for the address library.
CommonAddress
The CommonAddress struct defines the fields of a valid address, following the FGDC standard, with the inclusion of NENA-required fields for emergency response.
CommonAddresses
The CommonAddresses struct holds a vector of type CommonAddress.
Csv
The Csv struct contains error information associated with the csv crate.
Decode
The Decode struct contains decode error information associated with the bincode crate.
Encode
The Encode struct contains encoding error information associated with the bincode crate.
FireInspection
The FireInspection struct contains fields from a fire inspection record, with the business address mapped to a PartialAddress. Built from a FireInspectionRaw.
FireInspectionMatch
The FireInspectionmatch struct holds a FireInspection in the inspection field, and a MatchPartialRecord in the record field. The record matches the partial business address against a set of fully-specified addresses.
FireInspectionMatchRecord
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.
FireInspectionMatchRecords
The FireInspectionMatchRecords struct is wrapper for a vector of type FireInspectionMatchRecord.
FireInspectionMatches
The FireInspectionMatches struct is a wrapper for a vector of type FireInspectionMatch.
FireInspectionRaw
The FireInspectionRaw struct functions as a builder for a FireInspection 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 a PartialAddress.
FireInspections
The FireInspections struct is a wrapper around a vector of type FireInspection.
GeoAddress
The GeoAddress struct defines a common address that has associated geographic coordinates.
GeoAddresses
The GeoAddresses struct holds a vector of type GeoAddress.
GrantsPassAddress
The GrantsPassSpatialAddress struct represents an address site point for the City of Grants Pass.
GrantsPassAddresses
The GrantsPassAddresses struct holds a vector of type [‘GrantsPassAddress’].
GrantsPassSpatialAddress
The GrantsPassSpatialAddress struct represents an address site point for the City of Grants Pass that includes geographic and projected coordinate information.
GrantsPassSpatialAddresses
The GrantsPassSpatialAddresses struct holds a vector of type [‘GrantsPassSpatialAddress’].
Io
The Io struct contains error information associated with input/output calls.
JosephineCountyAddress
The JosephineCountyAddress struct represents an address site point for Josephine County, prior to the schema adopted by the agency in April of 2024.
JosephineCountyAddress2024
The JosephineCountyAddress2024 struct represents an address site point for Josephine County, consistent with the schema adopted by the agency in April of 2024.
JosephineCountyAddresses
The JosephineCountyAddresses struct holds a vector of type [‘JosephineCountyAddress’].
JosephineCountyAddresses2024
The JosephineCountyAddresses2024 struct holds a vector of type [‘JosephineCountyAddress2024’].
JosephineCountySpatialAddress
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.
JosephineCountySpatialAddress2024
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.
JosephineCountySpatialAddresses
The JosephineCountySpatialAddresses struct holds a vector of type [‘JosephineCountySpatialAddress’].
JosephineCountySpatialAddresses2024
The JosephineCountySpatialAddresses2024 struct holds a vector of type [‘JosephineCountySpatialAddress2024’].
LexisNexis
The LexisNexis struct holds a vector of LexisNexisItem objects, for serialization into a .csv file.
LexisNexisItem
The LexisNexisItem struct contains the required fields in the LexisNexis spreadsheet.
LexisNexisItemBuilder
The LexisNexisItemBuilder struct provides a framework to create and modify the required fields in the LexisNexis spreadsheet.
LexisNexisRange
The LexisNexisRange struct holds a vector of address number observations associated with a given complete street name. The include 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.
LexisNexisRangeItem
The LexisNexisRangeItem represents an address number num, and whether to include the number in the range selection.
MatchPartialRecord
The MatchPartialRecord struct contains match data for a PartialAddress.
MatchPartialRecords
The MatchPartialRecords struct holds a vector of type MatchPartialRecord.
MatchRecord
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.
MatchRecords
The MatchRecords struct holds a vector of type MatchRecord.
Nom
The Nom struct contains error information associated with the nom crate.
Parse
The Parser struct holds methods for parsing addresses.
PartialAddress
The PartialAddress struct contains optional fields so that incomplete or missing data can be compared against Addresses or PartialAddresses for potential matches. Used to help match address information that does not parse into a full valid address.
PartialAddresses
The PartialAddresses struct holds a records field that contains a vector of type PartialAddress.
SpatialAddress
The SpatialAddress struct defines a common address that has both associated geographic coordinates and projected cartesian coordinates.
SpatialAddresses
The SpatialAddresses struct holds a vector of type SpatialAddress.
SpatialAddressesRaw
The SpatialAddressesRaw struct holds a vector of type [SpatialAddressRaw].

Enums§

AddressErrorKind
The AddressErrorKind enum contains the individual error type associated with the library operation.
AddressStatus
The AddressStatus enum represents the address status, used by City of Grants Pass staff.
MatchStatus
The MatchStatus enum delineates whether a given address has a match (the Matching variant), has a match but differs in some descriptive fields (the Divergent variant), or does not have a match in the comparison set (the Missing variant).
Mismatch
The Mismatch enum tracks the fields of an address that can diverge while still potentially referring to the same location.
PostalCommunity
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
StreetNamePostType
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.
StreetNamePreDirectional
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.
StreetNamePreModifier
The StreetNamePreModifier is the pre-modifier element of a complete street name.
StreetNamePreType
The StreetNamePreType is the pre-type element of a complete street name.
StreetSeparator
The StreetNamePreType is the pre-type element of a complete street name.
SubaddressType
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 type Address.
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 location path into a Vec<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 location path. Errors bubble up from serialization in bincode 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.