******************************************************************************* Application Stats ******************************************************************************* The stats application contains the actions to generate generate an automatic report. Templates =============================================================================== The stats application contains 8 template : - :code:`variant.html` : stat page where the evolution of the variants is represented in 3 graphs - :code:`stats_VolumetryGraph.html` : stat page where the volumery of EMERGEN-DB id represented in a sankey graph - :code:`stats_sampling.html` : stat page where a calender that reprsents how many samplings are collected each day - :code:`stats_public.html` : stat page of the public statistics - :code:`stats_dashboard_labo.html` : stat page where the automatic report for the laboratory dashbaord is returned - :code:`stats_dashboard_activities.html` : stat page where the automatic report for the general dashboard is returned - :code:`flash.html` : stat page that allows the user to filter results via the the flash - :code:`error.html` : an error page Key files of the "stats" application =============================================================================== management.commands ------------------------------------------------------------------------------- load_region.py ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: apps.stats.management.commands.load_region :members: load_departement.py ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: apps.stats.management.commands.load_departement :members: admin.py ------------------------------------------------------------------------------- .. automodule:: apps.stats.admin :members: models.py ------------------------------------------------------------------------------- .. automodule:: apps.stats.models :members: test.py ------------------------------------------------------------------------------- .. automodule:: apps.stats.tests :members: url.py ------------------------------------------------------------------------------- The :code:`urls.py` file contains : .. automodule:: apps.stats.urls :members: view.py ------------------------------------------------------------------------------- .. automodule:: apps.stats.views :members: Create =============================================================================== Table ------------------------------------------------------------------------------- We use the datable web library to display the tables. In view.py ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ To use the Datatable library in an automated way, the function sends, for each table, 3 elements : - A list of lists. Each sub-list corresponds to a row of the table with the name of the row in the first position. By convention, this element is called tabX where X is the table number - A list of column names. By convention, this element is called tabX_column_loc where X is the table number - A list of column numbers. By convention, this element is called tabX_column_num where X is the number of the table The code contains several tables that can help you in adding new tables. In template/stats/stats.html ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **1- Add a div in the body at the desired position** .. code-block:: HTML {% for l in tabX_column_loc %} {% endfor %}
{{ l }}
**2- Add at the end of the body with the other scripts a new JS script like the following example** .. code-block:: HTML Charts ------------------------------------------------------------------------------- We use two libraries : - `Echarts `_ - `ChartJS `_ The codes :code:`view.py` and :code:`template/stats/stats.html` contain several examples that can help you in adding new charts. Map ------------------------------------------------------------------------------- To create map, we use `Leaflet `. The codes :code:`view.py` and :code:`template/stats/stats.html` contain several examples that can help you to custom map and format data.