Skip to content

Commit

Permalink
New Source: umweltverbaende.at (#1295)
Browse files Browse the repository at this point in the history
* import from off-line repo

* update_docu_links run

* updated Baden/Scheibbs .md

* depreciation warning added to source scripts
  • Loading branch information
dt215git authored Oct 5, 2023
1 parent ec54d49 commit 5f618df
Show file tree
Hide file tree
Showing 8 changed files with 386 additions and 3 deletions.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@ Waste collection schedules in the following formats and countries are supported.
<details>
<summary>Austria</summary>

- [Abfallverband Hollabrunn](/doc/source/umweltverbaende_at.md) / hollabrunn.umweltverbaende.at
- [Abfallverband Korneuburg](/doc/source/umweltverbaende_at.md) / korneuburg.umweltverbaende.at
- [Abfallverband Schwechat](/doc/source/umweltverbaende_at.md) / schwechat.umweltverbaende.at
- [Abfallwirtschaft Stadt Krems](/doc/source/umweltverbaende_at.md) / kremsstadt.umweltverbaende.at
- [Abfallwirtschaft Stadt St Pölten](/doc/source/umweltverbaende_at.md) / stpoelten.umweltverbaende.at
- [Altenmarkt an der Triesting](/doc/source/citiesapps_com.md) / altenmarkt-triesting.gv.at
- [Andau](/doc/source/citiesapps_com.md) / andau-gemeinde.at
- [Apetlon](/doc/source/citiesapps_com.md) / gemeinde-apetlon.at
- [App CITIES](/doc/source/citiesapps_com.md) / citiesapps.com
- [AWV Neunkirchen](/doc/source/umweltverbaende_at.md) / neunkirchen.umweltverbaende.at
- [AWV Wr. Neustadt](/doc/source/umweltverbaende_at.md) / wrneustadt.umweltverbaende.at
- [Bad Blumau](/doc/source/citiesapps_com.md) / bad-blumau-gemeinde.at
- [Bad Gleichenberg](/doc/source/citiesapps_com.md) / bad-gleichenberg.gv.at
- [Bad Loipersdorf](/doc/source/citiesapps_com.md) / gemeinde.loipersdorf.at
Expand All @@ -86,6 +93,7 @@ Waste collection schedules in the following formats and countries are supported.
- [Deutsch Jahrndorf](/doc/source/citiesapps_com.md) / deutsch-jahrndorf.at
- [Deutsch Kaltenbrunn](/doc/source/citiesapps_com.md) / deutschkaltenbrunn.eu
- [Deutschkreutz](/doc/source/citiesapps_com.md) / deutschkreutz.at
- [Die NÖ Umweltverbände](/doc/source/umweltverbaende_at.md) / umweltverbaende.at
- [Dobl-Zwaring](/doc/source/citiesapps_com.md) / dobl-zwaring.gv.at
- [Drasenhofen](/doc/source/citiesapps_com.md) / drasenhofen.at
- [Draßmarkt](/doc/source/citiesapps_com.md) / drassmarkt.at
Expand All @@ -109,7 +117,12 @@ Waste collection schedules in the following formats and countries are supported.
- [Frohnleiten](/doc/source/citiesapps_com.md) / frohnleiten.com
- [Fürstenfeld](/doc/source/citiesapps_com.md) / fuerstenfeld.gv.at
- [Gabersdorf](/doc/source/citiesapps_com.md) / gabersdorf.gv.at
- [GABL](/doc/source/umweltverbaende_at.md) / bruck.umweltverbaende.at
- [Gattendorf](/doc/source/citiesapps_com.md) / gattendorf.at
- [GAUL Laa an der Thaya](/doc/source/umweltverbaende_at.md) / laa.umweltverbaende.at
- [GAUM Mistelbach](/doc/source/umweltverbaende_at.md) / mistelbach.umweltverbaende.at
- [GDA Amstetten](/doc/source/umweltverbaende_at.md) / amstetten.umweltverbaende.at
- [Gemeindeverband Horn](/doc/source/umweltverbaende_at.md) / horn.umweltverbaende.at
- [Gols](/doc/source/citiesapps_com.md) / gols.at
- [Grafendorf bei Hartberg](/doc/source/citiesapps_com.md) / grafendorf.at
- [Grafenschachen](/doc/source/citiesapps_com.md) / grafenschachen.at
Expand All @@ -119,8 +132,20 @@ Waste collection schedules in the following formats and countries are supported.
- [Großwarasdorf](/doc/source/citiesapps_com.md) / grosswarasdorf.at
- [Großwilfersdorf](/doc/source/citiesapps_com.md) / grosswilfersdorf.steiermark.at
- [Gutenberg](/doc/source/citiesapps_com.md) / gutenberg-stenzengreith.gv.at
- [GV Gmünd](/doc/source/umweltverbaende_at.md) / gmuend.umweltverbaende.at
- [GV Krems](/doc/source/umweltverbaende_at.md) / krems.umweltverbaende.at
- [GV Zwettl](/doc/source/umweltverbaende_at.md) / zwettl.umweltverbaende.at
- [GVA Baden](/doc/source/umweltverbaende_at.md) / baden.umweltverbaende.at
- [GVA Baden](/doc/source/baden_umweltverbaende_at.md) / baden.umweltverbaende.at
- [GVA Lilienfeld](/doc/source/umweltverbaende_at.md) / lilienfeld.umweltverbaende.at
- [GVA Mödling](/doc/source/umweltverbaende_at.md) / moedling.umweltverbaende.at
- [GVA Tulln](/doc/source/umweltverbaende_at.md) / tulln.umweltverbaende.at
- [GVA Waidhofen/Thaya](/doc/source/umweltverbaende_at.md) / waidhofen.umweltverbaende.at
- [GVU Bezirk Gänserndorf](/doc/source/umweltverbaende_at.md) / gaenserndorf.umweltverbaende.at
- [GVU Melk](/doc/source/umweltverbaende_at.md) / melk.umweltverbaende.at
- [GVU Scheibbs](/doc/source/umweltverbaende_at.md) / scheibbs.umweltverbaende.at
- [GVU Scheibbs](/doc/source/scheibbs_umweltverbaende_at.md) / scheibbs.umweltverbaende.at
- [GVU St. Pölten](/doc/source/umweltverbaende_at.md) / stpoeltenland.umweltverbaende.at
- [Güssing](/doc/source/citiesapps_com.md) / guessing.co.at
- [Hagenberg im Mühlkreis](/doc/source/citiesapps_com.md) / hagenberg.at
- [Hannersdorf](/doc/source/citiesapps_com.md) / hannersdorf.at
Expand Down Expand Up @@ -148,6 +173,7 @@ Waste collection schedules in the following formats and countries are supported.
- [Kittsee](/doc/source/citiesapps_com.md) / kittsee.at
- [Kleinmürbisch](/doc/source/citiesapps_com.md) / kleinmürbisch.at
- [Klingenbach](/doc/source/citiesapps_com.md) / klingenbach.at
- [Klosterneuburg](/doc/source/umweltverbaende_at.md) / klosterneuburg.umweltverbaende.at
- [Klöch](/doc/source/citiesapps_com.md) / kloech.com
- [Kohfidisch](/doc/source/citiesapps_com.md) / kohfidisch.at
- [Korneuburg](/doc/source/citiesapps_com.md) / korneuburg.gv.at
Expand Down Expand Up @@ -527,8 +553,8 @@ Waste collection schedules in the following formats and countries are supported.
- [Landkreis Rhön Grabfeld](/doc/source/landkreis_rhoen_grabfeld.md) / abfallinfo-rhoen-grabfeld.de
- [Landkreis Rosenheim](/doc/source/awido_de.md) / abfall.landkreis-rosenheim.de
- [Landkreis Rotenburg (Wümme)](/doc/source/abfall_io.md) / lk-awr.de
- [Landkreis Roth](/doc/source/awido_de.md) / landratsamt-roth.de
- [Landkreis Roth](/doc/source/c_trace_de.md) / landratsamt-roth.de
- [Landkreis Roth](/doc/source/awido_de.md) / landratsamt-roth.de
- [Landkreis Schweinfurt](/doc/source/awido_de.md) / landkreis-schweinfurt.de
- [Landkreis Schwäbisch Hall](/doc/source/cmcitymedia_de.md) / cmcitymedia.de
- [Landkreis Schwäbisch Hall](/doc/source/lrasha_de.md) / lrasha.de
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection

_LOGGER = logging.getLogger(__name__)

TITLE = "GVA Baden"
DESCRIPTION = "Source for waste collection services Association of Municipalities in the District of Baden"
URL = "https://baden.umweltverbaende.at/"
Expand All @@ -26,6 +29,9 @@ def __init__(self, region):
self._region = region

def fetch(self):
_LOGGER.warning(
"The baden_umweltverbaende_at source is depreciated and may be removed in the future. Please migrate to the umweltverbaende_at source"
)
s = requests.Session()
# get list of regions and weblinks
r0 = s.get("https://baden.umweltverbaende.at/?kat=32")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection

_LOGGER = logging.getLogger(__name__)

TITLE = "GVU Scheibbs"
DESCRIPTION = "Source for waste collection services Association of Municipalities in the District of Scheibbs"
URL = "https://scheibbs.umweltverbaende.at/"
Expand All @@ -26,6 +29,9 @@ def __init__(self, region):
self._region = region

def fetch(self):
_LOGGER.warning(
"The scheibbs_umweltverbaende_at source is depreciated and may be removed in the future. Please migrate to the umweltverbaende_at source"
)
s = requests.Session()
# get list of regions and weblinks
r0 = s.get("https://scheibbs.umweltverbaende.at/?kat=32")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
from datetime import datetime

import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection

TITLE = "Die NÖ Umweltverbände"
DESCRIPTION = (
"Consolidated waste collection provider for several districts in Lower Austria"
)
URL = "https://www.umweltverbaende.at/"
EXTRA_INFO = [
{
"title": "GDA Amstetten",
"url": "https://amstetten.umweltverbaende.at/",
"country": "at",
},
{
"title": "GABL",
"url": "https://bruck.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVA Baden",
"url": "https://baden.umweltverbaende.at/",
"country": "at",
},
{
"title": "GV Gmünd",
"url": "https://gmuend.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVU Bezirk Gänserndorf",
"url": "https://gaenserndorf.umweltverbaende.at/",
"country": "at",
},
{
"title": "Abfallverband Hollabrunn",
"url": "https://hollabrunn.umweltverbaende.at/",
"country": "at",
},
{
"title": "Gemeindeverband Horn",
"url": "https://horn.umweltverbaende.at/",
"country": "at",
},
{
"title": "Klosterneuburg",
"url": "https://klosterneuburg.umweltverbaende.at/",
"country": "at",
},
{
"title": "Abfallverband Korneuburg",
"url": "https://korneuburg.umweltverbaende.at/",
"country": "at",
},
{
"title": "GV Krems",
"url": "https://krems.umweltverbaende.at/",
"country": "at",
},
{
"title": "Abfallwirtschaft Stadt Krems",
"url": "https://kremsstadt.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVA Lilienfeld",
"url": "https://lilienfeld.umweltverbaende.at/",
"country": "at",
},
{
"title": "GAUL Laa an der Thaya",
"url": "https://laa.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVA Mödling",
"url": "https://moedling.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVU Melk",
"url": "https://melk.umweltverbaende.at/",
"country": "at",
},
{
"title": "GAUM Mistelbach",
"url": "https://mistelbach.umweltverbaende.at/",
"country": "at",
},
{
"title": "AWV Neunkirchen",
"url": "https://neunkirchen.umweltverbaende.at/",
"country": "at",
},
{
"title": "Abfallwirtschaft Stadt St Pölten",
"url": "https://stpoelten.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVU St. Pölten",
"url": "https://stpoeltenland.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVU Scheibbs",
"url": "https://scheibbs.umweltverbaende.at/",
"country": "at",
},
{
"title": "Abfallverband Schwechat",
"url": "https://schwechat.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVA Tulln",
"url": "https://tulln.umweltverbaende.at/",
"country": "at",
},
{
"title": "AWV Wr. Neustadt",
"url": "https://wrneustadt.umweltverbaende.at/",
"country": "at",
},
{
"title": "GVA Waidhofen/Thaya",
"url": "https://waidhofen.umweltverbaende.at/",
"country": "at",
},
{
"title": "GV Zwettl",
"url": "https://zwettl.umweltverbaende.at/",
"country": "at",
},
]

TEST_CASES = {
# "Amstetten": {"district": "amstetten", "municipal": "?"}, # No schedules listed on website
"Bruck/Leitha": {"district": "bruck", "municipal": "Berg"},
"Baden": {"district": "baden", "municipal": "Hernstein"},
"Gmünd": {"district": "gmuend", "municipal": "Weitra"},
"Gänserndorf": {"district": "gaenserndorf", "municipal": "Marchegg"},
"Hollabrunn": {"district": "hollabrunn", "municipal": "Retz"},
"Horn": {"district": "horn", "municipal": "Japons"},
"Klosterneuburg": {"district": "klosterneuburg", "municipal": "Klosterneuburg"},
"Korneuburg": {"district": "korneuburg", "municipal": "Bisamberg"},
"Krems": {"district": "krems", "municipal": "Aggsbach"},
"Stadt Krems": {"district": "kremsstadt", "municipal": "Rehberg"},
"Lilienfeld": {"district": "lilienfeld", "municipal": "Annaberg"},
# "Laa/Thaya": {"district": "laa", "municipal": "Staatz"}, # schedules use www.gaul-laa.at
"Mödling": {"district": "moedling", "municipal": "Wienerwald"},
"Melk": {"district": "melk", "municipal": "Schollach"},
"Mistelbach": {"district": "mistelbach", "municipal": "Falkenstein"},
# "Neunkirchen": {"district": "neunkirchen", "municipal": "?"}, # No schedules listed on website
"St. Pölten": {"district": "stpoeltenland", "municipal": "Pyhra"},
# "Stadt St. Pölten": {"district": "stpoelten", "municipal": "?"}, # schedules use www.st-poelten.at/gv-buergerservice/bauen-und-wohnen/muell-und-abfall
"Scheibbs": {"district": "scheibbs", "municipal": "Wolfpassing"},
"Schwechat": {"district": "schwechat", "municipal": "Ebergassing"},
"Tulln": {"district": "tulln", "municipal": "Absdorf"},
# "Wiener Neustadt": {"district": "wrneustadt", "municipal": "?"}, # schedules use www.umweltverbaende.at/verband/vb_wn_sms.asp
"Waidhofen/Thaya": {"district": "waidhofen", "municipal": "Kautzen"},
"Zwettl": {"district": "zwettl", "municipal": "Martinsberg"},
}


ICON_MAP = {
"Restmüll": "mdi:trash-can",
"Gelber Sack": "mdi:sack",
"Gelbe Tonne": "mdi:trash-can",
"Altpapier": "mdi:package-variant",
"Papier": "mdi:package-variant",
"Biotonne": "mdi:leaf",
"Bio": "mdi:leaf",
"Windeltonne": "mdi:baby",
}


class Source:
def __init__(self, district, municipal):
self._district = district.lower()
self._municipal = municipal

def get_icon(self, waste_text: str) -> str:
for waste in ICON_MAP:
if waste in waste_text:
mdi_icon = ICON_MAP[waste]
return mdi_icon

def append_entry(self, ent: list, txt: list):
ent.append(
Collection(
date=datetime.strptime(txt[1].strip(), "%d.%m.%Y").date(),
t=txt[2].strip(),
icon=self.get_icon(txt[2].strip()),
)
)
return

def fetch(self):
s = requests.Session()
# Select appropriate url, the "." allows stpoelten/stpoeltenland and krems/kremsstadt to be distinguished
for item in EXTRA_INFO:
if (self._district.lower() + ".") in item["url"]:
district_url = item["url"]
r0 = s.get(f"{district_url}?kat=32")
soup = BeautifulSoup(r0.text, "html.parser")

# Get list of municipalities and weblinks
# kremsstadt lists collections for all municipals on the main page so skip that district
if self._district != "kremsstadt":
table = soup.find_all("div", {"class": "col-sm-9"})
for item in table:
weblinks = item.find_all("a", {"class": "weblink"})
for item in weblinks:
# match weblink with municipal to get collection schedule
if self._municipal in item.text:
r1 = s.get(f"{district_url}{item['href']}")
soup = BeautifulSoup(r1.text, "html.parser")

# Find all the listed collections
schedule = soup.find_all("div", {"class": "tunterlegt"})

entries = []
for day in schedule:
txt = day.text.strip().split(" \u00a0")
if (
self._district == "kremsstadt"
): # Filter for kremstadt rayon here because it was skipped earlier
if self._municipal.upper() in txt[2].upper():
self.append_entry(entries, txt)
else: # Process all other municipals
self.append_entry(entries, txt)

return entries
14 changes: 13 additions & 1 deletion doc/source/baden_umweltverbaende_at.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# GVA Baden

```diff
-This source is now depreciated
``````
**GVA Baden is now supported as part of the [Die NÖ Umweltverbände](/doc/source/umweltverbaende_at.md) source.**

<br>

## Legacy Information


Support for waste collection services Association of Municipalities in the District of Baden for [GVA Baden](https://baden.umweltverbaende.at), Austria.

## Configuration via configuration.yaml
Expand Down Expand Up @@ -28,4 +38,6 @@ waste_collection_schedule:
sources:
- name: baden_umweltverbaende_at
args:
region: "Mitterndorf an der Fischa"
region: "Mitterndorf an der Fischa"
```
Loading

0 comments on commit 5f618df

Please sign in to comment.