diff --git a/counting_osm_objects/loop_thematics_history_in_zone_to_counts.py b/counting_osm_objects/loop_thematics_history_in_zone_to_counts.py
index 1e85e6d3..5f117745 100644
--- a/counting_osm_objects/loop_thematics_history_in_zone_to_counts.py
+++ b/counting_osm_objects/loop_thematics_history_in_zone_to_counts.py
@@ -81,7 +81,7 @@ THEMES = {
},
"advertising_board": {
"tag_filter": "advertising=board and message=political",
- "important_tags": ["operator", "content"],
+ "important_tags": ["operator", ],
},
"building": {
"tag_filter": "building",
diff --git a/src/Service/FollowUpService.php b/src/Service/FollowUpService.php
index cf94a509..30fa02cb 100644
--- a/src/Service/FollowUpService.php
+++ b/src/Service/FollowUpService.php
@@ -2,8 +2,8 @@
namespace App\Service;
-use App\Entity\Stats;
use App\Entity\CityFollowUp;
+use App\Entity\Stats;
use Doctrine\ORM\EntityManagerInterface;
class FollowUpService
@@ -38,7 +38,7 @@ class FollowUpService
} elseif ($type === 'police') {
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'police') ?? [];
} elseif ($type === 'healthcare') {
- $objects = array_filter($elements, function($el) {
+ $objects = array_filter($elements, function ($el) {
return isset($el['tags']['healthcare'])
|| ($el['tags']['amenity'] ?? null) === 'doctors'
|| ($el['tags']['amenity'] ?? null) === 'pharmacy'
@@ -74,7 +74,7 @@ class FollowUpService
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'public_bookcase') ?? [];
} elseif ($type === 'playground') {
$objects = array_filter($elements, fn($el) => ($el['tags']['leisure'] ?? null) === 'playground') ?? [];
- }elseif ($type === 'restaurant') {
+ } elseif ($type === 'restaurant') {
$objects = array_filter($elements, fn($el) => ($el['tags']['amenity'] ?? null) === 'restaurant') ?? [];
} else {
$objects = [];
@@ -133,8 +133,7 @@ class FollowUpService
$completed[] = $el;
}
}
- }
- // ... fallback pour les types sans tags attendus
+ } // ... fallback pour les types sans tags attendus
else {
$completed = [];
$partialCompletions = array_fill(0, count($data['objects']), 0);
@@ -377,11 +376,11 @@ class FollowUpService
$now = new \DateTime();
$refDate = clone $now;
$refDate->modify('-7 days');
-
+
// Récupérer toutes les mesures pour ce type
$countData = [];
$completionData = [];
-
+
foreach ($followups as $fu) {
if ($fu->getName() === $type . '_count') {
$countData[] = [
@@ -396,20 +395,20 @@ class FollowUpService
];
}
}
-
+
// Trier par date
usort($countData, fn($a, $b) => $a['date'] <=> $b['date']);
usort($completionData, fn($a, $b) => $a['date'] <=> $b['date']);
-
+
$countDelta = self::calculateDelta($countData, $refDate);
$completionDelta = self::calculateDelta($completionData, $refDate);
-
+
return [
'count' => $countDelta,
'completion' => $completionDelta
];
}
-
+
/**
* Calcule le delta pour une série de données
*/
@@ -418,9 +417,9 @@ class FollowUpService
if (empty($data)) {
return null;
}
-
+
$last = end($data)['value'];
-
+
// Chercher la mesure exacte à la date de référence
$exactRef = null;
foreach (array_reverse($data) as $point) {
@@ -429,18 +428,18 @@ class FollowUpService
break;
}
}
-
+
// Si on a trouvé une mesure exacte, l'utiliser
if ($exactRef !== null) {
return $last - $exactRef;
}
-
+
// Sinon, chercher les deux mesures les plus proches pour faire une interpolation
$beforeRef = null;
$afterRef = null;
$beforeDate = null;
$afterDate = null;
-
+
// Chercher la mesure juste avant la date de référence
foreach (array_reverse($data) as $point) {
if ($point['date'] < $refDate) {
@@ -449,7 +448,7 @@ class FollowUpService
break;
}
}
-
+
// Chercher la mesure juste après la date de référence
foreach ($data as $point) {
if ($point['date'] > $refDate) {
@@ -458,7 +457,7 @@ class FollowUpService
break;
}
}
-
+
// Si on a les deux mesures, faire une interpolation linéaire
if ($beforeRef !== null && $afterRef !== null && $beforeDate !== null && $afterDate !== null) {
$timeDiff = $afterDate->getTimestamp() - $beforeDate->getTimestamp();
@@ -467,17 +466,17 @@ class FollowUpService
$interpolatedRef = $beforeRef + ($afterRef - $beforeRef) * $ratio;
return $last - $interpolatedRef;
}
-
+
// Si on n'a qu'une mesure avant, l'utiliser
if ($beforeRef !== null) {
return $last - $beforeRef;
}
-
+
// Si on n'a qu'une mesure après, l'utiliser
if ($afterRef !== null) {
return $last - $afterRef;
}
-
+
// Si aucune mesure n'est disponible, retourner null
return null;
}
@@ -501,7 +500,7 @@ class FollowUpService
'police' => ['phone', 'website'],
'healthcare' => ['name', 'contact:phone', 'phone', 'email', 'contact:email'],
'bicycle_parking' => ['capacity', 'covered'],
- 'advertising_board' => ['operator', 'contact:phone'],
+ 'advertising_board' => ['operator'],
'building' => ['building'],
'rnb' => ['building', 'ref:FR:RNB'],
'email' => ['name', 'phone'],
diff --git a/templates/admin/followup_theme_graph.html.twig b/templates/admin/followup_theme_graph.html.twig
index 5e782bc6..42b9d05f 100644
--- a/templates/admin/followup_theme_graph.html.twig
+++ b/templates/admin/followup_theme_graph.html.twig
@@ -7,6 +7,10 @@