diff --git a/.cache/bernReligionMapByReligionCount.json b/.cache/bernReligionMapByReligionCount.json new file mode 100644 index 0000000..8d28ff2 --- /dev/null +++ b/.cache/bernReligionMapByReligionCount.json @@ -0,0 +1 @@ +{"_default": {"1": {"date": "2026-01-01", "religionCount": {"1-1": 270, "1-2": 2, "1-3": 1, "1-4": 11, "1-5": 73, "1-6": 4, "1-7": 4, "1-8": 3, "1-9": 186, "1-10": 10, "1-11": 26, "2-12": 16, "2-13": 1, "2-14": 2, "3-15": 3, "3-16": 9, "3-17": 7, "3-18": 3, "4-0": 8, "5-0": 2, "6-0": 2, "7-0": 1, "8-0": 2, "9-0": 2}}}} \ No newline at end of file diff --git a/feed/atom/de/gotteshauserNachReligionImKantonBern.atom b/feed/atom/de/gotteshauserNachReligionImKantonBern.atom index 695eef3..82b4cf8 100644 --- a/feed/atom/de/gotteshauserNachReligionImKantonBern.atom +++ b/feed/atom/de/gotteshauserNachReligionImKantonBern.atom @@ -2,7 +2,7 @@ https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/feed/atom/de/gotteshauserNachReligionImKantonBern Gotteshäuser nach Religion im Kanton Bern - 2026-06-18T14:56:22.734774+02:00 + 2026-06-18T18:06:22.013240+02:00 ReSSPublica @@ -13,7 +13,7 @@ 1767265200.0 Gotteshäuser nach Religion im Kanton Bern-2026-01-01 2026-01-01T00:00:00+01:00 - <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-de-2026-01-01-2026-04-30.png" alt="Gotteshäuser nach Religion im Kanton Bern 2026-01-01"> + <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-de-2026-01-01-2026-04-30.png" alt="Gotteshäuser nach Religion im Kanton Bern 2026-01-01">evangelisch-reformiert (christlich): 270<br>lutherisch (christlich): 2<br>anglikanisch (christlich): 1<br>evangelische Migrationskirche (christlich): 11<br>römisch-katholisch (christlich): 73<br>christkatholisch (christlich): 4<br>orthodox (christlich): 4<br>orientalisch-orthodox (christlich): 3<br>freikirchlich (christlich): 186<br>mennonitisch (christlich): 10<br>christlich, weitere (christlich): 26<br>sunnitisch (islamisch): 16<br>schiitisch (islamisch): 1<br>islamisch, weitere (islamisch): 2<br>Theravada (buddhistisch): 3<br>Mahayana (buddhistisch): 9<br>Vajrayana (buddhistisch): 7<br>buddhistisch, weitere (buddhistisch): 3<br>hinduistisch: 8<br>jüdisch: 2<br>alevitisch: 2<br>Sikh: 1<br>Bahai: 2<br>weitere: 2<br> 2026-01-01T00:00:00+01:00 diff --git a/feed/atom/fr/lieuDeCulteParReligionDansLeCantonDeBerne.atom b/feed/atom/fr/lieuDeCulteParReligionDansLeCantonDeBerne.atom index 32c5e45..7a16c61 100644 --- a/feed/atom/fr/lieuDeCulteParReligionDansLeCantonDeBerne.atom +++ b/feed/atom/fr/lieuDeCulteParReligionDansLeCantonDeBerne.atom @@ -2,7 +2,7 @@ https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/feed/atom/fr/lieuDeCulteParReligionDansLeCantonDeBerne Lieu de culte par religion dans le canton de Berne - 2026-06-18T14:56:22.733812+02:00 + 2026-06-18T18:06:22.012315+02:00 ReSSPublica @@ -13,7 +13,7 @@ 1767265200.0 Lieu de culte par religion dans le canton de Berne-2026-01-01 2026-01-01T00:00:00+01:00 - <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-fr-2026-01-01-2026-04-30.png" alt="Lieu de culte par religion dans le canton de Berne 2026-01-01"> + <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-fr-2026-01-01-2026-04-30.png" alt="Lieu de culte par religion dans le canton de Berne 2026-01-01">réformé évangélique (Christianisme): 270<br>luthérien (Christianisme): 2<br>anglican (Christianisme): 1<br>évangélique, église de la migration (Christianisme): 11<br>catholique romain (Christianisme): 73<br>catholique chrétien (Christianisme): 4<br>orthodoxe (Christianisme): 4<br>orthodoxe oriental (Christianisme): 3<br>église libre (Christianisme): 186<br>mennonite (Christianisme): 10<br>autre (Christianisme): 26<br>sunnite (Islam): 16<br>chiite (Islam): 1<br>autre (Islam): 2<br>theravada (Bouddhisme ): 3<br>mahayana (Bouddhisme ): 9<br>vajrayana (Bouddhisme ): 7<br>autre (Bouddhisme ): 3<br>Hindouisme: 8<br>Judaïsme: 2<br>Alévisme: 2<br>Sikhisme: 1<br>Bahaïsme: 2<br>Autre tradition: 2<br> 2026-01-01T00:00:00+01:00 diff --git a/feed/rss/de/gotteshauserNachReligionImKantonBern.xml b/feed/rss/de/gotteshauserNachReligionImKantonBern.xml index 295c0e4..013e9d2 100644 --- a/feed/rss/de/gotteshauserNachReligionImKantonBern.xml +++ b/feed/rss/de/gotteshauserNachReligionImKantonBern.xml @@ -8,10 +8,10 @@ https://github.com/tomasriveral/ReSSPublica python-feedgen de - Thu, 18 Jun 2026 14:56:22 +0200 + Thu, 18 Jun 2026 18:06:22 +0200 Gotteshäuser nach Religion im Kanton Bern-2026-01-01 - <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-de-2026-01-01-2026-04-30.png" alt="Gotteshäuser nach Religion im Kanton Bern 2026-01-01"> + <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-de-2026-01-01-2026-04-30.png" alt="Gotteshäuser nach Religion im Kanton Bern 2026-01-01">evangelisch-reformiert (christlich): 270<br>lutherisch (christlich): 2<br>anglikanisch (christlich): 1<br>evangelische Migrationskirche (christlich): 11<br>römisch-katholisch (christlich): 73<br>christkatholisch (christlich): 4<br>orthodox (christlich): 4<br>orientalisch-orthodox (christlich): 3<br>freikirchlich (christlich): 186<br>mennonitisch (christlich): 10<br>christlich, weitere (christlich): 26<br>sunnitisch (islamisch): 16<br>schiitisch (islamisch): 1<br>islamisch, weitere (islamisch): 2<br>Theravada (buddhistisch): 3<br>Mahayana (buddhistisch): 9<br>Vajrayana (buddhistisch): 7<br>buddhistisch, weitere (buddhistisch): 3<br>hinduistisch: 8<br>jüdisch: 2<br>alevitisch: 2<br>Sikh: 1<br>Bahai: 2<br>weitere: 2<br> 1767265200.0 Thu, 01 Jan 2026 00:00:00 +0100 diff --git a/feed/rss/fr/lieuDeCulteParReligionDansLeCantonDeBerne.xml b/feed/rss/fr/lieuDeCulteParReligionDansLeCantonDeBerne.xml index e933519..3a1d703 100644 --- a/feed/rss/fr/lieuDeCulteParReligionDansLeCantonDeBerne.xml +++ b/feed/rss/fr/lieuDeCulteParReligionDansLeCantonDeBerne.xml @@ -8,10 +8,10 @@ https://github.com/tomasriveral/ReSSPublica python-feedgen fr - Thu, 18 Jun 2026 14:56:22 +0200 + Thu, 18 Jun 2026 18:06:22 +0200 Lieu de culte par religion dans le canton de Berne-2026-01-01 - <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-fr-2026-01-01-2026-04-30.png" alt="Lieu de culte par religion dans le canton de Berne 2026-01-01"> + <img src="https://raw.githubusercontent.com/tomasriveral/ReSSPublica/refs/heads/main/.cache/bernReligionMap-fr-2026-01-01-2026-04-30.png" alt="Lieu de culte par religion dans le canton de Berne 2026-01-01">réformé évangélique (Christianisme): 270<br>luthérien (Christianisme): 2<br>anglican (Christianisme): 1<br>évangélique, église de la migration (Christianisme): 11<br>catholique romain (Christianisme): 73<br>catholique chrétien (Christianisme): 4<br>orthodoxe (Christianisme): 4<br>orthodoxe oriental (Christianisme): 3<br>église libre (Christianisme): 186<br>mennonite (Christianisme): 10<br>autre (Christianisme): 26<br>sunnite (Islam): 16<br>chiite (Islam): 1<br>autre (Islam): 2<br>theravada (Bouddhisme ): 3<br>mahayana (Bouddhisme ): 9<br>vajrayana (Bouddhisme ): 7<br>autre (Bouddhisme ): 3<br>Hindouisme: 8<br>Judaïsme: 2<br>Alévisme: 2<br>Sikhisme: 1<br>Bahaïsme: 2<br>Autre tradition: 2<br> 1767265200.0 Thu, 01 Jan 2026 00:00:00 +0100 diff --git a/resspublica/bernReligionMap.py b/resspublica/bernReligionMap.py index 95704a2..ba6fed4 100644 --- a/resspublica/bernReligionMap.py +++ b/resspublica/bernReligionMap.py @@ -28,12 +28,6 @@ def generateBernReligionMap(ASSETS, CACHE): logger.info("Generating Religion map in Bern feed...") logger.info("Preparing data...") - #ASIAN_HORNETS_DB_PATH = CACHE / "bernAsianHornet.json" - #global db - #global q - #db = TinyDB(ASIAN_HORNETS_DB_PATH) - #q = Query() - # 1. Load data url = "https://geofiles.be.ch/geoportal/pub/download/RELIGION/religion_relstaet.parquet" @@ -101,6 +95,40 @@ def generateBernReligionMap(ASSETS, CACHE): ) logger.debug(religions) + # we generate the count by each religion and store it in a database to log changes. + + BERN_RELIGION_MAP_DB_PATH = CACHE / "bernReligionMapByReligionCount.json" + + db = TinyDB(BERN_RELIGION_MAP_DB_PATH) + q = Query() + + + for start, end in trimesterRangesFrom(arbitraryStartDate): + if db.contains(q.date == start.isoformat()): + continue # we already calculated the entry for this date. We skip it. + dbEntry = { + "date": start.isoformat(), + "religionCount": {} + } + # initialize with default values + for religionID in religions.keys(): + dbEntry["religionCount"][str(religionID)] = 0 + # count + for placeOfWorship in religionGeoDataFrame.itertuples(): + # again we must check against religions that don't have nkenn information + try: + placeOfWorship.nkenn_id + dbEntry["religionCount"][f"{placeOfWorship.reltra_id}-{str(placeOfWorship.nkenn_id).split(".")[0]}"] += 1 + except: + dbEntry["religionCount"][f"{placeOfWorship.reltra_id}-0"] += 1 + logger.info("Religion Count") + logger.info(dbEntry["religionCount"]) + + db.upsert(dbEntry, q.date == start.isoformat()) + + + # we generate the map(s) now + # generate color palette (1 color by religion with similar religion similar color) palette = color_palette("husl", len(religions.keys())) color_map = { @@ -248,10 +276,19 @@ def generateBernReligionMap(ASSETS, CACHE): trimestrialEntry["date"] = start.isoformat() # there is no point have them different. On other feeds it's used for update date trimestrialEntry["source"] = "opendata.swiss" + countDataBase = db.get(q.date == start.isoformat())["religionCount"] + for lang in ["fr", "de"]: trimestrialEntry["url"] = f"https://opendata.swiss/{lang}/dataset/religionslandkarte" trimestrialEntry["title"] = f"{translatedPlacesOfWorshipInBern[lang]}-{start.isoformat()}" trimestrialEntry["text"] = f"\"{translatedPlacesOfWorshipInBern[lang]}" + + for religionID in religions.keys(): + + if religionID[2] == "0": # that means there is no nkenn + trimestrialEntry["text"] += f"{religions[religionID][f"reltrat_reltra_{lang}"]}: {countDataBase[religionID]}
" + else: + trimestrialEntry["text"] += f"{religions[religionID][f"nkennt_nkenn_{lang}"]} ({religions[religionID][f"reltrat_reltra_{lang}"]}): {countDataBase[religionID]}
" feeds[lang].append(copy.deepcopy(trimestrialEntry)) generateFeed( translatedPlacesOfWorshipInBern["fr"],