Module:Sandbox/Ajuanca/GraphIt/doc

= 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, are assigned with the   sign:.

For all the examples shown below, the file Data:COVID-19 cases in Asturias.tab is going to be used.

Incidence proportion:
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.

Parameters
The possible parameters are:
 * 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, " "
 * 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 " ".
 * 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 " ".
 * 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.
 * 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).
 * param: A Boolean (true or false) specifiying if a graph should be generated as an output. Default is false. I.e.  (showing a graph as an output).
 * param: A Boolean (true or false) specifiying if the Lua variable should be generated as an output. Default is false. I.e.  (no returning the variable itself). This is a extrange value to be requested.
 * param: A Boolean (true or false) specifiying if a Wikitable table should be generated as an output. Default is false. I.e.  (no returning a wikitable). This options is still NOT AVAILABLE.

''Note 1: Instead of the  parameter,   can be used intead. Alike,  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  and  .''

''Note 2: If  is requested, all parameters available at the Module:Graph 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:

Examples
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 Template:Graph (in the "date" row).

In this case, we will type:

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

we get:

Various incidence proportions:
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.

Parameters
The possible parameters are:
 * 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, " "
 * 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 " and  " respectively.
 * 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 " ".
 * 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.
 * 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).
 * 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  given, and they're also given with a   beetween each element. I.e. Calculate the average for two days and three days:.
 * param: A Boolean (true or false) specifiying if a graph should be generated as an output. Default is false. I.e.  (showing a graph as an output).
 * param: A Boolean (true or false) specifiying if the Lua variable should be generated as an output. Default is false. I.e.  (no returning the variable itself). This is a extrange value to be requested.
 * param: A Boolean (true or false) specifiying if a Wikitable table should be generated as an output. Default is false. I.e.  (no returning a wikitable). This options is still NOT AVAILABLE.

''Note 2: If  is requested, all parameters available at the Module:Graph 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:

Examples
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:

which will output: