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.
    • 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
                          • sissiwup
                            sissiwup @sissiwup last edited by

                            @sissiwup
                            Und wieder mal neu, jetzt werden Formeln in der Excel verwendet.

                            1 Reply Last reply Reply Quote 0
                            • F
                              fraltho last edited by

                              aktuell (seit ca. einer Woche) werden die Impfungen nicht mehr aktualisiert, generell? Oder nur bei mir und einigen wenigen anderen Kollegen?

                              Mfg
                              Frank

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

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

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

                                  @fastfoot es gibt ja ein issue darüber, warten wir also ab 🙂

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

                                    @fastfoot
                                    Hallo @fastfoot: Leider wurde die Excelliste anscheinend schon wieder angepasst. Und die Zahlen passen nicht zusammen. Kannst Du mal einen Blick darauf werfen?

                                    343f0294-0e9c-40f6-b477-ae8085ab726c-image.png

                                    5bd4a36e-0088-4b2d-9426-045f6aa4354f-image.png

                                    Danke
                                    Gruß Christian

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

                                      @morpheus-0 Für den Covid Adapter ist ausschließlich @Dutchman zuständig, dies hier ist der Thread zum Skript, welches allerdings zur Zeit nicht weiterentwickelt wird und deshalb auch nicht funktioniert. Sorry dass ich da keine besseren Neuigkeiten habe

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

                                        Hi,

                                        hier mal die aktuelle Version:
                                        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
                                        headline = None
                                        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=25,max_row=19, values_only=True):
                                                try:
                                                    sum=sum+row[2]
                                                    nrow=[str(dat.date()),str(datakt),str(datetime.timestamp(dat))]
                                                    anzbl=anzbl+1
                                                    row = [x for x in row if x is not None]
                                                    nrow.extend(list(row))
                                                    if titel==0:
                                                        titel=1
                                                        headline = [x for x in headline if x is not None]
                                                        trow=['Datenstand','Dat-Import', 'Datenstand-Unix']
                                                        trow.extend(list(headline))
                                                        print(trow)
                                                        c.writerow(trow)
                                        
                                                    print(nrow)
                                                    c.writerow(nrow)
                                                except:
                                                    if headline==None:
                                                        headline=list(row)
                                                    else:
                                                        for i in range(0,len(headline)):
                                                            if row[i] is not None:
                                                                if headline[i] is None:
                                                                    headline[i]=row[i]
                                                                else:
                                                                    headline[i]=headline[i]+"."+row[i]
                                        
                                        if anzbl!=16:
                                            print("Es sollten 16 Bundesländer sein:",anzbl)
                                            sys.exit(99)
                                        
                                        if len(headline)!=15:
                                            print("Anzahl Spalten sollte 15 sein:",len(headline))
                                            sys.exit(99)
                                        
                                        print("Gesamtzahl der Impfungen in Deutschland: " + str(sum))
                                        print("Datenstand: " + str(dat) + " Sheetname:" + str(sheet.title))
                                        

                                        getImpfquoten.sh:

                                        #!/bin/bash
                                        NOW=`date +"%d.%m.%g %H:%M.%S"`
                                        NOWDAT=`date +"%u"`
                                        USER=usermysql
                                        PASS=passwordmysql
                                        
                                        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"
                                        	cp /var/skripte/data/Impfquotenmonitoring.xlsx /var/skripte/data/Impquotenmonitoring_$NOWDAT.xlsx.backup
                                                cp /var/skripte/data/Impfquotenmonitoring.csv /var/skripte/data/Impfquotenmonitoring_$NOWDAT.csv.backup
                                        	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.rs=i2.rs and i1.import_datum<i2.import_datum)"
                                        mysql -u $USER -p$PASS iobroker -e "UPDATE cor_impfung inner join cor_bundesland on rs=lan_ew_ags SET Bundesland=lan_ew_gen"
                                        

                                        Tabelle:

                                        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 '\'"??"\'',
                                          `Gesamtimpfungen` int(11) NOT NULL DEFAULT 0,
                                          `Impfungen` int(11) DEFAULT 0,
                                          `BioNTech` int(11) NOT NULL DEFAULT 0,
                                          `Moderna` int(11) NOT NULL DEFAULT 0,
                                          `AstraZeneca` 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,
                                          `BioNTech_2` int(11) NOT NULL DEFAULT 0,
                                          `Moderna_2` int(11) NOT NULL DEFAULT 0,
                                          `AstraZeneca_2` int(11) NOT NULL DEFAULT 0,
                                          `Zweit_Differenz_Vortag` int(11) NOT NULL DEFAULT 0,
                                          `Impfquote_2` double NOT NULL DEFAULT 0
                                        ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
                                        

                                        Index:

                                        ALTER TABLE `cor_impfung`
                                          ADD PRIMARY KEY (`datenstand`,`Bundesland`(24),`import_datum`),
                                          ADD KEY `datenstand-unix` (`datenstand_unix`,`Bundesland`(24));
                                        COMMIT;
                                        

                                        Erklärung siehe oben bei meinem letzten Post

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

                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        478
                                        Online

                                        31.8k
                                        Users

                                        80.0k
                                        Topics

                                        1.3m
                                        Posts

                                        7
                                        31
                                        2079
                                        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