[x] run the application locally (bin/rails server) and verified that my changes behave as expected.
[x] run static code analysis (bin/rubocop) and vulnerability scan (bin/brakeman) against my changes.
[x] run the test suite (bin/rake spec) and verified that all tests pass.
[x] summarized below my changes and noted which issues (if any) this pull request fixes or addresses.
[x] thoroughly outlined below the steps necessary to test my changes.
[x] read, understand, and agree to the terms described in CONTRIBUTING.md.
Summary of Changes
This pull request…
Uses the Google Maps Directions API to calculate distances between full ZIP codes in the PPM Estimator
Adds the google-maps gem
Removes the cached ZIP3-to-ZIP3 distances retrieved from DTOD from the database and seeds
It turns out that PPMs do not use Basepoint City to Basepoint City distance, like HHGs. Instead, DPS asks DTOD for the distance between the full ZIP5 codes to calculate the distance.
Since we don't want to rely on DTOD for the move.mil portal, this PR asks Google for the distance instead. It uses the same GOOGLE_MAPS_API_KEY environment variable as Locator Maps.
This is more accurate than the previously used ZIP3-to-ZIP3 distances, but is not identical to what DTOD would return for the same query, since DTOD uses a different data source and takes trucking restrictions into account.
Removing the stored ZIP3-to-ZIP3 distance data also reduces the time needed to seed.
One downside to this change is that estimates take slightly longer to calculate, due to the call to Google's API.
Testing
To verify the changes proposed in this pull request…
clone this repo,
git checkout ppm-zip5-distance,
set up development dependencies according to CONTRIBUTING.md,
Checklist
I have…
bin/rails server
) and verified that my changes behave as expected.bin/rubocop
) and vulnerability scan (bin/brakeman
) against my changes.bin/rake spec
) and verified that all tests pass.Summary of Changes
This pull request…
It turns out that PPMs do not use Basepoint City to Basepoint City distance, like HHGs. Instead, DPS asks DTOD for the distance between the full ZIP5 codes to calculate the distance.
Since we don't want to rely on DTOD for the move.mil portal, this PR asks Google for the distance instead. It uses the same GOOGLE_MAPS_API_KEY environment variable as Locator Maps.
This is more accurate than the previously used ZIP3-to-ZIP3 distances, but is not identical to what DTOD would return for the same query, since DTOD uses a different data source and takes trucking restrictions into account.
Removing the stored ZIP3-to-ZIP3 distance data also reduces the time needed to seed.
One downside to this change is that estimates take slightly longer to calculate, due to the call to Google's API.
Testing
To verify the changes proposed in this pull request…
ppm-zip5-distance
,bin/rails server
, and