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

[MV] Update to latest data & fix ids #148

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions jedeschule/spiders/mecklenburg_vorpommern.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
from jedeschule.spiders.school_spider import SchoolSpider


def as_string(value: str):
try:
return str(int(value))
except ValueError:
return value


class MecklenburgVorpommernSpider(SchoolSpider):
name = "mecklenburg-vorpommern"
# The state provides the data as an Excel file. The current year's
Expand All @@ -15,7 +22,7 @@ class MecklenburgVorpommernSpider(SchoolSpider):
# https://www.statistischebibliothek.de/mir/receive/MVSerie_mods_00000396
# Official documentation on all available data here:
# https://www.laiv-mv.de/Statistik/Veröffentlichungen/Verzeichnisse/
base_url = "https://www.statistischebibliothek.de/mir/servlets/MCRFileNodeServlet/MVHeft_derivate_00006849/V034%202022%2000.xlsx"
base_url = "https://www.statistischebibliothek.de/mir/servlets/MCRFileNodeServlet/MVHeft_derivate_00007470/V044%202023%2000.xlsx"
start_urls = [base_url]

def parse(self, response):
Expand All @@ -32,10 +39,10 @@ def parse(self, response):
def normalize(item: Item) -> School:
return School(
name=item.get("NAME1"),
id="MV-{}".format(item.get("DIENSTSTELLEN-NUMMER")),
id="MV-{}".format(as_string(item.get("DIENSTSTELLEN-NUMMER"))),
address=item.get("STRASSE"),
address2="",
zip=item.get("PLZ"),
zip=as_string(item.get("PLZ")).zfill(5),
city=item.get("ORT"),
website=item.get("INTERNET"),
email=item.get("E-MAIL-ADRESSE"),
Expand Down
Loading