from django.db import models from django.conf import settings class PotholeDetection(models.Model): uploaded_image = models.ImageField(upload_to='road_detection/uploads/') result_image = models.ImageField(upload_to='road_detection/results/', blank=True, null=True) detection_count = models.IntegerField(default=0) confidence_threshold = models.FloatField(default=0.25) created_at = models.DateTimeField(auto_now_add=True) created_by = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True, ) notes = models.TextField(blank=True) # GPS de la photo source (extrait de l'EXIF) image_lat = models.FloatField(null=True, blank=True) image_lon = models.FloatField(null=True, blank=True) # Détail des détections individuelles avec coordonnées GPS estimées detections_data = models.JSONField(null=True, blank=True) class Meta: ordering = ['-created_at'] verbose_name = 'Pothole Detection' verbose_name_plural = 'Pothole Detections' def __str__(self): return f"Detection #{self.pk} - {self.detection_count} pothole(s) - {self.created_at:%Y-%m-%d %H:%M}"