diff --git a/jedeschule/spiders/rheinland_pfalz.py b/jedeschule/spiders/rheinland_pfalz.py index b4c652d..49726d4 100644 --- a/jedeschule/spiders/rheinland_pfalz.py +++ b/jedeschule/spiders/rheinland_pfalz.py @@ -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" @@ -43,6 +66,17 @@ 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)", "@") + + if kurzbezeichnung := item.get('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")), @@ -56,4 +90,5 @@ def normalize(self, item: Item) -> School: provider=item.get("Träger"), fax=item.get("Telefax"), phone=item.get("Telefon"), + school_type=school_type )