Page 1 of 3

Dashticz Coronavirus - Features, Fixes & Updates

Posted: Sunday 29 March 2020 21:46
by clinkadink
This evening the beta has been updated to provide Coronavirus reporting within Dashticz.

It uses the dataset of John Hopkins University, which is updated daily. It can report on world stats and also country specific, using the 2 character ISO Alpha-2 country codes (link below).

https://www.nationsonline.org/oneworld/ ... e_list.htm

The following block config produces the image displayed below:
Spoiler: show

Code: Select all

blocks['coronavirus_graph_uk'] = {	
	title: 'Coronavirus',
	type: 'corona',
	countryCode:'GB',
	startDate: '01/03/2020',
	datasetColors: ['#7fcdbb', '#f03b20'],
	graph: 'bar',
	startDate: '01/03/2020',
	stacked: true,
	toolTipStyle: true,
	height: '760px',
	zoom: 'x'
} 

blocks['coronavirus_graph_us'] = {	
	title: 'Coronavirus',
	type: 'corona',
	countryCode:'US',	
	startDate: '01/03/2020',
	datasetColors: ['#7fcdbb', '#f03b20'],
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '380px',
	zoom: 'x'
} 

blocks['coronavirus_graph_it'] = {	
	title: 'Coronavirus',
	type: 'corona',
	countryCode:'IT',
	startDate: '01/03/2020',
	datasetColors: ['#7fcdbb', '#f03b20'],
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '380px',
	zoom: 'x'
} 

blocks['coronavirus_graph_es'] = {	
	title: 'Coronavirus',
	type: 'corona',
	countryCode:'ES',	
	startDate: '01/03/2020',
	datasetColors: ['#7fcdbb', '#f03b20'],
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '380px',
	zoom: 'x'
} 

blocks['coronavirus_graph_de'] = {	
	title: 'Coronavirus',
	type: 'corona',
	countryCode:'DE',	
	startDate: '01/03/2020',
	datasetColors: ['#7fcdbb', '#f03b20'],
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '380px',
	width: 6,
	zoom: 'x'
} 

blocks['coronavirus_graph_fr'] = {	
	title: 'Coronavirus',
	type: 'corona',
	countryCode:'FR',	
	startDate: '01/03/2020',
	datasetColors: ['#7fcdbb', '#f03b20'],
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '380px',
	width: 6,
	zoom: 'x'
} 


blocks['coronavirus_global_confirmed'] = {	
	report: 'Confirmed',
	type: 'corona',
	width: 3
} 

blocks['coronavirus_global_deaths'] = {	
	report: 'Deaths',
	type: 'corona',
	width: 3
} 

blocks['coronavirus_gb_confirmed'] = {	
	countryCode:'GB',
	type: 'corona',
	report: 'Confirmed',
	width: 3
} 

blocks['coronavirus_gb_deaths'] = {	
	countryCode:'GB',
	type: 'corona',
	report: 'Deaths',
	width: 3
} 

blocks['coronavirus_gb_ratio'] = {	
	countryCode:'GB',
	type: 'corona',
	report: 'Ratio',
	width: 6
} 

blocks['coronavirus_gb_doubling'] = {	
	countryCode:'GB',
	type: 'corona',
	report: 'Doubling',
	width: 6
} 

columns[40] = {}
columns[40]['width'] = 8;
columns[40]['blocks'] = ['coronavirus_global_confirmed', 'coronavirus_global_deaths', 'coronavirus_gb_confirmed','coronavirus_gb_deaths', 'coronavirus_graph_uk', 'coronavirus_graph_de', 'coronavirus_graph_fr']

columns[41] = {}
columns[41]['width'] = 4;
columns[41]['blocks'] = ['coronavirus_gb_ratio', 'coronavirus_gb_doubling', 'coronavirus_graph_us', 'coronavirus_graph_it', 'coronavirus_graph_es']
You can right click whilst over the image and "Open image in new tab", to view full screen ...
Image

There are a couple of new block parameters:
  • countryCode: 2 character ISO Alpha-2 code for the country to report on. Without this, it will report globally. E.g. Netherlands is NL, Spain is ES, etc. This code is also used to display the flag for the country.
  • startDate: all data starts on 20/01/2020. The user can specify when they want to report from.
Note: many original graph parameters work, such as those in the example above.

Report blocks can be either "global" or "country specific". There are several report options:
  • Confirmed - the number of confirmed cases
  • Deaths - the number of deaths
  • Ratio - the ratio that shows for each infected person there are X amount of uninfected people, e.g. 1:2500 equates to one infected person for every 2,500 people
  • Doubling - reports on rate of infection in a specific country, i.e. how many hours to double. This cannot be used for global stats.
Important: all blocks must be named with "coronavirus_" substring.

Finally, credit to ExpDev07 for providing the api, allowing this capability in Dashticz.
https://github.com/ExpDev07/coronavirus-tracker-api

Re: Dashticz Coronavirus reporting

Posted: Monday 30 March 2020 23:30
by clinkadink
I have updated the corona block code so that you don't need to name it with "coronavirus_" substring. Instead, you add type: 'corona' to the block.

Code: Select all

blocks['my_graph_name'] = {
	type: 'corona',
	countryCode: 'NL',
	startDate: '01/03/2020',
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '600px',
	zoom: 'x'
} 
Image

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 15:59
by TankySpanky
Hmm
I have copied and pasted in into my Dashticz but i see nothing :(
Do i miss something ??

Are only those 2 inserts enough for the display ?

thanx in advance

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 16:04
by Boattailman
Update dashticz? Works fine here.

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 17:08
by clinkadink
TankySpanky wrote: Thursday 02 April 2020 15:59 Hmm
I have copied and pasted in into my Dashticz but i see nothing :(
Do i miss something ??

Are only those 2 inserts enough for the display ?

thanx in advance
Are you running the latest beta?
Using the single block code below, have you added the graph to your column?

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 17:36
by TankySpanky
Hello.

From the version.txt ("version": "3.4.1","branch": "beta",)
----
columns[7] = {}
columns[7]['width'] = 4;
columns[7]['blocks'] = ['coronavirus_gb_ratio', 'coronavirus_gb_doubling', 'coronavirus_graph_us', 'coronavirus_graph_it', 'coronavirus_graph_es']
---------
screens[3] = {}
screens[3]['background'] = 'bg14.jpg';
screens[3]['columns'] = [6,7]
----------------

Copy pasted it like that, so i thought it should be on screen 3, but its empty.

ty in advance

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 17:41
by clinkadink
TankySpanky wrote: Thursday 02 April 2020 17:36 Hello.

From the version.txt ("version": "3.4.1","branch": "beta",)
----
columns[7] = {}
columns[7]['width'] = 4;
columns[7]['blocks'] = ['coronavirus_gb_ratio', 'coronavirus_gb_doubling', 'coronavirus_graph_us', 'coronavirus_graph_it', 'coronavirus_graph_es']
---------
screens[3] = {}
screens[3]['background'] = 'bg14.jpg';
screens[3]['columns'] = [6,7]
----------------

Copy pasted it like that, so i thought it should be on screen 3, but its empty.

ty in advance
Thanks. It looks like you are using a copy of the code from post 1. In post 2 the was a change, you need to add "type: 'corona'," to your block. Please confirm you have done this. If not, please add it.

Code: Select all

blocks['my_graph_name'] = {
	type: 'corona',
	countryCode: 'NL',
	startDate: '01/03/2020',
	graph: 'bar',
	stacked: true,
	toolTipStyle: true,
	height: '600px',
	zoom: 'x'
} 

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 17:47
by TankySpanky
Thanx,
I guess i overread that part, i did see it but ....... ( blame the age ) hehe

Ty matey

Now i get the graph's

Re: Dashticz Coronavirus reporting

Posted: Thursday 02 April 2020 18:06
by clinkadink
TankySpanky wrote: Thursday 02 April 2020 17:47 Thanx,
I guess i overread that part, i did see it but ....... ( blame the age ) hehe

Ty matey

Now i get the graph's
No worries, glad its working. At half a century young, I know the feeling ;)
I have updated post 1 code now, just in case anyone else copies the code.

Re: Dashticz Coronavirus reporting

Posted: Friday 03 April 2020 17:15
by clinkadink
In the latest beta (today), there have been a couple of changes:
  • The doubling calculation is now accurate to the nearest hour, instead of the nearest day. The result no longer update in factors of 24 hours, but instead, 1 hour.
  • The graph headers now include the doubling (rate of growth in hours) per country.
Note: "Doubling time" is the amount of time it takes for a given quantity to double in size or value at a constant growth rate.

For example, since yesterday, the UK's doubling has slowed from 96 hours to 122 hours.
Image

This "doubling" figure has now been added to end of the header of each graph.
Image

Image

Re: Dashticz Coronavirus reporting

Posted: Friday 03 April 2020 18:39
by clinkadink
florisi wrote: Friday 03 April 2020 18:24 This is the error.

Code: Select all

Uncaught TypeError: Cannot read property 'confirmed' of undefined
    at Object.success (<anonymous>:161:39)
    at fire (bundle.js:37)
    at Object.fireWith [as resolveWith] (bundle.js:37)
    at done (bundle.js:37)
    at XMLHttpRequest.<anonymous> (bundle.js:37)
I have added my response to this thread, as this specifically relates to the corona block.

I have tried to replicate at my end, but cannot. I can see all corona blocks for all reports.

Image

This is my block config for the above layout.
Spoiler: show

Code: Select all

blocks['coronavirus_global_confirmed'] = {
	report: 'confirmed',
	type: 'corona',	
	width: 3
} 

blocks['coronavirus_global_deaths'] = {	
	type: 'corona',
	report: 'Deaths',
	width: 3
} 

blocks['coronavirus_gb_confirmed'] = {
	type: 'corona',	
	countryCode:'NL',
	report: 'Confirmed',
	width: 3
} 

blocks['coronavirus_gb_deaths'] = {
	type: 'corona',	
	countryCode:'NL',
	report: 'Deaths',
	width: 3
} 

blocks['coronavirus_gb_ratio'] = {
	type: 'corona',	
	countryCode:'NL',
	report: 'Ratio',
	width: 6
} 

blocks['coronavirus_gb_doubling'] = {
	type: 'corona',	
	countryCode:'NL',
	report: 'Doubling',
	width: 6
} 
If copying and pasting the code above doesn't work, then the only thing I can think of is double checking your Dashticz version (click on the settings cog then Info). It should say "Dashticz V3.4.2 beta".

Re: Dashticz Coronavirus reporting

Posted: Friday 03 April 2020 18:59
by florisi
This my config for the blocks.
And I'm running V3.4.2 beta.
Still the same error.

Code: Select all

blocks['coronavirus_global_confirmed'] = {
    report: 'confirmed',
    type: 'corona',
    width: 6
}

blocks['coronavirus_global_deaths'] = {
    report: 'Deaths',
    type: 'corona',
    width: 6
}

Re: Dashticz Coronavirus reporting

Posted: Friday 03 April 2020 19:10
by clinkadink
Hmm. This is the url that the block uses:
https://coronavirus-tracker-api.herokua ... imelines=1
I am guessing you can access this OK?

For the "Confirmed" report, it gets "confirmed":14697 from the returned JSON.
But for you, Dashticz is not returning the JSON.

Do you have your CORS URL set?

Code: Select all

config['default_cors_url']
If so, as a test, please can you remove the url and retest?

Re: Dashticz Coronavirus reporting

Posted: Friday 03 April 2020 23:00
by clinkadink
OK, the issue has now been resolved. Apologies for the inconvienience.
Please can you apply the latest beta updated just now.

Re: Dashticz Coronavirus reporting

Posted: Saturday 04 April 2020 8:08
by florisi
Thanks, it's working again.
Updated for April 3rd.

Re: Dashticz Coronavirus reporting

Posted: Saturday 04 April 2020 10:30
by clinkadink
florisi wrote: Saturday 04 April 2020 8:08 Thanks, it's working again.
Updated for April 3rd.
Great, thanks for letting me know ;)

Re: Dashticz Coronavirus reporting

Posted: Tuesday 07 April 2020 8:27
by magicduck
This is strange on chrominium on RPI the graphics is missing...

Re: Dashticz Coronavirus reporting

Posted: Tuesday 07 April 2020 8:33
by clinkadink
Do you mean the icons in the graph header, or the icons in the report blocks?
Do you have any other non-corona graphs with the icons showing? Or is the issue with just corona?
Have you the latest beta installed?

Re: Dashticz Coronavirus reporting

Posted: Tuesday 07 April 2020 17:43
by clinkadink
The current url for corona api is currently down. There is an alternative url which is available and working. I will get this fixed. In the meantime, if anyone wants to manually update it, you can.

Open the corona script located in your Dashticz folder: js\components\coronavirus.js
Replace the url for the api:

Code: Select all

var api = 'https://coronavirus-tracker-api.herokuapp.com/v2/';
With this:

Code: Select all

var api = 'https://covid-tracker-us.herokuapp.com/v2/';

Re: Dashticz Coronavirus - Features, Fixes & Updates

Posted: Saturday 11 April 2020 15:22
by clinkadink
The Coronavirus module was updated today in the latest beta. The graphs now includes two new datasets; Confirmed (Day) and Deaths (Day.

Image

The image above shows the new graph block parameter, "tooltiptotal" being used. For more info, check out this thread:
https://www.domoticz.com/forum/viewtopi ... 60#p243248