enrich exports lat et lon
This commit is contained in:
parent
46d3b21cf6
commit
b5b2880637
6 changed files with 606 additions and 53 deletions
115
templates/admin/import_stats.html.twig
Normal file
115
templates/admin/import_stats.html.twig
Normal file
|
@ -0,0 +1,115 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Import d'objets Stats{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h1><i class="bi bi-upload"></i> Import d'objets Stats</h1>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info">
|
||||
<h5><i class="bi bi-info-circle"></i> Instructions</h5>
|
||||
<p>Cette page permet d'importer des objets Stats à partir d'un fichier JSON.</p>
|
||||
<ul>
|
||||
<li>Seuls les objets Stats qui n'existent pas encore seront créés</li>
|
||||
<li>Les objets existants (même code INSEE) seront ignorés</li>
|
||||
<li>Le fichier JSON doit contenir un tableau d'objets avec les champs requis</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="mb-3">
|
||||
<label for="json_file" class="form-label">Fichier JSON</label>
|
||||
<input type="file"
|
||||
class="form-control"
|
||||
id="json_file"
|
||||
name="json_file"
|
||||
accept=".json,application/json"
|
||||
required>
|
||||
<div class="form-text">
|
||||
Sélectionnez un fichier JSON contenant un tableau d'objets Stats.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-upload"></i> Importer
|
||||
</button>
|
||||
<a href="{{ path('app_admin') }}" class="btn btn-secondary">
|
||||
<i class="bi bi-arrow-left"></i> Retour
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<h5><i class="bi bi-file-text"></i> Format attendu</h5>
|
||||
<p>Le fichier JSON doit contenir un tableau d'objets avec la structure suivante :</p>
|
||||
|
||||
<div class="bg-light p-3 rounded">
|
||||
<pre><code>[
|
||||
{
|
||||
"zone": "75056",
|
||||
"name": "Paris",
|
||||
"population": 2161000,
|
||||
"budgetAnnuel": "8500000000",
|
||||
"siren": 200054781,
|
||||
"codeEpci": 200054781,
|
||||
"codesPostaux": "75001;75002;75003",
|
||||
"decomptes": {
|
||||
"placesCount": 1250,
|
||||
"avecHoraires": 980,
|
||||
"avecAdresse": 1200,
|
||||
"avecSite": 850,
|
||||
"avecAccessibilite": 450,
|
||||
"avecNote": 320,
|
||||
"completionPercent": 75
|
||||
}
|
||||
}
|
||||
]</code></pre>
|
||||
</div>
|
||||
|
||||
<h6 class="mt-3">Champs requis :</h6>
|
||||
<ul>
|
||||
<li><strong>zone</strong> : Code INSEE de la zone</li>
|
||||
<li><strong>name</strong> : Nom de la ville/zone</li>
|
||||
</ul>
|
||||
|
||||
<h6>Champs optionnels :</h6>
|
||||
<ul>
|
||||
<li><strong>population</strong> : Population de la zone</li>
|
||||
<li><strong>budgetAnnuel</strong> : Budget annuel de la collectivité</li>
|
||||
<li><strong>siren</strong> : Code SIREN</li>
|
||||
<li><strong>codeEpci</strong> : Code EPCI</li>
|
||||
<li><strong>codesPostaux</strong> : Codes postaux (séparés par des points-virgules)</li>
|
||||
<li><strong>decomptes</strong> : Objet contenant les statistiques
|
||||
<ul>
|
||||
<li>placesCount : Nombre de lieux</li>
|
||||
<li>avecHoraires : Lieux avec horaires</li>
|
||||
<li>avecAdresse : Lieux avec adresse</li>
|
||||
<li>avecSite : Lieux avec site web</li>
|
||||
<li>avecAccessibilite : Lieux avec accessibilité</li>
|
||||
<li>avecNote : Lieux avec note</li>
|
||||
<li>completionPercent : Pourcentage de complétion</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="alert alert-warning mt-3">
|
||||
<h6><i class="bi bi-exclamation-triangle"></i> Important</h6>
|
||||
<ul class="mb-0">
|
||||
<li>Les objets Stats existants ne seront pas modifiés</li>
|
||||
<li>Seuls les nouveaux objets seront créés</li>
|
||||
<li>Assurez-vous que le fichier JSON est valide avant l'import</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -311,10 +311,16 @@
|
|||
<h1 class="card-title p-4">Tableau des {{ stats.places |length }} lieux</h1>
|
||||
</div>
|
||||
<div class="col-md-6 col-12">
|
||||
<a class="btn btn-primary pull-right mt-4" href="{{ path('app_admin_export_csv', {'insee_code': stats.zone}) }}" class="btn btn-primary">
|
||||
<i class="bi bi-filetype-csv"></i>
|
||||
Exporter en CSV
|
||||
</a>
|
||||
<div class="btn-group mt-4" role="group">
|
||||
<a href="{{ path('app_admin_export_overpass_csv', {'insee_code': stats.zone}) }}" class="btn btn-primary">
|
||||
<i class="bi bi-filetype-csv"></i>
|
||||
Export Overpass CSV
|
||||
</a>
|
||||
<a href="{{ path('app_admin_export_table_csv', {'insee_code': stats.zone}) }}" class="btn btn-success">
|
||||
<i class="bi bi-table"></i>
|
||||
Export Tableau CSV
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue