Data model¶
Field-level reference for the media_classification app's core models — the Classification four-type hierarchy, its dynamic attributes, and the AI provider models. For the concepts behind these, see Classification model and AI pipeline architecture.
Classification¶
| Field | Type | Notes |
|---|---|---|
resource |
FK → Resource |
The media item this classification is about. |
classification_type |
choice | FINAL | AI | USER | FEEDBACK. |
model |
FK → AIProvider, nullable |
Set only for AI-type rows — which provider produced it. |
source_classification |
FK → self, nullable | For USER: the row it was forked from. For FINAL: the approved AI/USER row. For FEEDBACK: the approved row it corrects. |
final_classification |
FK → self, nullable | For AI/USER/FEEDBACK: always points at the resource's FINAL row. |
frames_msgpack |
FileField | Per-classification zstd-compressed msgpack of per-frame object data — see Msgpack contract. |
is_approved |
bool | Only meaningful on FINAL. |
is_blank |
bool | No animal/object of interest present. |
is_setup |
bool | Camera-setup/test shot, excluded from most analytics. |
is_gold_standard |
bool | Marked as fully correct (objects identified, classified, and tracked) — eligible for benchmarking/training data. |
ClassificationDynamicAttrs¶
One row per observed object (or expert-authored group) on a non-FINAL classification.
| Field | Type | Notes |
|---|---|---|
classification |
FK → Classification (related_name="dynamic_attrs") |
|
observation_type |
choice | human | animal | vehicle | blank | unknown | unclassified. |
observation_level |
choice | object (default, one row per tracked individual) | group (expert-authored aggregate, no bbox/individual_id, count = group size). |
species |
FK → Species, nullable |
See Taxonomy & GBIF. |
sex |
choice | unknown | female | male. |
age |
choice | unknown | adult | subadult | juvenile | offspring. |
behaviour |
choice | undefined | grazing | browsing | rooting | vigilance | running | walking. |
count |
int | Default 1. For group rows, the expert-authored group size. |
count_new |
int, nullable | |
individual_id |
string, nullable | Human-assigned individual mark/tag. Must be null on group rows. |
classification_confidence |
decimal (0–1), nullable | |
bboxes |
JSON list | [xmin, ymin, width, height], relative coordinates, for the object's first occurrence. Must be empty/null on group rows. |
first_frame_index |
int | 0 for images; original-video-FPS frame index for video. |
distance |
float, nullable | Metres from camera at first occurrence — see Distance estimation. For video at ≥5 FPS, averaged over the first 3 frames. |
attrs |
JSON dict | Custom attributes defined by the project's Classificator. |
attr_confidence |
JSON dict | Per-attribute AI confidence scores. |
Database constraints enforce the object/group split: group rows can't carry bboxes, can't have an individual_id, and must have count >= 1.
AI provider models¶
AIProvider is a django-polymorphic base with two concrete subclasses:
| Model | Distinguishing field | Created by |
|---|---|---|
TrapperAIProvider |
connection → AIProviderConnection |
sync_ai_models (bootstrapped from an AI Manager) |
ExternalAIProvider |
none — bare AIProvider |
manually, for a model not registered on any connected AI Manager |
Shared AIProvider fields:
| Field | Type | Notes |
|---|---|---|
name, version, description |
string | |
provider_type |
choice | detection | classification | depth | pose. |
video_support |
bool | |
object_based |
bool | |
crop_image |
bool | Crop before classification — species-classification providers only. |
remote_id |
UUID, nullable | PredictionModel.id on the AI Manager. |
categories |
JSON | Camtrap DP-shaped attribute mapping: {attributeMappings: [{attributeType, labels: [{aiLabel, value, gbifSpeciesKey, speciesId, ...}]}]}. speciesId is computed by sync_ai_models — never hand-edit it. |
keypoint_topology |
JSON | Pose providers only: keypoint names/skeleton/default OKS anchors, stamped at sync time. |
is_active |
bool | Managed by sync; manually created providers stay active. |
model_file_hash |
string (SHA-256), nullable | Re-matches a provider across re-registrations with a new remote_id. |
keep_synced |
bool | Disable to preserve manual edits (e.g. hand-tuned categories) across future syncs. |
last_synced |
datetime, nullable | |
token |
string | Used in AI-callback URLs. |
AIProviderConnection (one per AI Manager instance):
| Field | Notes |
|---|---|
api_url |
Base URL of the AI Manager. |
api_auth_login / api_auth_passw |
Credentials of the AI Worker user on that AI Manager. |
trapper_instance_url |
This Expert's base URL, as seen from the AI Manager (callback target). |
is_active |
AIClassificationJob¶
One row per AI run submitted for a (project × collection) pair.
| Field | Notes |
|---|---|
id |
UUID. |
user_remote_task |
OneToOne → UserRemoteTask (tracks the remote job's lifecycle on the AI Manager). |
ai_provider |
FK → AIProvider. |
collection |
FK → ClassificationProjectCollection, nullable. |
stage |
Internal remote-task stage name. |
job_config |
JSON snapshot of exactly what was submitted — minimum_confidence, skip_empty, skip_missing_labels, tracker/depth config. The single source of truth for "what did this run actually do?" |
See also¶
- Classification model — the concepts behind this reference
- Msgpack contract — per-frame data that doesn't live in
ClassificationDynamicAttrs - Register & sync AI providers