|
|
|
@ -35,7 +35,14 @@ QUELLEN = {
|
|
|
|
|
"%A4ndern/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel"
|
|
|
|
|
"=esriSpatialRelIntersects&outFields=*&orderByFields=faelle_100000_EW%20desc&resultOffset=0"
|
|
|
|
|
"&resultRecordCount=50&cacheHint=true",
|
|
|
|
|
"rki_landkreis": "https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=cases%20desc&resultOffset=0&resultRecordCount=1000&cacheHint=true"
|
|
|
|
|
"rki_landkreis": "https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten"
|
|
|
|
|
"/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel"
|
|
|
|
|
"=esriSpatialRelIntersects&outFields=*&orderByFields=cases%20desc&resultOffset=0"
|
|
|
|
|
"&resultRecordCount=1000&cacheHint=true "
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
INTENSIVREGISTER = {
|
|
|
|
|
"intensivregister": "https://www.intensivregister.de/api/public/reporting/laendertabelle"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -55,6 +62,12 @@ def daten_abrufen(url):
|
|
|
|
|
return json_text["features"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def intensivbetten_daten_abrufen(url):
|
|
|
|
|
response = requests.get(url)
|
|
|
|
|
json_text = json.loads(response.text)
|
|
|
|
|
return json_text["data"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def jhu_daten_erstellen(quelle, daten):
|
|
|
|
|
daten_dict = {}
|
|
|
|
|
for data in daten:
|
|
|
|
@ -116,6 +129,21 @@ def rki_landkreis_daten_erstellen(quelle, daten):
|
|
|
|
|
return daten_dict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def intensivbetten_daten_erstellen(daten):
|
|
|
|
|
daten_dict = {}
|
|
|
|
|
for data in daten:
|
|
|
|
|
daten_dict[data['bundesland']] = (db.Intensivregister(
|
|
|
|
|
datetime.datetime.strptime(data['creationTimestamp'], "%Y-%m-%dT%H:%M:%SZ"),
|
|
|
|
|
data['bundesland'],
|
|
|
|
|
data['faelleCovidAktuell'],
|
|
|
|
|
data['faelleCovidAktuellBeatmet'],
|
|
|
|
|
data['intensivBettenBelegt'],
|
|
|
|
|
data['intensivBettenFrei'],
|
|
|
|
|
data['intensivBettenNotfall7d']
|
|
|
|
|
))
|
|
|
|
|
return daten_dict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def daten_erstellen(quelle, daten):
|
|
|
|
|
if quelle == "jhu":
|
|
|
|
|
daten_db = jhu_daten_erstellen(quelle, daten)
|
|
|
|
@ -144,12 +172,20 @@ def headers_erstellen():
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
headers = headers_erstellen()
|
|
|
|
|
# Coronazahlen
|
|
|
|
|
for quelle, url in QUELLEN.items():
|
|
|
|
|
json_daten = daten_abrufen(url)
|
|
|
|
|
daten = daten_erstellen(quelle, json_daten)
|
|
|
|
|
daten_server = daten_trennen(daten)
|
|
|
|
|
db.sende_daten(CONFIG["url"], CONFIG["tablename_daten"], headers, daten_server)
|
|
|
|
|
|
|
|
|
|
# Intensivbetten
|
|
|
|
|
for quelle, url in INTENSIVREGISTER.items():
|
|
|
|
|
json_daten = intensivbetten_daten_abrufen(url)
|
|
|
|
|
daten = intensivbetten_daten_erstellen(json_daten)
|
|
|
|
|
daten_server = daten_trennen(daten)
|
|
|
|
|
db.sende_daten((CONFIG["url"]), "intensivregister", headers, daten_server)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|
|
|
|
|