= Usage =Place the following snippet on the wiki page, replacing function_name with the name of the function to be used, and giving the parameters separated with |
. Specific parameters, the ones with a specific name, like avgs
, are assigned with the =
sign: |''avgs=2,3,4''|
.
For all the examples shown below, the file Data:COVID-19 cases in Asturias.tab is going to be used.
<nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''function_name''|''param1''|''param2''|''param name = param value''}}
get_incidence
This function calculates the incidence proportion of a specific event for all the available dates.
I.e.: The daily confirmed cases of flu per 10.000 inhabitants in Asturias.
The possible parameters are:
src=
or the first param: The name of the Tabular file. These files are hosted on Wikimedia Commons, inside the Data namespace ("Data:name of tabular file.tab"). The files in this section must end with the suffix ("Data: name of tabular file.tab"). I.e. The file itself, "[[c:Data:COVID-19 cases in Asturias.tab|COVID-19 cases in Asturias.tab]]
"column_name=
or the second param: The name of the column where the data of the event is stored. I.e. The column with the total confirmed cases of COVID-19 in Asturias, called "total_cases
".date_name=
or the third param: The name of the column where the date of the data of the event is stored. I.e. The column with the date (in a String format YYYY-MM-DD), called "date
".inhabitants=
or the fourth param: The population size of the given region. I.e. 1,018,775 total inhabitants living in Asturias, according to the INE as a temporarly data for January 1st, 2020.nth=
or the fifth param: The power of 10 for the generated output (the power of ten to the nth, 10n). This value normally will be 4 or 5, althought can be changed for smaller or bigger population sizes. I.e. 5, which causes the output to be given per 105 inhabitants (100,000).graph=
param: A Boolean (true or false) specifiying if a graph should be generated as an output. Default is false. I.e. true
(showing a graph as an output).ltable=
param: A Boolean (true or false) specifiying if the Lua variable should be generated as an output. Default is false. I.e. false
(no returning the variable itself). This is a extrange value to be requested.wtable=
param: A Boolean (true or false) specifiying if a Wikitable table should be generated as an output. Default is false. I.e. false
(no returning a wikitable). This options is still NOT AVAILABLE.Note 1: Instead of the column_name
parameter, column_title
can be used intead. Alike, date_title
can be given. It is unusual, but two or more columns could have the same title (but not the same name), so this approach is less safe than column_name
and date_name
.
Note 2: If graph=true
is requested, all parameters available at the can be given. They will be passed to this moduled without any kind of modification.
As a recap, the snippet to include will look like this:
{{((}}#invoke:{{BASEPAGENAME}}|'''get_all_incidence'''|''src''|''colum_name''|''date_name''|''inhabitants''|''nth''|graph=''true''{{))}}
Let's say we want a graph of the Data:COVID-19 cases in Asturias.tab Tabular file, showing the daily incidence of the total COVID-19 confirmed cases (which is registered in the "total_cases" column), expressed per 100.000 inhabitants, and assuming a total population of 1,018,775. Also note that the date is written in a format compatible with the (in the "date" row).
In this case, we will type:
{{((}}#invoke:{{BASEPAGENAME}}|get_all_incidence|COVID-19 cases in Asturias.tab|total_cases|date|1018775|5|graph=true{{))}}
which will output:
But this is an awful graph. remmeber that we can pass any Module:Graph parameter. In this case, we should specify that the x-values are dates. We can give a width and height, and other line width and color. A legend is also available.
With {{((}}#invoke:{{BASEPAGENAME}}|get_all_incidence|COVID-19 cases in Asturias.tab|total_cases|date|1018775|5|graph=true|height=300|width=800|colors=#2c72ff|linewidth=2|xType=date|legend=Legend|y1Title=Confirmed cases per 100.,000 inhabitants|title=COVID-19 cases in Asturias{{))}}
we get:
get_incidences
This function calculates various incidence proportions of the given events for all the available dates. It can also output the medium of a specified interval, instead of all daily values.
I.e.: The week average of the daily confirmed cases of flu per 10.000 inhabitants in Asturias.
The possible parameters are:
src=
or the first param: The name of the Tabular file. These files are hosted on Wikimedia Commons, inside the Data namespace ("Data:name of tabular file.tab"). The files in this section must end with the suffix ("Data: name of tabular file.tab"). I.e. The file itself, "[[c:Data:COVID-19 cases in Asturias.tab|COVID-19 cases in Asturias.tab]]
"column_names=
or the second param: The name of all the columns where the data of the events are stored. Each name should be separated by a comma (,
). I.e. The column with the total confirmed cases of COVID-19 in Asturias, and the column with the total recovered people, called "total_cases
and total_recovered
" respectively.date_name=
or the third param: The name of the column where the date of the data of the event is stored. I.e. The column with the date (in a String format YYYY-MM-DD), called "date
".inhabitants=
or the fourth param: The population size of the given region. I.e. 1,018,775 (1018775
) total inhabitants living in Asturias, according to the INE as a temporarly data for January 1st, 2020.nth=
or the fifth param: The power of 10 for the generated output (the power of ten to the nth, 10n). This value normally will be 4 or 5, althought can be changed for smaller or bigger population sizes. I.e. 5, which causes the output to be given per 105 inhabitants (100,000).avgs=
param: A list of values that specify by how many items the average should be done. The number of avgs should be equal to the number ot column_names
given, and they're also given with a ,
beetween each element. I.e. Calculate the average for two days and three days: 2,3
.graph=
param: A Boolean (true or false) specifiying if a graph should be generated as an output. Default is false. I.e. true
(showing a graph as an output).ltable=
param: A Boolean (true or false) specifiying if the Lua variable should be generated as an output. Default is false. I.e. false
(no returning the variable itself). This is a extrange value to be requested.wtable=
param: A Boolean (true or false) specifiying if a Wikitable table should be generated as an output. Default is false. I.e. false
(no returning a wikitable). This options is still NOT AVAILABLE.Note 2: If graph=true
is requested, all parameters available at the can be given. They will be passed to this moduled without any kind of modification.
As a recap, the snippet to include will look like this:
{{((}}#invoke:{{BASEPAGENAME}}|'''get_incidences'''|''src''|''colum_names''|''date_name''|''inhabitants''|''nth''|''avgs''|graph=''true''{{))}}
Let's say we want a graph of the Data:COVID-19 cases in Asturias.tab Tabular file, showing the daily incidence of the total COVID-19 confirmed cases (which is registered in the "total_cases" column), expressed per 100,000 inhabitants, and assuming a total population of 1,018,775. We will request an average per two days. In the same plot, the recovered cases, also expressed per 100,000, with an average of one week.
In this case, we will type:
{{((}}#invoke:{{BASEPAGENAME}}|get_incidences|COVID-19 cases in Asturias.tab|total_cases,total_recovered|date|1018775|5|avgs=2,7|graph=true{{))}}
which will output: