diff --git a/BURST_EVENTS.md b/BURST_EVENTS.md new file mode 100644 index 0000000..d6116ca --- /dev/null +++ b/BURST_EVENTS.md @@ -0,0 +1,11 @@ +# Burst Events + +A report with at least three `occurrences` is a Burst Event. `event_kind`, `is_burst`, `bangs_per_15_minutes`, and `burst_intensity` are derived properties on both PendingEvent and Event; they are never stored separately. One or two occurrences are ordinary reports. + +`captured_at` is the reported occurrence time for a manual report. PendingEvent `created_at` is its actual submission time; approval copies that value into Event `submitted_at`, while Event `approved_at` remains the approval time. Older Events have an unknown `submitted_at` because their original submission time cannot be reconstructed. `occurrence_time_approximate` records uncertainty about the reported time. No individual bang times are inferred from an aggregate report. + +`observation_duration_minutes` holds a window only when the reporter explicitly accepts an estimate, or when a future source provides a measured window. `observation_duration_kind` distinguishes `estimated` from `measured`; a blank kind or duration means intensity is unavailable. The quick form suggests 15 minutes and asks the reporter to accept that estimate. Existing records migrate with an unknown duration, preserving their counts without inventing an intensity. + +The normalised rate is `occurrences × 15 / observation_duration_minutes`. Provisional presentation bands live in `fireworks_detect/bursts.py`: light below 5, moderate from 5 to below 10, intense from 10 per 15 minutes. This describes **frequency, not loudness**. The map event JSON exposes the count, event kind, duration, duration kind, rate, intensity, and approximate-time flag for future timeline work. No timeline is rendered in this pass. + +Quick reports remain Pending until moderated. The browser can enhance the form, while the POST endpoint also accepts an ordinary server-rendered form submission with no microphone, classifier, or JavaScript. A reporter can correct the count and estimated duration before moderation through a session-scoped receipt form; each correction creates a ManualReportRevision. Corrections do not change the original occurrence or submission time. diff --git a/SENSOR_FIRMWARE_VALIDATION.md b/SENSOR_FIRMWARE_VALIDATION.md index afe28d8..76775b4 100644 --- a/SENSOR_FIRMWARE_VALIDATION.md +++ b/SENSOR_FIRMWARE_VALIDATION.md @@ -1,24 +1,32 @@ -# Waveshare firmware validation — concept archive +# Waveshare V2 firmware integration status -Reviewed `BoomCast_Waveshare_Arduino_v0.1.0-concept.zip` as supplied. The README targets the non-touch ESP32-S3-ePaper-1.54 **V2**, but the physical board revision has not been inspected. Waveshare states that V1 and V2 example programs are not interchangeable. Confirm the V2 marking on the PCB before flashing. The official V2 has 8 MiB PSRAM, 8 MiB flash, ES8311 codec, microphone, and microSD slot. The firmware's SDMMC pins 39/40/41 match Waveshare's published pinout for this board. +The owner has confirmed a non-touch Waveshare ESP32-S3-ePaper-1.54 V2 board. The firmware now lives at `../arduino/BoomCast_Waveshare_Arduino/`; that folder is currently **outside** the Django Git worktree (`django/`). Its sketch, build guide, source, pinned preparation script, local-config example, ignore rules, and hardware/API/checklist documents are there. -## Source review +The official Waveshare support was inspected at commit `aaf395c1bbd86f7c5b7a2f9f0401241ff5c44956`. The Arduino audio `board_cfg.h` and explicitly V2 ESP-IDF audio example agree on ES8311 I2S pins. The official Arduino SD example uses CLK/D0/CMD 39/40/41. The firmware uses those pins. Waveshare documents V2 as 8 MB flash and 8 MB PSRAM and says V1/V2 examples are not interchangeable. -- **Microphone and capture:** `boomcast_audio.cpp` uses Waveshare's `audio_bsp` wrapper and a 16 kHz stereo read, selecting the louder slot per frame for mono. That slot selection is a heuristic; verify actual channel mapping and recorded playback on the board. A 2.5-second PSRAM ring and 2.5-second post-trigger buffer make an intended 5-second capture. The detector uses RMS/peak thresholds and cooldown. The first capture after boot can contain less pre-roll. Return values from `audio_playback_read` are not checked, so failed or short reads could enter recordings. -- **WAV and storage:** `boomcast_queue.cpp` writes RIFF PCM mono 16-bit headers and a 16 kHz sample rate. Header arithmetic matches the intended sample count. The queue is on FAT microSD, but files are written directly to their final `.wav` names without a temporary file and atomic rename. Power loss or a full card can leave a truncated item that appears queued; `fwrite`, `fflush`, and `fclose` results are not checked. -- **Network and uploads:** `boomcast_network.cpp` reconnects Wi-Fi and starts NTP. `boomcast_uploader.cpp` sends a conventional multipart body with CRLF boundaries and a `file` part. It sends a Bearer header if a token is set. The current fields are `event_id`, `trigger_type`, optional `detected_at`, and `file`; this **does not satisfy** the new `/api/pending/` contract's `sensor_id`, `captured_at`, `duration_seconds`, or `firmware_version`. It still targets `/fireworks/classify/`. -- **TLS and credentials:** `TLS_ALLOW_INSECURE` defaults to true, and the HTTPS client has no CA certificate configured when it is false. `SENSOR_TOKEN` is in committed-style `boomcast_config.h`; move it into an ignored local header or provisioned NVS and configure a trusted CA before deployment. The setup AP also uses a fixed prototype password. -- **Retries and duplicate safety:** the SD item remains after non-2xx or transport failure, and filename-derived `event_id` is stable across retries. The main loop only calls the uploader after an explicit local UI sync request; it does not automatically drain the queue after reconnection. The uploader treats any 2xx response as success without parsing the submission ID or status, and deletes the file immediately. Add bounded retry scheduling with backoff, parse the JSON receipt, and delete only after a matching accepted or duplicate receipt. -- **Display and memory:** the ePaper shows capture and queue count, plus a transient upload message on the owner screen. It lacks distinct persistent queued, uploading, success, and failure indicators on the display. The upload path allocates the whole WAV plus multipart framing in PSRAM for each request; there is no measured heap or fragmentation data. Measure free and largest contiguous PSRAM before/after repeated uploads and Wi-Fi outages. +## Implemented in source -## Required firmware changes before an end-to-end trial +- Audio reads now check the codec return code, clear input buffers first, discard failed blocks, abort a capture after a read error, select one fixed microphone slot, and count read/recording errors. Capture duration uses the available pre-roll plus the requested post-roll; UTC capture-start and trigger timestamps are retained when time is valid. +- SD commits use checked WAV and sidecar writes, flush/fsync/close, WAV length/header validation, final renames, interrupted-commit recovery, a queue commit marker, oldest-first selection across the directory, an event-count cap, and a free-space reserve. Incomplete files are excluded from upload. +- Uploads stream file contents through `WiFiClientSecure` with a trusted CA, require HTTPS, send the actual `/api/pending/` fields, parse JSON receipts, verify the echoed event ID and submission ID, and retain files after ambiguous responses. Automatic retries use bounded exponential backoff and jitter. Source-embedded token placeholders were replaced with an ignored local header and optional NVS token; shared setup and management passwords were replaced with per-device NVS passwords. +- ePaper owner status reflects listening, recording, queue/offline, uploading, successful submission, retry failure, and audio error counters. +- Django now returns `event_id` in first and duplicate receipts and accepts an explicit `time_state=unknown` when the device clock was not synchronized. The same Pending Review and classifier pipeline remains in use. -1. Confirm the physical V2 revision and use its matching official support files. Do not copy Atom Echo GPIO assignments. -2. Point at `/api/pending/` and send `sensor_id`, stable `event_id`, UTC `captured_at`, measured `duration_seconds`, `firmware_version`, and `file`. Do not send a timestamp until NTP or the RTC is valid; preserve a reliable capture time with the queued file. -3. Configure CA-backed HTTPS and store the sensor token outside committed source. Reject HTTP on deployed builds. -4. Write queue items atomically, detect SD write errors, auto-retry with backoff, validate the JSON receipt, and retain files on ambiguous responses. -5. Show distinct recording, queued, uploading, success, and failure states; log I2S read failures and memory metrics. +## Verification performed -## Verification status +- Official Waveshare pin/support comparison at the pinned commit. +- The pinned `prepare_from_waveshare.sh` completed successfully against a checkout at that commit. +- Arduino CLI 1.5.1 compiled the sketch for ESP32-S3 with ESP32 core 3.3.0, 8 MB flash, OPI PSRAM, and the 8 MB partition scheme. The only emitted warnings were in copied Waveshare support and Espressif touch APIs. +- The `fireworks_detect` Django suite passed: 39 tests. Firmware-shaped unknown-time and receipt fields have focused backend tests. +- Firmware `.gitignore` patterns were checked for local credentials, copied support, and build artifacts. -Automated Django tests cover authenticated submission, storage, classification response handling, duplicate retry, invalid token/sensor/audio, conflict, and classifier outage. A temporary local Django instance was inspected with Playwright at desktop and 390 px mobile width; its Pending Review sensor detail rendered and showed no console errors. **No physical Waveshare board was flashed or tested.** Microphone fidelity, trigger timing, HTTPS certificate validation, firmware build, offline queue recovery, and on-device RAM stability remain hardware test items. Use a real recording and a controlled Wi-Fi outage for final acceptance. +## Still open + +- **Firmware compile passed; no flash was performed.** Arduino CLI 1.5.1 compiled the sketch with ESP32 core 3.3.0, Waveshare support at the pinned commit, LVGL 8.4.0, ArduinoJson 7.4.3, 8 MB flash, and OPI PSRAM. The build reports 1,350,599 bytes of program storage (40%) and 99,368 bytes of global dynamic memory (30%). Device runtime RAM use is unmeasured. +- **No physical V2 test was performed.** The fixed microphone slot, actual audio fidelity, short successful codec reads, ePaper refresh, SD power-cut behavior, TLS handshake, and offline recovery need the real board. +- Waveshare's codec API reports read success/failure but not a byte count; a successful short read cannot be detected through the current wrapper. +- FAT does not provide an atomic transaction spanning WAV and sidecar. Valid interrupted commits are recovered; incomplete/orphan files remain on SD for manual inspection rather than being uploaded or overwritten. +- The uploader currently runs synchronously in the main loop. During a slow HTTPS attempt, the local web UI and display update may pause. Verify this on hardware and move upload to a worker task if it affects usability or watchdog health. +- Arduino source is not tracked by the current Django Git repository. Decide on a project-wide repository or a dedicated firmware repository before relying on source control for deployment. + +See `../arduino/BoomCast_Waveshare_Arduino/docs/validation-checklist.md` for the pending physical acceptance checks. Do not treat this source review or the Django tests as hardware validation. diff --git a/SENSOR_SUBMISSION_API.md b/SENSOR_SUBMISSION_API.md index b43590e..ef05cb4 100644 --- a/SENSOR_SUBMISSION_API.md +++ b/SENSOR_SUBMISSION_API.md @@ -2,8 +2,10 @@ `POST /api/pending/` accepts `multipart/form-data` from an active, registered sensor. Send `Authorization: Bearer `. The token determines the sensor and owner; send the sensor's database ID in `sensor_id` as an assertion, never as authority. -Required parts: `file` (16-bit PCM mono WAV), `sensor_id`, `event_id` (1–100 ASCII letters, digits, `_` or `-`), `captured_at` (UTC ISO 8601 timestamp with offset or Unix seconds), `duration_seconds` (positive number matching the WAV within 0.1 seconds), and `firmware_version` (1–64 printable characters). Optional: `trigger_type` (short label), `signal_rms`, `signal_peak` (finite nonnegative numbers), and `latitude`/`longitude` (untrusted device claims, retained only as metadata). No client location is promoted to the trusted event location. +Required parts: `file` (16-bit PCM mono WAV), `sensor_id`, `event_id` (1–100 ASCII letters, digits, `_` or `-`), `captured_at` (UTC ISO 8601 timestamp with offset or Unix seconds, or omit it with `time_state=unknown` when the device clock was not synchronized), `duration_seconds` (positive number matching the WAV within 0.1 seconds), and `firmware_version` (1–64 printable characters). Optional: `trigger_type` (short label), `signal_rms`, `signal_peak` (finite nonnegative numbers), and `latitude`/`longitude` (untrusted device claims, retained only as metadata). No client location is promoted to the trusted event location. -WAV data must be PCM, mono, 16-bit, at 16 kHz, at most 25 MiB, and 0.1–30 seconds long. A successful first submission returns HTTP 201 with `submission_id`, `status: pending`, and classifier results. A repeat of the same `(sensor, event_id)` returns HTTP 200 with the same `submission_id` and `duplicate: true`; a different body with the same ID returns HTTP 409. Errors have `code` and `detail` fields. HTTP 429 means retry after the `Retry-After` interval. HTTP 502 means classification failed and the device should retain the queued clip. +WAV data must be PCM, mono, 16-bit, at 16 kHz, at most 25 MiB, and 0.1–30 seconds long. A successful first submission returns HTTP 201 with `event_id`, `submission_id`, `status: pending`, and classifier results. A repeat of the same `(sensor, event_id)` returns HTTP 200 with the same `event_id`, `submission_id`, and `duplicate: true`; a different body with the same ID returns HTTP 409. Errors have `code` and `detail` fields. HTTP 429 means retry after the `Retry-After` interval. HTTP 502 means classification failed and the device should retain the queued clip. The existing `/fireworks/classify/` route remains available for older clients. New firmware should use this contract. Pending audio stays behind the staff-only playback route and follows the existing accept/reject workflow and storage lifetime. + +`captured_at` means the start of the actual recorded WAV. Optional `capture_started_at`, `triggered_at`, and `queued_at` are UTC ISO 8601 timestamps; `time_state=unknown` leaves the database capture time null. A missing timestamp without that explicit state is invalid. diff --git a/db.sqlite3 b/db.sqlite3 index 7a804ed..9235801 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/fireworks_detect/__pycache__/admin.cpython-312.pyc b/fireworks_detect/__pycache__/admin.cpython-312.pyc index c492ecf..7a9ba43 100644 Binary files a/fireworks_detect/__pycache__/admin.cpython-312.pyc and b/fireworks_detect/__pycache__/admin.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/admin.cpython-313.pyc b/fireworks_detect/__pycache__/admin.cpython-313.pyc index c2689cf..9a95c3f 100644 Binary files a/fireworks_detect/__pycache__/admin.cpython-313.pyc and b/fireworks_detect/__pycache__/admin.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/bursts.cpython-312.pyc b/fireworks_detect/__pycache__/bursts.cpython-312.pyc new file mode 100644 index 0000000..034cb37 Binary files /dev/null and b/fireworks_detect/__pycache__/bursts.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/bursts.cpython-313.pyc b/fireworks_detect/__pycache__/bursts.cpython-313.pyc new file mode 100644 index 0000000..c2fe01c Binary files /dev/null and b/fireworks_detect/__pycache__/bursts.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/models.cpython-312.pyc b/fireworks_detect/__pycache__/models.cpython-312.pyc index bcff490..d53d28a 100644 Binary files a/fireworks_detect/__pycache__/models.cpython-312.pyc and b/fireworks_detect/__pycache__/models.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/models.cpython-313.pyc b/fireworks_detect/__pycache__/models.cpython-313.pyc index 8013dc4..c446bb7 100644 Binary files a/fireworks_detect/__pycache__/models.cpython-313.pyc and b/fireworks_detect/__pycache__/models.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/test_browser_processing.cpython-313.pyc b/fireworks_detect/__pycache__/test_browser_processing.cpython-313.pyc new file mode 100644 index 0000000..b58c52e Binary files /dev/null and b/fireworks_detect/__pycache__/test_browser_processing.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/test_sensor_submission.cpython-313.pyc b/fireworks_detect/__pycache__/test_sensor_submission.cpython-313.pyc new file mode 100644 index 0000000..fe22ae9 Binary files /dev/null and b/fireworks_detect/__pycache__/test_sensor_submission.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/tests.cpython-313.pyc b/fireworks_detect/__pycache__/tests.cpython-313.pyc index fb2016a..8542961 100644 Binary files a/fireworks_detect/__pycache__/tests.cpython-313.pyc and b/fireworks_detect/__pycache__/tests.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/urls.cpython-312.pyc b/fireworks_detect/__pycache__/urls.cpython-312.pyc index 34aeb83..5a2f055 100644 Binary files a/fireworks_detect/__pycache__/urls.cpython-312.pyc and b/fireworks_detect/__pycache__/urls.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/urls.cpython-313.pyc b/fireworks_detect/__pycache__/urls.cpython-313.pyc index bd814dc..798a095 100644 Binary files a/fireworks_detect/__pycache__/urls.cpython-313.pyc and b/fireworks_detect/__pycache__/urls.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/views.cpython-312.pyc b/fireworks_detect/__pycache__/views.cpython-312.pyc index 5e54ef5..fec4f31 100644 Binary files a/fireworks_detect/__pycache__/views.cpython-312.pyc and b/fireworks_detect/__pycache__/views.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/views.cpython-313.pyc b/fireworks_detect/__pycache__/views.cpython-313.pyc index 43c83cd..1debce5 100644 Binary files a/fireworks_detect/__pycache__/views.cpython-313.pyc and b/fireworks_detect/__pycache__/views.cpython-313.pyc differ diff --git a/fireworks_detect/admin.py b/fireworks_detect/admin.py index 47c0e9d..8057b62 100644 --- a/fireworks_detect/admin.py +++ b/fireworks_detect/admin.py @@ -10,7 +10,7 @@ from django.urls import path, reverse from django.utils.html import format_html from django.utils.translation import gettext as _, gettext_lazy, ngettext -from .models import BrowserProcessingSettings, ClassificationRule, Event, PendingEvent, Sensor +from .models import BrowserProcessingSettings, ClassificationRule, Event, ManualReportRevision, PendingEvent, Sensor from . import views as classifier_views @@ -49,11 +49,11 @@ class BrowserProcessingSettingsAdmin(admin.ModelAdmin): class ClassificationAdmin(admin.ModelAdmin): - list_display = ("original_filename", "source_type", "sensor", "occurrences", "location", "visually_confirmed", "primary_label", "primary_score", "duration", "created_at") + list_display = ("original_filename", "source_type", "sensor", "occurrences", "event_kind", "observation_duration_minutes", "location", "visually_confirmed", "primary_label", "primary_score", "duration", "created_at") list_filter = ("source_type", "visually_confirmed", "created_at") search_fields = ("original_filename",) readonly_fields = ("audio_file", "sensor", "h3_cell", "direction_display", "direction_accuracy_degrees", "original_filename", "created_at", "pretty_classifier_response") - fields = ("audio_file", "sensor", "source_type", "occurrences", "location", "latitude", "longitude", "h3_cell", "direction_display", "direction_accuracy_degrees", "visually_confirmed", "original_filename", "created_at") + fields = ("audio_file", "sensor", "source_type", "occurrences", "observation_duration_minutes", "observation_duration_kind", "occurrence_time_approximate", "location", "latitude", "longitude", "h3_cell", "direction_display", "direction_accuracy_degrees", "visually_confirmed", "original_filename", "created_at") change_form_template = "admin/fireworks_detect/classification_audio_change_form.html" @admin.display(description=gettext_lazy("Direction")) @@ -149,13 +149,28 @@ class PendingEventAdmin(ClassificationAdmin): @admin.register(Event) class EventAdmin(ClassificationAdmin): - readonly_fields = ClassificationAdmin.readonly_fields + ("approved_at",) - fields = ClassificationAdmin.fields + ("approved_at",) + readonly_fields = ClassificationAdmin.readonly_fields + ("submitted_at", "approved_at") + fields = ClassificationAdmin.fields + ("submitted_at", "approved_at") def has_add_permission(self, request): return False +@admin.register(ManualReportRevision) +class ManualReportRevisionAdmin(admin.ModelAdmin): + list_display = ("original_pending_id", "previous_occurrences", "new_occurrences", "previous_duration_minutes", "new_duration_minutes", "changed_at") + readonly_fields = list_display + + def has_add_permission(self, request): + return False + + def has_change_permission(self, request, obj=None): + return False + + def has_delete_permission(self, request, obj=None): + return False + + @admin.register(Sensor) class SensorAdmin(admin.ModelAdmin): list_display = ("name", "owner", "is_active", "heartbeat_light", "last_heartbeat", "last_submission", "token_prefix", "archived_at") diff --git a/fireworks_detect/bursts.py b/fireworks_detect/bursts.py new file mode 100644 index 0000000..5979eca --- /dev/null +++ b/fireworks_detect/bursts.py @@ -0,0 +1,25 @@ +"""Derived burst presentation rules; rates describe frequency, not loudness.""" + +from decimal import Decimal + +BURST_MIN_BANGS = 3 +DEFAULT_ESTIMATED_DURATION_MINUTES = 15 +MODERATE_RATE_PER_15_MINUTES = Decimal("5") +INTENSE_RATE_PER_15_MINUTES = Decimal("10") + + +def burst_rate(bang_count, duration_minutes): + if bang_count < BURST_MIN_BANGS or not duration_minutes or duration_minutes <= 0: + return None + return Decimal(bang_count) * 15 / Decimal(duration_minutes) + + +def burst_intensity(bang_count, duration_minutes): + rate = burst_rate(bang_count, duration_minutes) + if rate is None: + return None + if rate >= INTENSE_RATE_PER_15_MINUTES: + return "intense" + if rate >= MODERATE_RATE_PER_15_MINUTES: + return "moderate" + return "light" diff --git a/fireworks_detect/migrations/0012_event_observation_duration_kind_and_more.py b/fireworks_detect/migrations/0012_event_observation_duration_kind_and_more.py new file mode 100644 index 0000000..39c9835 --- /dev/null +++ b/fireworks_detect/migrations/0012_event_observation_duration_kind_and_more.py @@ -0,0 +1,57 @@ +# Generated by Django 6.1.1 on 2026-10-09 23:43 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fireworks_detect', '0011_event_captured_at_event_device_metadata_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='observation_duration_kind', + field=models.CharField(blank=True, choices=[('estimated', 'Estimated'), ('measured', 'Measured')], max_length=10), + ), + migrations.AddField( + model_name='event', + name='observation_duration_minutes', + field=models.PositiveSmallIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='event', + name='occurrence_time_approximate', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='pendingevent', + name='observation_duration_kind', + field=models.CharField(blank=True, choices=[('estimated', 'Estimated'), ('measured', 'Measured')], max_length=10), + ), + migrations.AddField( + model_name='pendingevent', + name='observation_duration_minutes', + field=models.PositiveSmallIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='pendingevent', + name='occurrence_time_approximate', + field=models.BooleanField(default=False), + ), + migrations.CreateModel( + name='ManualReportRevision', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('original_pending_id', models.PositiveBigIntegerField()), + ('previous_occurrences', models.PositiveIntegerField()), + ('new_occurrences', models.PositiveIntegerField()), + ('previous_duration_minutes', models.PositiveSmallIntegerField(blank=True, null=True)), + ('new_duration_minutes', models.PositiveSmallIntegerField(blank=True, null=True)), + ('changed_at', models.DateTimeField(auto_now_add=True)), + ('pending_event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fireworks_detect.pendingevent')), + ], + ), + ] diff --git a/fireworks_detect/migrations/0013_event_submitted_at.py b/fireworks_detect/migrations/0013_event_submitted_at.py new file mode 100644 index 0000000..9a2ac98 --- /dev/null +++ b/fireworks_detect/migrations/0013_event_submitted_at.py @@ -0,0 +1,18 @@ +# Generated by Django 6.1.1 on 2026-10-09 23:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fireworks_detect', '0012_event_observation_duration_kind_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='submitted_at', + field=models.DateTimeField(blank=True, null=True), + ), + ] diff --git a/fireworks_detect/migrations/__pycache__/0012_event_observation_duration_kind_and_more.cpython-313.pyc b/fireworks_detect/migrations/__pycache__/0012_event_observation_duration_kind_and_more.cpython-313.pyc new file mode 100644 index 0000000..02e191d Binary files /dev/null and b/fireworks_detect/migrations/__pycache__/0012_event_observation_duration_kind_and_more.cpython-313.pyc differ diff --git a/fireworks_detect/migrations/__pycache__/0013_event_submitted_at.cpython-313.pyc b/fireworks_detect/migrations/__pycache__/0013_event_submitted_at.cpython-313.pyc new file mode 100644 index 0000000..3e35860 Binary files /dev/null and b/fireworks_detect/migrations/__pycache__/0013_event_submitted_at.cpython-313.pyc differ diff --git a/fireworks_detect/models.py b/fireworks_detect/models.py index fd68832..9ae03dd 100644 --- a/fireworks_detect/models.py +++ b/fireworks_detect/models.py @@ -117,12 +117,19 @@ class ClassifiedAudio(models.Model): SENSOR = "sensor", _("Sensor") MANUAL = "manual", _("Manual report") + class DurationKind(models.TextChoices): + ESTIMATED = "estimated", _("Estimated") + MEASURED = "measured", _("Measured") + audio_file = models.FileField(upload_to="fireworks_audio/%Y/%m/%d", blank=True) sensor = models.ForeignKey(Sensor, null=True, blank=True, on_delete=models.SET_NULL, related_name="%(class)s_records") original_filename = models.CharField(max_length=255) classifier_response = models.JSONField() source_type = models.CharField(max_length=10, choices=SourceType.choices, default=SourceType.SENSOR) occurrences = models.PositiveIntegerField(default=1) + observation_duration_minutes = models.PositiveSmallIntegerField(null=True, blank=True) + observation_duration_kind = models.CharField(max_length=10, choices=DurationKind.choices, blank=True) + occurrence_time_approximate = models.BooleanField(default=False) location = models.CharField(max_length=255, blank=True) latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True) longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True) @@ -154,6 +161,10 @@ class ClassifiedAudio(models.Model): not math.isfinite(self.direction_accuracy_degrees) or self.direction_accuracy_degrees < 0 ): errors["direction_accuracy_degrees"] = _("Compass accuracy must be a finite, non-negative value.") + if self.observation_duration_minutes is not None and not 1 <= self.observation_duration_minutes <= 1440: + errors["observation_duration_minutes"] = _("Observation duration must be between 1 and 1,440 minutes.") + if bool(self.observation_duration_minutes) != bool(self.observation_duration_kind): + errors["observation_duration_kind"] = _("A duration needs an estimated or measured source.") if errors: raise ValidationError(errors) @@ -172,6 +183,33 @@ class ClassifiedAudio(models.Model): return "—" return f"{self.direction_degrees:g}° ({self.direction_cardinal})" + @property + def is_burst(self): + from .bursts import BURST_MIN_BANGS + return self.occurrences >= BURST_MIN_BANGS + + @property + def event_kind(self): + return "burst" if self.is_burst else "ordinary" + + @property + def bangs_per_15_minutes(self): + from .bursts import burst_rate + if not self.observation_duration_kind: + return None + return burst_rate(self.occurrences, self.observation_duration_minutes) + + @property + def burst_intensity(self): + from .bursts import burst_intensity + if not self.observation_duration_kind: + return None + return burst_intensity(self.occurrences, self.observation_duration_minutes) + + @property + def burst_intensity_display(self): + return {"light": _("Light"), "moderate": _("Moderate"), "intense": _("Intense")}.get(self.burst_intensity) + @property def predictions(self): @@ -229,6 +267,7 @@ class PendingEvent(ClassifiedAudio): @transaction.atomic def approve(self): event = Event.objects.create( + submitted_at=self.created_at, audio_file=self.audio_file.name, sensor=self.sensor, captured_at=self.captured_at, @@ -238,6 +277,9 @@ class PendingEvent(ClassifiedAudio): classifier_response=self.classifier_response, source_type=self.source_type, occurrences=self.occurrences, + observation_duration_minutes=self.observation_duration_minutes, + observation_duration_kind=self.observation_duration_kind, + occurrence_time_approximate=self.occurrence_time_approximate, location=self.location, latitude=self.latitude, longitude=self.longitude, @@ -261,12 +303,25 @@ class Event(ClassifiedAudio): """A reviewed classification that is safe to appear in the event feed.""" approved_at = models.DateTimeField(auto_now_add=True) + submitted_at = models.DateTimeField(null=True, blank=True) class Meta(ClassifiedAudio.Meta): verbose_name = _("Event") verbose_name_plural = _("Events") +class ManualReportRevision(models.Model): + """Record edits to a session-owned manual Pending report.""" + + pending_event = models.ForeignKey(PendingEvent, null=True, blank=True, on_delete=models.SET_NULL) + original_pending_id = models.PositiveBigIntegerField() + previous_occurrences = models.PositiveIntegerField() + new_occurrences = models.PositiveIntegerField() + previous_duration_minutes = models.PositiveSmallIntegerField(null=True, blank=True) + new_duration_minutes = models.PositiveSmallIntegerField(null=True, blank=True) + changed_at = models.DateTimeField(auto_now_add=True) + + class SensorSubmission(models.Model): """Durable idempotency receipt, retained after moderation.""" diff --git a/fireworks_detect/templates/fireworks_detect/event_detail.html b/fireworks_detect/templates/fireworks_detect/event_detail.html index c62cafb..6e34feb 100644 --- a/fireworks_detect/templates/fireworks_detect/event_detail.html +++ b/fireworks_detect/templates/fireworks_detect/event_detail.html @@ -1,9 +1,13 @@ {% load i18n %} {% if event.source_type == "manual" %} -

{% trans "Manual fireworks report" %}

+

{% if event.is_burst %}{% trans "Burst Event" %}{% else %}{% trans "Manual fireworks report" %}{% endif %}

{% blocktrans with date=event.approved_at|date:"j M Y, H:i" %}Approved {{ date }} · Reported manually{% endblocktrans %}

{% trans "Report details" %}

{% trans "Occurrences" %}{{ event.occurrences }}
+
{% trans "Occurred" %}{% if event.occurrence_time_approximate %}{% trans "Approximately" %} {% endif %}{{ event.captured_at|date:"j M Y, H:i"|default:"Unknown" }}
+
{% trans "Submitted" %}{% if event.submitted_at %}{{ event.submitted_at|date:"j M Y, H:i" }}{% else %}{% trans "Unknown" %}{% endif %}
+{% if event.is_burst %}
{% trans "Duration" %}{% if event.observation_duration_minutes %}{{ event.observation_duration_minutes }} {% if event.observation_duration_kind == "estimated" %}{% trans "minutes (estimated)" %}{% else %}{% trans "minutes (measured)" %}{% endif %}{% else %}{% trans "Unknown" %}{% endif %}
+
{% trans "Intensity" %}{% if event.burst_intensity %}{{ event.burst_intensity_display }} · {{ event.bangs_per_15_minutes|floatformat:1 }} {% trans "bangs per 15 minutes" %}{% else %}{% trans "Not rated" %}{% endif %}
{% endif %}
{% trans "Location" %}{{ event.location|default:"Not recorded" }}
{% trans "Captured location" %}{{ event_h3_cell|default:"Not recorded" }}
{% trans "Direction" %}{{ event.direction_display }}
diff --git a/fireworks_detect/templates/fireworks_detect/events_list.html b/fireworks_detect/templates/fireworks_detect/events_list.html index d61dde4..3323d78 100644 --- a/fireworks_detect/templates/fireworks_detect/events_list.html +++ b/fireworks_detect/templates/fireworks_detect/events_list.html @@ -5,7 +5,7 @@ {% if event.source_type == "manual" %} {% trans "Manual report" %} - {% trans "Manual fireworks report" %}
+ {% if event.is_burst %}{% trans "Burst Event" %}{% else %}{% trans "Manual fireworks report" %}{% endif %}
{% blocktrans count count=event.occurrences %}{{ count }} occurrence{% plural %}{{ count }} occurrences{% endblocktrans %}{% if event.location %} · {{ event.location }}{% endif %} {% else %} {% trans "Sensor classification" %} diff --git a/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html b/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html index e747dd8..bde7f6c 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html +++ b/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html @@ -20,6 +20,12 @@ +
+ +
+ + {% trans "Leave the time empty to use the submission time." %} +
@@ -28,6 +34,13 @@
+

{% trans "Ordinary report" %}

+
+
+ + + + {% trans "Optional. Without an accepted window, BoomCast reports the count without an intensity rating." %}
{% include "fireworks_detect/includes/manual_direction_panel.html" %} @@ -55,7 +68,7 @@ - +
diff --git a/fireworks_detect/templates/fireworks_detect/includes/map_panel.html b/fireworks_detect/templates/fireworks_detect/includes/map_panel.html index 6c37702..d2c94f8 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/map_panel.html +++ b/fireworks_detect/templates/fireworks_detect/includes/map_panel.html @@ -1,8 +1,8 @@ {% load i18n %} -
-
{% trans "Manual reports · privacy-preserving H3 cells" %} {% blocktrans with resolution=h3_resolution %}H3 resolution {{ resolution }} · sensor layer disabled{% endblocktrans %}
-
- +
+
{% trans "Reviewed reports · privacy-preserving H3 cells" %} {% blocktrans with resolution=h3_resolution %}H3 resolution {{ resolution }}{% endblocktrans %}
+
+
{{ h3_cells|json_script:"h3-cells-data" }} diff --git a/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html b/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html index fe56eff..9c23088 100644 --- a/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html +++ b/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html @@ -6,12 +6,24 @@

{{ error }}

{% else %} - {% trans "Report received!" %} + {% if updated %}{% trans "Report updated!" %}{% else %}{% trans "Report received!" %}{% endif %}

{% trans "Thank you. Your report helps map fireworks nearby." %}

- {{ pending.created_at|date:"H:i" }} · + {% if pending.occurrence_time_approximate %}{% trans "Approximately" %} {% endif %}{{ pending.captured_at|date:"j M Y, H:i" }} · {% blocktrans count count=pending.occurrences %}{{ count }} occurrence{% plural %}{{ count }} occurrences{% endblocktrans %} - {% if direction_label %} · {{ direction_label }} {{ pending.direction_degrees|floatformat:0 }}°{% endif %} + {% if pending.direction_degrees is not None %} · {{ direction_label|default:pending.direction_cardinal }} {{ pending.direction_degrees|floatformat:0 }}°{% endif %}

+

{% if pending.is_burst %}{% trans "Burst Event" %}{% else %}{% trans "Ordinary report" %}{% endif %} · {% trans "Submitted" %} {{ pending.created_at|date:"j M Y, H:i" }}

+ {% if pending.is_burst %}

{% trans "Duration" %}: {% if pending.observation_duration_minutes %}{{ pending.observation_duration_minutes }} {% trans "minutes (estimated)" %}{% else %}{% trans "Unknown" %}{% endif %}

+

{% trans "Intensity" %}: {% if pending.burst_intensity %}{{ pending.burst_intensity_display }} ({{ pending.bangs_per_15_minutes|floatformat:1 }} {% trans "bangs per 15 minutes" %}){% else %}{% trans "Not rated" %}{% endif %}

{% endif %} + {% if editable %}
+ {% csrf_token %} + + + + + + +
{% endif %} {% endif %}
diff --git a/fireworks_detect/templates/fireworks_detect/map.html b/fireworks_detect/templates/fireworks_detect/map.html index fd60c30..101d6d1 100644 --- a/fireworks_detect/templates/fireworks_detect/map.html +++ b/fireworks_detect/templates/fireworks_detect/map.html @@ -14,12 +14,12 @@ {% include "fireworks_detect/includes/navigation.html" with active_page="map" %}
-

{% trans "Manual report intelligence" %}

{% trans "Sound activity map." %}

-

{% trans "Reviewed manual reports with a captured location appear as their H3 cell, not their precise coordinates. Saved phone compass readings show the reported direction of the sound." %}

+

{% trans "Reviewed sound reports" %}

{% trans "Sound activity map." %}

+

{% trans "Reviewed reports with a stored location appear at their H3 cell centre, not their precise coordinates. Sensor events use only saved event locations; device-reported coordinates are not trusted for this map." %}

-
+
diff --git a/fireworks_detect/test_sensor_submission.py b/fireworks_detect/test_sensor_submission.py index a9475ef..f0740bb 100644 --- a/fireworks_detect/test_sensor_submission.py +++ b/fireworks_detect/test_sensor_submission.py @@ -44,11 +44,18 @@ class SensorSubmissionTests(TestCase): def test_authenticated_upload_is_classified_and_retry_is_idempotent(self): response_body = io.BytesIO(json.dumps({"predictions": [{"class": "Fireworks", "score": 0.8}], "duration_seconds": 1}).encode()) with TemporaryDirectory() as media, override_settings(MEDIA_ROOT=media), patch("fireworks_detect.views.urlopen", return_value=response_body) as classify: - first = self.submit(trigger_type="audio_spike", latitude="52.1") + first = self.submit( + trigger_type="audio_spike", latitude="52.1", + capture_started_at="2026-10-09T10:00:00Z", + triggered_at="2026-10-09T10:00:02Z", + queued_at="2026-10-09T10:00:05Z", + ) second = self.submit() self.assertEqual(first.status_code, 201) self.assertEqual(second.status_code, 200) self.assertEqual(first.json()["submission_id"], second.json()["submission_id"]) + self.assertEqual(first.json()["event_id"], "device-event-1") + self.assertEqual(second.json()["event_id"], "device-event-1") self.assertEqual(PendingEvent.objects.count(), 1) self.assertEqual(SensorSubmission.objects.count(), 1) self.assertEqual(classify.call_count, 1) @@ -57,8 +64,17 @@ class SensorSubmissionTests(TestCase): self.assertEqual(pending.source_type, "sensor") self.assertFalse(pending.latitude) self.assertEqual(pending.device_metadata["latitude"], "52.1") + self.assertEqual(pending.device_metadata["triggered_at"], "2026-10-09T10:00:02Z") self.assertTrue(pending.audio_file.storage.exists(pending.audio_file.name)) + def test_unknown_capture_time_is_explicit_and_retained(self): + response_body = io.BytesIO(json.dumps({"predictions": [], "duration_seconds": 1}).encode()) + with TemporaryDirectory() as media, override_settings(MEDIA_ROOT=media), patch("fireworks_detect.views.urlopen", return_value=response_body): + response = self.submit(captured_at="", time_state="unknown") + self.assertEqual(response.status_code, 201) + self.assertIsNone(PendingEvent.objects.get().captured_at) + self.assertEqual(PendingEvent.objects.get().device_metadata["time_state"], "unknown") + def test_pending_admin_shows_sensor_details(self): staff = get_user_model().objects.create_superuser("reviewer-sensor", password="test") pending = PendingEvent.objects.create(sensor=self.sensor, source_type="sensor", original_filename="event.wav", classifier_response={"predictions": [{"class": "Fireworks", "score": 0.8}]}, firmware_version="0.1.0-concept", device_metadata={"trigger_type": "audio_spike"}) diff --git a/fireworks_detect/tests.py b/fireworks_detect/tests.py index 6e8646d..d7fad67 100644 --- a/fireworks_detect/tests.py +++ b/fireworks_detect/tests.py @@ -14,7 +14,8 @@ from django.urls import reverse from django.utils import timezone from .h3_utils import cell_from_coordinates, h3_resolution -from .models import ClassificationRule, Event, PendingEvent +from .models import ClassificationRule, Event, ManualReportRevision, PendingEvent +from .bursts import burst_intensity, burst_rate class ClassificationRuleApiTests(TestCase): @@ -88,6 +89,114 @@ class ManualPendingEventTests(TestCase): self.assertContains(response, 'data-result="error"', status_code=400) self.assertFalse(PendingEvent.objects.exists()) + def test_burst_boundaries_and_intensity_rates(self): + for count, duration, category in ((1, 15, None), (2, 15, None), (3, 15, "light"), (10, 15, "intense"), (10, 30, "moderate"), (10, 60, "light")): + with self.subTest(count=count, duration=duration): + pending = PendingEvent(occurrences=count, observation_duration_minutes=duration, observation_duration_kind="estimated") + self.assertEqual(pending.is_burst, count >= 3) + self.assertEqual(pending.burst_intensity, category) + self.assertEqual(burst_rate(10, 30), Decimal("5")) + self.assertEqual(burst_intensity(10, None), None) + + def test_server_rendered_quick_report_with_estimated_duration_and_approximate_time(self): + response = self.client.post(reverse("fireworks_detect:submit_manual_pending"), { + "occurrences": "10", "occurred_at": "2026-10-09T20:30", "time_approximate": "on", + "duration_minutes": "30", "duration_confirmed": "on", + }) + self.assertEqual(response.status_code, 200) + self.assertContains(response, "Burst Event") + self.assertContains(response, "Moderate") + pending = PendingEvent.objects.get() + self.assertEqual(pending.occurrences, 10) + self.assertEqual(pending.observation_duration_minutes, 30) + self.assertEqual(pending.observation_duration_kind, "estimated") + self.assertTrue(pending.occurrence_time_approximate) + self.assertNotEqual(pending.captured_at, pending.created_at) + self.assertEqual(pending.bangs_per_15_minutes, Decimal("5")) + reviewed = pending.approve() + self.assertEqual(reviewed.observation_duration_minutes, 30) + self.assertEqual(reviewed.captured_at, pending.captured_at) + self.assertEqual(reviewed.submitted_at, pending.created_at) + + def test_unaccepted_window_has_no_intensity_and_legacy_burst_stays_compatible(self): + response = self.client.post(reverse("fireworks_detect:submit_manual_pending"), {"occurrences": "3", "duration_minutes": "15"}) + self.assertEqual(response.status_code, 200) + pending = PendingEvent.objects.get() + self.assertTrue(pending.is_burst) + self.assertIsNone(pending.observation_duration_minutes) + self.assertIsNone(pending.burst_intensity) + old = Event.objects.create(occurrences=10, original_filename="old report", classifier_response={}, source_type="manual") + self.assertTrue(old.is_burst) + self.assertIsNone(old.burst_intensity) + + accepted = self.client.post(reverse("fireworks_detect:submit_manual_pending"), { + "occurrences": "3", "duration_confirmed": "on", + }) + self.assertEqual(accepted.status_code, 200) + self.assertEqual(PendingEvent.objects.latest("pk").observation_duration_minutes, 15) + + measured = Event.objects.create(occurrences=10, original_filename="measured", classifier_response={}, + observation_duration_minutes=30, observation_duration_kind="measured") + self.assertEqual(measured.burst_intensity, "moderate") + self.assertEqual(measured.observation_duration_kind, "measured") + + def test_session_scoped_count_edits_recalculate_and_preserve_original_time(self): + self.client.post(reverse("fireworks_detect:submit_manual_pending"), { + "occurrences": "2", "occurred_at": "2026-10-09T20:30", + }) + pending = PendingEvent.objects.get() + occurred_at, submitted_at = pending.captured_at, pending.created_at + url = reverse("fireworks_detect:update_manual_pending", args=[pending.pk]) + response = self.client.post(url, {"occurrences": "3", "duration_minutes": "15", "duration_confirmed": "on"}) + self.assertEqual(response.status_code, 200) + pending.refresh_from_db() + self.assertEqual(pending.burst_intensity, "light") + self.client.post(url, {"occurrences": "10", "duration_minutes": "10", "duration_confirmed": "on"}) + pending.refresh_from_db() + self.assertEqual(pending.burst_intensity, "intense") + self.client.post(url, {"occurrences": "10", "duration_minutes": "30", "duration_confirmed": "on"}) + pending.refresh_from_db() + self.assertEqual(pending.burst_intensity, "moderate") + self.client.post(url, {"occurrences": "2"}) + pending.refresh_from_db() + self.assertFalse(pending.is_burst) + self.assertIsNone(pending.burst_intensity) + self.assertEqual(pending.captured_at, occurred_at) + self.assertEqual(pending.created_at, submitted_at) + self.assertEqual(ManualReportRevision.objects.filter(original_pending_id=pending.pk).count(), 4) + from django.test import Client + self.assertEqual(Client().post(url, {"occurrences": "10"}).status_code, 404) + + def test_invalid_estimated_duration_and_future_occurrence_are_rejected(self): + for data in ( + {"occurrences": "10", "duration_confirmed": "on", "duration_minutes": "0"}, + {"occurrences": "10", "duration_confirmed": "on", "duration_minutes": "1441"}, + {"occurrences": "10", "occurred_at": (timezone.localtime() + timedelta(days=1)).strftime("%Y-%m-%dT%H:%M")}, + ): + with self.subTest(data=data): + response = self.client.post(reverse("fireworks_detect:submit_manual_pending"), data) + self.assertEqual(response.status_code, 400) + self.assertFalse(PendingEvent.objects.exists()) + + def test_map_data_exposes_derived_burst_fields_without_precise_location(self): + event = Event.objects.create( + original_filename="manual burst", classifier_response={}, source_type="manual", occurrences=10, + latitude=Decimal("52.123456"), longitude=Decimal("5.987654"), + observation_duration_minutes=30, observation_duration_kind="estimated", + occurrence_time_approximate=True, captured_at=timezone.now() - timedelta(hours=1), + ) + from .views import _events_for_map + mapped, _ = _events_for_map({"date_from": None, "date_to": None, "visual": "all", "source": "manual"}) + item = next(item for item in mapped if item["occurrences"] == 10) + self.assertEqual(item["event_kind"], "burst") + self.assertEqual(item["observation_duration_kind"], "estimated") + self.assertEqual(item["bangs_per_15_minutes"], 5.0) + self.assertEqual(item["burst_intensity"], "moderate") + self.assertTrue(item["occurrence_time_approximate"]) + self.assertIsNone(item["submitted_on"]) + self.assertNotIn("latitude", item) + self.assertNotIn("longitude", item) + def test_manual_report_accepts_optional_wav_on_the_same_pending_event(self): from tempfile import TemporaryDirectory @@ -220,7 +329,7 @@ class ManualPendingEventTests(TestCase): ) list_response = self.client.get(reverse("fireworks_detect:events_list")) - self.assertContains(list_response, "Manual fireworks report") + self.assertContains(list_response, "Burst Event") self.assertContains(list_response, "5 occurrences") self.assertContains(list_response, "Back garden") @@ -238,7 +347,7 @@ class ManualPendingEventTests(TestCase): self.assertEqual(h3_resolution(), 8) self.assertTrue(cell_from_coordinates(Decimal("52.123456"), Decimal("5.987654"))) - def test_map_uses_manual_h3_data_and_excludes_sensor_events(self): + def test_map_source_filter_separates_reviewed_sensor_events(self): manual_cell = cell_from_coordinates(Decimal("52.123456"), Decimal("5.987654")) sensor_cell = cell_from_coordinates(Decimal("53.123456"), Decimal("5.987654")) Event.objects.create( @@ -271,12 +380,41 @@ class ManualPendingEventTests(TestCase): self.assertContains(response, '"direction_degrees": 237.0') self.assertContains(response, "data-h3-resolution") self.assertContains(response, 'type="module"') - self.assertContains(response, "sensor layer disabled") - self.assertContains(response, "Sensor events — coming soon") + self.assertContains(response, 'name="source"') + self.assertContains(response, "Sensor events") self.assertNotContains(response, sensor_cell) self.assertNotContains(response, "52.123456") self.assertNotContains(response, "H3 demo cell") + sensor_response = self.client.get(reverse("fireworks_detect:map"), {"range": "all", "source": "sensor"}) + self.assertEqual(len(sensor_response.context["map_events"]), 1) + self.assertEqual(sensor_response.context["map_events"][0]["source_type"], "sensor") + self.assertContains(sensor_response, sensor_cell) + self.assertNotContains(sensor_response, manual_cell) + self.assertNotContains(sensor_response, "53.123456") + + both_response = self.client.get(reverse("fireworks_detect:map"), {"range": "all", "source": "all"}) + self.assertEqual(len(both_response.context["map_events"]), 2) + self.assertContains(both_response, manual_cell) + self.assertContains(both_response, sensor_cell) + + def test_sensor_map_excludes_pending_and_device_only_locations(self): + pending_cell = cell_from_coordinates(Decimal("51.876543"), Decimal("5.123456")) + PendingEvent.objects.create( + original_filename="pending.wav", classifier_response={}, + source_type=PendingEvent.SourceType.SENSOR, h3_cell=pending_cell, + ) + Event.objects.create( + original_filename="unlocated.wav", classifier_response={}, + source_type=Event.SourceType.SENSOR, + device_metadata={"latitude": "52.654321", "longitude": "5.654321"}, + ) + + response = self.client.get(reverse("fireworks_detect:map"), {"range": "all", "source": "sensor"}) + self.assertEqual(response.context["map_events"], []) + self.assertNotContains(response, pending_cell) + self.assertNotContains(response, "52.654321") + def test_map_date_range_filters_manual_reports(self): recent_cell = cell_from_coordinates(Decimal("52.400000"), Decimal("5.700000")) older_cell = cell_from_coordinates(Decimal("53.400000"), Decimal("5.700000")) diff --git a/fireworks_detect/urls.py b/fireworks_detect/urls.py index a2471f4..bd02c69 100644 --- a/fireworks_detect/urls.py +++ b/fireworks_detect/urls.py @@ -12,6 +12,7 @@ from .views import ( pending_audio, manual_direction_panel, submit_manual_pending_event, + update_manual_pending_event, submit_pending_event, sensor_heartbeat, submit_sensor_pending, @@ -29,6 +30,7 @@ urlpatterns = [ path("heartbeat/", sensor_heartbeat, name="sensor_heartbeat"), path("submit-pending/", submit_pending_event, name="submit_pending"), path("submit-manual-pending/", submit_manual_pending_event, name="submit_manual_pending"), + path("submit-manual-pending//update/", update_manual_pending_event, name="update_manual_pending"), path("manual-direction/", manual_direction_panel, name="manual_direction_panel"), path("events/", events_view, name="events"), path("events/list/", events_list, name="events_list"), diff --git a/fireworks_detect/views.py b/fireworks_detect/views.py index 6d1e976..4c807e3 100644 --- a/fireworks_detect/views.py +++ b/fireworks_detect/views.py @@ -29,7 +29,8 @@ from django.views.decorators.http import require_http_methods from .h3_utils import cell_boundary, cell_center, cell_from_coordinates, h3_resolution from .browser_policy import advisory_browser_metadata, browser_config, browser_policy -from .models import BrowserProcessingSettings, ClassificationRule, Event, PendingEvent, Sensor, SensorSubmission +from .models import BrowserProcessingSettings, ClassificationRule, Event, ManualReportRevision, PendingEvent, Sensor, SensorSubmission +from .bursts import BURST_MIN_BANGS, DEFAULT_ESTIMATED_DURATION_MINUTES, burst_intensity, burst_rate CLASSIFIER_URL = "http://192.168.1.122:5000/classify" @@ -85,17 +86,24 @@ def _map_filters(request): visual = request.GET.get("visual", "all") if visual not in {"all", "yes", "no"}: visual = "all" + source = request.GET.get("source", "manual") + if source not in {"manual", "sensor", "all"}: + source = "manual" return { "date_from": date_from, "date_to": date_to, "range": selected_range, "visual": visual, + "source": source, } def _events_for_map(filters): - """Create privacy-preserving map data for reviewed manual reports only.""" - events = Event.objects.filter(source_type=Event.SourceType.MANUAL) + """Create H3 map data for reviewed events with a stored, trusted location.""" + source = filters.get("source", "manual") + events = Event.objects.all() + if source != "all": + events = events.filter(source_type=source) if filters["date_from"]: events = events.filter(created_at__date__gte=filters["date_from"]) if filters["date_to"]: @@ -109,7 +117,8 @@ def _events_for_map(filters): mapped_events = [] for event in events.values( "h3_cell", "latitude", "longitude", "occurrences", "visually_confirmed", - "direction_degrees", "direction_accuracy_degrees", "created_at", + "direction_degrees", "direction_accuracy_degrees", "created_at", "captured_at", "submitted_at", "source_type", + "observation_duration_minutes", "observation_duration_kind", "occurrence_time_approximate", ): # Coordinates are used only here to derive an H3 cell; they never leave the server. h3_cell = event["h3_cell"] or cell_from_coordinates(event["latitude"], event["longitude"]) @@ -124,13 +133,26 @@ def _events_for_map(filters): "center": center, "reports": 0, "occurrences": 0, + "manual_reports": 0, + "sensor_reports": 0, }) aggregate["reports"] += 1 aggregate["occurrences"] += event["occurrences"] + aggregate[f'{event["source_type"]}_reports'] += 1 + rate = burst_rate(event["occurrences"], event["observation_duration_minutes"]) if event["observation_duration_kind"] else None mapped_events.append({ "cell": h3_cell, "center": center, + "source_type": event["source_type"], "occurrences": event["occurrences"], + "event_kind": "burst" if event["occurrences"] >= BURST_MIN_BANGS else "ordinary", + "observation_duration_minutes": event["observation_duration_minutes"], + "observation_duration_kind": event["observation_duration_kind"], + "bangs_per_15_minutes": float(rate) if rate is not None else None, + "burst_intensity": burst_intensity(event["occurrences"], event["observation_duration_minutes"]) if event["observation_duration_kind"] else None, + "occurrence_time_approximate": event["occurrence_time_approximate"], + "occurred_on": (event["captured_at"] or event["created_at"]).date().isoformat(), + "submitted_on": event["submitted_at"].date().isoformat() if event["submitted_at"] else None, "visually_confirmed": event["visually_confirmed"], # A day is sufficient for this map and avoids sharing a precise report time. "reported_on": event["created_at"].date().isoformat(), @@ -152,11 +174,13 @@ def fireworks_map_view(request): "h3_cells": h3_cells, "map_events": map_events, "mapped_event_count": len(map_events), + "map_source": filters["source"], "map_filters": { "date_from": filters["date_from"].isoformat() if filters["date_from"] else "", "date_to": filters["date_to"].isoformat() if filters["date_to"] else "", "range": filters["range"], "visual": filters["visual"], + "source": filters["source"], }, }) @@ -395,6 +419,10 @@ def submit_manual_pending_event(request): status=400, ) + details, error = _manual_observation_details(request, occurrences) + if error: + return render(request, "fireworks_detect/manual_pending_submission.html", {"error": error}, status=400) + uploaded_file = request.FILES.get("audio") if uploaded_file: if uploaded_file.size > MAX_AUDIO_SIZE or uploaded_file.content_type not in ("audio/wav", "audio/wave", "audio/x-wav"): @@ -415,6 +443,7 @@ def submit_manual_pending_event(request): classifier_response={}, source_type=PendingEvent.SourceType.MANUAL, occurrences=occurrences, + **details, latitude=latitude, longitude=longitude, h3_cell=h3_cell or "", @@ -422,15 +451,86 @@ def submit_manual_pending_event(request): direction_accuracy_degrees=direction_accuracy_degrees, direction_source="device_compass" if direction_degrees is not None else "", ) + owned = request.session.get("manual_pending_ids", []) + request.session["manual_pending_ids"] = (owned + [pending.pk])[-20:] direction_names = { "N": _("North"), "NE": _("Northeast"), "E": _("East"), "SE": _("Southeast"), "S": _("South"), "SW": _("Southwest"), "W": _("West"), "NW": _("Northwest"), } return render(request, "fireworks_detect/manual_pending_submission.html", { "pending": pending, + "editable": True, "direction_label": direction_names.get(pending.direction_cardinal) if direction_degrees is not None else "", }) + +def _manual_observation_details(request, occurrences): + raw_time = request.POST.get("occurred_at", "").strip() + if raw_time: + occurred_at = parse_datetime(raw_time) + if occurred_at is None: + return None, _("Enter a valid occurrence date and time.") + if timezone.is_naive(occurred_at): + occurred_at = timezone.make_aware(occurred_at, timezone.get_current_timezone()) + if occurred_at > timezone.now() + timedelta(minutes=5): + return None, _("Occurrence time cannot be in the future.") + else: + occurred_at = timezone.now() + + details = { + "captured_at": occurred_at, + "occurrence_time_approximate": request.POST.get("time_approximate") == "on", + "observation_duration_minutes": None, + "observation_duration_kind": "", + } + if occurrences >= BURST_MIN_BANGS and request.POST.get("duration_confirmed") == "on": + raw_duration = request.POST.get("duration_minutes", "").strip() + try: + duration = int(raw_duration) if raw_duration else DEFAULT_ESTIMATED_DURATION_MINUTES + except ValueError: + return None, _("Enter a duration between 1 and 1,440 minutes.") + if not 1 <= duration <= 1440: + return None, _("Enter a duration between 1 and 1,440 minutes.") + details["observation_duration_minutes"] = duration + details["observation_duration_kind"] = PendingEvent.DurationKind.ESTIMATED + return details, None + + +@require_http_methods(["POST"]) +@never_cache +def update_manual_pending_event(request, event_id): + if event_id not in request.session.get("manual_pending_ids", []): + raise Http404 + try: + occurrences = int(request.POST.get("occurrences", "")) + except (TypeError, ValueError): + occurrences = 0 + if not 1 <= occurrences <= 1000: + return render(request, "fireworks_detect/manual_pending_submission.html", {"error": _("Choose between 1 and 1,000 occurrences.")}, status=400) + _, error = _manual_observation_details(request, occurrences) + if error: + return render(request, "fireworks_detect/manual_pending_submission.html", {"error": error}, status=400) + # The occurrence time and location belong to the original observation. + duration = None + kind = "" + if occurrences >= BURST_MIN_BANGS and request.POST.get("duration_confirmed") == "on": + raw = request.POST.get("duration_minutes", "").strip() + duration = int(raw) if raw else DEFAULT_ESTIMATED_DURATION_MINUTES + kind = PendingEvent.DurationKind.ESTIMATED + with transaction.atomic(): + pending = get_object_or_404(PendingEvent.objects.select_for_update(), pk=event_id, source_type=PendingEvent.SourceType.MANUAL) + ManualReportRevision.objects.create( + pending_event=pending, original_pending_id=pending.pk, + previous_occurrences=pending.occurrences, new_occurrences=occurrences, + previous_duration_minutes=pending.observation_duration_minutes, + new_duration_minutes=duration, + ) + pending.occurrences = occurrences + pending.observation_duration_minutes = duration + pending.observation_duration_kind = kind + pending.save(update_fields=["occurrences", "observation_duration_minutes", "observation_duration_kind"]) + return render(request, "fireworks_detect/manual_pending_submission.html", {"pending": pending, "editable": True, "updated": True}) + @never_cache def events_list(request): return render(request, "fireworks_detect/events_list.html", {"events": Event.objects.all()[:30]}) @@ -549,23 +649,30 @@ def submit_sensor_pending(request): finally: uploaded.seek(0) raw_time = request.POST.get("captured_at", "") - try: - captured_at = datetime.fromtimestamp(float(raw_time), datetime_timezone.utc) if re.fullmatch(r"[0-9]{10}(?:\.[0-9]+)?", raw_time) else parse_datetime(raw_time) - if captured_at is None or timezone.is_naive(captured_at): - raise ValueError() - if captured_at > timezone.now() + timedelta(minutes=5): - raise ValueError() - except (ValueError, OverflowError, OSError): - return _submission_error("invalid_capture_time", "captured_at must be a valid past UTC time.") + if not raw_time and request.POST.get("time_state") == "unknown": + captured_at = None + else: + try: + captured_at = datetime.fromtimestamp(float(raw_time), datetime_timezone.utc) if re.fullmatch(r"[0-9]{10}(?:\.[0-9]+)?", raw_time) else parse_datetime(raw_time) + if captured_at is None or timezone.is_naive(captured_at): + raise ValueError() + if captured_at > timezone.now() + timedelta(minutes=5): + raise ValueError() + except (ValueError, OverflowError, OSError): + return _submission_error("invalid_capture_time", "Provide a valid UTC captured_at or time_state=unknown.") firmware = request.POST.get("firmware_version", "") if not 1 <= len(firmware) <= 64 or not firmware.isprintable(): return _submission_error("invalid_firmware_version", "Provide a printable firmware_version of at most 64 characters.") - metadata = {} - for key in ("trigger_type", "signal_rms", "signal_peak", "latitude", "longitude"): + metadata = {"time_state": "unknown"} if captured_at is None else {} + for key in ("trigger_type", "signal_rms", "signal_peak", "latitude", "longitude", "capture_started_at", "triggered_at", "queued_at"): value = request.POST.get(key) if value is None or value == "": continue - if key == "trigger_type": + if key.endswith("_at"): + parsed = parse_datetime(value) + if parsed is None or timezone.is_naive(parsed): + return _submission_error("invalid_metadata", f"Invalid {key}.") + elif key == "trigger_type": if len(value) > 64 or not value.isprintable(): return _submission_error("invalid_metadata", "Invalid trigger_type.") else: @@ -585,7 +692,7 @@ def submit_sensor_pending(request): if existing: if existing.audio_sha256 != audio_hash: return _submission_error("event_id_conflict", "event_id already belongs to different audio.", 409) - return JsonResponse({"submission_id": str(existing.submission_id), "status": "pending" if existing.pending_event_id else "reviewed", "duplicate": True}, status=200) + return JsonResponse({"submission_id": str(existing.submission_id), "event_id": event_id, "status": "pending" if existing.pending_event_id else "reviewed", "duplicate": True}, status=200) rate_key = f"sensor-submissions:{sensor.pk}" if cache.get(rate_key, 0) >= 30: response = _submission_error("rate_limited", "Sensor submission rate exceeded.", 429) @@ -606,17 +713,20 @@ def submit_sensor_pending(request): except (HTTPError, URLError, TimeoutError, OSError, ValueError, json.JSONDecodeError): return _submission_error("classifier_unavailable", "Classification failed; retain the queued recording.", 502) uploaded.seek(0) + pending = None try: with transaction.atomic(): pending = PendingEvent.objects.create(audio_file=uploaded, sensor=sensor, source_type=PendingEvent.SourceType.SENSOR, original_filename=Path(uploaded.name).name[:255], classifier_response=payload, captured_at=captured_at, firmware_version=firmware, device_metadata=metadata) receipt = SensorSubmission.objects.create(sensor=sensor, event_id=event_id, audio_sha256=audio_hash, pending_event=pending) except IntegrityError: + if pending and pending.audio_file: + pending.audio_file.storage.delete(pending.audio_file.name) existing = SensorSubmission.objects.get(sensor=sensor, event_id=event_id) if existing.audio_sha256 != audio_hash: return _submission_error("event_id_conflict", "event_id already belongs to different audio.", 409) - return JsonResponse({"submission_id": str(existing.submission_id), "status": "pending" if existing.pending_event_id else "reviewed", "duplicate": True}) + return JsonResponse({"submission_id": str(existing.submission_id), "event_id": event_id, "status": "pending" if existing.pending_event_id else "reviewed", "duplicate": True}) sensor.record_heartbeat(submission=True) - return JsonResponse({"submission_id": str(receipt.submission_id), "pending_event_id": pending.pk, "status": "pending", "classification": payload}, status=201) + return JsonResponse({"submission_id": str(receipt.submission_id), "event_id": event_id, "pending_event_id": pending.pk, "status": "pending", "classification": payload}, status=201) @csrf_exempt diff --git a/frontend/src/scripts/event-map.js b/frontend/src/scripts/event-map.js index 4c6adad..8c84fd5 100644 --- a/frontend/src/scripts/event-map.js +++ b/frontend/src/scripts/event-map.js @@ -24,13 +24,17 @@ const bounds = L.latLngBounds([]); h3Cells.forEach((cell) => { + const hasManual = cell.manual_reports > 0; + const hasSensor = cell.sensor_reports > 0; + const color = hasManual && hasSensor ? "#a78bfa" : hasSensor ? "#22d3ee" : "#f59e0b"; const polygon = L.polygon(cell.boundary, { - color: "#f59e0b", weight: 2, fillColor: "#f59e0b", fillOpacity: 0.25, + color, weight: 2, fillColor: color, fillOpacity: 0.25, }).addTo(map); polygon.bindPopup( "H3 " + cell.cell + "" + "" + cell.reports + " " + (cell.reports === 1 ? (t.report || "report") : (t.reports || "reports")) + " · " + cell.occurrences + - " " + (cell.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + " · " + (t.resolution || "resolution") + " " + h3Resolution + "" + " " + (cell.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + " · " + (t.resolution || "resolution") + " " + h3Resolution + + "
" + cell.manual_reports + " " + (t.manualReport || "Manual report") + " · " + cell.sensor_reports + " " + (t.sensorEvent || "Sensor event") + "" ); bounds.extend(L.latLngBounds(cell.boundary)); }); @@ -60,7 +64,11 @@ const reportIcon = L.divIcon({ className: "", html: "
✦
", iconSize: [37, 37], iconAnchor: [19, 19], }); + const sensorIcon = L.divIcon({ + className: "", html: "
S
", iconSize: [37, 37], iconAnchor: [19, 19], + }); reports.forEach((report) => { + const isSensor = report.source_type === "sensor"; const visualStatus = report.visually_confirmed ? (t.visuallyConfirmed || "Visually confirmed") : (t.notVisuallyConfirmed || "Not visually confirmed"); let detail = report.occurrences + " " + (report.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + " · " + visualStatus + "
" + (t.reported || "Reported") + " " + report.reported_on; @@ -70,8 +78,8 @@ detail += " (±" + Math.round(report.direction_accuracy_degrees) + "°)"; } } - L.marker(report.center, { icon: reportIcon }).addTo(map).bindPopup( - "" + (t.manualReport || "Manual report") + " · H3 " + report.cell + "" + + L.marker(report.center, { icon: isSensor ? sensorIcon : reportIcon }).addTo(map).bindPopup( + "" + (isSensor ? (t.sensorEvent || "Sensor event") : (t.manualReport || "Manual report")) + " · H3 " + report.cell + "" + "" + detail + "" ); @@ -98,4 +106,4 @@ input.addEventListener("change", () => { range.value = "custom"; }); }); } - \ No newline at end of file + diff --git a/frontend/src/scripts/manual-report.js b/frontend/src/scripts/manual-report.js index aff439f..632d48d 100644 --- a/frontend/src/scripts/manual-report.js +++ b/frontend/src/scripts/manual-report.js @@ -21,6 +21,10 @@ const reportTime = document.querySelector("#manual-report-time"); const reportHours = document.querySelector("#report-clock-hours"); const reportMinutes = document.querySelector("#report-clock-minutes"); + const occurredAt = document.querySelector("#manual-occurred-at"); + const useNow = document.querySelector("#manual-use-now"); + const burstStatus = document.querySelector("#manual-burst-status"); + const burstDuration = document.querySelector("#manual-burst-duration"); let orientationListener; let compassUnavailableTimeout; let compassRotation = null; @@ -47,6 +51,11 @@ updateReportTime(); if (reportTime) window.setInterval(updateReportTime, 60000); const idleSubmitLabel = submitLabel?.textContent || "I heard fireworks"; + useNow?.addEventListener("click", () => { + const now = new Date(); + const local = new Date(now.getTime() - now.getTimezoneOffset() * 60000); + occurredAt.value = local.toISOString().slice(0, 16); + }); const setSubmissionState = (next, message = "") => { manualForm.dataset.state = next; @@ -70,16 +79,23 @@ return successful; }; + const showBurstState = () => { + const burst = Number(occurrences.value) >= 3; + if (burstStatus) burstStatus.textContent = burst ? (t.burstEvent || "Burst Event") : (t.ordinaryReport || "Ordinary report"); + if (burstDuration) burstDuration.hidden = !burst; + }; const setCount = (value) => { const count = Number.parseInt(value, 10); occurrences.value = String(Math.min(1000, Math.max(1, Number.isFinite(count) ? count : 1))); decrease.disabled = occurrences.value === "1"; increase.disabled = occurrences.value === "1000"; + showBurstState(); }; setCount(occurrences.value); decrease.addEventListener("click", () => setCount(Number(occurrences.value) - 1)); increase.addEventListener("click", () => setCount(Number(occurrences.value) + 1)); occurrences.addEventListener("change", () => setCount(occurrences.value)); + occurrences.addEventListener("input", showBurstState); const stopCompassReading = () => { if (orientationListener) window.removeEventListener("deviceorientation", orientationListener); diff --git a/frontend/src/styles/components/manual-report-structure.scss b/frontend/src/styles/components/manual-report-structure.scss index 7405f46..874796c 100644 --- a/frontend/src/styles/components/manual-report-structure.scss +++ b/frontend/src/styles/components/manual-report-structure.scss @@ -6,6 +6,67 @@ --manual-report-section-gap: 1rem; } +.manual-report__occurrence, .manual-report__duration { + display: grid; + gap: .55rem; + max-width: 36rem; + margin-bottom: var(--manual-report-section-gap); + padding: .85rem 1rem; + border: 1px solid #584891; + border-radius: 1rem; + background: #151932; + color: #e9def8; + input[type="datetime-local"], input[type="number"] { + width: 100%; + min-height: 2.75rem; + padding: .45rem .65rem; + border: 1px solid #725da4; + border-radius: .55rem; + color: #f5f0ff; + background: #211d3d; + font: inherit; + color-scheme: dark; + } + small { color: #cbbce5; } +} + +.manual-report__duration[hidden] { display: none; } +.manual-report__time-row { + display: flex; + gap: .5rem; + align-items: center; + input { min-width: 0; flex: 1; } + button { flex: none; } +} +@media (max-width: 30rem) { + .manual-report__time-row { flex-direction: column; align-items: stretch; } + .manual-report__time-row button { align-self: flex-start; } +} +.manual-report__occurrence button { + justify-self: start; + padding: .35rem .75rem; + border: 1px solid #725da4; + border-radius: .55rem; + color: #f5f0ff; + background: #302553; + cursor: pointer; +} +.manual-report__check { + display: flex; + align-items: center; + gap: .5rem; + color: #e9def8; +} +.manual-report__burst-status { margin: .5rem 0 0; color: #ffbf72; font-weight: 750; } +.manual-submission__edit { + display: grid; + gap: .4rem; + max-width: 18rem; + margin-top: 1rem; + input[type="number"] { min-height: 2.5rem; padding: .4rem; border-radius: .5rem; } + button { min-height: 2.5rem; cursor: pointer; } +} + .manual-report__primary { display: grid; gap: var(--manual-report-section-gap); diff --git a/frontend/src/styles/pages/map.scss b/frontend/src/styles/pages/map.scss index 1fcf0f7..786d09f 100644 --- a/frontend/src/styles/pages/map.scss +++ b/frontend/src/styles/pages/map.scss @@ -258,6 +258,14 @@ body { background: #8b5cf633; } +.legend-sensor { + width: .85rem; + height: .85rem; + border: 2px solid #a5f3fc; + border-radius: .2rem; + background: #0891b2; +} + .legend-line { width: 1.1rem; border-top: 2px dashed #644b9c; @@ -277,6 +285,20 @@ body { box-shadow: 0 .3rem 1rem #a84f2670; } +.sensor-icon { + display: grid; + width: 2.3rem; + height: 2.3rem; + place-items: center; + border: 2px solid #cffafe; + border-radius: .55rem; + color: #ecfeff; + font-size: 1rem; + font-weight: 900; + background: #087e97; + box-shadow: 0 .3rem 1rem #06465a88; +} + .source-icon { display: grid; width: 2.45rem; @@ -388,6 +410,18 @@ body { font-size: .78rem; } +@media (max-width:80rem) { + .filters { + grid-template-columns: repeat(5,minmax(0,1fr)); + .filter-submit { + grid-column: 1/3; + } + .map-tag { + grid-column: 5; + } + } +} + @media (max-width:52rem) { .shell { width: min(100% - 1.25rem,80rem); @@ -405,6 +439,9 @@ body { .filter:first-child { grid-column: 1/-1; } + .filter-submit, .map-tag { + grid-column: auto; + } } .map { height: 32rem; diff --git a/locale/nl/LC_MESSAGES/django.mo b/locale/nl/LC_MESSAGES/django.mo index e956dd4..4e803a1 100644 Binary files a/locale/nl/LC_MESSAGES/django.mo and b/locale/nl/LC_MESSAGES/django.mo differ diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po index ee5c6b0..45fa5cf 100644 --- a/locale/nl/LC_MESSAGES/django.po +++ b/locale/nl/LC_MESSAGES/django.po @@ -1403,3 +1403,83 @@ msgstr "Toegang tot de microfoon is geweigerd. Je kunt nog steeds handmatig meld msgid "Microphone capture failed." msgstr "Opnemen met de microfoon is mislukt." +msgid "When did it happen?" +msgstr "Wanneer gebeurde het?" + +msgid "Use now" +msgstr "Gebruik nu" + +msgid "Time is approximate" +msgstr "Tijdstip is ongeveer" + +msgid "Leave the time empty to use the submission time." +msgstr "Laat leeg om het verzendtijdstip te gebruiken." + +msgid "Ordinary report" +msgstr "Gewone melding" + +msgid "Burst Event" +msgstr "Knalreeks" + +msgid "Estimated observation window (minutes, for 3+ bangs)" +msgstr "Geschatte tijdsduur (minuten, vanaf 3 knallen)" + +msgid "Use this estimated window for burst intensity" +msgstr "Gebruik deze geschatte tijdsduur voor de intensiteit" + +msgid "Optional. Without an accepted window, BoomCast reports the count without an intensity rating." +msgstr "Optioneel. Zonder bevestigde tijdsduur toont BoomCast geen intensiteit." + +msgid "Correct bang count" +msgstr "Aantal knallen aanpassen" + +msgid "Estimated minutes for a burst" +msgstr "Geschatte minuten voor de knalreeks" + +msgid "Use this estimated window" +msgstr "Gebruik deze geschatte tijdsduur" + +msgid "Update report" +msgstr "Melding bijwerken" + +msgid "Duration" +msgstr "Tijdsduur" + +msgid "Intensity" +msgstr "Intensiteit" + +msgid "Not rated" +msgstr "Niet beoordeeld" + +msgid "Unknown" +msgstr "Onbekend" + +msgid "Approximately" +msgstr "Ongeveer" + +msgid "Submitted" +msgstr "Verzonden" + +msgid "Occurred" +msgstr "Gebeurd" + +msgid "minutes (estimated)" +msgstr "minuten (geschat)" + +msgid "minutes (measured)" +msgstr "minuten (gemeten)" + +msgid "bangs per 15 minutes" +msgstr "knallen per 15 minuten" + +msgid "Light" +msgstr "Licht" + +msgid "Moderate" +msgstr "Matig" + +msgid "Intense" +msgstr "Intens" + +msgid "Report updated!" +msgstr "Melding bijgewerkt!" diff --git a/media/fireworks_audio/2026/10/09/sample.wav b/media/fireworks_audio/2026/10/09/sample.wav new file mode 100644 index 0000000..6a8dc96 --- /dev/null +++ b/media/fireworks_audio/2026/10/09/sample.wav @@ -0,0 +1 @@ +RIFF0000WAVEdata \ No newline at end of file diff --git a/media/fireworks_audio/2026/10/09/sound-signal-manual-20261009-111456-7d6a24bf.wav b/media/fireworks_audio/2026/10/09/sound-signal-manual-20261009-111456-7d6a24bf.wav deleted file mode 100644 index 0ee8d2e..0000000 Binary files a/media/fireworks_audio/2026/10/09/sound-signal-manual-20261009-111456-7d6a24bf.wav and /dev/null differ diff --git a/members/__pycache__/test_sensors.cpython-313.pyc b/members/__pycache__/test_sensors.cpython-313.pyc index 24dc709..7990eef 100644 Binary files a/members/__pycache__/test_sensors.cpython-313.pyc and b/members/__pycache__/test_sensors.cpython-313.pyc differ diff --git a/members/templates/members/partials/sensor_detail.html b/members/templates/members/partials/sensor_detail.html index 3dc7ea6..fa1e4e6 100644 --- a/members/templates/members/partials/sensor_detail.html +++ b/members/templates/members/partials/sensor_detail.html @@ -13,6 +13,7 @@
{% with status=heartbeat %}● {{ status.1 }}{% endwith %}
+
{% trans "Sensor ID" %}
{{ sensor.pk }}
{% trans "Last heartbeat" %}
{{ sensor.last_heartbeat|date:"j M Y, H:i"|default:"—" }}
{% trans "Last submission" %}
{{ sensor.last_submission|date:"j M Y, H:i"|default:"—" }}
{% trans "Token prefix" %}
{{ sensor.token_prefix|default:"—" }}
diff --git a/members/templates/members/partials/sensor_list.html b/members/templates/members/partials/sensor_list.html index fa2b646..2f05e43 100644 --- a/members/templates/members/partials/sensor_list.html +++ b/members/templates/members/partials/sensor_list.html @@ -7,6 +7,7 @@

{{ sensor.name }}

{% with status=sensor.heartbeat_status %}● {{ status.1 }}{% endwith %}
{% if sensor.is_active %}{% trans "Enabled" %}{% else %}{% trans "Disabled" %}{% endif %}
+
{% trans "Sensor ID" %}
{{ sensor.pk }}
{% trans "Last heartbeat" %}
{{ sensor.last_heartbeat|date:"j M Y, H:i"|default:"—" }}
{% trans "Created" %}
{{ sensor.created_at|date:"j M Y" }}
{% trans "Token prefix" %}
{{ sensor.token_prefix|default:"—" }}
diff --git a/members/test_sensors.py b/members/test_sensors.py index 1e8f4aa..cf7f86d 100644 --- a/members/test_sensors.py +++ b/members/test_sensors.py @@ -32,6 +32,7 @@ class SensorSettingsTests(TestCase): listing = self.client.get(reverse("user_settings")) self.assertContains(listing, "Balcony") self.assertContains(listing, "Portable") + self.assertContains(listing, f"{sensor.pk}", html=True) self.assertNotContains(listing, "System") self.assertNotContains(listing, "Bob's device") self.client.force_login(self.bob) @@ -45,6 +46,7 @@ class SensorSettingsTests(TestCase): detail = self.client.get(reverse("manage_sensor", args=[sensor.pk]), **headers) self.assertContains(detail, "Balcony") + self.assertContains(detail, f"{sensor.pk}", html=True) self.assertContains(detail, reverse("sensor_list")) self.assertNotContains(detail, "") diff --git a/staticfiles/vite/assets/frontend/src/entries/dashboard.js-C2DCho1J.js b/staticfiles/vite/assets/frontend/src/entries/dashboard.js-C2DCho1J.js new file mode 100644 index 0000000..00f3979 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/dashboard.js-C2DCho1J.js @@ -0,0 +1 @@ +/* empty css *//* empty css */import"./fireworks-home.js-CZsCTUTv.js";import"./map.js-ZTK3kmoy.js";import"../../../manual-report-44fwUW4y.js";import"../../../theme-DXAi27ON.js"; diff --git a/staticfiles/vite/assets/frontend/src/entries/home.js-Cam3C1NX.js b/staticfiles/vite/assets/frontend/src/entries/home.js-Cam3C1NX.js new file mode 100644 index 0000000..ce00367 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/home.js-Cam3C1NX.js @@ -0,0 +1 @@ +/* empty css */import"../../../manual-report-44fwUW4y.js";import"../../../theme-DXAi27ON.js"; diff --git a/staticfiles/vite/assets/frontend/src/entries/map.js-ZTK3kmoy.js b/staticfiles/vite/assets/frontend/src/entries/map.js-ZTK3kmoy.js new file mode 100644 index 0000000..9bbb4a7 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/map.js-ZTK3kmoy.js @@ -0,0 +1 @@ +/* empty css *//* empty css */import"../../../theme-DXAi27ON.js";const e=window.BOOMCAST_I18N||{},u=document.getElementById("event-map"),f=u.dataset.h3Resolution,n=L.map(u,{zoomControl:!1,scrollWheelZoom:!1}).setView([52.1326,5.2913],7);L.control.zoom({position:"bottomleft"}).addTo(n);const m=L.control({position:"topright"});m.onAdd=()=>{const o=L.DomUtil.create("div","map-compass");return o.setAttribute("role","img"),o.setAttribute("aria-label",e.mapCompass||"Map compass: north is up"),o.innerHTML='NESW↑',L.DomEvent.disableClickPropagation(o),o};m.addTo(n);L.tileLayer("https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png",{maxZoom:18,attribution:"© OpenStreetMap contributors"}).addTo(n);const M=JSON.parse(document.getElementById("h3-cells-data").textContent),y=JSON.parse(document.getElementById("map-events-data").textContent),d=L.latLngBounds([]);M.forEach(o=>{const s=o.manual_reports>0,c=o.sensor_reports>0,t=s&&c?"#a78bfa":c?"#22d3ee":"#f59e0b";L.polygon(o.boundary,{color:t,weight:2,fillColor:t,fillOpacity:.25}).addTo(n).bindPopup('H3 '+o.cell+''+o.reports+" "+(o.reports===1?e.report||"report":e.reports||"reports")+" · "+o.occurrences+" "+(o.occurrences===1?e.occurrence||"occurrence":e.occurrences||"occurrences")+" · "+(e.resolution||"resolution")+" "+f+"
"+o.manual_reports+" "+(e.manualReport||"Manual report")+" · "+o.sensor_reports+" "+(e.sensorEvent||"Sensor event")+"
"),d.extend(L.latLngBounds(o.boundary))});function v(o){return["N","NE","E","SE","S","SW","W","NW"][Math.floor((o+22.5)%360/45)]}function b(o,s,c){const a=s*Math.PI/180,r=o[0]*Math.PI/180,h=o[1]*Math.PI/180,i=c/6378137,l=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(a)),g=h+Math.atan2(Math.sin(a)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(l));return[l*180/Math.PI,g*180/Math.PI]}const S=L.divIcon({className:"",html:'
✦
',iconSize:[37,37],iconAnchor:[19,19]}),_=L.divIcon({className:"",html:'
S
',iconSize:[37,37],iconAnchor:[19,19]});y.forEach(o=>{const s=o.source_type==="sensor",c=o.visually_confirmed?e.visuallyConfirmed||"Visually confirmed":e.notVisuallyConfirmed||"Not visually confirmed";let t=o.occurrences+" "+(o.occurrences===1?e.occurrence||"occurrence":e.occurrences||"occurrences")+" · "+c+"
"+(e.reported||"Reported")+" "+o.reported_on;if(o.direction_degrees!==null&&(t+="
"+(e.compassDirection||"Compass direction")+" "+Math.round(o.direction_degrees)+"° ("+v(o.direction_degrees)+")",o.direction_accuracy_degrees!==null&&(t+=" (±"+Math.round(o.direction_accuracy_degrees)+"°)")),L.marker(o.center,{icon:s?_:S}).addTo(n).bindPopup(''+(s?e.sensorEvent||"Sensor event":e.manualReport||"Manual report")+" · H3 "+o.cell+''+t+""),o.direction_degrees!==null){const a=b(o.center,o.direction_degrees,900);L.polyline([o.center,a],{color:"#fff7e6",weight:9,opacity:.8}).addTo(n),L.polyline([o.center,a],{color:"#6d45a0",weight:5,opacity:1}).addTo(n);const r=L.divIcon({className:"",html:'
↑
',iconSize:[56,56],iconAnchor:[28,28]});L.marker(a,{icon:r,interactive:!1}).addTo(n)}});d.isValid()&&n.fitBounds(d.pad(.18));const p=document.getElementById("range");p&&document.querySelectorAll("#from-date, #to-date").forEach(o=>{o.addEventListener("change",()=>{p.value="custom"})}); diff --git a/staticfiles/vite/assets/manual-report-44fwUW4y.js b/staticfiles/vite/assets/manual-report-44fwUW4y.js new file mode 100644 index 0000000..86f60a1 --- /dev/null +++ b/staticfiles/vite/assets/manual-report-44fwUW4y.js @@ -0,0 +1 @@ +const we=document.querySelector("#manual-report-form"),g=window.BOOMCAST_I18N||{};function fe(){if(!we)return null;const e=document.querySelector("#burst-start"),t=e.closest(".burst-listener"),n=e.closest(".manual-report__supporting"),i=document.querySelector("#burst-state"),I=document.querySelector("#burst-panel"),y=document.querySelector("#burst-heading"),L=document.querySelector("#burst-detail"),w=document.querySelector("#burst-waveform"),Z=document.querySelector("#burst-preview"),se=document.querySelector("#burst-resume"),re=document.querySelector("#burst-discard"),pe=document.querySelector("#burst-stop"),_=document.querySelector("#burst-error"),A=new Float32Array(300);let f=0,S="off",M,d,X,c,G,x,k,v;function $(){const a=w.getContext("2d");a.clearRect(0,0,w.width,w.height),a.fillStyle="#ffbd62";const l=w.width/A.length,p=Math.max(.003,...A);for(let s=0;s{for(let V=0;V{if(l.type==="level"&&(S==="listening"||S==="tail"))A[f]=l.value,f=(f+1)%A.length,$();else if(l.type==="trigger"&&S==="listening")N("tail");else if(l.type==="clip"){const p=new File([be(l.samples,l.sampleRate)],he(),{type:"audio/wav"});v?(v(p),v=null):S==="tail"&&(ee(),k=p,x=URL.createObjectURL(p),Z.src=x,Z.hidden=!1,N("captured"))}},X.connect(c),c.connect(G).connect(d.destination),await d.resume(),A.fill(0),f=0,$(),N("listening")}catch(l){await P(),t&&(t.dataset.state="error"),n&&(n.dataset.state="error"),i&&(i.textContent=g.microphoneUnavailable||"Microphone unavailable"),_.textContent=l.name==="NotAllowedError"?g.microphoneDenied||"Microphone permission was denied. Manual reporting is still available.":g.microphoneFailed||"Microphone capture failed.",_.hidden=!1}finally{e.disabled=!1}}async function P(){v&&(v(null),v=null),ee(),c==null||c.disconnect(),X==null||X.disconnect(),G==null||G.disconnect(),M==null||M.getTracks().forEach(a=>a.stop()),await(d==null?void 0:d.close()),M=d=X=c=G=null,A.fill(0),f=0,N("off")}function te(){ee(),A.fill(0),f=0,$(),c==null||c.port.postMessage("reset"),c&&N("listening")}return e.addEventListener("click",ye),pe.addEventListener("click",P),re.addEventListener("click",te),se.addEventListener("click",te),window.addEventListener("pagehide",P),document.addEventListener("visibilitychange",()=>{document.hidden&&P()}),{get active(){return S!=="off"},async clipForSubmission(){return k||(S==="off"||!c?null:new Promise(a=>{v=a,c.port.postMessage("snapshot")}))},submissionSucceeded:te}}const o=window.BOOMCAST_I18N||{},m=document.querySelector("#manual-report-form"),K=document.querySelector("#manual-submit"),F=document.querySelector("#manual-submit-label"),C=document.querySelector("#manual-occurrences"),de=document.querySelector("#manual-decrease"),Ce=document.querySelector("#manual-increase"),Se=document.querySelector("#manual-latitude"),Ge=document.querySelector("#manual-longitude"),O=document.querySelector("#manual-direction-degrees"),ve=document.querySelector("#manual-direction-accuracy"),j=()=>document.querySelector("#manual-capture-direction"),u=()=>document.querySelector("#manual-direction-status"),r=()=>document.querySelector("#manual-direction-panel"),H=document.querySelector("#manual-compass"),T=document.querySelector("#manual-compass-home"),z=document.querySelector("#manual-compass-rose"),Re=document.querySelector("#manual-compass-heading"),E=document.querySelector("#manual-report-time"),ce=document.querySelector("#report-clock-hours"),le=document.querySelector("#report-clock-minutes"),Ze=document.querySelector("#manual-occurred-at"),ne=document.querySelector("#manual-use-now"),ge=document.querySelector("#manual-burst-status"),ue=document.querySelector("#manual-burst-duration");let B,J,R=null;const Y=fe(),oe=e=>Number.isFinite(e),ie=e=>[o.north||"North",o.northeast||"Northeast",o.east||"East",o.southeast||"Southeast",o.south||"South",o.southwest||"Southwest",o.west||"West",o.northwest||"Northwest"][Math.floor((e+22.5)%360/45)],Q=e=>Number(e.toFixed(1)).toString(),Ie=()=>{var I,y;if(!E)return;const e=new Date;E.dateTime=e.toISOString();const t=new Intl.DateTimeFormat(document.documentElement.lang||void 0,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(e),n=(I=t.find(L=>L.type==="hour"))==null?void 0:I.value,i=(y=t.find(L=>L.type==="minute"))==null?void 0:y.value;!n||!i||!ce||!le||(ce.textContent=n,le.textContent=i,E.setAttribute("aria-label",`${n}:${i}`))};Ie();E&&window.setInterval(Ie,6e4);const Me=(F==null?void 0:F.textContent)||"I heard fireworks";ne==null||ne.addEventListener("click",()=>{const e=new Date,t=new Date(e.getTime()-e.getTimezoneOffset()*6e4);Ze.value=t.toISOString().slice(0,16)});const h=(e,t="")=>{if(m.dataset.state=e,K.disabled=e==="submitting",F&&(F.textContent=e==="submitting"?o.sendingReport||"Sending…":Me),t){const n=document.querySelector("#manual-submission");n.className="manual-report__submission",n.textContent=t}},Ae=(e,t)=>{const n=new DOMParser().parseFromString(e,"text/html").querySelector("#manual-submission");return n?(document.querySelector("#manual-submission").replaceWith(n),h(t?"submitted":"error"),t):(h("error",o.reportFailed||"Could not send the report. Please try again."),!1)},me=()=>{const e=Number(C.value)>=3;ge&&(ge.textContent=e?o.burstEvent||"Burst Event":o.ordinaryReport||"Ordinary report"),ue&&(ue.hidden=!e)},U=e=>{const t=Number.parseInt(e,10);C.value=String(Math.min(1e3,Math.max(1,Number.isFinite(t)?t:1))),de.disabled=C.value==="1",Ce.disabled=C.value==="1000",me()};U(C.value);de.addEventListener("click",()=>U(Number(C.value)-1));Ce.addEventListener("click",()=>U(Number(C.value)+1));C.addEventListener("change",()=>U(C.value));C.addEventListener("input",me);const q=()=>{B&&window.removeEventListener("deviceorientation",B),window.clearTimeout(J),B=null,J=null,H.hidden=!0,R=null},Xe=e=>{const t=-e;if(R===null)R=t,z.style.transition="none",z.style.transform=`rotate(${R}deg)`,z.offsetWidth,z.style.transition="";else{const n=(t-R+540)%360-180;R+=n,z.style.transform=`rotate(${R}deg)`}Re.textContent=`${Q(e)}° · ${ie(e)}`,H.setAttribute("aria-label",`${o.compassDirection||"Compass direction"} ${Q(e)}° ${ie(e)}`),H.hidden=!1},We=(e,t)=>{const n=u();if(n)if(n.classList.toggle("manual-direction-panel__status--accuracy",t!==null),t===null)n.textContent=o.accuracyUnavailable||"Accuracy unavailable";else{const I=document.createElement("span");I.textContent=o.accuracy||"Accuracy";const y=document.createElement("strong");y.textContent=`±${Q(t)}°`,n.replaceChildren(I,y)}const i=j();i&&(i.textContent=o.stopCapture||"Stop measuring direction")},Be=()=>{u()&&(q(),r()&&(r().dataset.state="measuring"),u().textContent=o.pointPhone||"Point the top of your phone toward the sound — direction will update live.",B=e=>{const t="webkitCompassHeading"in e,n=oe(e.webkitCompassHeading)?e.webkitCompassHeading:!t&&e.absolute&&oe(e.alpha)?(360-e.alpha)%360:null;if(n===null||n<0||n>=360)return;const i=oe(e.webkitCompassAccuracy)&&e.webkitCompassAccuracy>=0?e.webkitCompassAccuracy:null;O.value=n,ve.value=i===null?"":i,We(n,i),Xe(n),window.clearTimeout(J)},window.addEventListener("deviceorientation",B),J=window.setTimeout(()=>{q();const e=j(),t=u();e&&(e.textContent=o.captureDirection||"Start measuring direction"),t&&(t.textContent=o.compassUnavailable||"Compass unavailable on this device."),r()&&(r().dataset.state="unavailable")},15e3))},He=async()=>{var e;if(B){q(),j().textContent=o.captureAgain||"Measure again",r()&&(r().dataset.state=O.value?"captured":"ready");return}if((e=u())==null||e.classList.remove("manual-direction-panel__status--accuracy"),!window.isSecureContext){u().textContent=o.secureCompass||"Compass capture requires a secure HTTPS connection.",r()&&(r().dataset.state="unavailable");return}if(typeof window.DeviceOrientationEvent>"u"){u().textContent=o.compassUnavailable||"Compass unavailable on this device.",r()&&(r().dataset.state="unavailable");return}if(typeof DeviceOrientationEvent.requestPermission=="function"){u().textContent=o.compassPermission||"Requesting compass permission…";try{if(await DeviceOrientationEvent.requestPermission(!0)!=="granted"){u()&&(u().textContent=o.compassDenied||"Compass permission denied."),r()&&(r().dataset.state="unavailable");return}}catch{u()&&(u().textContent=o.compassDenied||"Compass permission denied."),r()&&(r().dataset.state="unavailable");return}}Be()},ae=async()=>{if(U(C.value),q(),h("submitting",o.sendingReport||"Sending…"),Y!=null&&Y.active){try{const e=await Y.clipForSubmission(),t=new FormData(m);e&&t.append("audio",e);const n=await fetch(m.action,{method:"POST",body:t,credentials:"same-origin"}),i=await n.text();Ae(i,n.ok)&&Y.submissionSucceeded()}catch{h("error",o.reportFailed||"Could not send the report. Please try again.")}return}if(window.htmx)try{htmx.ajax("POST",m.action,{source:m,target:"#manual-submission",swap:"outerHTML"})}catch{h("error",o.reportFailed||"Could not send the report. Please try again.")}else m.submit()};m.addEventListener("click",e=>{e.target.closest("#manual-capture-direction")&&He(),e.target.closest(".manual-direction-panel__close")&&(q(),T&&T.append(H))});document.body.addEventListener("htmx:beforeSwap",e=>{var t;((t=e.detail.target)==null?void 0:t.id)==="manual-direction-panel"&&T&&T.append(H)});document.body.addEventListener("htmx:afterSwap",e=>{var n,i;if(((n=e.detail.target)==null?void 0:n.id)!=="manual-direction-panel")return;j()&&((i=r().querySelector(".manual-direction-panel__copy"))==null||i.after(H));const t=document.querySelector("#manual-direction-summary");if(t&&O.value!==""){const I=Number(O.value);t.textContent=`${ie(I)} · ${Q(I)}°`,r().dataset.state="captured"}});K.addEventListener("click",()=>{if(!K.disabled){if(h("submitting",o.requestingLocation||"Requesting your optional location…"),!navigator.geolocation){ae();return}navigator.geolocation.getCurrentPosition(e=>{Se.value=e.coords.latitude,Ge.value=e.coords.longitude,ae()},()=>ae(),{enableHighAccuracy:!1,maximumAge:3e5,timeout:1e4})}});m.addEventListener("submit",e=>{e.preventDefault(),K.disabled||K.click()});document.body.addEventListener("htmx:afterRequest",e=>{if(e.detail.elt!==m)return;const t=e.detail.xhr;t?t.status>=400?Ae(t.responseText,!1):h("submitted"):h("error",o.reportFailed||"Could not send the report. Please try again.")});document.body.addEventListener("htmx:sendError",e=>{e.detail.elt===m&&h("error",o.reportFailed||"Could not send the report. Please try again.")}); diff --git a/staticfiles/vite/assets/manual-report-BTZbA1qV.css b/staticfiles/vite/assets/manual-report-BTZbA1qV.css new file mode 100644 index 0000000..5c09995 --- /dev/null +++ b/staticfiles/vite/assets/manual-report-BTZbA1qV.css @@ -0,0 +1 @@ +.manual-report__supporting{padding:1rem;border:1px solid #514282;border-radius:1rem;background:#11152c}.manual-report__supporting-header{display:flex;align-items:center;gap:.7rem}.manual-report__microphone{display:grid;width:2.5rem;height:2.5rem;flex:none;place-items:center;border-radius:.7rem;background:#2a2051;font-size:1.3rem}.burst-listener__state{display:block;margin-top:.15rem;color:#b9addb;font-size:.84rem}.manual-report__supporting[data-state=listening] .burst-listener__state{color:#8fe5cc}.manual-report__supporting[data-state=error] .burst-listener__state{color:#ffbd9d}.burst-listener{width:100%;margin-top:.85rem}.burst-listener__button,.burst-listener__actions button{min-height:2.75rem;padding:.65rem 1rem;border:1px solid #8d77d2;border-radius:.7rem;color:#e8dcff;font:inherit;font-weight:750;background:#292148;cursor:pointer}.burst-listener__button{width:100%}.burst-listener__panel{color:#f0eaff}.burst-listener__panel strong{font-size:.92rem}.burst-listener__panel canvas{display:block;width:100%;height:4rem;margin:.7rem 0 .35rem;border-radius:.5rem;background:linear-gradient(90deg,#191738,#241b44)}.burst-listener__panel p{margin:.35rem 0 .75rem;color:#b9addb;font-size:.82rem}.burst-listener__panel audio{width:100%;margin-bottom:.75rem}.burst-listener__actions{display:flex;flex-wrap:wrap;gap:.5rem}.burst-listener__actions button{flex:1 1 10rem}.burst-listener__actions #burst-stop{border-color:#fb9b72;color:#ffd8c4;background:#2e1b31}.burst-listener [hidden]{display:none!important}.burst-listener [role=alert]{margin:.65rem 0 0;color:#ffd1b6}.burst-listener button:focus-visible{outline:3px solid #c9b4ff;outline-offset:3px}:root[data-theme=light] .manual-report__supporting{border-color:#d9b4d8;background:#fff8fb}:root[data-theme=light] .manual-report__microphone{background:#ead2eb}:root[data-theme=light] .burst-listener__state,:root[data-theme=light] .burst-listener__panel p{color:#694b68}:root[data-theme=light] .burst-listener__panel{color:#321d42}:root[data-theme=light] .burst-listener__button,:root[data-theme=light] .burst-listener__actions button{border-color:#b68bb5;color:#321d42;background:#ead2eb}:root[data-theme=light] .burst-listener__actions #burst-stop{border-color:#cf7957;color:#71331d;background:#ffe9de}.manual-compass{display:grid;justify-items:center;width:7rem;margin:.6rem 0 0 auto;color:#fff3d7;font-size:.78rem;font-weight:850;font-variant-numeric:tabular-nums}.manual-compass[hidden]{display:none}.manual-compass__dial{position:relative;width:5.75rem;aspect-ratio:1;border:2px solid #f2d7a8;border-radius:50%;background:radial-gradient(circle,#342441 0,#342441 28%,#211a32 75%);box-shadow:0 .35rem 1rem #09061566,inset 0 0 0 .25rem #ffffff12}.manual-compass__rose{position:absolute;top:0;right:0;bottom:0;left:0;transition:transform .12s ease-out}.manual-compass__rose span{position:absolute;line-height:1}.manual-compass__north{top:.38rem;left:50%;color:#ff9e78;transform:translate(-50%)}.manual-compass__east{right:.47rem;top:50%;transform:translateY(-50%)}.manual-compass__south{bottom:.38rem;left:50%;transform:translate(-50%)}.manual-compass__west{left:.47rem;top:50%;transform:translateY(-50%)}.manual-compass__pointer{position:absolute;top:-.55rem;left:50%;width:0;height:0;border-right:.37rem solid transparent;border-bottom:.65rem solid #ffbd62;border-left:.37rem solid transparent;transform:translate(-50%);filter:drop-shadow(0 .1rem .15rem #160d1b)}.manual-compass__center{position:absolute;top:50%;left:50%;width:.5rem;aspect-ratio:1;border-radius:50%;background:#ffbd62;transform:translate(-50%,-50%)}.manual-compass__heading{margin-top:.5rem;white-space:nowrap}:root[data-theme=light] .manual-compass{color:#43243d}:root[data-theme=light] .manual-compass__dial{border-color:#996a9b;background:radial-gradient(circle,#f8ebf8 0,#f8ebf8 28%,#e8d7e9 75%)}:root[data-theme=light] .manual-compass__east,:root[data-theme=light] .manual-compass__south,:root[data-theme=light] .manual-compass__west{color:#43243d}@media(prefers-reduced-motion:reduce){.manual-compass__rose{transition:none}}.manual-report__header{max-width:42rem}.manual-report{--manual-report-section-gap: 1rem}.manual-report__occurrence,.manual-report__duration{display:grid;gap:.55rem;max-width:36rem;margin-bottom:var(--manual-report-section-gap);padding:.85rem 1rem;border:1px solid #584891;border-radius:1rem;background:#151932;color:#e9def8}.manual-report__occurrence input[type=datetime-local],.manual-report__occurrence input[type=number],.manual-report__duration input[type=datetime-local],.manual-report__duration input[type=number]{width:100%;min-height:2.75rem;padding:.45rem .65rem;border:1px solid #725da4;border-radius:.55rem;color:#f5f0ff;background:#211d3d;font:inherit;color-scheme:dark}.manual-report__occurrence small,.manual-report__duration small{color:#cbbce5}.manual-report__duration[hidden]{display:none}.manual-report__time-row{display:flex;gap:.5rem;align-items:center}.manual-report__time-row input{min-width:0;flex:1}.manual-report__time-row button{flex:none}@media(max-width:30rem){.manual-report__time-row{flex-direction:column;align-items:stretch}.manual-report__time-row button{align-self:flex-start}}.manual-report__occurrence button{justify-self:start;padding:.35rem .75rem;border:1px solid #725da4;border-radius:.55rem;color:#f5f0ff;background:#302553;cursor:pointer}.manual-report__check{display:flex;align-items:center;gap:.5rem;color:#e9def8}.manual-report__burst-status{margin:.5rem 0 0;color:#ffbf72;font-weight:750}.manual-submission__edit{display:grid;gap:.4rem;max-width:18rem;margin-top:1rem}.manual-submission__edit input[type=number]{min-height:2.5rem;padding:.4rem;border-radius:.5rem}.manual-submission__edit button{min-height:2.5rem;cursor:pointer}.manual-report__primary{display:grid;gap:var(--manual-report-section-gap);max-width:36rem}.manual-report__quantity{padding:1rem;border:1px solid #584891;border-radius:1rem;background:#151932}.manual-report .manual-report__quantity #manual-occurrences{width:100%;min-width:0;min-height:3.75rem;margin:0;padding:0;border:0;color:#f5f0ff;font-size:clamp(2.25rem,8vw,3.5rem);font-weight:850;text-align:center;background:transparent;-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.manual-report__quantity #manual-occurrences::-webkit-inner-spin-button,.manual-report__quantity #manual-occurrences::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.manual-report__stepper{display:grid;grid-template-columns:3.5rem minmax(0,1fr) 3.5rem;align-items:center;gap:.5rem}.manual-report__stepper button{display:grid;place-items:center;width:3.5rem;height:3.5rem;min-height:0;padding:0;border:1px solid #6d54ac;border-radius:50%;color:#f5f0ff;font:inherit;font-size:2rem;line-height:1;background:#302553;cursor:pointer}.manual-report__stepper button:disabled{opacity:.4;cursor:default}.manual-report .manual-report__primary .manual-direction-panel{width:100%;margin:0;border-radius:1rem;background:#1a1739}.manual-direction-panel[data-state=measuring]{border-color:#a27cff}.manual-direction-panel[data-state=captured]{border-color:#68dba1}.manual-direction-panel[data-state=unavailable]{border-color:#d38b7a}.manual-direction-panel__topline{display:flex;align-items:center;justify-content:space-between;gap:1rem}.manual-direction-panel__summary{margin:.35rem 0 .8rem;color:#f5f0ff;font-weight:700}.manual-report .manual-direction-panel__status--accuracy{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin:.75rem 0;padding:.55rem .75rem;border:1px solid #5d4d92;border-radius:.7rem;color:#d9cfee;background:#191630;font-size:.85rem}.manual-direction-panel__status--accuracy strong{color:#f5edff;font-size:1rem;font-variant-numeric:tabular-nums;white-space:nowrap}.manual-direction-panel__open,.manual-direction-panel__close{min-height:2.75rem;border:1px solid #8d77d2;border-radius:.7rem;color:#e8dcff;font:inherit;font-weight:750;background:#302553;cursor:pointer}.manual-direction-panel__open{padding:.5rem .85rem}.manual-direction-panel__close{min-width:2.75rem;font-size:1.4rem}.manual-report #manual-submit{width:100%;max-width:36rem;min-height:4.5rem;margin-top:var(--manual-report-section-gap)}.manual-report__submit:disabled{cursor:wait;opacity:.72}.manual-submission{display:grid;justify-items:center;gap:.5rem;max-width:36rem;margin-top:1rem;padding:1.3rem;border:1px solid #4caa82;border-radius:1rem;color:#eafff2;text-align:center;background:#10352e}.manual-submission__icon{display:grid;width:3.5rem;height:3.5rem;place-items:center;border:2px solid #6ce4a8;border-radius:50%;color:#eafff2;font-size:2rem;background:#226c51}.manual-submission strong{font-size:1.35rem}.manual-submission p{margin:0;line-height:1.45}.manual-submission__summary{margin-top:.35rem!important;color:#b2e8cf;font-size:.9rem}.manual-submission--error{border-color:#d37c6a;color:#fff0e8;background:#3a1c2b}.manual-submission--error .manual-submission__icon{border-color:#ffac8c;background:#9b493a}.manual-report__submission:empty{display:none}.manual-report button:focus-visible,.manual-report input:focus-visible{outline:3px solid #c9b4ff;outline-offset:3px}.manual-report__supporting{max-width:36rem;margin-top:var(--manual-report-section-gap);padding-top:1.25rem;border-top:1px solid #584891}.manual-report__supporting h3{margin:0;color:#d8cffd;font-size:1rem}.manual-report__supporting .burst-listener{width:100%}:root[data-theme=light] .manual-report__quantity{border-color:#d9b4d8;background:#fff8fb}:root[data-theme=light] .manual-report__quantity #manual-occurrences{border:0!important;color:#321d42!important;background:transparent!important}:root[data-theme=light] .manual-report__stepper button,:root[data-theme=light] .manual-direction-panel__open,:root[data-theme=light] .manual-direction-panel__close{color:#321d42;border-color:#b68bb5;background:#ead2eb}:root[data-theme=light] .manual-direction-panel__summary{color:#321d42}:root[data-theme=light] .manual-report .manual-direction-panel__status--accuracy{border-color:#cfaad1;color:#694b68;background:#fff8fb}:root[data-theme=light] .manual-direction-panel__status--accuracy strong{color:#321d42}:root[data-theme=light] .manual-submission{border-color:#54a67b;color:#164d34;background:#e8fff2}:root[data-theme=light] .manual-submission__icon{color:#fff}:root[data-theme=light] .manual-submission__summary{color:#2b6b48}:root[data-theme=light] .manual-submission--error{border-color:#ca7d65;color:#743520;background:#fff0e8}:root[data-theme=light] .manual-report__supporting{border-color:#d9b4d8}:root[data-theme=light] .manual-report__supporting h3{color:#492846}@media(max-width:42rem){.home-grid{grid-template-columns:minmax(0,1fr)}body:not(.dashboard-page){padding:max(1rem,env(safe-area-inset-top,0px)) max(.5rem,env(safe-area-inset-right,0px)) max(1rem,env(safe-area-inset-bottom,0px)) max(.5rem,env(safe-area-inset-left,0px))}.home-grid .manual-report,.dashboard-report,.dashboard-report .manual-report{overflow:visible}.manual-report{padding:1.25rem}.dashboard-report .manual-report{padding:0}.manual-report__header{padding-right:2.5rem}.manual-report form{padding-bottom:calc(5rem + env(safe-area-inset-bottom,0px))}.manual-report #manual-submit{position:sticky;bottom:calc(.5rem + env(safe-area-inset-bottom,0px));z-index:10;box-shadow:0 .7rem 1.6rem #070a18b3}body:has(#manual-occurrences:focus) .manual-report #manual-submit{position:static}.dashboard-intro{margin-bottom:1rem}.dashboard-intro h1{font-size:clamp(2rem,8vw,2.8rem)}.dashboard-intro p:last-child{margin-top:.75rem;font-size:.95rem;line-height:1.4}.dashboard-section{margin-top:1rem}.dashboard-shell{padding-bottom:calc(2rem + env(safe-area-inset-bottom,0px))}.manual-report__stepper{grid-template-columns:3.5rem minmax(0,1fr) 3.5rem}}@media(max-width:23.5rem){.manual-report{padding:1rem}.manual-report__quantity{padding:.75rem}.manual-report__stepper{grid-template-columns:3rem minmax(0,1fr) 3rem;gap:.25rem}.manual-report__stepper button{width:3rem;height:3rem}}.manual-report__heading-row{display:flex;align-items:center;gap:.7rem}.manual-report__fire{flex:none;font-size:clamp(1.8rem,5vw,2.5rem);filter:drop-shadow(0 .2rem .65rem rgba(255,112,59,.5333333333))}.manual-report__intro,.dashboard-report .manual-report__intro{margin-bottom:.85rem}.report-clock{box-sizing:border-box;width:100%;max-width:36rem;margin:0 0 1rem;padding:.65rem .95rem .7rem;border:1px solid #69539d;border-radius:.85rem;background:linear-gradient(115deg,#17162d,#10182c);box-shadow:inset 0 1px #ffffff0a}.report-clock__label{color:#cbbce5;font-size:.66rem;font-weight:750;letter-spacing:.13em;text-transform:uppercase}.report-clock__display{display:flex;align-items:end;justify-content:space-between;gap:.75rem}.report-clock__time{display:inline-flex;align-items:center;color:#ffbf72;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:clamp(2rem,9vw,2.45rem);font-weight:700;line-height:1.1;letter-spacing:0;font-variant-numeric:tabular-nums;text-shadow:0 0 .7rem rgba(255,150,59,.3333333333);white-space:nowrap}.report-clock__time span{display:inline-block}.report-clock__time #report-clock-hours,.report-clock__time #report-clock-minutes{width:2ch}.report-clock__colon{width:1ch;flex:none;margin-inline:-.08em;line-height:1;text-align:center;transform:translateY(-.06em);animation:report-clock-blink 2s steps(1,end) infinite}.report-clock__now{display:inline-flex;align-items:center;gap:.4rem;flex:none;padding:.2rem .45rem;border:1px solid #93634d;border-radius:999px;color:#ffd2a2;font-size:.7rem;font-weight:750;letter-spacing:.08em;text-transform:uppercase}.report-clock__dot{width:.4rem;height:.4rem;border-radius:50%;background:#ffab5d}@keyframes report-clock-blink{50%{opacity:0}}.manual-direction-panel__open{width:100%;text-align:left}.manual-direction-panel--open .manual-compass{width:100%;margin:.5rem auto 1rem}.manual-direction-panel--open .manual-compass__dial{width:min(100%,12rem);border-color:#8b67d4;background:radial-gradient(circle,#302054 0,#302054 20%,#17132d 70%);box-shadow:0 0 0 .35rem #6640a228,0 0 2rem #ac6aff35}.manual-direction-panel--open .manual-compass__pointer{border-bottom-color:#ff925f}.manual-direction-panel--open .manual-compass__heading{font-size:1.1rem}.manual-report__stepper button,.manual-direction-panel__open,.manual-direction-panel__close,.manual-report__submit{transition:transform .15s ease,box-shadow .15s ease,filter .15s ease}.manual-report__stepper button:not(:disabled):active,.manual-direction-panel__open:active,.manual-report__submit:not(:disabled):active{transform:scale(.97)}.manual-report__submit:not(:disabled):hover{filter:brightness(1.05)}.manual-submission--success .manual-submission__icon{animation:manual-confirm .35s ease-out both}@keyframes manual-confirm{0%{transform:scale(.75);opacity:.3}to{transform:scale(1);opacity:1}}:root[data-theme=dark] .home-grid .manual-report,:root[data-theme=dark] .dashboard-report{border-color:#7256ab;background:radial-gradient(circle at 88% 5%,rgba(88,37,74,.3333333333),transparent 13rem),linear-gradient(155deg,#151326,#0d1022 72%);box-shadow:0 1rem 3rem #02041399}:root[data-theme=dark] .manual-report__title{color:#fff8f3}:root[data-theme=dark] .manual-report__intro{color:#d6cce4}:root[data-theme=dark] .manual-report__quantity{border-color:#514896;background:linear-gradient(145deg,#19183a,#121834);box-shadow:inset 0 0 0 1px #ffffff08}:root[data-theme=dark] .home-grid .manual-direction-panel,:root[data-theme=dark] .dashboard-report .manual-direction-panel{border-color:#59499b;background:linear-gradient(145deg,#211945,#151835)}:root[data-theme=dark] .manual-report__supporting{border-color:#493d7d;background:linear-gradient(145deg,#15142f,#10162d)}:root[data-theme=dark] .manual-report__stepper button{box-shadow:0 .25rem .7rem #07041655}:root[data-theme=dark] .manual-report__submit{background:linear-gradient(110deg,#ffc276,#ff7654);box-shadow:0 .55rem 1.35rem #e2633a4d}:root[data-theme=dark] .manual-direction-panel[data-state=measuring]{border-color:#a27cff}:root[data-theme=dark] .manual-direction-panel[data-state=captured]{border-color:#68dba1}:root[data-theme=dark] .manual-direction-panel[data-state=unavailable]{border-color:#d38b7a}:root[data-theme=light] .report-clock{border-color:#8b6bab;background:linear-gradient(115deg,#221b37,#182039)}:root[data-theme=light] .manual-direction-panel--open .manual-compass__dial{background:radial-gradient(circle,#f8ebf8 0,#f8ebf8 25%,#e8d7e9 75%)}@media(prefers-reduced-motion:reduce){.manual-report__stepper button,.manual-direction-panel__open,.manual-direction-panel__close,.manual-report__submit{transition:none}.manual-submission--success .manual-submission__icon{animation:none}.report-clock__colon{animation:none;opacity:1}} diff --git a/staticfiles/vite/assets/map-CneBwLkV.css b/staticfiles/vite/assets/map-CneBwLkV.css new file mode 100644 index 0000000..96b6e45 --- /dev/null +++ b/staticfiles/vite/assets/map-CneBwLkV.css @@ -0,0 +1 @@ +:root{--ink: #eef3ff;--muted: #a9b9d8;--surface: #111a31;--line: #2a3a61;--blue: #83b7ff;--violet: #b69cff;--amber: #ffbc61;--green: #6ee7b7}*{box-sizing:border-box}body{min-width:320px;min-height:100vh;margin:0;color:var(--ink);font-family:var(--font-ui);background:radial-gradient(circle at 8% 0%,#263a76 0,transparent 32rem),radial-gradient(circle at 95% 0%,#492064 0,transparent 27rem),#090e1d}.shell{width:min(100% - 2.5rem,70rem);margin:0 auto;padding:clamp(2rem,6vw,5rem) 0}.topbar{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:3.5rem}.brand{display:flex;align-items:center;gap:.7rem;color:var(--ink);font-size:.9rem;font-weight:800;letter-spacing:.1em;text-decoration:none;text-transform:uppercase}.brand-mark{display:grid;width:2.25rem;aspect-ratio:1;place-items:center;border-radius:.75rem;color:#141022;background:linear-gradient(135deg,#fcd34d,#fb7185);box-shadow:0 .5rem 1.5rem #fb718550}.nav{display:flex;gap:.35rem;padding:.25rem;border:1px solid var(--line);border-radius:.75rem;background:#111a31a6}.nav a{padding:.5rem .75rem;border-radius:.5rem;color:var(--muted);font-size:.86rem;font-weight:700;text-decoration:none}.nav a[aria-current=page]{color:var(--ink);background:#2a3b67}.kicker{margin:0 0 .65rem;color:#bfdbfe;font-size:.76rem;font-weight:800;letter-spacing:.14em;text-transform:uppercase}.headline{display:flex;align-items:end;justify-content:space-between;gap:2rem;margin-bottom:2rem}.headline h1{margin:0;font-size:clamp(2.3rem,5vw,4.5rem);line-height:.98;letter-spacing:-.06em}.headline p{max-width:30rem;margin:0;color:var(--muted);line-height:1.6}.filters{display:grid;grid-template-columns:repeat(5,minmax(8rem,1fr)) auto auto;gap:.75rem;align-items:end;margin-bottom:1rem;padding:1rem;border:1px solid var(--line);border-radius:1.1rem;background:#121d37d9;box-shadow:0 1rem 3rem #03071466}.filter{display:grid;gap:.35rem}.filter label{color:#9fb1d5;font-size:.7rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.filter select,.filter input{width:100%;min-height:2.65rem;border:1px solid #354a77;border-radius:.65rem;padding:0 .75rem;color:var(--ink);font:inherit;background:#0c1428}.filter select:focus,.filter input:focus{outline:2px solid #82b5ff;outline-offset:2px}.filter-submit{min-height:2.65rem;border:1px solid #8ab7ff;border-radius:.65rem;padding:0 1rem;color:#101a31;font:inherit;font-weight:800;background:#b9d6ff;cursor:pointer}.map-tag{align-self:center;padding:.46rem .65rem;border:1px solid #4a5f8e;border-radius:999px;color:#c9d8f6;font-size:.75rem;font-weight:700;white-space:nowrap;background:#1d2b4e}.map-panel{overflow:hidden;border:1px solid var(--line);border-radius:1.25rem;background:var(--surface);box-shadow:0 1.5rem 4rem #0206168a}.map-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.2rem;border-bottom:1px solid var(--line)}.map-header strong{font-size:.95rem}.live{display:flex;align-items:center;gap:.45rem;color:#a7f3d0;font-size:.8rem}.live i{width:.5rem;height:.5rem;border-radius:50%;background:var(--green);box-shadow:0 0 0 .25rem #34d3992e}.map-wrap{position:relative}.map{height:clamp(30rem,65vh,45rem);background:#dce4cf}.legend{position:absolute;z-index:600;right:1rem;bottom:1rem;width:min(15rem,100% - 2rem);padding:.85rem;border:1px solid #344973;border-radius:.8rem;color:#dce7fe;font-size:.78rem;background:#101a31e8;box-shadow:0 .75rem 2rem #05091480;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.legend h2{margin:0 0 .6rem;font-size:.82rem}.legend div{display:flex;align-items:center;gap:.5rem;margin-top:.4rem}.legend-dot{width:.7rem;height:.7rem;border:2px solid #f2c56b;border-radius:50%;background:#ed8e2e88}.legend-ring{width:.85rem;height:.85rem;border:2px solid #a98af7;border-radius:50%;background:#8b5cf633}.legend-sensor{width:.85rem;height:.85rem;border:2px solid #a5f3fc;border-radius:.2rem;background:#0891b2}.legend-line{width:1.1rem;border-top:2px dashed #644b9c}.report-icon{display:grid;width:2.3rem;height:2.3rem;place-items:center;border:2px solid #fff3d5;border-radius:50%;color:#452000;font-size:1rem;font-weight:900;background:#f7a52f;box-shadow:0 .3rem 1rem #a84f2670}.sensor-icon{display:grid;width:2.3rem;height:2.3rem;place-items:center;border:2px solid #cffafe;border-radius:.55rem;color:#ecfeff;font-size:1rem;font-weight:900;background:#087e97;box-shadow:0 .3rem 1rem #06465a88}.source-icon{display:grid;width:2.45rem;height:2.45rem;place-items:center;border:2px solid #fff3d5;border-radius:50% 50% 50% 0;color:#452000;font-size:1.15rem;background:#f7a52f;box-shadow:0 .3rem 1rem #a84f2670;transform:rotate(-45deg)}.source-icon span{transform:rotate(45deg)}.direction-marker{display:grid;width:3.5rem;height:3.5rem;place-items:center;border:3px solid #fff7e6;border-radius:50%;color:#fff;background:#6d45a0;box-shadow:0 .3rem 1rem #281642b3}.direction-marker span{display:block;font-size:2.45rem;font-weight:950;line-height:1;text-shadow:0 .1rem .25rem #1e1136;transform-origin:center}.map-compass{position:relative;width:5rem;height:5rem;border:2px solid #eaf1ff;border-radius:50%;color:#f7fbff;font-size:.72rem;font-weight:900;background:#111a31e8;box-shadow:0 .5rem 1.5rem #05091480;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.map-compass span{position:absolute;display:grid;place-items:center}.map-compass .compass-n{top:.35rem;left:50%;transform:translate(-50%);color:#ffd18c}.map-compass .compass-e{top:50%;right:.45rem;transform:translateY(-50%)}.map-compass .compass-s{bottom:.35rem;left:50%;transform:translate(-50%)}.map-compass .compass-w{top:50%;left:.45rem;transform:translateY(-50%)}.map-compass .compass-needle{top:1.3rem;left:50%;color:#ffd18c;font-size:2rem;line-height:1;transform:translate(-50%);text-shadow:0 .1rem .35rem #3b1b48}.leaflet-control-zoom a{color:#243456!important}.leaflet-popup-content-wrapper,.leaflet-popup-tip{color:#e9f1ff;background:#14203a}.leaflet-popup-content{margin:.75rem .9rem;font-family:inherit}.popup-title{display:block;margin-bottom:.2rem;font-weight:800}.popup-meta{color:#a9b9d8;font-size:.78rem}@media(max-width:80rem){.filters{grid-template-columns:repeat(5,minmax(0,1fr))}.filters .filter-submit{grid-column:1/3}.filters .map-tag{grid-column:5}}@media(max-width:52rem){.shell{width:min(100% - 1.25rem,80rem)}.topbar{margin-bottom:2.5rem}.headline{align-items:start;flex-direction:column;gap:1rem}.filters{grid-template-columns:1fr 1fr}.filters .filter:first-child{grid-column:1/-1}.filters .filter-submit,.filters .map-tag{grid-column:auto}.map{height:32rem}}@media(max-width:30rem){.nav a{padding:.5rem}.filters{grid-template-columns:1fr}.filters .filter:first-child{grid-column:auto}} diff --git a/templates/js_translations.html b/templates/js_translations.html index 1d87918..f7e146a 100644 --- a/templates/js_translations.html +++ b/templates/js_translations.html @@ -81,6 +81,9 @@ window.BOOMCAST_I18N = { irrelevantGateMessage: "{% trans 'BoomCast could not identify a sound this service currently looks for. You can still submit it for manual review.' as value %}{{ value|escapejs }}", gateChooseMessage: "{% trans 'Recording checked. Choose another recording or submit for manual review.' as value %}{{ value|escapejs }}", secureVideoFailed: "{% trans 'Could not prepare this video for upload. Please choose an audio recording.' as value %}{{ value|escapejs }}", - manualReport: "{% trans 'Manual report' as value %}{{ value|escapejs }}" + manualReport: "{% trans 'Manual report' as value %}{{ value|escapejs }}", + burstEvent: "{% trans 'Burst Event' as value %}{{ value|escapejs }}", + ordinaryReport: "{% trans 'Ordinary report' as value %}{{ value|escapejs }}", + sensorEvent: "{% trans 'Sensor event' as value %}{{ value|escapejs }}" };