Initial commit

This commit is contained in:
Claude Paroz 2024-06-03 16:49:01 +02:00
commit 793bb6a488
182 changed files with 17153 additions and 0 deletions

View file

@ -0,0 +1,11 @@
<div class="row border-bottom mb-3">
<div class="col">
<form method="get">
{{ date_form.non_field_errors }}
<p class="lead">
Statistiques du 1<sup>er</sup> {{ date_form.start_month }} {{ date_form.start_year }} à fin {{ date_form.end_month }} {{ date_form.end_year }}
<button type="submit" class="btn btn-sm btn-outline-primary">Mettre à jour</button>
</p>
</form>
</div>
</div>

View file

@ -0,0 +1,41 @@
<ul class="nav nav-tabs nav-statistiques">
{# active is defined in include tag #}
<li class="nav-item">
<a class="nav-link {% if active == 'general' %}active{% endif %}"
href="{% url 'stats' %}?{% param_replace %}">Familles et enfants</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'localite' %}active{% endif %}"
href="{% url 'stats-localite' %}?{% param_replace %}">Par localité</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'region' %}active{% endif %}"
href="{% url 'stats-region' %}?{% param_replace %}">Par région</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'duree' %}active{% endif %}"
href="{% url 'stats-duree' %}?{% param_replace %}">Par durée</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'age' %}active{% endif %}"
href="{% url 'stats-age' %}?{% param_replace %}">Par âge</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'motifs' %}active{% endif %}"
href="{% url 'stats-motifs' %}?{% param_replace %}">Motifs, proven. et destin.</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'prestations' %}active{% endif %}"
href="{% url 'stats-prestations' %}">Prestations</a>
</li>
<li class="nav-item">
<a class="nav-link {% if active == 'niveau' %}active{% endif %}"
href="{% url 'stats-niveaux' %}?{% param_replace %}">Niveaux</a>
</li>
{% if perms.aemo.export_stats %}
<li class="nav-item">
<a class="nav-link {% if active == 'export' %}active{% endif %}"
href="{% url 'export-prestation' %}">Exportations</a>
</li>
{% endif %}
</ul>

View file

@ -0,0 +1,98 @@
{% extends "base.html" %}
{% block title %}Statistiques{% endblock %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="general" %}
<div class="row">
<div class="col">
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th></th>{% for month in months %}<th>{{ month }}</th>{% endfor %}<th>Total</th></tr>
</thead>
<tbody>
<tr>
<td colspan="{{ months|length|add:2 }}" class="app_line">
<h3>Familles</h3>
<small><em>{{ familles.total_familles }} familles prise en compte sur la période choisie</em></small>
</td>
</tr>
<tr>
<td>Total familles (évaluation et/ou accomp.)</td>
{% for month in months %}<td class="num">{{ familles.familles_total|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.familles_total.total }}</td>
</tr>
<tr>
<td>Total enfants suivis (évaluation et/ou accomp.)</td>
{% for month in months %}<td class="num">{{ familles.enfants_total|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.enfants_total.total }}</td>
</tr>
<tr>
<td>Familles évaluées</td>
{% for month in months %}<td class="num">{{ familles.familles_evaluees|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.familles_evaluees.total }}</td>
</tr>
<tr>
<td>Enfants évalués</td>
{% for month in months %}<td class="num">{{ familles.enfants_evalues|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.enfants_evalues.total }}</td>
</tr>
<tr>
<td>Enfants non suivis de familles évaluées</td>
{% for month in months %}<td class="num">{{ familles.enfants_evalues_non_suivis|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.enfants_evalues_non_suivis.total }}</td>
</tr>
<tr>
<td>Familles évaluées sans aboutir à un suivi</td>
{% for month in months %}<td class="num">{{ familles.familles_eval_sans_suivi|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.familles_eval_sans_suivi.total }}</td>
</tr>
<tr>
<td>Familles suivies</td>
{% for month in months %}<td class="num">{{ familles.familles_suivies|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.familles_suivies.total }}</td>
</tr>
<tr>
<td>Enfants suivis</td>
{% for month in months %}<td class="num">{{ familles.enfants_suivis|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.enfants_suivis.total }}</td>
</tr>
<tr>
<td>Enfants non suivis de familles suivies</td>
{% for month in months %}<td class="num">{{ familles.enfants_suivis_non_suivis|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.enfants_suivis_non_suivis.total }}</td>
</tr>
<tr>
<td>dont Familles daccueil</td>
{% for month in months %}<td class="num">{{ familles.familles_accueil|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.familles_accueil.total }}</td>
</tr>
<tr>
<td>dont Familles déjà suivies</td>
{% for month in months %}<td class="num">{{ familles.familles_connues|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.familles_connues.total }}</td>
</tr>
<tr>
<td>Demandes prioritaires</td>
{% for month in months %}<td class="num">{{ familles.prioritaires|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.prioritaires.total }}</td>
</tr>
<tr>
<td>Rendez-vous manqués</td>
{% for month in months %}<td class="num">{{ familles.rdv_manques|get_item:month }}</td>{% endfor %}
<td class="num">{{ familles.rdv_manques.total }}</td>
</tr>
<tr>
<td colspan="{{ months|length|add:1 }}">Durée moyenne entre demande et début de suivi</td>
<td class="num">{{ familles.duree_attente.moyenne.days }} jours</td>
</tr>
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,43 @@
{% extends "base.html" %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="age" %}
<div class="row">
<div class="col">
<p class="fw-bold mt-3">
Répartition des enfants suivis (dès demande jusqu'à la fin daccompagnement) par âge. Lâge est calculé à la date médiane entre la demande et la fin du suivi.
</p>
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th class="left">Âge</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td colspan="{{ months|length|add:3 }}" style="background-color: #eee;">
<h3>Âges</h3>
</td></tr>
{% for age, stats in ages.items %}
<tr>
<td>{{ age }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
<tr>
<td>Âge moyen</td>
{% for month in months %}<td class="num">{{ means|get_item:month }}</td>{% endfor %}
<td class="num">{{ means.total }}</td>
</tr>
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="duree" %}
<div class="row">
<div class="col">
<p class="fw-bold mt-3">
Répartition des suivis par durée daccompagnement. Les suivis pris en compte sont ceux dont la date de fin de suivi se situe entre les bornes temporelles sélectionnées.
</p>
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th class="left">Durée</th>
<th>Nb de suivis</th>
</tr>
</thead>
<tbody>
{% for slice in slices %}
<tr>
<td>{{ slice.label }}</td>
<td class="num">{{ durees|get_item:slice.label }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,45 @@
{% extends "base.html" %}
{% block extrastyle %}
<style>
.stat_table tr.first td { border-top: 1px solid #999; }
</style>
{% endblock %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="interv" %}
<div class="row">
<div class="col">
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th class="left">Intervenant-e</th><th></th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td colspan="{{ months|length|add:3 }}" class="app_line">
<h3>AEMO</h3>
</td></tr>
{% for interv, counters in intervs.items %}
<tr class="first">
<td>{{ interv.nom_prenom }}</td><td><small>Familles</small></td>
{% for month in months %}<td class="num">{{ counters.num_familles|get_item:month }}</td>{% endfor %}
<td class="num">{{ counters.num_familles.total }}</td>
</tr>
<tr>
<td></td><td><small>Enfants</small></td>
{% for month in months %}<td class="num">{{ counters.num_enfants|get_item:month }}</td>{% endfor %}
<td class="num">{{ counters.num_enfants.total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,45 @@
{% extends "base.html" %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="localite" %}
<div class="row">
<div class="col">
<p class="fw-bold mt-3">
Nombre denfants suivis (dès demande jusqu'à la fin daccompagnement) par localité.
</p>
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th class="left">Localité</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td colspan="{{ months|length|add:3 }}" style="background-color: #eee;">
<h3>Localités</h3>
</td></tr>
{% for localite, stats in localites.items %}
{% if localite != 'totals' %}
<tr>
<td>{{ localite }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endif %}
{% endfor %}
<tr>
<td>Totaux</td>
{% for month in months %}<td class="num">{{ localites.totals|get_item:month }}</td>{% endfor %}
<td class="num">{{ localites.totals.totals }}</td>
</tr>
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,120 @@
{% extends "base.html" %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="motifs" %}
<div class="row">
<div class="col">
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th class="left">Motif dannonce</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% for motif, stats in data.ann.items %}
<tr>
<td>{{ motif }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
</tbody>
<thead>
<tr><th class="left">Service annonceur</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% for service, stats in data.orient.items %}
<tr>
<td>{{ service }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
</tbody>
<thead>
<tr><th class="left">Motif de fin dévaluation ou daccompagnement</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
<tr class="subdiv2"><td>Abandon avant évaluation</td></tr>
{% for motif, stats in data.fin_preeval.items %}
<tr>
<td>{{ motif }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
<tr class="subdiv2"><td>Abandon après évaluation</td></tr>
{% for motif, stats in data.fin_posteval.items %}
<tr>
<td>{{ motif }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
<tr class="subdiv2"><td>Fin de l'accompagnement</td></tr>
{% for motif, stats in data.fin_postacc.items %}
<tr>
<td>{{ motif }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
<tr class="subdiv2"><td>Total</td></tr>
{% for motif, stats in data.fin_total.items %}
<tr>
<td>{{ motif }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
</tbody>
<thead>
<tr><th class="left">Provenance</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% for prov, stats in data.prov.items %}
<tr>
<td>{{ prov }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
</tbody>
<thead>
<tr><th class="left">Destination</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% for dest, stats in data.dest.items %}
<tr>
<td>{{ dest }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="niveau" %}
<div class="row">
<div class="col">
<table class="table table-sm stat_table table-hover mt-4">
<thead>
<tr class="app_line">
<th class="text-start h4 pt-3">Ressources par niveau</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% for niveau, prest_list in stats.items %}
<tr>
<td colspan="3" class="fw-bold bg-light">Niveau {{ niveau }}</td><td></td>
</tr>
{% for prest, prest_data in prest_list.items %}
<tr>
<td class="ps-5">{{ prest_map|get_item:prest }}</td>
{% for month in months %}<td class="num">{{ prest_data|get_item:month|format_duree }}</td>{% endfor %}
<td class="num">{{ prest_data|get_item:'total'|format_duree }}</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,78 @@
{% extends "base.html" %}
{% block content %}
<div class="row border-bottom mb-3">
<div class="col">
<form method="get">
{{ date_form.non_field_errors }}
<p class="lead">
Statistiques de l'année {{ date_form.year }}
<button type="submit" class="btn btn-sm btn-outline-primary">Mettre à jour</button>
</p>
</form>
</div>
</div>
{% include "statistiques/stat-tabs.html" with active="prestations" %}
<div class="row">
<div class="col">
<table class="table table-sm stat_table">
<thead>
<tr>
<th></th>
{% for month in months %}
<th class="month">{{ month|date:"N" }}</th>
{% endfor %}
<th class="total num">Total</th>
</tr>
</thead>
<tbody>
<tr><td colspan="15" class="app_line">
<h3>Intervenant·e·s {{ unite|upper }}</h3><small>Heures prestées</small></td>
</tr>
{% for user, detail in intervenants.items %}
<tr>
<td class="m-0 p-1">{{ user|nom_prenom_abreg }}</td>
{% for h in detail.heures_prestees %}
<td class="m-0 p-1 num">{{ h|format_duree|default_if_zero }}</td>
{% endfor %}
<td class="m-0 p-1 num">{{ detail.tot_prestees|format_duree }}</td>
</tr>
{% endfor %}
</tbody>
<!-- Résumé par type de prestation -->
<thead class="table-light">
<tr>
<th></th>
{% for month in months %}
<th class="month">{{ month|date:"N" }}</th>
{% endfor %}
<th class="total">Total</th>
</tr>
</thead>
<tbody>
{% for libelle in libelles_prest %}
<tr {% if forloop.first %}class="first"{% endif %}>
<td class="m-0 p-1">{{ libelle.nom }}</td>
{% for month, data in totaux_prest_mensuels.items %}
<td class="m-0 p-1 num">{% if month.is_future %}-{% else %}{{ data|get_item:libelle.nom|format_duree }}{% endif %}</td>
{% endfor %}
<td class="m-0 p-1 num">{{ totaux_par_prest|get_item:libelle.nom|format_duree }}</td>
</tr>
{% endfor %}
<tr class="first">
<td class="m-0 p-1">Totaux</td>
{% for month, data in totaux_prest_mensuels.items %}
<td class="m-0 p-1 num">{{ data.total|format_duree }}</td>
{% endfor %}
<td class="m-0 p-1 num">{{ total_gen|format_duree }}</td>
</tr>
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,45 @@
{% extends "base.html" %}
{% block content %}
{% include "statistiques/stat-form.html" %}
{% include "statistiques/stat-tabs.html" with active="region" %}
<div class="row">
<div class="col">
<p class="fw-bold mt-3">
Nombre denfants suivis (dès demande jusqu'à la fin daccompagnement) par région.
</p>
<table class="table table-sm table-hover stat_table">
<thead>
<tr><th class="left">Région</th>
{% for month in months %}<th>{{ month }}</th>{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td colspan="{{ months|length|add:3 }}" style="background-color: #eee;">
<h3>Régions</h3>
</td></tr>
{% for region, stats in regions.items %}
{% if region != 'totals' %}
<tr>
<td>{{ region }}</td>
{% for month in months %}<td class="num">{{ stats|get_item:month }}</td>{% endfor %}
<td class="num">{{ stats.total }}</td>
</tr>
{% endif %}
{% endfor %}
<tr>
<td>Totaux</td>
{% for month in months %}<td class="num">{{ regions.totals|get_item:month }}</td>{% endfor %}
<td class="num">{{ regions.totals.total }}</td>
</tr>
</tbody>
</table>
<div class="text-end">
<a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
</div>
</div>
</div>
{% endblock %}