suivi des suppressions d'objets par ville

This commit is contained in:
Tykayn 2025-11-26 00:26:47 +01:00 committed by tykayn
parent 62e086cd64
commit 8e43908cef
13 changed files with 1185 additions and 2 deletions

View file

@ -60,6 +60,9 @@
<a class="nav-link {% if active_menu == 'stats_evolutions' %}active{% endif %}" href="{{ path('app_public_stats_evolutions', {'insee_code': stats.zone}) }}">
<i class="bi bi-activity"></i> Évolutions des objets
</a>
<a class="nav-link {% if active_menu == 'zone_places_history' %}active{% endif %}" href="{{ path('app_public_zone_places_history', {'insee_code': stats.zone}) }}">
<i class="bi bi-clock-history"></i> Historique ZonePlaces
</a>
<a class="nav-link {% if active_menu == 'street_completion' %}active{% endif %}" href="{{ path('admin_street_completion', {'insee_code': stats.zone}) }}">
<i class="bi bi-signpost"></i> Complétion des rues
</a>
@ -74,8 +77,8 @@
{# </a>#}
</nav>
<!-- Flux RSS -->
<div class="sidebar-heading">Flux RSS</div>
<!-- Flux RSS/Atom -->
<div class="sidebar-heading">Flux RSS/Atom</div>
<nav class="nav flex-column">
{# <a class="nav-link" href="{{ path('app_public_rss_city_demandes', {'insee_code': stats.zone}) }}" target="_blank">#}
{# <i class="bi bi-rss"></i> Demandes#}
@ -83,6 +86,12 @@
{# <a class="nav-link" href="{{ path('app_public_rss_city_themes', {'insee_code': stats.zone}) }}" target="_blank">#}
{# <i class="bi bi-rss"></i> Changements thématiques#}
{# </a>#}
<a class="nav-link" href="{{ path('app_public_atom_city_deletions', {'insee_code': stats.zone}) }}" target="_blank">
<i class="bi bi-trash"></i> Suppressions (Atom)
</a>
<a class="nav-link" href="{{ path('app_public_atom_city_creations', {'insee_code': stats.zone}) }}" target="_blank">
<i class="bi bi-plus-circle"></i> Créations (Atom)
</a>
</nav>
<!-- Actions -->

View file

@ -8,6 +8,12 @@
{% endblock %}
{% block body %}
<style>
table {
max-height: 600px;
overflow-y: auto;
}
</style>
<div class="container-fluid">
<div class="row">
<!-- Sidebar de navigation -->

View file

@ -281,6 +281,152 @@
{# </div> #}
</div>
{# Section des objets supprimés et statistiques #}
{% if has_zone_places is defined and has_zone_places %}
<div class="card mt-4 mb-4">
<div class="card-header">
<h4><i class="bi bi-info-circle"></i> Suivi des objets OSM</h4>
</div>
<div class="card-body">
{# Statistiques des objets actuels #}
{% if current_objects_stats is defined %}
<div class="mb-4">
<h5><i class="bi bi-list-ul"></i> Objets actuels suivis</h5>
<div class="row">
<div class="col-md-3">
<div class="card bg-light">
<div class="card-body text-center">
<div class="h3 mb-0">{{ current_objects_stats.node|default(0) }}</div>
<div class="text-muted">Nodes</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-light">
<div class="card-body text-center">
<div class="h3 mb-0">{{ current_objects_stats.way|default(0) }}</div>
<div class="text-muted">Ways</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-light">
<div class="card-body text-center">
<div class="h3 mb-0">{{ current_objects_stats.relation|default(0) }}</div>
<div class="text-muted">Relations</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-primary text-white">
<div class="card-body text-center">
<div class="h3 mb-0">{{ current_objects_stats.total|default(0) }}</div>
<div>Total</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{# Section des objets supprimés #}
<div class="mt-4">
<h5><i class="bi bi-trash"></i> Objets supprimés récemment</h5>
{% if disappeared_objects is defined and disappeared_objects|length > 0 %}
<p class="text-muted">Liste des objets OSM qui ont été supprimés, triés du plus récent au plus ancien.</p>
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead>
<tr>
<th>Type</th>
<th>ID</th>
<th>Créateur</th>
<th>Dernière modification</th>
<th>Changeset</th>
<th>Date de suppression détectée</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for obj in disappeared_objects %}
<tr>
<td><span class="badge bg-secondary">{{ obj.type|upper }}</span></td>
<td><code>{{ obj.id }}</code></td>
<td>{{ obj.user|default('Inconnu') }}</td>
<td>
{% if obj.timestamp %}
{% if obj.timestamp matches '/^\\d{4}-\\d{2}-\\d{2}/' %}
{{ obj.timestamp }}
{% else %}
{{ obj.timestamp|date('Y-m-d H:i:s') }}
{% endif %}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if obj.changeset %}
<a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}"
target="_blank"
title="Voir le changeset dans achavi"
class="text-decoration-none">
<code>{{ obj.changeset }}</code>
<i class="bi bi-box-arrow-up-right ms-1"></i>
</a>
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if obj.noticed_deleted_date %}
<span class="text-danger">{{ obj.noticed_deleted_date }}</span>
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
{% set josm_type = obj.type == 'node' ? 'n' : (obj.type == 'way' ? 'w' : 'r') %}
<a href="http://127.0.0.1:8111/load_object?objects={{ josm_type }}{{ obj.id }}"
class="btn btn-primary"
title="Ouvrir dans JOSM"
target="_blank">
<i class="bi bi-tools"></i> JOSM
</a>
<a href="https://osmlab.github.io/osm-deep-history/#/{{ obj.type }}/{{ obj.id }}"
class="btn btn-info"
title="Voir l'historique dans OSM Deep History"
target="_blank">
<i class="bi bi-clock-history"></i> Historique
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
<i class="bi bi-check-circle"></i> Aucune suppression d'objet n'a été détectée pour ce thème.
</div>
{% endif %}
</div>
</div>
</div>
{% else %}
<div class="card mt-4 mb-4">
<div class="card-header">
<h4><i class="bi bi-info-circle"></i> Suivi des objets OSM</h4>
</div>
<div class="card-body">
<div class="alert alert-warning">
<i class="bi bi-exclamation-triangle"></i> Le suivi des objets OSM n'a pas encore été initialisé pour ce thème.
Il sera créé lors de la prochaine mise à jour du followup.
</div>
</div>
</div>
{% endif %}
<div class="card mt-4 mb-4">
<div class="card-header">

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Créations d'objets OSM - {{ stats.name }}</title>
<link href="https://{{ base_url }}{{ path('app_public_atom_city_creations', {'insee_code': stats.zone}) }}" rel="self" />
<link href="https://{{ base_url }}{{ path('app_admin_stats', {'insee_code': stats.zone}) }}" />
<id>https://{{ base_url }}/atom/city/{{ stats.zone }}/creations</id>
<updated>{{ "now"|date("Y-m-d\\TH:i:s\\Z") }}</updated>
<author>
<name>OSM Commerces</name>
</author>
<subtitle>Flux Atom des créations/modifications récentes d'objets OSM pour {{ stats.name }} ({{ stats.zone }})</subtitle>
{% for date, themes in creationsByDate %}
{% for theme, objects in themes %}
{% set themeLabel = followup_labels[theme]|default(theme|capitalize) %}
{% for obj in objects %}
<entry>
<title>Création/Modification : {{ themeLabel }} - {{ obj.type|upper }} {{ obj.id }}</title>
<link href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}" />
<id>https://{{ base_url }}/atom/city/{{ stats.zone }}/creations/{{ date }}/{{ theme }}/{{ obj.type }}/{{ obj.id }}</id>
<updated>{% if obj.timestamp %}{{ obj.timestamp|replace({' ': 'T'}) }}Z{% else %}{{ "now"|date("Y-m-d\\TH:i:s\\Z") }}{% endif %}</updated>
<summary type="html">
<![CDATA[
<p><strong>Thème:</strong> {{ themeLabel }}</p>
<p><strong>Type:</strong> {{ obj.type|upper }}</p>
<p><strong>ID OSM:</strong> {{ obj.id }}</p>
{% if obj.user %}
<p><strong>Contributeur:</strong> {{ obj.user }}</p>
{% endif %}
{% if obj.timestamp %}
<p><strong>Date de modification:</strong> {{ obj.timestamp }}</p>
{% endif %}
{% if obj.changeset %}
<p><strong>Changeset:</strong> <a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}">{{ obj.changeset }}</a></p>
{% endif %}
]]>
</summary>
<content type="html">
<![CDATA[
<p><strong>Thème:</strong> {{ themeLabel }}</p>
<p><strong>Type:</strong> {{ obj.type|upper }}</p>
<p><strong>ID OSM:</strong> <a href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}">{{ obj.id }}</a></p>
{% if obj.user %}
<p><strong>Contributeur:</strong> <a href="https://www.openstreetmap.org/user/{{ obj.user|url_encode }}">{{ obj.user }}</a></p>
{% endif %}
{% if obj.timestamp %}
<p><strong>Date de modification:</strong> {{ obj.timestamp }}</p>
{% endif %}
{% if obj.changeset %}
<p><strong>Changeset:</strong> <a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}">{{ obj.changeset }}</a></p>
{% endif %}
<p>
<a href="https://osmlab.github.io/osm-deep-history/#/{{ obj.type }}/{{ obj.id }}">Historique OSM Deep History</a> |
{% if obj.changeset %}
<a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}">Voir dans achavi</a> |
{% endif %}
<a href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}">Voir sur OSM</a>
</p>
]]>
</content>
</entry>
{% endfor %}
{% endfor %}
{% endfor %}
</feed>

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Suppressions d'objets OSM - {{ stats.name }}</title>
<link href="https://{{ base_url }}{{ path('app_public_atom_city_deletions', {'insee_code': stats.zone}) }}" rel="self" />
<link href="https://{{ base_url }}{{ path('app_admin_stats', {'insee_code': stats.zone}) }}" />
<id>https://{{ base_url }}/atom/city/{{ stats.zone }}/deletions</id>
<updated>{{ "now"|date("Y-m-d\\TH:i:s\\Z") }}</updated>
<author>
<name>OSM Commerces</name>
</author>
<subtitle>Flux Atom des suppressions d'objets OSM pour {{ stats.name }} ({{ stats.zone }})</subtitle>
{% for date, themes in deletionsByDate %}
{% for theme, objects in themes %}
{% set themeLabel = followup_labels[theme]|default(theme|capitalize) %}
{% for obj in objects %}
<entry>
<title>Suppression : {{ themeLabel }} - {{ obj.type|upper }} {{ obj.id }}</title>
<link href="https://osmlab.github.io/osm-deep-history/#/{{ obj.type }}/{{ obj.id }}" />
<id>https://{{ base_url }}/atom/city/{{ stats.zone }}/deletions/{{ date }}/{{ theme }}/{{ obj.type }}/{{ obj.id }}</id>
<updated>{% if obj.noticed_deleted_date %}{{ obj.noticed_deleted_date|replace({' ': 'T', '/': '-'}) }}Z{% else %}{{ "now"|date("Y-m-d\\TH:i:s\\Z") }}{% endif %}</updated>
<summary type="html">
<![CDATA[
<p><strong>Thème:</strong> {{ themeLabel }}</p>
<p><strong>Type:</strong> {{ obj.type|upper }}</p>
<p><strong>ID OSM:</strong> {{ obj.id }}</p>
{% if obj.user %}
<p><strong>Dernier contributeur:</strong> {{ obj.user }}</p>
{% endif %}
{% if obj.timestamp %}
<p><strong>Dernière modification:</strong> {{ obj.timestamp }}</p>
{% endif %}
{% if obj.changeset %}
<p><strong>Changeset:</strong> <a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}">{{ obj.changeset }}</a></p>
{% endif %}
<p><strong>Date de suppression détectée:</strong> {{ obj.noticed_deleted_date }}</p>
]]>
</summary>
<content type="html">
<![CDATA[
<p><strong>Thème:</strong> {{ themeLabel }}</p>
<p><strong>Type:</strong> {{ obj.type|upper }}</p>
<p><strong>ID OSM:</strong> <a href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}">{{ obj.id }}</a></p>
{% if obj.user %}
<p><strong>Dernier contributeur:</strong> <a href="https://www.openstreetmap.org/user/{{ obj.user|url_encode }}">{{ obj.user }}</a></p>
{% endif %}
{% if obj.timestamp %}
<p><strong>Dernière modification:</strong> {{ obj.timestamp }}</p>
{% endif %}
{% if obj.changeset %}
<p><strong>Changeset:</strong> <a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}">{{ obj.changeset }}</a></p>
{% endif %}
<p><strong>Date de suppression détectée:</strong> {{ obj.noticed_deleted_date }}</p>
<p>
<a href="https://osmlab.github.io/osm-deep-history/#/{{ obj.type }}/{{ obj.id }}">Historique OSM Deep History</a> |
{% if obj.changeset %}
<a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}">Voir dans achavi</a> |
{% endif %}
<a href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}">Voir sur OSM</a>
</p>
]]>
</content>
</entry>
{% endfor %}
{% endfor %}
{% endfor %}
</feed>

View file

@ -0,0 +1,221 @@
{% extends 'base.html.twig' %}
{% block title %}Historique ZonePlaces - {{ stats.name }}{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link href='{{ asset('css/city-sidebar.css') }}' rel='stylesheet'/>
{% endblock %}
{% block body %}
<div class="container-fluid">
<div class="row">
<!-- Sidebar de navigation -->
<div class="col-12">
{% include 'admin/_city_sidebar.html.twig' with {'stats': stats, 'active_menu': 'zone_places_history'} %}
</div>
<!-- Contenu principal -->
<div class="col-md-9 col-lg-10 main-content">
<div class="p-4">
<h1>Historique ZonePlaces - {{ stats.name }} ({{ stats.zone }})</h1>
<p class="text-muted">Historique combiné des suppressions et créations d'objets OSM par thème, groupé par date.</p>
{% if changesByDate is empty %}
<div class="alert alert-info">
<i class="bi bi-info-circle"></i> Aucun changement enregistré pour cette ville.
</div>
{% else %}
{% for date, changes in changesByDate %}
<div class="card mb-4">
<div class="card-header">
<h3><i class="bi bi-calendar"></i> {{ date|date('d/m/Y') }}</h3>
</div>
<div class="card-body">
{# Suppressions #}
{% if changes.deletions is not empty %}
<div class="mb-4">
<h4 class="text-danger"><i class="bi bi-trash"></i> Suppressions</h4>
{% for theme, objects in changes.deletions %}
{% set themeLabel = followup_labels[theme]|default(theme|capitalize) %}
{% set themeIcon = followup_icons[theme]|default('bi-question-circle') %}
<div class="mb-3">
<h5><i class="bi {{ themeIcon }}"></i> {{ themeLabel }} ({{ objects|length }} suppression{{ objects|length > 1 ? 's' : '' }})</h5>
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead>
<tr>
<th>Thème</th>
<th>Type</th>
<th>ID</th>
<th>Contributeur</th>
<th>Dernière modification</th>
<th>Changeset</th>
<th>Date suppression</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for obj in objects %}
<tr>
<td><span class="badge bg-info">{{ themeLabel }}</span></td>
<td><span class="badge bg-secondary">{{ obj.type|upper }}</span></td>
<td><code>{{ obj.id }}</code></td>
<td>
{% if obj.user %}
<a href="https://www.openstreetmap.org/user/{{ obj.user|url_encode }}" target="_blank">
{{ obj.user }}
<i class="bi bi-box-arrow-up-right"></i>
</a>
{% else %}
<span class="text-muted">Inconnu</span>
{% endif %}
</td>
<td>
{% if obj.timestamp %}
{{ obj.timestamp }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if obj.changeset %}
<a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}" target="_blank">
<code>{{ obj.changeset }}</code>
<i class="bi bi-box-arrow-up-right"></i>
</a>
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td><span class="text-danger">{{ obj.noticed_deleted_date }}</span></td>
<td>
<div class="btn-group btn-group-sm" role="group">
{% set josm_type = obj.type == 'node' ? 'n' : (obj.type == 'way' ? 'w' : 'r') %}
<a href="http://127.0.0.1:8111/load_object?objects={{ josm_type }}{{ obj.id }}"
class="btn btn-primary btn-sm"
title="Ouvrir dans JOSM"
target="_blank">
<i class="bi bi-tools"></i> JOSM
</a>
<a href="https://osmlab.github.io/osm-deep-history/#/{{ obj.type }}/{{ obj.id }}"
class="btn btn-info btn-sm"
title="Voir l'historique dans OSM Deep History"
target="_blank">
<i class="bi bi-clock-history"></i> Historique
</a>
<a href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}"
class="btn btn-secondary btn-sm"
title="Voir sur OSM"
target="_blank">
<i class="bi bi-geo-alt"></i> OSM
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{# Créations #}
{% if changes.creations is not empty %}
<div>
<h4 class="text-success"><i class="bi bi-plus-circle"></i> Créations/Modifications</h4>
{% for theme, objects in changes.creations %}
{% set themeLabel = followup_labels[theme]|default(theme|capitalize) %}
{% set themeIcon = followup_icons[theme]|default('bi-question-circle') %}
<div class="mb-3">
<h5><i class="bi {{ themeIcon }}"></i> {{ themeLabel }} ({{ objects|length }} objet{{ objects|length > 1 ? 's' : '' }})</h5>
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead>
<tr>
<th>Thème</th>
<th>Type</th>
<th>ID</th>
<th>Contributeur</th>
<th>Date modification</th>
<th>Changeset</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for obj in objects %}
<tr>
<td><span class="badge bg-info">{{ theme }}</span></td>
<td><span class="badge bg-success">{{ obj.type|upper }}</span></td>
<td><code>{{ obj.id }}</code></td>
<td>
{% if obj.user %}
<a href="https://www.openstreetmap.org/user/{{ obj.user|url_encode }}" target="_blank">
{{ obj.user }}
<i class="bi bi-box-arrow-up-right"></i>
</a>
{% else %}
<span class="text-muted">Inconnu</span>
{% endif %}
</td>
<td>
{% if obj.timestamp %}
{{ obj.timestamp }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
{% if obj.changeset %}
<a href="https://overpass-api.de/achavi/?changeset={{ obj.changeset }}" target="_blank">
<code>{{ obj.changeset }}</code>
<i class="bi bi-box-arrow-up-right"></i>
</a>
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
{% set josm_type = obj.type == 'node' ? 'n' : (obj.type == 'way' ? 'w' : 'r') %}
<a href="http://127.0.0.1:8111/load_object?objects={{ josm_type }}{{ obj.id }}"
class="btn btn-primary btn-sm"
title="Ouvrir dans JOSM"
target="_blank">
<i class="bi bi-tools"></i> JOSM
</a>
<a href="https://osmlab.github.io/osm-deep-history/#/{{ obj.type }}/{{ obj.id }}"
class="btn btn-info btn-sm"
title="Voir l'historique dans OSM Deep History"
target="_blank">
<i class="bi bi-clock-history"></i> Historique
</a>
<a href="https://www.openstreetmap.org/{{ obj.type }}/{{ obj.id }}"
class="btn btn-secondary btn-sm"
title="Voir sur OSM"
target="_blank">
<i class="bi bi-geo-alt"></i> OSM
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}