elmbridge md file added

This commit is contained in:
dt215git
2022-10-12 20:13:55 +01:00
parent 034575d0c7
commit 562b978e51
2 changed files with 82 additions and 2 deletions

View File

@@ -3,7 +3,6 @@ import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from datetime import datetime, timedelta from datetime import datetime, timedelta
from time import sleep
from waste_collection_schedule import Collection from waste_collection_schedule import Collection
TITLE = 'elmbridge.gov.uk' TITLE = 'elmbridge.gov.uk'
@@ -64,7 +63,7 @@ class Source:
# Some clunky logic can deal with this: # Some clunky logic can deal with this:
# If a date in less than 1 month in the past, it doesn't matter as the collection will have recently occured. # If a date in less than 1 month in the past, it doesn't matter as the collection will have recently occured.
# If a date is more than 1 month in the past, assume it's an incorrectly assigned date and increment the year by 1. # If a date is more than 1 month in the past, assume it's an incorrectly assigned date and increment the year by 1.
# One that's been done, offset the week-commencing dates to match day of the week each waste collection type is scheduled. # Once that's been done, offset the week-commencing dates to match day of the week each waste collection type is scheduled.
# If you have a better way of doing this, feel free to update via a Pull Request! # If you have a better way of doing this, feel free to update via a Pull Request!
# Get current date and year in format consistent with API result # Get current date and year in format consistent with API result

View File

@@ -0,0 +1,81 @@
# Elmbridge Borough Council
Support for schedules provided by [Elmbridge Borough Council](https://emaps.elmbridge.gov.uk/myElmbridge.aspx?tab=0#Refuse_&_Recycling), serving Elmbridge, UK.
## Configuration via configuration.yaml
```yaml
waste_collection_schedule:
sources:
- name: elmbridge_gov_uk
args:
uprn: UNIQUE_PROPERTY_REFERENCE_NUMBER
```
### Configuration Variables
**uprn**<br>
*(string) (required)*
This is required to unambiguously identify the property.
## Example
```yaml
waste_collection_schedule:
sources:
- name: elmbridge
args:
uprn: "10013119164"
```
## How to find your `UPRN`
An easy way to find your Unique Property Reference Number (UPRN) is by going to https://www.findmyaddress.co.uk/ and entering in your address details.
#### Notes:
The Elmbridge web site does not show a list of collection dates. It describes the day of the week your waste collection(s) happen on, and lists the start date of the weeks this applies to. The format also differs depending on your collection schedule, for example:
```
Refuse and recycling collection days
Your collection day for refuse is Wednesday in the weeks indicated below.
Your collection day for recycling is Wednesday in the weeks indicated below.
Your collection day for garden waste (if you subscribe) is Tuesday in the weeks indicated below.
Recycling and garden waste collections for weeks commencing Monday
10 Oct - refuse + garden
17 Oct - refuse + recycling
24 Oct - refuse + garden
31 Oct - refuse + recycling
```
```
Refuse and recycling collection days
Your collection day for refuse and food waste or, recycling and food waste is Tuesday in the weeks indicated below.
Your collection day for garden waste (if you subscribe) is Tuesday in the weeks indicated below.
Recycling and garden waste collections for weeks commencing Monday
10 Oct - refuse + food + garden
17 Oct - recycling + food
24 Oct - refuse + food + garden
31 Oct - recycling + food
```
Trying to convert all this into a schedule of dates for each specific waste collections is a bit fiddly. By way of explanaion of what the the script tries to do:
* It assumes the week-commencing dates are for the current year.
* This'll cause problems in December as upcoming January collections will have been assigned dates in the past.
* Some clunky logic can deal with this:
* If a date in less than 1 month in the past, it doesn't matter as the collection will have recently occured.
* If a date is more than 1 month in the past, assume it's an incorrectly assigned date and increments the year by 1.
* Once that's been done, offset the week-commencing dates to match day of the week indicated for each waste collection type.
There no indication of how public holidays affect collection schedules, so plenty of scope for things to go wrong!
If you have a better way of doing this, feel free to update all the elmbridge_gov_uk files via a pull request!