|
@ -13,8 +13,8 @@ application. |
|
|
### Business Requirements |
|
|
### Business Requirements |
|
|
1. The API will receive a latitude/longitude, using the provided list in pharmacies.csv the API will calculate the |
|
|
1. The API will receive a latitude/longitude, using the provided list in pharmacies.csv the API will calculate the |
|
|
closest pharmacy to the input latitude/longitude. |
|
|
closest pharmacy to the input latitude/longitude. |
|
|
2. The API will return the closest pharmacy (with name and address) in a consumable response packet. 3. The |
|
|
2. The API will return the closest pharmacy (with name and address) in a consumable response packet. |
|
|
API will include the distance (in miles) between the input latitude/longitude and the selected closest pharmacy |
|
|
3. The API will include the distance (in miles) between the input latitude/longitude and the selected closest pharmacy |
|
|
in the response packet. |
|
|
in the response packet. |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -38,3 +38,15 @@ create table pharmacies |
|
|
Longitude REAL not null |
|
|
Longitude REAL not null |
|
|
); |
|
|
); |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
----- |
|
|
|
|
|
|
|
|
|
|
|
Call: https://rhays.us/Examples/RX_API_Call/RX.php?K=RLH1234&Latitude=39.1030&Longitude=-95.3222 |
|
|
|
|
|
|
|
|
|
|
|
This is a basic lookup system to find the closest pharmacy to a given Lat/Lon |
|
|
|
|
|
|
|
|
|
|
|
My assumptions: |
|
|
|
|
|
1) No clear request for distance, options are drive distance or straight line distance, I chose: straight line distance. |
|
|
|
|
|
2) No request trap errors, I added a few, validation, key check, request check, and a basic DB check. |
|
|
|
|
|
3) Output was requested as a packet but not the type, so I just passed the requested data back as text and not JSON. |
|
|
|
|
|
|
|
|