Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder

    This topic has been deleted. Only users with topic management privileges can see it.
    • Homoran
      Homoran Global Moderator Administrators @fastfoot last edited by

      @fastfoot sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

      deine 'Beschwerden' müsstest du an das RKI richten

      Bezog sich ja auch nicht auf dich!

      F 1 Reply Last reply Reply Quote 0
      • F
        fastfoot @Homoran last edited by

        @Homoran sagte in [Skript]RKI-Impfquotenmonitoring Deutschland incl. B-länder:

        Bezog sich ja auch nicht auf dich!

        Das war schon klar! Aber Jammern nützt da ja auch nichts, diese Daten werden nunmal nicht zur elektronischen Weiterverarbeitung veröffentlicht, sondern ... ähem... keine Ahnung... einmal hiess das Sheet mit den Daten auch Presse. In den paar Tagen seit Veröffentlichung der Daten hat sich der Aufbau des Excel auch schon mehrfach geändert und wird dies bestimmt noch öfter tun. Seitdem Merkel die Feststellung über das 'Neuland' gemacht hat habe ich den Verdacht, dass das gar keine Feststellung, sondern eine Aufforderung war😰 Jedenfalls hat sich nicht viel geändert seitdem

        1 Reply Last reply Reply Quote 1
        • F
          fastfoot @fastfoot last edited by

          @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

          Dutchman 1 Reply Last reply Reply Quote 1
          • Dutchman
            Dutchman Developer Most Active Administrators @fastfoot last edited by

            @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 🙂

            sissiwup 1 Reply Last reply Reply Quote 0
            • sissiwup
              sissiwup @Dutchman last edited by sissiwup

              Hallo,

              da ich die Daten selber für mich immer gerne archiviere:

              getImpfquoten.py:

              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:
              Bildschirmfoto 2021-01-02 um 16.47.23.png

              Anschließend kann man das dann in grafana wunderbar visualisieren (deshalb die Unix-Timestamps)

              Dutchman F 3 Replies Last reply Reply Quote 0
              • Dutchman
                Dutchman Developer Most Active Administrators @sissiwup last edited by

                @sissiwup
                thanks, mit dem adapter version 0.6.5 kam man dies jetzt. auch per sql oder influxdb adapter machen

                Homoran 1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @Dutchman last edited by Homoran

                  @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?

                  Impfstatus.png

                  Dutchman 1 Reply Last reply Reply Quote 0
                  • Dutchman
                    Dutchman Developer Most Active Administrators @Homoran last edited by Dutchman

                    @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

                    1 Reply Last reply Reply Quote 0
                    • F
                      fastfoot @sissiwup last edited by

                      @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 🙂

                      1 Reply Last reply Reply Quote 1
                      • F
                        fastfoot @sissiwup last edited by

                        @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...

                        sissiwup 1 Reply Last reply Reply Quote 0
                        • sissiwup
                          sissiwup @fastfoot last edited by

                          @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.

                          F 1 Reply Last reply Reply Quote 0
                          • F
                            fastfoot @sissiwup last edited by

                            @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 👍

                            1 Reply Last reply Reply Quote 0
                            • M
                              morpheus 0 last edited by morpheus 0

                              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

                              F 1 Reply Last reply Reply Quote 0
                              • F
                                fastfoot @morpheus 0 last edited by

                                @morpheus-0 Bitte LOG Ausgaben in Code Tags!

                                Das Problem liegt wohl an der geänderten Website

                                sissiwup K Dutchman 3 Replies Last reply Reply Quote 0
                                • sissiwup
                                  sissiwup @fastfoot last edited by

                                  Heute hat sich das Format des Excel geändert.
                                  Mein Script oben habe ich angepaßt ...

                                  1 Reply Last reply Reply Quote 0
                                  • K
                                    klassisch Most Active @fastfoot last edited by

                                    @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".

                                    M 1 Reply Last reply Reply Quote 0
                                    • M
                                      morpheus 0 @klassisch last edited by

                                      Es gibt jetzt eine Version
                                      https://github.com/iobroker-community-adapters/ioBroker.coronavirus-statistics

                                      Jetzt funktioniert alles wieder einwandfrei 🙂

                                      K 1 Reply Last reply Reply Quote 0
                                      • K
                                        klassisch Most Active @morpheus 0 last edited by

                                        @morpheus-0 bei mir auch, vielen Dank!

                                        1 Reply Last reply Reply Quote 0
                                        • Dutchman
                                          Dutchman Developer Most Active Administrators @fastfoot last edited by

                                          @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 🙂

                                          sissiwup 1 Reply Last reply Reply Quote 0
                                          • sissiwup
                                            sissiwup @Dutchman last edited by sissiwup

                                            Mann, heute schon wieder eine Anpassung.
                                            Die Reiter sind mal wieder umbenannt worden...
                                            Habs oben im Skript angepaßt.

                                            sissiwup 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            866
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            7
                                            31
                                            2074
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo