NEWS
[Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder
-
@fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
@fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
Evtl. werden die Daten auch bald im Covid-19 Adapter zur Verfügung stehen
kaum gepostet, ist das Skript dank @Dutchman schon im Adapter integriert. Wer die Tabelle also nicht benötigt ist mit der neuesten Version des Covid-19 Adapters(v0.6.5) besser bedient
danke fuer deine ausgezeichnete vorgabe
-
Hallo,
da ich die Daten selber für mich immer gerne archiviere:
import openpyxl from pathlib import Path import requests import os,sys import csv from datetime import datetime url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx;jsessionid=159D4550C958EDFAA9A49921FA132A35.internet122?__blob=publicationFile" # url = "https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx" r = requests.get(url, allow_redirects=True) open(r'/var/skripte/data/Impfquotenmonitoring.xlsx', 'wb').write(r.content) xlsx_file = Path(os.getcwd(), r'/var/skripte/data/Impfquotenmonitoring.xlsx') wb_obj = openpyxl.load_workbook(xlsx_file,data_only=True) datakt=datetime.now() dat="--" sheet=wb_obj.active for sht in wb_obj: print(sht.title) try: dat = datetime.strptime(sht.title[-8:],'%d.%m.%y') sheet=sht except: pass print("Selected: "+sheet.title) # print(dat) if dat=="--": print("Datum nicht ermittelbar!") sys.exit(99) #sheet = wb_obj.active sum = 0 anzbl = 0 titel = 0 with open(r'/var/skripte/data/Impfquotenmonitoring.csv', 'w', newline="") as f: c = csv.writer(f) for row in sheet.iter_rows(min_row=1,max_col=9,max_row=19, values_only=True): try: print(row) sum=sum+row[2] nrow=[str(dat.date()),str(datakt),str(datetime.timestamp(dat))] anzbl=anzbl+1 nrow.extend(list(row)) c.writerow(nrow) except: nrow=['Datenstand','Dat-Import', 'Datenstand-Unix'] if titel==0: titel=1 nrow.extend(list(row)) c.writerow(nrow) if anzbl!=16: print("Es sollten 16 Bundesländer sein:",anzbl) sys.exit(99) print("Gesamtzahl der Impfungen in Deutschland: " + str(sum)) print("Datenstand: " + str(dat) + " Sheetname:" + str(sheet.title))
-> da kommt ein csv raus. Pfad bitte bei Bedarf anpassen.
Dann Datenbank:
CREATE TABLE `cor_impfung` ( `datenstand` date NOT NULL DEFAULT current_timestamp(), `import_datum` datetime NOT NULL DEFAULT current_timestamp(), `datenstand_unix` bigint(20) NOT NULL DEFAULT 0, `RS` int(11) NOT NULL DEFAULT -1, `Bundesland` mediumtext COLLATE utf8_bin NOT NULL DEFAULT '\'"??"\'', `Impfungen` int(11) DEFAULT 0, `BioNTech` int(11) NOT NULL DEFAULT 0, `Moderna` int(11) NOT NULL DEFAULT 0, `Differenz_Vortag` int(11) DEFAULT 0, `Impfquote` double NOT NULL DEFAULT 0, `Zweitimpfung` int(11) NOT NULL DEFAULT 0, `Zweit_Differenz_Vortag` int(11) NOT NULL DEFAULT 0 ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
und Skript zum abholen:
#!/bin/bash NOW=`date +"%d.%m.%g %H:%M.%S"` NOWDAT=`date +"%u"` USER=mysqluser PASS=mysqlpassword echo "Starte Abgleich: $NOW" rm /var/skripte/data/Impfquotenmonitoring.csv rm /var/skripte/data/Impfquotenmonitoring.xlsx rm /var/skripte/data/cor_impfung.csv python3.9 -u /var/skripte/getImpfquoten.py if [ $? -eq 99 ] then echo "Fehler bei Datenabholung" exit 99 fi cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/Impfquotenmonitoring_$NOWDAT.csv.backup cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/cor_impfung.csv echo "Starte Import $NOW" mysqlimport --fields-terminated-by=, --ignore-lines=1 --verbose --ignore --local -u $USER -p$PASS iobroker /var/skripte/data/cor_impfung.csv mysql -u $USER -p$PASS iobroker -e "DELETE i1.* from cor_impfung i1 inner join cor_impfung i2 on (i1.datenstand=i2.datenstand and i1.bundesland=i2.bundesland and i1.import_datum<i 2.import_datum)"
User und Passwort anspassen! (Das letzte Statement behält nur den letzten Import des Tages)
Sieht dann so aus:
Anschließend kann man das dann in grafana wunderbar visualisieren (deshalb die Unix-Timestamps)
-
@sissiwup
thanks, mit dem adapter version 0.6.5 kam man dies jetzt. auch per sql oder influxdb adapter machen -
@Dutchman sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
mit dem adapter version 0.6.5 kam man dies jetzt.
Danke - habe ich gerade installiert!
Aber die Aufteilung nach Bundesland ist dort noch nicht implementiert? -
@Homoran sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
Aber die Aufteilung nach Bundesland ist dort noch nicht implementiert?
doch aber nur wen du Bundesländer in der adapter config ausgewählt hast
und unter dem. jeweiligen Bundesland im Ordner Bundesland
-
@sissiwup immer gut zu sehen, wie es auch in anderen Sprachen gehen kann. Einen Import in eine DB hatte ich mir auch überlegt, aber mit der Integration in den Adapter ist das jetzt nicht mehr notwendig. Trotzdem verstehe ich dich gut, mit einem eigenen Skript hat man die volle Kontrolle darüber, was genau passiert
-
@sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
da ich die Daten selber für mich immer gerne archiviere:
ich ermittle die url zum Exceldownload ja relativ aufwändig, Hintergrund ist die SessionID, welche sich ja immer ändert. Hier würde mich interessieren, ob du damit mit der Zeit Probleme beim Download bekommst, da du sie ja statisch eingetragen hast. Ich könnte mir vorstellen dass sie 'verfällt', bin mir da aber gar nicht sicher...
-
@fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
@sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
da ich die Daten selber für mich immer gerne archiviere:
ich ermittle die url zum Exceldownload ja relativ aufwändig, Hintergrund ist die SessionID, welche sich ja immer ändert. Hier würde mich interessieren, ob du damit mit der Zeit Probleme beim Download bekommst, da du sie ja statisch eingetragen hast. Ich könnte mir vorstellen dass sie 'verfällt', bin mir da aber gar nicht sicher...
Hallo,
bisher habe ich keine Probleme mit der id. Läuft allerdings auch erst seit drei Tagen.
-
@sissiwup sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
Hallo,
bisher habe ich keine Probleme mit der id. Läuft allerdings auch erst seit drei Tagen.Das ist gut, frage mich wozu diese id dann gut sein soll. Danke für das Feedback
-
Ich bekomme nach Aktualisierung auf 0.6.6 leider folgende Fehlermeldung im Log:
coronavirus-statistics.0 2021-01-04 14:36:18.333 error at Covid19.onReady (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:615:5)
coronavirus-statistics.0 2021-01-04 14:36:18.333 error at germanyBundersland (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:312:37)
coronavirus-statistics.0 2021-01-04 14:36:18.333 error at Covid19.getGermanyVaccinationData (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:796:27)
coronavirus-statistics.0 2021-01-04 14:36:18.333 error at processTicksAndRejections (internal/process/task_queues.js:97:5)
coronavirus-statistics.0 2021-01-04 14:36:18.333 error at runMicrotasks (<anonymous>)
coronavirus-statistics.0 2021-01-04 14:36:18.333 error at getInfos (/opt/iobroker/node_modules/iobroker.coronavirus-statistics/main.js:780:80)
coronavirus-statistics.0 2021-01-04 14:36:18.333 error (2268) [germanyFederalStates] error: Cannot read property '2' of null, stack: TypeError: Cannot read property '2' of null -
@morpheus-0 Bitte LOG Ausgaben in Code Tags!
Das Problem liegt wohl an der geänderten Website
-
Heute hat sich das Format des Excel geändert.
Mein Script oben habe ich angepaßt ... -
@fastfoot bei mir das gleiche
coronavirus-statistics.0 2021-01-04 18:39:46.138 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:46.138 warn (15408) Object coronavirus-statistics.0.Germany.Stadt.Coburg.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, fi coronavirus-statistics.0 2021-01-04 18:39:46.106 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:46.106 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Bodenseekreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mi coronavirus-statistics.0 2021-01-04 18:39:46.082 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:46.082 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Ortenaukreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mix coronavirus-statistics.0 2021-01-04 18:39:46.059 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:46.059 warn (15408) Object coronavirus-statistics.0.Germany.Stadt.Freiburg_im_Breisgau.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, obj coronavirus-statistics.0 2021-01-04 18:39:46.034 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:46.034 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Freudenstadt.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mix coronavirus-statistics.0 2021-01-04 18:39:46.014 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:46.014 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Calw.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, file coronavirus-statistics.0 2021-01-04 18:39:45.993 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.992 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Rastatt.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, f coronavirus-statistics.0 2021-01-04 18:39:45.972 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.971 warn (15408) Object coronavirus-statistics.0.Germany.Stadt.Karlsruhe.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, coronavirus-statistics.0 2021-01-04 18:39:45.948 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.947 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Hohenlohekreis.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, m coronavirus-statistics.0 2021-01-04 18:39:45.923 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.923 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Esslingen.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, coronavirus-statistics.0 2021-01-04 18:39:45.884 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.884 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Böblingen.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixed, coronavirus-statistics.0 2021-01-04 18:39:45.859 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.859 warn (15408) Object coronavirus-statistics.0.Germany.Kreis.Germersheim.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object, mixe coronavirus-statistics.0 2021-01-04 18:39:45.817 warn (15408) This object will not be created in future versions. Please report this to the developer. coronavirus-statistics.0 2021-01-04 18:39:45.817 warn (15408) Object coronavirus-statistics.0.Germany.Stadt.Frankfurt_am_Main.last_update is invalid: obj.common.type has an invalid value (date) but has to be one of number, string, boolean, array, object coronavirus-statistics.0 2021-01-04 18:39:45.658 error at process._tickCallback (internal/process/next_tick.js:68:7) coronavirus-statistics.0 2021-01-04 18:39:45.658 error at getInfos (C:\Program Files\iobroker\ioBrMain026\node_modules\iobroker.coronavirus-statistics\main.js:780:80) coronavirus-statistics.0 2021-01-04 18:39:45.658 error (15408) [germanyFederalStates] error: Cannot read property '2' of null, stack: TypeError: Cannot read property '2' of null
Danke @Dutchman für die Weiterentwicklung des Adapters.
Abseits des Adapters teile ich den den Groll von @Homoran . Verstehe das alles nicht. Meine Meinung zu Beginn der Pandemie: Deutschland sollte 16 Mrd für Impfstoffentwicklung bereitstellen zu 4 Approaches @ je 4 Mrd. Einer der vier wird es schaffen und 4Mrd pro Approach wird wohl reichen (grob geschätzt).
Und 16Mrd ist billig im Vergleich zu den erwartenden Corona-Lockdown-Schäden.
Und Im Frühjahr, als die Gesundheitsämter noch nicht so viel zu tun hatten, gleich die Impflogistik planen und alles vorbereiten.
Wird man ja sicher brauchen.
Stattdessen habe ich den Eindruck, man habe sich sich auf die EU verlassen. Dort scheint man nicht nur Französisch zu sprechen, sondern auch so zu denken. "Sanofi wird uns retten, muß uns retten". Also die Rettungsdosis bei Sonfi bestellt und die Bestellungen bei Biontech/Pfizer hintan gestellt. Hat aber nicht funktioniert, Sanofi hat wohl gepatzt.
Jetzt ist man verlassen und wir werden von anderen überholt, obwohl die Technologie hier entwickelt wurde. Unglaublich.
Wer wissen will, wie es besser geht, schaut nach Israel.
Jetzt erst aber mal "look at the figures". -
Es gibt jetzt eine Version
https://github.com/iobroker-community-adapters/ioBroker.coronavirus-statisticsJetzt funktioniert alles wieder einwandfrei
-
@morpheus-0 bei mir auch, vielen Dank!
-
@fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
@morpheus-0 Bitte LOG Ausgaben in Code Tags!
Das Problem liegt wohl an der geänderten Website
@klassisch sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
@fastfoot bei mir das gleiche
verwechselt bitte script nicht mit adapter, issues zu adapter bitte am besten immer git oder im betreffenden thread.
Obwohl in diesem fall zufällig @fastfoot auch fast gleichzeitig ne Lesung parat hatte -
Mann, heute schon wieder eine Anpassung.
Die Reiter sind mal wieder umbenannt worden...
Habs oben im Skript angepaßt. -
@sissiwup
Und wieder mal neu, jetzt werden Formeln in der Excel verwendet. -
aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?
Mfg
Frank -
@fraltho sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:
aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?
das obige Skript ist seit der Implementierung im Adapter eh obsolet und läuft auch mit den aktuellen Versionen des RKI Excelsheet nicht mehr. Das gleiche Problem hat wohl auch der Adapter, die RKI Leute wechseln das Layout ständig und auch nicht gerade auswertefreundlich. Leider ist das Excel die einzige mir bekannte Quelle für Impfdaten auf Bundeslandebene. Inwiefern @Dutchman da jetzt Änderungen im Adapter macht kann ich nicht sagen, meines Wissens wollte er sich das aber ansehen.