BREAK: replace datasource (rp-online by c19d)
This commit is contained in:
parent
741d2d1838
commit
792fce3981
4 changed files with 20 additions and 17 deletions
|
@ -26,11 +26,9 @@
|
|||
<span class="bright incidence">
|
||||
Inzidenz: <span class={{new7_class}}>{{ cases.new7_100k }}</span>
|
||||
</span><br/>
|
||||
<span class="bright new7"> Neu: {{ cases.new7 }} </span><br/>
|
||||
<span class="bright active">Aktiv: {{ cases.active }}</span><br/>
|
||||
<span class="total">Gesamt: {{ cases.total }}</span><br/>
|
||||
<span class="death">Tote: {{ cases.death }}</span><br/>
|
||||
<span class="cured">Genesen: {{ cases.cured }}</span><br/>
|
||||
<div class="xsmall ts">
|
||||
<span>7-Tage Trend, Stand {{ cases.ts }}</span>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Module: MMM-covid19
|
||||
|
||||
This module displays COVID-19 data aggregated by [rp-online](https://rp-online.de).
|
||||
This module displays COVID-19 data aggregated by [c19d](https://c19d.smsvc.net).
|
||||
|
||||
![](screenshot.png)
|
||||
|
||||
|
@ -37,7 +37,7 @@ modules: [
|
|||
|
||||
### List available regions
|
||||
|
||||
`curl https://rp-online.de/app/interaktiv_server/data/rki_nrw_mapped.json.php | jq | awk '/^ "/ {print}'`
|
||||
`curl -s https://c19d.smsvc.net/api/v2/districts | jq '.[].LK_Name'`
|
||||
|
||||
## MMPM integration
|
||||
```
|
||||
|
|
|
@ -1,27 +1,32 @@
|
|||
var NodeHelper = require("node_helper");
|
||||
const fetch = require("node-fetch");
|
||||
|
||||
var data_url = "https://rp-online.de/app/interaktiv_server/data/rki_nrw_mapped.json.php";
|
||||
var cases = {}
|
||||
|
||||
module.exports = NodeHelper.create({
|
||||
|
||||
socketNotificationReceived: function (notification, region) {
|
||||
|
||||
// get id for passed region
|
||||
fetch("https://c19d.smsvc.net/api/v2/districts?LK_Name="+region)
|
||||
.then(response=>response.json())
|
||||
.then(data=>{
|
||||
region_id=data[0]["ID"]
|
||||
|
||||
// get and parse json data from source
|
||||
res = fetch(data_url)
|
||||
fetch("https://c19d.smsvc.net/api/v2/districts/"+region_id+"/data/last")
|
||||
.then(response=>response.json())
|
||||
.then(data=>{
|
||||
// extract data
|
||||
cases.new7 = data[region]["last_7"];
|
||||
cases.new7_100k = data[region]["last_7_100000"];
|
||||
cases.active = data[region]["active"];
|
||||
cases.total = data[region]["cases"];
|
||||
cases.death = data[region]["tot"];
|
||||
cases.cured = data[region]["gesund"];
|
||||
cases.ts = data[region]["date"];
|
||||
cases.new7_100k = data["Cases_Last_Week_Per_100000"];
|
||||
cases.active = data["Cases_Last_Week"];
|
||||
cases.total = data["Cases"];
|
||||
cases.death = data["Deaths"];
|
||||
cases.ts = data["Date"];
|
||||
|
||||
// send data back to module
|
||||
this.sendSocketNotification("{{MODULE_NAME}}-set_cases", cases)
|
||||
})
|
||||
})
|
||||
},
|
||||
});
|
||||
|
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 27 KiB |
Loading…
Reference in a new issue