feedingamerica / freshtrak-public

FreshTrak public access created with Can't Stop Columbus March 2020
4 stars 3 forks source link

Pantry Finder - Event Resources - add distance #42

Open karengreene opened 4 years ago

karengreene commented 4 years ago

The distance in the Event Resources section is not correct. Phil said that the issue is that the distance isn't correct because can't get the zip query to serialize.

davidpickering commented 4 years ago
@PhilNorman2 has made quite a bit of progress on this. 

Example JSON: `
{
  "zip_agencies": [
    {
      "id": 72,
      "agencies": [
        {
          "id": 6,
          "address": "3960 BROOKHAM DR",
          "city": "GROVE CITY",
          "state": "OH",
          "zip": "43123",
          "phone": "614-317-9482",
          "name": "Mid-Ohio Foodbank - Kroger Community Pantry",
          "nickname": "MOF Kroger Pantry",
          "events": [
            {
              "id": 5563,
              "address": "3960 BROOKHAM DR ",
              "city": "Grove City",
              "state": "OH",
              "zip": "43123",
              "agency_id": 6,
              "latitude": "39.8862352",
              "longitude": "-83.05538713",
              "name": "Drive Through",
              "service": "Prepack Pantry",
              "zip_query": "43046",
              "distance": 28,
              "event_dates": [
                {
                  "id": 9,
                  "event_id": 5563,
                  "start_time": "01:00 PM",
                  "end_time": "03:00 PM",
                  "date": "2020-04-20"
                },
                {
                  "id": 10,
                  "event_id": 5563,
                  "start_time": "01:00 PM",
                  "end_time": "03:00 PM",
                  "date": "2020-04-22"
                },
                {
                  "id": 11,
                  "event_id": 5563,
                  "start_time": "01:00 PM",
                  "end_time": "03:00 PM",
                  "date": "2020-04-24"
                },
                {
                  "id": 12,
                  "event_id": 5563,
                  "start_time": "01:00 PM",
                  "end_time": "03:00 PM",
                  "date": "2020-04-25"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 89,
      "agencies": [
        {
          "id": 59,
          "address": "41 W 1ST ST",
          "city": "BUCKEYE LAKE",
          "state": "OH",
          "zip": "43008",
          "phone": "740-928-4481",
          "name": "Buckeye Lake LEADS",
          "nickname": "Buckeye Lake LEADS",
          "events": [
            {
              "id": 96,
              "address": "5302 Walnut Road SW ",
              "city": "BUCKEYE LAKE",
              "state": "OH",
              "zip": "43008",
              "agency_id": 59,
              "latitude": "39.932396",
              "longitude": "-82.481078",
              "name": "Pantry",
              "service": "Choice Pantry",
              "zip_query": "43046",
              "distance": 3,
              "event_dates": [
                {
                  "id": 37,
                  "event_id": 96,
                  "start_time": "08:00 AM",
                  "end_time": "11:00 AM",
                  "date": "2020-04-20"
                },
                {
                  "id": 38,
                  "event_id": 96,
                  "start_time": "08:00 AM",
                  "end_time": "11:00 AM",
                  "date": "2020-04-23"
                },
                {
                  "id": 39,
                  "event_id": 96,
                  "start_time": "08:00 AM",
                  "end_time": "11:00 AM",
                  "date": "2020-04-25"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 124,
      "agencies": [
        {
          "id": 85,
          "address": "9350 Jacksontown Road",
          "city": "JACKSONTOWN",
          "state": "OH",
          "zip": "43030",
          "phone": "740-323-4430",
          "name": "Jacksontown United Methodist Church",
          "nickname": "Jacksontown United Methodist Church",
          "events": [
            {
              "id": 125,
              "address": "9350 Jacksontown Road ",
              "city": "JACKSONTOWN",
              "state": "OH",
              "zip": "43030",
              "agency_id": 85,
              "latitude": "39.9578234",
              "longitude": "-82.4139482",
              "name": "Pantry",
              "service": "Choice Pantry",
              "zip_query": "43046",
              "distance": 7,
              "event_dates": [
                {
                  "id": 46,
                  "event_id": 125,
                  "start_time": "01:00 PM",
                  "end_time": "04:00 PM",
                  "date": "2020-04-22"
                },
                {
                  "id": 47,
                  "event_id": 125,
                  "start_time": "01:00 PM",
                  "end_time": "04:00 PM",
                  "date": "2020-04-24"
                },
                {
                  "id": 48,
                  "event_id": 125,
                  "start_time": "01:00 PM",
                  "end_time": "04:00 PM",
                  "date": "2020-04-25"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 147,
      "agencies": [
        {
          "id": 104,
          "address": "2315 WEEKLY AVE",
          "city": "MILLERSPORT",
          "state": "OH",
          "zip": "43046",
          "phone": "614-314-3901",
          "name": "Millersport Community Food Pantry",
          "nickname": "Millersport Community Food Pantry",
          "events": [
            {
              "id": 159,
              "address": "2315 WEEKLY AVE ",
              "city": "MILLERSPORT",
              "state": "OH",
              "zip": "43046",
              "agency_id": 104,
              "latitude": "39.90037882",
              "longitude": "-82.53778996",
              "name": "Pantry",
              "service": "Choice Pantry",
              "zip_query": "43046",
              "distance": 0,
              "event_dates": [
                {
                  "id": 28,
                  "event_id": 159,
                  "start_time": "03:00 PM",
                  "end_time": "04:30 PM",
                  "date": "2020-04-23"
                },
                {
                  "id": 29,
                  "event_id": 159,
                  "start_time": "03:00 PM",
                  "end_time": "04:30 PM",
                  "date": "2020-04-24"
                },
                {
                  "id": 30,
                  "event_id": 159,
                  "start_time": "03:00 PM",
                  "end_time": "04:30 PM",
                  "date": "2020-04-25"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
davidpickering commented 4 years ago

I gave Phil this feedback: Comments:

davidpickering commented 4 years ago

This work is pretty far along, and we are likely to see a PR from Phil in the coming days.

PhilNorman2 commented 4 years ago

I had to recreate the linked PR in the comment above to a new repository. Here is a link to the new PR: https://github.com/midohiofoodbank/freshtrak-pantry-finder-api/pull/3

PhilNorman2 commented 4 years ago

We will need to figure out a way to configure the board to pull in the appropriate repos for the right audiences.