BioScan Museo records two distinct activity streams: raw scan events (every time a visitor scans or views a species) and species audit log entries (every admin action such as creating, editing, or deleting a species). Both streams are exposed as filterable JSON endpoints for dashboards, exports, and automated reporting. Both endpoints share their logic with the corresponding HTML admin pages, so any filter accepted by the UI is equally valid here. All requests must be made by an authenticated session whose user account hasDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GustavoNightmare/InformacionMuseo/llms.txt
Use this file to discover all available pages before exploring further.
is_admin = True. Unauthenticated requests are redirected to the login page (HTTP 302); authenticated non-admin requests abort with HTTP 403.
GET /api/admin/metricas
Returns aggregated scan metrics for the given date range and optional filters. The response is built bybuild_scan_metrics_context(), which runs a set of SQL aggregation queries against the ScanEvent table.
Authentication: Login required + is_admin = True. Returns 403 for authenticated non-admin users.
Query parameters
Start date of the reporting window in
YYYY-MM-DD format. Defaults to 30 days before today. If start is later than end, the two values are silently swapped.End date (inclusive) in
YYYY-MM-DD format. Defaults to today (UTC). Invalid date strings fall back to the default 30-day window.Filter results to a single species by its internal ID. Ignored if the species does not exist in the database.
Filter by scan origin. Accepted values:
qr, web, manual. Any other value (including empty) is ignored and treated as “all origins”.Response
The resolved filter values applied to this request.
Top-level aggregate metrics for the filtered window.
Per-species scan breakdown, ordered by
total_scans descending. Each item contains:| Field | Type | Description |
|---|---|---|
species_id | string | Internal species ID. |
qr_id | string | QR identifier slug. |
nombre_comun | string | Common name. |
nombre_cientifico | string | Scientific name. |
total_scans | integer | Total scans for this species in the window. |
unique_users | integer | Distinct authenticated users who scanned it. |
last_scan | string | Timestamp of the most recent scan, formatted as YYYY-MM-DD HH:MM. Empty string if unavailable. |
Pre-formatted data arrays for rendering charts.
Example
GET /api/admin/especies/auditoria
Returns a paginated, filterable list of species audit log entries from theSpeciesAuditLog table. Audit events are created automatically whenever a species is created, updated, deleted, or viewed by an admin. Snapshots of the species name, scientific name, and qr_id are stored at write time so that log entries remain informative even after a species is deleted.
Authentication: Login required + is_admin = True. Returns 403 for authenticated non-admin users.
Query parameters
Filter by species internal ID. Accepted even if the species has been deleted, as long as historical log entries reference it.
Filter by action type. Accepted values:
created, updated, deleted, viewed_admin. Any other value is ignored.Filter by the integer user ID of the admin who performed the action. Ignored if the user does not exist.
Start date in
YYYY-MM-DD format. Defaults to 30 days before today.End date (inclusive) in
YYYY-MM-DD format. Defaults to today (UTC).Page number for pagination. Defaults to
1. Each page contains 10 items.Response
Resolved filter values.
Paginated list of audit log entries. Each item contains:
| Field | Type | Description |
|---|---|---|
id | integer | Audit log row ID. |
species_id | string | Internal species ID at the time of the event. |
species_name | string | Common name from the species record, or from the snapshot if the species was deleted. |
species_scientific_name | string | Scientific name (same fallback logic). |
qr_id | string | QR identifier (same fallback logic). |
action | string | One of created, updated, deleted, viewed_admin. |
field_name | string | null | The specific field that changed. Populated for updated events; null for others. |
old_value | string | null | Previous field value. Populated for updated events. |
new_value | string | null | New field value. Populated for updated events. |
created_at | string | Event timestamp formatted as YYYY-MM-DD HH:MM:SS. |
user_id | integer | null | ID of the admin who triggered the event. null for system-generated events. |
user_name | string | Display name of the user, or "Sistema" if user_id is null. |
notes | string | null | Free-text note attached to the event (e.g., "Especie creada", "Especie eliminada"). |
Total number of log entries matching the filters across all pages.
Pagination metadata.