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

[RP] add school_type #153

Merged
merged 2 commits into from
Mar 5, 2025
Merged
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions jedeschule/spiders/rheinland_pfalz.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@
from jedeschule.items import School
from jedeschule.spiders.school_spider import SchoolSpider

school_types = {
'BEA': 'BEA', # I could not find the meaning of this abbreviation
'BBS': 'Berufsbildende Schule',
'FWS': 'Freie Waldorfschule',
'GHS': 'Grund- und Hauptschule (org. verbunden)',
'GRS+': 'Grund- und Realschule plus (org. verbunden)',
'GS': 'Grundschule',
'GY': 'Gymnasium',
'HS': 'Hauptschule',
'IGS': 'Integrierte Gesamtschule',
'Koll': 'Kolleg',
'Koll/AGY': 'Kolleg und Abendgymnasium (org.verbunden)',
'RS': 'Realschule',
'RS+': 'Realschule plus',
'RS+FOS': 'Realschule plus mit Fachoberschule',
'StudSem': 'Studienseminar'

# Förderschulen (special education schools) come in a variety of abbreviations
# The following are some examples from the dataset
# SFGLS, SFG, SFGM, SFE, SFL, SFLG, SFBLS, SFMG, SFLS
# so we will treat them a bit differently, see below in the normalize step
}


class RheinlandPfalzSpider(CrawlSpider, SchoolSpider):
name = "rheinland-pfalz"
Expand Down Expand Up @@ -43,6 +66,18 @@ def parse_school(self, response):
def normalize(self, item: Item) -> School:
zip, city = item.get("Anschrift")[-1].split(" ", 1)
email = item.get("E-Mail", "").replace("(at)", "@")

kurzbezeichnung = item.get('Kurzbezeichnung')
if kurzbezeichnung:
first_part = kurzbezeichnung.split(" ")[0]
# special handling for special education schools
if first_part.startswith('SF'):
school_type = 'Förderschule'
else:
school_type = school_types.get(first_part, None)
else:
school_type = None

return School(
name=item.get("name"),
id="RP-{}".format(item.get("id")),
Expand All @@ -56,4 +91,5 @@ def normalize(self, item: Item) -> School:
provider=item.get("Träger"),
fax=item.get("Telefax"),
phone=item.get("Telefon"),
school_type=school_type
)