Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Nottingham City to pull only one date per bin type #3353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TurnrDev
Copy link
Contributor

Nottingham City API sometimes give multiple dates for bins, particularly just after collection date. Locally, it makes sense to only use the smallest of these dates as we want the NEXT collection only.

Here's an example API response which is causing the issue:

{
  "uprn": "200001405145",
  "address": "FLAT 2 3 CAMERON STREET",
  "postcode": "NG5 2HS",
  "binTypes": [
    "CommunalRecycling",
    "Waste",
    "Garden",
    "Recycling"
  ],
  "nextCollections": [
    {
      "collectionType": "Waste",
      "collectionDate": "2025-01-07T07:00:00",
      "collectionDay": "Tuesday"
    },
    {
      "collectionType": "Recycling",
      "collectionDate": "2025-01-14T07:00:00",
      "collectionDay": "Tuesday"
    },
    {
      "collectionType": "Recycling",
      "collectionDate": "2400-01-11T00:00:00",
      "collectionDay": "Tuesday"
    },
    {
      "collectionType": "Garden",
      "collectionDate": "2900-01-19T00:00:00",
      "collectionDay": "Tuesday"
    }
  ],
  "hasWaste": true,
  "hasRecycling": true,
  "hasGarden": true,
  "hasFood": false,
  "isCommunal": true,
  "nextBinIsWaste": true,
  "nextBinIsRecycling": false,
  "nextBinIsGarden": false,
  "nextBinIsFood": false,
  "recyclingWeek": "Recycling Week A",
  "nextCollectionType": "Waste",
  "nextCollectionDate": "2025-01-07T07:00:00",
  "oldStyleCategoryForMyProperty": "waste-hasgarden",
  "collectionDay": "Tuesday",
  "calendarDay": "Tuesday",
  "contextJobs": null
}

Nottingham City API sometimes give multiple dates for bins, particularly just after collection date. Locally, it makes sense to only use the smallest of these dates as we want the NEXT collection only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant