<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FAjuanca%2FGraphIt%2Fdoc</id>
	<title>Module:Sandbox/Ajuanca/GraphIt/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FAjuanca%2FGraphIt%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Ajuanca/GraphIt/doc&amp;action=history"/>
	<updated>2026-05-24T06:32:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/Ajuanca/GraphIt/doc&amp;diff=145093&amp;oldid=prev</id>
		<title>imported&gt;Ajuanca: add get_incidences</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Ajuanca/GraphIt/doc&amp;diff=145093&amp;oldid=prev"/>
		<updated>2020-10-11T18:20:28Z</updated>

		<summary type="html">&lt;p&gt;add get_incidences&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Usage =&lt;br /&gt;
Place the following snippet on the wiki page, replacing &amp;#039;&amp;#039;function_name&amp;#039;&amp;#039; with the name of the function to be used, and giving the parameters separated with &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. Specific parameters, the ones with a specific name, like &amp;lt;code&amp;gt;avgs&amp;lt;/code&amp;gt;, are assigned with the &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; sign: &amp;lt;code&amp;gt;|&amp;#039;&amp;#039;avgs=2,3,4&amp;#039;&amp;#039;|&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For all the examples shown below, the file [[c:Data:COVID-19 cases in Asturias.tab|Data:COVID-19 cases in Asturias.tab]] is going to be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;#invoke:{{BASEPAGENAME}}|&amp;#039;&amp;#039;function_name&amp;#039;&amp;#039;|&amp;#039;&amp;#039;param1&amp;#039;&amp;#039;|&amp;#039;&amp;#039;param2&amp;#039;&amp;#039;|&amp;#039;&amp;#039;param name = param value&amp;#039;&amp;#039;}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Incidence proportion: &amp;lt;code&amp;gt;get_incidence&amp;lt;/code&amp;gt; ==&lt;br /&gt;
This function calculates the incidence proportion of a specific event for all the available dates. &lt;br /&gt;
&lt;br /&gt;
I.e.: The daily confirmed cases of flu per 10.000 inhabitants in [[Asturias]].&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
The possible parameters are:&lt;br /&gt;
*&amp;lt;code&amp;gt;src=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;first&amp;#039;&amp;#039;&amp;#039; param: The name of the Tabular file. These files are hosted on [[c:Main page|Wikimedia Commons]], inside the &amp;#039;&amp;#039;Data&amp;#039;&amp;#039; namespace (&amp;quot;&amp;#039;&amp;#039;Data&amp;#039;&amp;#039;:name of tabular file.tab&amp;quot;). The files in this section must end with the suffix (&amp;quot;Data: name of tabular file&amp;#039;&amp;#039;.tab&amp;#039;&amp;#039;&amp;quot;). I.e. The file itself, &amp;quot;&amp;lt;code&amp;gt;[[c:Data:COVID-19 cases in Asturias.tab|COVID-19 cases in Asturias.tab]]&amp;lt;/code&amp;gt;&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;column_name=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;second&amp;#039;&amp;#039;&amp;#039; 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 &amp;quot;&amp;lt;code&amp;gt;total_cases&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
*&amp;lt;code&amp;gt;date_name=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;third&amp;#039;&amp;#039;&amp;#039; 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 (computer science)|String]] format YYYY-MM-DD), called &amp;quot;&amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
*&amp;lt;code&amp;gt;inhabitants=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;fourth&amp;#039;&amp;#039;&amp;#039; param: The population size of the given region. I.e. 1,018,775 total inhabitants living in Asturias, according to the [[Instituto Nacional de Estadística (Spain)|INE]] as a temporarly data for January 1st, 2020.&lt;br /&gt;
*&amp;lt;code&amp;gt;nth=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;fifth&amp;#039;&amp;#039;&amp;#039; param: The power of 10 for the generated output (the power of ten to the n&amp;#039;&amp;#039;th&amp;#039;&amp;#039;, 10&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt;). 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 10&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; inhabitants (100,000).&lt;br /&gt;
*&amp;lt;code&amp;gt;graph=&amp;lt;/code&amp;gt; param: A [[Boolean]] (true or false) specifiying if a graph should be generated as an output. &amp;#039;&amp;#039;&amp;#039;Default is false&amp;#039;&amp;#039;&amp;#039;. I.e. &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; (showing a graph as an output).&lt;br /&gt;
*&amp;lt;code&amp;gt;ltable=&amp;lt;/code&amp;gt; param: A [[Boolean]] (true or false) specifiying if the [[Lua]] variable should be generated as an output. &amp;#039;&amp;#039;&amp;#039;Default is false&amp;#039;&amp;#039;&amp;#039;. I.e. &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; (no returning the variable itself). This is a extrange value to be requested. &lt;br /&gt;
*&amp;lt;code&amp;gt;wtable=&amp;lt;/code&amp;gt; param: A [[Boolean]] (true or false) specifiying if a Wikitable table should be generated as an output. &amp;#039;&amp;#039;&amp;#039;Default is false&amp;#039;&amp;#039;&amp;#039;. I.e. &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; (no returning a wikitable). This options is still &amp;#039;&amp;#039;&amp;#039;NOT AVAILABLE&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Note 1: Instead of the &amp;lt;code&amp;gt;column_name&amp;lt;/code&amp;gt; parameter, &amp;lt;code&amp;gt;column_title&amp;lt;/code&amp;gt; can be used intead. Alike, &amp;lt;code&amp;gt;date_title&amp;lt;/code&amp;gt; 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 &amp;lt;code&amp;gt;column_name&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;date_name&amp;lt;/code&amp;gt;.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Note 2: If &amp;lt;code&amp;gt;graph=true&amp;lt;/code&amp;gt; is requested, all parameters available at the [[Module:Graph]] can be given. They will be passed to this moduled without any kind of modification.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As a recap, the snippet to include will look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;{{((}}#invoke:{{BASEPAGENAME}}|&amp;#039;&amp;#039;&amp;#039;get_all_incidence&amp;#039;&amp;#039;&amp;#039;|&amp;#039;&amp;#039;src&amp;#039;&amp;#039;|&amp;#039;&amp;#039;colum_name&amp;#039;&amp;#039;|&amp;#039;&amp;#039;date_name&amp;#039;&amp;#039;|&amp;#039;&amp;#039;inhabitants&amp;#039;&amp;#039;|&amp;#039;&amp;#039;nth&amp;#039;&amp;#039;|graph=&amp;#039;&amp;#039;true&amp;#039;&amp;#039;{{))}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
Let&amp;#039;s say we want a graph of the [[c:Data:COVID-19 cases in Asturias.tab|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 &amp;quot;total_cases&amp;quot; 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 &amp;quot;date&amp;quot; row).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this case, we will type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;{{((}}#invoke:{{BASEPAGENAME}}|get_all_incidence|COVID-19 cases in Asturias.tab|total_cases|date|1018775|5|graph=true{{))}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will output:&lt;br /&gt;
&lt;br /&gt;
{{#invoke:{{BASEPAGENAME}}|get_all_incidence|COVID-19 cases in Asturias.tab|total_cases|date|1018775|5|graph=true}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;code&amp;gt;{{((}}#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{{))}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we get:&lt;br /&gt;
&lt;br /&gt;
{{#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=3|legend=Legend|y1Title=Confirmed cases per 100.,000 inhabitants|title=COVID-19 cases in Asturias|xType=date}}&lt;br /&gt;
&lt;br /&gt;
== Various incidence proportions: &amp;lt;code&amp;gt;get_incidences&amp;lt;/code&amp;gt; ==&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
I.e.: The week average of the daily confirmed cases of flu per 10.000 inhabitants in [[Asturias]].&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
The possible parameters are:&lt;br /&gt;
*&amp;lt;code&amp;gt;src=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;first&amp;#039;&amp;#039;&amp;#039; param: The name of the Tabular file. These files are hosted on [[c:Main page|Wikimedia Commons]], inside the &amp;#039;&amp;#039;Data&amp;#039;&amp;#039; namespace (&amp;quot;&amp;#039;&amp;#039;Data&amp;#039;&amp;#039;:name of tabular file.tab&amp;quot;). The files in this section must end with the suffix (&amp;quot;Data: name of tabular file&amp;#039;&amp;#039;.tab&amp;#039;&amp;#039;&amp;quot;). I.e. The file itself, &amp;quot;&amp;lt;code&amp;gt;[[c:Data:COVID-19 cases in Asturias.tab|COVID-19 cases in Asturias.tab]]&amp;lt;/code&amp;gt;&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;column_names=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;second&amp;#039;&amp;#039;&amp;#039; param: The name of all the columns where the data of the events are stored. Each name should be separated by a comma (&amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt;). I.e. The column with the total confirmed cases of COVID-19 in Asturias, and the column with the total recovered people, called &amp;quot;&amp;lt;code&amp;gt;total_cases&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;total_recovered&amp;lt;/code&amp;gt;&amp;quot; respectively.&lt;br /&gt;
*&amp;lt;code&amp;gt;date_name=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;third&amp;#039;&amp;#039;&amp;#039; 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 (computer science)|String]] format YYYY-MM-DD), called &amp;quot;&amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
*&amp;lt;code&amp;gt;inhabitants=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;fourth&amp;#039;&amp;#039;&amp;#039; param: The population size of the given region. I.e. 1,018,775 (&amp;lt;code&amp;gt;1018775&amp;lt;/code&amp;gt;) total inhabitants living in Asturias, according to the [[Instituto Nacional de Estadística (Spain)|INE]] as a temporarly data for January 1st, 2020.&lt;br /&gt;
*&amp;lt;code&amp;gt;nth=&amp;lt;/code&amp;gt; or the &amp;#039;&amp;#039;&amp;#039;fifth&amp;#039;&amp;#039;&amp;#039; param: The power of 10 for the generated output (the power of ten to the n&amp;#039;&amp;#039;th&amp;#039;&amp;#039;, 10&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt;). 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 10&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; inhabitants (100,000).&lt;br /&gt;
*&amp;lt;code&amp;gt;avgs=&amp;lt;/code&amp;gt; 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 &amp;lt;code&amp;gt;column_names&amp;lt;/code&amp;gt; given, and they&amp;#039;re also given with a &amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt; beetween each element. I.e. Calculate the average for two days and three days: &amp;lt;code&amp;gt;2,3&amp;lt;/code&amp;gt;.&lt;br /&gt;
*&amp;lt;code&amp;gt;graph=&amp;lt;/code&amp;gt; param: A [[Boolean]] (true or false) specifiying if a graph should be generated as an output. &amp;#039;&amp;#039;&amp;#039;Default is false&amp;#039;&amp;#039;&amp;#039;. I.e. &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; (showing a graph as an output).&lt;br /&gt;
*&amp;lt;code&amp;gt;ltable=&amp;lt;/code&amp;gt; param: A [[Boolean]] (true or false) specifiying if the [[Lua]] variable should be generated as an output. &amp;#039;&amp;#039;&amp;#039;Default is false&amp;#039;&amp;#039;&amp;#039;. I.e. &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; (no returning the variable itself). This is a extrange value to be requested. &lt;br /&gt;
*&amp;lt;code&amp;gt;wtable=&amp;lt;/code&amp;gt; param: A [[Boolean]] (true or false) specifiying if a Wikitable table should be generated as an output. &amp;#039;&amp;#039;&amp;#039;Default is false&amp;#039;&amp;#039;&amp;#039;. I.e. &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; (no returning a wikitable). This options is still &amp;#039;&amp;#039;&amp;#039;NOT AVAILABLE&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Note 2: If &amp;lt;code&amp;gt;graph=true&amp;lt;/code&amp;gt; is requested, all parameters available at the [[Module:Graph]] can be given. They will be passed to this moduled without any kind of modification.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As a recap, the snippet to include will look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;{{((}}#invoke:{{BASEPAGENAME}}|&amp;#039;&amp;#039;&amp;#039;get_incidences&amp;#039;&amp;#039;&amp;#039;|&amp;#039;&amp;#039;src&amp;#039;&amp;#039;|&amp;#039;&amp;#039;colum_names&amp;#039;&amp;#039;|&amp;#039;&amp;#039;date_name&amp;#039;&amp;#039;|&amp;#039;&amp;#039;inhabitants&amp;#039;&amp;#039;|&amp;#039;&amp;#039;nth&amp;#039;&amp;#039;|&amp;#039;&amp;#039;avgs&amp;#039;&amp;#039;|graph=&amp;#039;&amp;#039;true&amp;#039;&amp;#039;{{))}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
Let&amp;#039;s say we want a graph of the [[c:Data:COVID-19 cases in Asturias.tab|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 &amp;quot;total_cases&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
In this case, we will type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;{{((}}#invoke:{{BASEPAGENAME}}|get_incidences|COVID-19 cases in Asturias.tab|total_cases,total_recovered|date|1018775|5|avgs=2,7|graph=true{{))}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will output:&lt;br /&gt;
&lt;br /&gt;
{{#invoke:{{BASEPAGENAME}}|get_incidences|COVID-19 cases in Asturias.tab|total_cases,total_recovered|date|1018775|5|avgs=2,7|graph=true}}&lt;/div&gt;</summary>
		<author><name>imported&gt;Ajuanca</name></author>
	</entry>
</feed>