[freeside-commits] branch FREESIDE_4_BRANCH updated. 8a740849b0ae3ecc758ac9c2d69b92234f521fc9

Ivan Kohler ivan at freeside.biz
Mon Apr 11 15:43:27 PDT 2022


The branch, FREESIDE_4_BRANCH has been updated
       via  8a740849b0ae3ecc758ac9c2d69b92234f521fc9 (commit)
      from  980dbd5c9bd158ef683c89c98e0eb9452f908417 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8a740849b0ae3ecc758ac9c2d69b92234f521fc9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 11 15:43:26 2022 -0700

    strip address suffixes for better census coding, RT#86245

diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index 599b2a082..3beffc8a9 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -134,8 +134,11 @@ sub get_censustract_uscensus {
 
   my $url = 'https://geocoding.geo.census.gov/geocoder/geographies/address?';
 
+  my $address1 = $location->{address1};
+  $address1 =~ s/(apt|ste|suite|unit)[\s\d]\w*\s*$//i;
+
   my $query_hash = {
-                     street     => $location->{address1},
+                     street     => $address1,
                      city       => $location->{city},
                      state      => $location->{state},
                      benchmark  => 'Public_AR_Current',

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Misc/Geo.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list