Developer documentation

This chapter is targetted at developers and those who would like to understand the underlying data model.

In this chapter, we will discuss:

  • the data model - what data can WAStD handle?

  • the admin - manual data entry, validation, widgets

  • the API - programmatic data retrieval and query

  • the custom User app

  • remaining modules of the observations app

  • design smells

Design smells

Let’s start this chapter with early design decisions that could be refactored to be improved.

Unique identifiers

Fields with unique identifiers are called name. The word name is overloaded. The mixin class :ref:`shared.models.CodeLabelDescriptionMixin`_ brings three fields:

  • code - a unique, short, URL-safe short code

  • label - a human-readable label

  • description - a longer, comprehensive, complete description

Smell: inconsistent use of “name”, “label”, for unique identifiers across the codebase and docstrings.

Legacy sources

Two competing ways of tracking an upstream point of truth: :ref:`shared.models.LegacySourceMixin`_ and per model ChoiceField lookups. The underlying value is either a SmallInt (quick lookups, but incomrehensive to the user), or a short string.

Smell: refactor to use :ref:`shared.models.LegacySourceMixin`_. Mind that R package wastdr and ETL pipelines need to be updated too.

Hard-coded lookups

Hard-coding lookups prevents data corruption by over-eager admin users. Since we have much higher code churn than data model churn, these lookups are easy enough to maintain.

Smell: where to define lookup dicts - currently mixed in wastd.observations.models at both top level and model level.

Extending the application

ObservationGroup

TFA, TFL, TEC paper forms contain further observation groups, which are reviewed and evaluated for trustworthiness separately.

Each group becomes a model in TSC, inheriting from occurrences.models.ObservationGroup. WAStD can add new instances of Observation.

  • Model: add model to occurrences.models inheriting from ObservationGroup.

  • Migration: create, run in dev.

  • Form: create form for use in admin and views.

  • Admin: add Inline and standalone admin.

  • Views: CreateView, UpdateView. DetailView is that of related encounter.

  • URLs: create and update URLs. Add update_url to model.

  • Templates: card template for obsgroup model, add “create” link to either CAE/TAE detail template where applicable.

  • Tests: Create sample instances, view on detail page. Call create and update urls.

  • Docs: Migrate legacy docs on how to fill in the obsgroup sections.

  • DevOps: git, docker, deploy, migrate.

Data model

WAStD is designed to handle biological observations of any kind which happen during an encounter.

Both Encounters and Observations are polymorphic (database table inheritance) and share one primary key, while allowing for different fields for child models.

E.g., AnimalEncounters are Encounters (where, when, observed by, recorded by) with an Animal (species, sex, maturity, health). The combination of Animal attributes can determine which subsequent Observations are required.

Following this “mix&match” approach, e.g. an AnimalEncounter with a dead turtle will be a “Turtle Stranding” encounter, requiring TurtleMorphometricObesrvations, DistinguishingFeatureObservations, TurtleDamageObservations etc.

An AnimalEncounter with a nesting (= female, mature) turle will be a “Turtle Tagging” encounter, which requires a TurtleNestObservation, plus the above types of observations.

Both encounters will share MediaAttachments (photos, scanned field data sheet) and (if appropriate) TagObservations (flipper / PIT / satellite tags, biopsy samples etc.).

WAStD data model

wastd.observations.models Module

Observation models.

These models support opportunistic encounters with stranded, dead, injured, nesting turtles and possibly other wildlife, such as cetaceans and pinnipeds.

Species use a local name list, but should lookup a webservice. This Observation is generic for all species. Other Models can FK this Model to add species-specific measurements.

Observer name / address / phone / email is captured through the observer being a system user.

The combination of species and health determines subsequent measurements and actions:

  • [turtle, dugong, cetacean] damage observation

  • [turtle, dugong, cetacean] distinguishing features

  • [taxon] morphometrics

  • [flipper, pit, sat] tag observation

  • disposal actions

class wastd.observations.models.AnimalEncounter(*args, **kwargs)[source]

Bases: wastd.observations.models.Encounter

The encounter of an animal of a species.

Extends the base Encounter class with:

  • taxonomic group (choices), can be used to filter remaining form choices

  • species (choices)

  • sex (choices)

  • maturity (choices)

  • health (choices)

  • activity (choices)

  • behaviour (free text)

  • habitat (choices)

Turtle Strandings are encounters of turtles

exception DoesNotExist

Bases: wastd.observations.models.Encounter.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Encounter.MultipleObjectsReturned

activity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

behaviour

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

card_template()[source]
cause_of_death

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cause_of_death_confidence

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

checked_for_flipper_tags

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

checked_for_injuries

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

datetime_of_last_sighting

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

encounter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

encounter_ptr_id
get_absolute_url()[source]

Detail url, used by Django to link admin to site.

Default: app:model-detail(**pk).

get_activity_display(*, field=<django.db.models.fields.CharField: activity>)
get_cause_of_death_confidence_display(*, field=<django.db.models.fields.CharField: cause_of_death_confidence>)
get_cause_of_death_display(*, field=<django.db.models.fields.CharField: cause_of_death>)
get_checked_for_flipper_tags_display(*, field=<django.db.models.fields.CharField: checked_for_flipper_tags>)
get_checked_for_injuries_display(*, field=<django.db.models.fields.CharField: checked_for_injuries>)
property get_encounter_type

Infer the encounter type.

AnimalEncounters are either in water, tagging or stranding encounters. If the animal is dead (at various decompositional stages), a stranding is assumed. In water captures happen if the habitat is in the list of aquatic habitats. Remaining encounters are assumed to be taggings, as other encounters are excluded. Note that an animal encountered in water, or even a dead animal (whether that makes sense or not) can also be tagged.

get_habitat_display(*, field=<django.db.models.fields.CharField: habitat>)
get_health_display(*, field=<django.db.models.fields.CharField: health>)
get_maturity_display(*, field=<django.db.models.fields.CharField: maturity>)
get_nesting_disturbed_display(*, field=<django.db.models.fields.CharField: nesting_disturbed>)
get_nesting_event_display(*, field=<django.db.models.fields.CharField: nesting_event>)
get_scanned_for_pit_tags_display(*, field=<django.db.models.fields.CharField: scanned_for_pit_tags>)
get_sex_display(*, field=<django.db.models.fields.CharField: sex>)
get_sighting_status_display(*, field=<django.db.models.fields.CharField: sighting_status>)
get_species_display(*, field=<django.db.models.fields.CharField: species>)
get_taxon_display(*, field=<django.db.models.fields.CharField: taxon>)
habitat

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

health

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property is_new_capture

Return whether this Encounter is a new capture.

New captures are named after their primary flipper tag. An Encounter is a new capture if there are:

  • no associated TagObservations of is_recapture status

  • at least one associated TabObservation of is_new status

property is_stranding

Return whether the Encounters is stranding or tagging.

If the animal is not “alive”, it’s a stranding encounter, else it’s a tagging encounter.

laparoscopy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property latitude

Return the WGS 84 DD latitude.

property longitude

Return the WGS 84 DD longitude.

maturity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nesting_disturbed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nesting_event

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
scanned_for_pit_tags

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sex

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property short_name

A short, often unique, human-readable representation of the encounter.

Slugified and dash-separated:

  • Date of encounter as YYYY-mm-dd

  • longitude in WGS 84 DD, rounded to 4 decimals (<10m),

  • latitude in WGS 84 DD, rounded to 4 decimals (<10m), (missing sign!!)

  • health,

  • maturity,

  • species,

  • name if available (requires “update names” and tag obs)

The short_name could be non-unique for encounters of multiple stranded animals of the same species and deadness.

sighting_status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

site_of_first_sighting

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

site_of_first_sighting_id
site_of_last_sighting

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

site_of_last_sighting_id
species

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

taxon

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.Area(*args, **kwargs)[source]

Bases: django.db.models.base.Model

An area with a polygonal extent.

This model accommodates anything with a polygonal extent, providing:

  • Area type (to classify different kinds of areas)

  • Area name must be unique within area type

  • Polygonal extent of the area

Some additional fields are populated behind the scenes at each save and serve to cache low churn, high use content:

  • centroid: useful for spatial analysis and location queries

  • northern extent: useful to sort by latitude

  • as html: an HTML map popup

AREATYPE_CHOICES = (('MPA', 'MPA'), ('Locality', 'Locality'), ('Site', 'Site'), ('Region', 'DBCA Region'), ('District', 'DBCA District'))
AREATYPE_DBCA_DISTRICT = 'District'
AREATYPE_DBCA_REGION = 'Region'
AREATYPE_LOCALITY = 'Locality'
AREATYPE_MPA = 'MPA'
AREATYPE_SITE = 'Site'
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property absolute_admin_url

Return the absolute admin change URL.

property all_encounters_url

All Encounters within this Area.

property animal_encounters_url

The admin URL for AnimalEncounters within this Area.

area_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

as_html

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

campaigns

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

centroid
property derived_centroid

The centroid, derived from the polygon.

property derived_northern_extent

The northern extent, derived from the polygon.

encounter_area

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

encounter_first_sighting

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

encounter_last_sighting

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

encounter_site

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

geom
get_area_type_display(*, field=<django.db.models.fields.CharField: area_type>)
property get_popup

Generate HTML popup content.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property leaflet_title

A title for leaflet map markers.

length_survey_roundtrip_m

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

length_surveyed_m

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

make_rest_detailurl(format='json')[source]

Return the API detail URL in given format (default: JSON).

Permissible formats depend on configured renderers: api (human readable HTML), csv, json, jsonp, yaml, latex (PDF).

make_rest_listurl(format='json')[source]

Return the API list URL in given format (default: JSON).

Permissible formats depend on configured renderers: api (human readable HTML), csv, json, jsonp, yaml, latex (PDF).

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

northern_extent

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
save(*args, **kwargs)[source]

Cache centroid and northern extent.

survey_area

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

survey_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

surveyend_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

w2_location_code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

w2_place_code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.Campaign(*args, **kwargs)[source]

Bases: django.db.models.base.Model

An endeavour of a team to a Locality within a defined time range.

  • Campaign are owned by an Organisation.

  • Campaign own all Surveys and Encounters within its area and time range.

  • Campaign can nominate other Organisations as viewers of their data.

High level specs: https://github.com/dbca-wa/biosys-turtles/issues/81

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

campaignmediaattachment_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

destination

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

destination_id
encounter_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property encounters

Return the QuerySet of all Encounters within this Campaign.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
owner

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

owner_id
start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

survey_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property surveys

Return a QuerySet of Surveys.

team

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

viewers

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class wastd.observations.models.CampaignMediaAttachment(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A media attachment to a Campaign.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

MEDIA_TYPE_CHOICES = (('datasheet', 'Data sheet'), ('journal', 'Field journal'), ('communication', 'Communication record'), ('photograph', 'Photograph'), ('other', 'Other'))
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

attachment

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

campaign_id
property filepath

Path to file.

get_media_type_display(*, field=<django.db.models.fields.CharField: media_type>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

media_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.DispatchRecord(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

A record of dispatching the subject of the encounter.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
sent_to

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

sent_to_id
class wastd.observations.models.DugongMorphometricObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Morphometric measurements of a Dugong at an AnimalEncounter.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

body_girth_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

body_length_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_tusks_found_display(*, field=<django.db.models.fields.CharField: tusks_found>)
observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
tail_fluke_width_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tusks_found

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.Encounter(*args, **kwargs)[source]

Bases: polymorphic.models.PolymorphicModel, shared.models.UrlsMixin, django.db.models.base.Model

The base Encounter class.

  • When: Datetime of encounter, stored in UTC, entered and displayed in local timezome.

  • Where: Point in WGS84.

  • Who: The observer has to be a registered system user.

  • Source: The previous point of truth for the record.

  • Source ID: The ID of the encounter at the previous point of truth. This can be a corporate file number, a database primary key, and likely is prefixed or post-fixed. Batch imports can (if they use the ID consistently) use the ID to identify previously imported records and avoid duplication.

A suggested naming standard for paper records is <prefix><date><running-number>, with possible

  • prefix indicates data type (stranding, tagging, nest obs etc)

  • date is reversed Y-m-d

  • a running number caters for multiple records of the same prefix and date

These Paper record IDs should be recorded on the original paper forms (before scanning), used as file names for the PDF’d scans, and typed into WAStD.

The QA status can only be changed through transition methods, not directly. Changes to the QA status, as wells as versions of the data are logged to preserve the data lineage.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

ENCOUNTER_INWATER = 'inwater'
ENCOUNTER_LOGGER = 'logger'
ENCOUNTER_NEST = 'nest'
ENCOUNTER_OTHER = 'other'
ENCOUNTER_STRANDING = 'stranding'
ENCOUNTER_TAG = 'tag-management'
ENCOUNTER_TAGGING = 'tagging'
ENCOUNTER_TRACKS = 'tracks'
ENCOUNTER_TYPES = (('stranding', 'Stranding'), ('tagging', 'Tagging'), ('nest', 'Nest'), ('tracks', 'Tracks'), ('inwater', 'In water'), ('tag-management', 'Tag Management'), ('logger', 'Logger'), ('other', 'Other'))
LEAFLET_COLOUR = {'inwater': 'blue', 'logger': 'orange', 'nest': 'green', 'other': 'purple', 'stranding': 'darkred', 'tag-management': 'darkpuple', 'tagging': 'blue', 'tracks': 'cadetblue'}
LEAFLET_ICON = {'inwater': 'tint', 'logger': 'tablet', 'nest': 'home', 'other': 'question-circle', 'stranding': 'exclamation-circle', 'tag-management': 'cog', 'tagging': 'tags', 'tracks': 'truck'}
LOCATION_ACCURACY_CHOICES = (('10', 'GPS reading at exact location (10 m)'), ('1000', 'Site centroid or place name (1 km)'), ('10000', 'Rough estimate (10 km)'))
LOCATION_DEFAULT = '1000'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

STATUS_CHOICES = (('new', 'New'), ('proofread', 'Proofread'), ('curated', 'Curated'), ('published', 'Published'), ('flagged', 'Flagged'), ('rejected', 'Rejected'))
STATUS_CURATED = 'curated'
STATUS_FLAGGED = 'flagged'
STATUS_LABELS = {'curated': 'success', 'flagged': 'warning', 'new': 'secondary', 'proofread': 'warning', 'published': 'info', 'rejected': 'danger'}
STATUS_NEW = 'new'
STATUS_PROOFREAD = 'proofread'
STATUS_PUBLISHED = 'published'
STATUS_REJECTED = 'rejected'
property absolute_admin_url

Return the absolute admin change URL.

animalencounter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

area

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

area_id
as_html

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

as_latex

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

campaign_id
can_curate()[source]

Return true if this record can be accepted.

can_embargo()[source]

Return true if encounter can be embargoed.

can_flag()[source]

Return true if curated status can be revoked.

can_proofread()[source]

Return true if this document can be proofread.

can_publish()[source]

Return true if this document can be published.

can_reject()[source]

Return true if the record can be rejected as entirely wrong.

can_require_proofreading()[source]

Return true if this document can be proofread.

can_reset()[source]

Return true if the record QA status can be reset.

card_template()[source]
comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod create_url()[source]

Create url. Default: app:model-create.

property crs

Return the location CRS.

curate(by=None)[source]

Accept record as trustworthy.

Curated data is deemed trustworthy by a subject matter expert. Records can be marked as curated from new, proofread, or flagged.

property date

Return the date component of Encounter.when.

property date_string

Return the date as string.

property datetime

Return the full datetime of the Encounter.

embargo(by=None)[source]

Mark encounter as NOT ready to be published.

Published data has been deemed fit for release by the data owner. Embargoed data is marked as curated, but not ready for release.

encounter_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

flag(by=None)[source]

Flag as requiring changes to data.

Curated data is deemed trustworthy by a subject matter expert. Revoking curation flags data for requiring changes by an expert.

property flipper_tags

Return a queryset of Flipper and PIT Tag Observations.

get_all_status_transitions(*, field=<django_fsm.FSMField: status>)
get_available_status_transitions(*, field=<django_fsm.FSMField: status>)
get_available_user_status_transitions(user, *, field=<django_fsm.FSMField: status>)
property get_encounter_type

Infer the encounter type.

“Track” encounters have a TrackTallyObservation, those who don’t have one but involve a TagObservation are tag management encounters (tag orders, distribution, returns, decommissioning). Lastly, the catch-all is “other” but complete records should not end up as such.

get_encounter_type_display(*, field=<django.db.models.fields.CharField: encounter_type>)
get_latex()[source]

Generate a Latex fragment of the Encounter.

get_location_accuracy_display(*, field=<django.db.models.fields.CharField: location_accuracy>)
get_next_by_when(*, field=<django.db.models.fields.DateTimeField: when>, is_next=True, **kwargs)
get_observations()[source]

Return related observations as a queryset.

get_popup()[source]

Generate HTML popup content.

get_previous_by_when(*, field=<django.db.models.fields.DateTimeField: when>, is_next=False, **kwargs)
get_report()[source]

Generate an HTML report of the Encounter.

get_source_display(*, field=<django.db.models.fields.CharField: source>)
get_status_display(*, field=<django_fsm.FSMField: status>)
property guess_area

Return the first Area containing the start_location or None.

property guess_site

Return the first Area containing the start_location or None.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property inferred_name

Return the inferred name from related new capture if existing.

TODO replace with reconstruct_animal_names logic

property is_new_capture

Return whether the Encounter is a new capture (hint: never).

Encounters can involve tags, but are never new captures. AnimalEncounters override this property, as they can be new captures.

property latitude

Return the WGS 84 DD latitude.

property leaflet_colour

Return the Leaflet.awesome-markers colour for the encounter type.

property leaflet_icon

Return the Fontawesome icon class for the encounter type.

property leaflet_title

A string for Leaflet map marker titles. Cache me as field.

linetransectencounter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

location_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location_accuracy_m

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

loggerencounter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property longitude

Return the WGS 84 DD longitude.

make_rest_detailurl(format='json')[source]

Return the API detail URL in given format (default: JSON).

Permissible formats depend on configured renderers: api (human readable HTML), csv, json, jsonp, yaml, latex (PDF).

make_rest_listurl(format='json')[source]

Return the API list URL in given format (default: JSON).

Permissible formats depend on configured renderers: api (human readable HTML), csv, json, jsonp, yaml, latex (PDF).

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property observation_set

Manually implement the backwards relation to the Observation model.

observations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

observer

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

observer_id
property opts

Make _meta accessible from templates.

property photographs

Return the URLs of all attached photograph or none.

polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
property primary_flipper_tag

Return the TagObservation of the primary (by location in animal) flipper or PIT tag.

proofread(by=None)[source]

Mark encounter as proof-read.

Proofreading compares the attached data sheet with entered values. Proofread data is deemed a faithful representation of original data captured on a paper field data collection form, or stored in a legacy system.

publish(by=None)[source]

Mark encounter as ready to be published.

Published data has been deemed fit for release by the data owner.

reject(by=None)[source]

Confirm that a record is not trustworthy and beyond repair.

property related_encounters

Return all Encounters with the same Animal.

This algorithm collects all Encounters with the same animal by traversing an Encounter’s TagObservations and their encounter histories.

The algorithm starts with the Encounter (self) as initial known Encounter (known_enc), and self.tags as both initial known (known_tags) and new TagObs (new_tags). While there are new TagObs, a “while” loop harvests new encounters:

  • For each tag in new_tags, retrieve the encounter history.

  • Combine and deduplicate the encounter histories

  • Remove known encounters and call this set of encounters new_enc.

  • Add new_enc to known_enc.

  • Combine and deduplicate all tags of all encounters in new_enc and call this set of TabObservations new_tags.

  • Add new_tags to known_tags.

  • Repeat the loop if the list of new tags is not empty.

Finally, deduplicate and return known_enc. These are all encounters that concern the same animal as this (self) encounter, as proven through the shared presence of TagObservations.

reporter

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reporter_id
require_proofreading(by=None)[source]

Mark encounter as having typos, requiring more proofreading.

Proofreading compares the attached data sheet with entered values. If a discrepancy to the data sheet is found, proofreading is required.

reset(by=None)[source]

Reset the QA status of a record to NEW.

This allows a record to be brought into the desired QA status.

property season

Return the season of the Encounter, the start year of the fiscal year.

Calculated as the calendar year 180 days before the date of the Encounter.

set_name(name)[source]

Set the animal name to a given value.

set_name_and_propagate(name)[source]

Set the animal name in this and all related Encounters.

Set the animal name in all related AnimalEncounters.

property short_name

A short, often unique, human-readable representation of the encounter.

Slugified and dash-separated:

  • Date of encounter as YYYY-mm-dd

  • longitude in WGS 84 DD, rounded to 4 decimals (<10m),

  • latitude in WGS 84 DD, rounded to 4 decimals (<10m), (missing sign!!)

  • health,

  • maturity,

  • species.

The short_name could be non-unique for encounters of multiple stranded animals of the same species and deadness.

site

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

site_id
source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

source_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status
property status_colour

Return a Bootstrap4 CSS colour class for each status.

property status_label

Return the boostrap tag-* CSS label flavour for the QA status.

survey

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

survey_id
classmethod tag_lists(encounter_list)[source]

Return the related tags of list of encounters.

TODO double-check performance

property tags

Return a queryset of TagObservations.

turtlenestencounter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property tx_logs

A list of dicts of QA timestamp, status and operator.

property update_url

Update url. Redirects to admin update URL, as we don’t have a front end form yet.

when

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

where
property wkt

Return the point coordinates as Well Known Text (WKT).

class wastd.observations.models.HatchlingMorphometricObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Morphometric measurements of a hatchling at a TurtleNestEncounter.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

body_weight_g

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
straight_carapace_length_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

straight_carapace_width_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.LightSourceObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Dict of one or list of many {

“light_source_photo”: null, “light_bearing_manual”: “50.0000000000”, “light_source_type”: “artificial” “natural” CHOICES “light_source_description”: “Oil rig#5”

}

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

bearing_light_degrees

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_light_source_type_display(*, field=<django.db.models.fields.CharField: light_source_type>)
light_source_description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

light_source_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.LineTransectEncounter(*args, **kwargs)[source]

Bases: wastd.observations.models.Encounter

Encounter with a line transect.

An observer tallies (not individually georeferenced) observations along a line transect, while recording the transect route live and keeping the tally until the end of the transect.

Although individually geo-referenced Encounters are preferable, this Encounter type supports tallies of abundant entities (like turtle tracks on a saturation beach), collected under time pressure.

Examples:

ODK form “Track Tally”, providing per record: * One LineTransectEncounter with zero to many related: * TrackTallyObservation * TurtleNestDisturbanceTallyObservation

exception DoesNotExist

Bases: wastd.observations.models.Encounter.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Encounter.MultipleObjectsReturned

card_template()[source]
encounter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

encounter_ptr_id
property get_encounter_type

Infer the encounter type.

If TrackTallyObservations are related, it’s a track observation.

TODO support other types of line transects when added

inferred_name()[source]

Return an empty string.

property latitude

Return the WGS 84 DD latitude.

property longitude

Return the WGS 84 DD longitude.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
property short_name

A short, often unique, human-readable representation of the encounter.

Slugified and dash-separated:

  • Date of encounter as YYYY-mm-dd

  • longitude in WGS 84 DD, rounded to 4 decimals (<10m),

  • latitude in WGS 84 DD, rounded to 4 decimals (<10m), (missing sign!!)

  • nest age (type),

  • species,

  • name if available (requires “update names” and tag obs)

The short_name could be non-unique.

transect
class wastd.observations.models.LoggerEncounter(*args, **kwargs)[source]

Bases: wastd.observations.models.Encounter

The encounter of an electronic logger during its life cycle.

Stages:

  • programmed (in office)

  • posted to field team (in mail)

  • deployed (in situ)

  • resighted (in situ)

  • retrieved (in situ)

  • downloaded (in office)

The life cycle can be repeated. The logger can be downloaded, reprogrammed and deployed again in situ.

This model is deprecated and LoggerEncounters will become Encounters with LoggerObservations.

exception DoesNotExist

Bases: wastd.observations.models.Encounter.DoesNotExist

LOGGER_STATUS_CHOICES = (('programmed', 'programmed'), ('posted', 'posted to field team'), ('deployed', 'deployed in situ'), ('resighted', 'resighted in situ'), ('retrieved', 'retrieved in situ'), ('downloaded', 'downloaded'))
LOGGER_STATUS_DEFAULT = 'resighted'
LOGGER_STATUS_NEW = 'programmed'
LOGGER_TYPE_CHOICES = (('temperature-logger', 'Temperature Logger'), ('data-logger', 'Data Logger'), ('ctd-data-logger', 'Conductivity, Temperature, Depth SR data logger'))
LOGGER_TYPE_DEFAULT = 'temperature-logger'
exception MultipleObjectsReturned

Bases: wastd.observations.models.Encounter.MultipleObjectsReturned

card_template()[source]
deployment_status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

encounter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

encounter_ptr_id
get_deployment_status_display(*, field=<django.db.models.fields.CharField: deployment_status>)
property get_encounter_type

Infer the encounter type.

LoggerEncounters are always logger encounters. Would you have guessed?

get_logger_type_display(*, field=<django.db.models.fields.CharField: logger_type>)
property inferred_name

Set the encounter name from logger ID.

property latitude

Return the WGS 84 DD latitude.

logger_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

logger_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property longitude

Return the WGS 84 DD longitude.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
property short_name

A short, often unique, human-readable representation of the encounter.

Slugified and dash-separated:

  • logger type

  • deployment status

  • logger id

The short_name could be non-unique for very similar encounters. In this case, a modifier can be added by the user to ensure uniqueness.

class wastd.observations.models.LoggerObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

A logger is observed during an Encounter.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

LOGGER_STATUS_CHOICES = (('programmed', 'programmed'), ('posted', 'posted to field team'), ('deployed', 'deployed in situ'), ('resighted', 'resighted in situ'), ('retrieved', 'retrieved in situ'), ('downloaded', 'downloaded'))
LOGGER_STATUS_DEFAULT = 'resighted'
LOGGER_STATUS_NEW = 'programmed'
LOGGER_TYPE_CHOICES = (('temperature-logger', 'Temperature Logger'), ('data-logger', 'Data Logger'), ('ctd-data-logger', 'Conductivity, Temperature, Depth SR Data Logger'))
LOGGER_TYPE_DEFAULT = 'temperature-logger'
exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deployment_status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_deployment_status_display(*, field=<django.db.models.fields.CharField: deployment_status>)
get_logger_type_display(*, field=<django.db.models.fields.CharField: logger_type>)
logger_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

logger_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.ManagementAction(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Management actions following an AnimalEncounter.

E.g, disposal, rehab, euthanasia.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

management_actions

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.MediaAttachment(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

A media attachment to an Encounter.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

MEDIA_TYPE_CHOICES = (('data_sheet', 'Data sheet'), ('communication', 'Communication record'), ('photograph', 'Photograph'), ('other', 'Other'))
exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

attachment

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
property filepath

The path to attached file.

get_media_type_display(*, field=<django.db.models.fields.CharField: media_type>)
media_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
property thumbnail
title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.NestTagObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Turtle Nest Tag Observation.

TNTs consist of three components, which are all optional:

  • flipper_tag_id: The primary flipper tag ID of the nesting turtle

  • date_nest_laid: The calendar (not turtle) date of nest creation

  • tag_label: Any extra nest label if other two components not available

Naming scheme:

  • Uppercase and remove whitespace from flipper tag ID

  • date nest laid: YYYY-mm-dd

  • Uppercase and remove whitespace from tag label

  • Join all with “_”

E.g.: WA1234_2017-12-31_M1

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_nest_laid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

flipper_tag_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_status_display(*, field=<django.db.models.fields.CharField: status>)
property history_url

The list view of all observations of this tag.

property name

Return the nest tag name according to the naming scheme.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tag_label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.Observation(*args, **kwargs)[source]

Bases: polymorphic.models.PolymorphicModel, shared.models.LegacySourceMixin, django.db.models.base.Model

The Observation base class for encounter observations.

Everything happens somewhere, at a time, to someone, and someone records it. Therefore, an Observation must happen during an Encounter.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property as_html

An HTML representation.

property as_latex

A Latex representation.

datetime()[source]

The encounter’s timestamp.

dispatchrecord

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

dugongmorphometricobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

encounter

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

encounter_id
get_source_display(*, field=<django.db.models.fields.PositiveIntegerField: source>)
hatchlingmorphometricobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property latitude

The encounter’s latitude.

lightsourceobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

loggerobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property longitude

The encounter’s longitude.

managementaction

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

mediaattachment

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

nesttagobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property observation_name

The concrete model name.

This method will inherit down the polymorphic chain, and always return the actual child model’s name.

observation_name can be included as field e.g. in API serializers, so e.g. a writeable serializer would know which child model to create or update.

property point

Return the encounter location.

polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
tagobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

temperatureloggerdeployment

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

temperatureloggersettings

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

tracktallyobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtledamageobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtlehatchlingemergenceobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtlehatchlingemergenceoutlierobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtlemorphometricobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtlenestdisturbanceobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtlenestdisturbancetallyobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

turtlenestobservation

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class wastd.observations.models.PathToSea(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A Mixin providing code, label and description.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
path_to_sea

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class wastd.observations.models.SiteVisitStartEnd(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A start or end point to a site visit.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

datetime

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_datetime(*, field=<django.db.models.fields.DateTimeField: datetime>, is_next=True, **kwargs)
get_previous_by_datetime(*, field=<django.db.models.fields.DateTimeField: datetime>, is_next=False, **kwargs)
get_source_display(*, field=<django.db.models.fields.CharField: source>)
get_type_display(*, field=<django.db.models.fields.CharField: type>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location
objects = <django.db.models.manager.Manager object>
source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

source_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.Survey(*args, **kwargs)[source]

Bases: shared.models.QualityControlMixin, shared.models.UrlsMixin, django.db.models.base.Model

A visit to one site by a team of field workers collecting data.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property absolute_admin_url

Return the absolute admin change URL.

area

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

area_id
property as_html

An HTML representation.

attachments

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

campaign_id
card_template()[source]
close_duplicates(actor=None)[source]

Mark this Survey as the only production survey, others as training and adopt all Encounters.

Data import of Surveys reconstructed from SVS and SVE, adjusting site bondaries, and previous import algorithms, can cause duplicate Surveys to be created.

The QA operator needs to identify duplicates, mark each as “not production” (=training, testing, or duplicate), set this Survey as “production”, then save each of them and set to “curated”.

Duplicate Surveys are recognized by an overlap of place and time. They can however extend longer individually, so that duplicates can contain Encounters outside the duration of the production Survey. The remaining production Survey needs to adjust its start and end time to include all Encounters of all closed duplicate surveys.

The production Survey adopts all Encounters within its spatial bounds. Encounters outside its spatial bounds can occur if the Survey site was adjusted manually. These will be orphaned after this operation, and can be adopted either by saving an adjacent survey, or running “adopt orphaned encounters”.

device_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property duplicate_surveys

A queryset of other surveys on the same date and site with intersecting durations.

encounter_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property encounters

Return the QuerySet of all Encounters within this Survey unless it’s a training run.

end_comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_device_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_location
end_location_accuracy_m

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_photo

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
end_source_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_all_status_transitions(*, field=<django_fsm.FSMField: status>)
get_available_status_transitions(*, field=<django_fsm.FSMField: status>)
get_available_user_status_transitions(user, *, field=<django_fsm.FSMField: status>)
get_source_display(*, field=<django.db.models.fields.CharField: source>)
get_status_display(*, field=<django_fsm.FSMField: status>)
property has_duplicates

Whether there are duplicate surveys.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property make_label
property no_duplicates

The number of duplicate surveys.

objects = <django.db.models.manager.Manager object>
production

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reporter

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reporter_id
site

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

site_id
source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

source_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property start_date

The calendar date of the survey’s start time in the local timezone.

start_location
start_location_accuracy_m

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_photo

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status
team

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

transect
class wastd.observations.models.SurveyEnd(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A visit to one site by a team of field workers collecting data.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

device_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_location
end_photo

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_source_display(*, field=<django.db.models.fields.CharField: source>)
property guess_site

Return the first Area containing the start_location or None.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
reporter

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reporter_id
save(*args, **kwargs)[source]

Guess site.

site

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

site_id
source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

source_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.SurveyMediaAttachment(*args, **kwargs)[source]

Bases: shared.models.LegacySourceMixin, django.db.models.base.Model

A media attachment to a Survey, e.g. start or end photos.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

MEDIA_TYPE_CHOICES = (('data_sheet', 'Data sheet'), ('communication', 'Communication record'), ('photograph', 'Photograph'), ('other', 'Other'))
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

attachment

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
property filepath

The path to attached file.

get_media_type_display(*, field=<django.db.models.fields.CharField: media_type>)
get_source_display(*, field=<django.db.models.fields.PositiveIntegerField: source>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

media_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
survey

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

survey_id
property thumbnail
title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TagObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

An Observation of an identifying tag on an observed entity.

The identifying tag can be a flipper tag on a turtle, a PIT tag, a satellite tag, a barcode on a sample taken off an animal, a whisker ID from a picture of a pinniped, a genetic fingerprint or similar.

The tag has its own life cycle through stages of production, delivery, affiliation with an animal, repeated sightings and disposal.

The life cycle stages will vary between tag types.

A TagObservation will find the tag in exactly one of the life cycle stages.

The life history of each tag can be reconstructed from the sum of all of its TagObservations.

As TagObservations can sometimes occur without an Observation of an animal, the FK to Observations is optional.

Flipper Tag Status as per WAMTRAM:

  • # = tag attached new, number NA, need to double-check number

  • P, p: re-sighted as attached to animal, no actions taken or necessary

  • do not use: 0L, A2, M, M1, N

  • AE = A1

  • P_ED = near flipper edge, might fall off soon

  • PX = tag re-sighted, but operator could not read tag ID (e.g. turtle running off)

  • RQ = tag re-sighted, tag was “insecure”, but no action was recorded

Recaptured tags: Need to record state (open, closed, tip locked or not) as feedback to taggers to improve their tagging technique.

PIT tag status:

  • applied and did read OK

  • applied and did not read (but still inside and might read later on)

Sample status:

  • taken off animal

  • handed to lab

  • done science to it

  • handed in report

Animal Name: All TagObservations of one animal are linked by shared encounters or shared tag names. The earliest associated flipper tag name is used as the animal’s name, and transferred onto all related TagObservations.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod encounter_histories(tagname_list, without=[])[source]

Return the related encounters of all tag names.

TODO double-check performance

classmethod encounter_history(tagname)[source]

Return the related encounters of all TagObservations of a given tag name.

get_status_display(*, field=<django.db.models.fields.CharField: status>)
get_tag_location_display(*, field=<django.db.models.fields.CharField: tag_location>)
get_tag_type_display(*, field=<django.db.models.fields.CharField: tag_type>)
handler

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

handler_id
property history_url

The list view of all observations of this tag.

property is_new

Return wheter the TagObservation is the first association with the animal.

property is_recapture

Return whether the TabObservation is a recapture.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
recorder

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

recorder_id
status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tag_location

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tag_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TemperatureLoggerDeployment(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

A record of deploying a temperature logger.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

depth_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

distance_to_marker1_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

distance_to_marker2_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

distance_to_vegetation_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_habitat_display(*, field=<django.db.models.fields.CharField: habitat>)
get_marker1_present_display(*, field=<django.db.models.fields.CharField: marker1_present>)
get_marker2_present_display(*, field=<django.db.models.fields.CharField: marker2_present>)
habitat

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

marker1_present

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

marker2_present

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.TemperatureLoggerSettings(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Temperature Logger Settings.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

get_tested_display(*, field=<django.db.models.fields.CharField: tested>)
logging_interval

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
recording_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tested

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TrackTallyObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Observation of turtle track tallies and signs of predation.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

get_nest_age_display(*, field=<django.db.models.fields.CharField: nest_age>)
get_nest_type_display(*, field=<django.db.models.fields.CharField: nest_type>)
get_species_display(*, field=<django.db.models.fields.CharField: species>)
nest_age

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nest_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
species

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tally

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TurtleDamageObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Observation of turtle damages or injuries.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

body_part

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

damage_age

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

damage_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_body_part_display(*, field=<django.db.models.fields.CharField: body_part>)
get_damage_age_display(*, field=<django.db.models.fields.CharField: damage_age>)
get_damage_type_display(*, field=<django.db.models.fields.CharField: damage_type>)
observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.TurtleHatchlingEmergenceObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Turtle hatchling emergence observation.

Hatchling emergence observations can include:

  • Emergence time (if seen directly),

  • Fan angles of hatchling tracks forming a fan from nest to sea,

  • Emergence climate

  • Outliers present (if yes: TurtleHatchlingEmergenceOutlierObservation)

  • Light sources known and present (if yes: LightSourceObservation).

# TON 0.54+ “fan_angles”: {

“photo_hatchling_tracks_seawards”: “1546836969404.jpg”, “photo_hatchling_tracks_relief”: null, “bearing_to_water_manual”: “98.0000000000”, “leftmost_track_manual”: “58.0000000000”, “rightmost_track_manual”: “122.0000000000”, “no_tracks_main_group”: “7”, “no_tracks_main_group_min”: “7”, “no_tracks_main_group_max”: “7”, “outlier_tracks_present”: “present”, “hatchling_path_to_sea”: “clear”, “path_to_sea_comments”: null, “hatchling_emergence_time_known”: “yes”, “cloud_cover_at_emergence_known”: “yes”, “light_sources_present”: “present”

}, “outlier_track”: {

“outlier_track_photo”: “1546837474680.jpg”, “outlier_track_bearing_manual”: “180.0000000000”, “outlier_group_size”: “1”, “outlier_track_comment”: null

}, “hatchling_emergence_time_group”: {

“hatchling_emergence_time”: “2019-01-06T23:07:00.000Z”, “hatchling_emergence_time_source”: “plusminus-2h”

}, “emergence_climate”: {

“cloud_cover_at_emergence”: “3”

}, “light_source”: [

{

“light_source_photo”: null, “light_bearing_manual”: “50.0000000000”, “light_source_type”: “artificial”, “light_source_description”: “Oil rig#5”

}, {

“light_source_photo”: null, “light_bearing_manual”: “190.0000000000”, “light_source_type”: “natural”, “light_source_description”: “Moon”

}

], “other_light_sources”: {

“other_light_sources_present”: “na”

}

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

bearing_leftmost_track_degrees

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

bearing_rightmost_track_degrees

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

bearing_to_water_degrees

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cloud_cover_at_emergence

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cloud_cover_at_emergence_known

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_cloud_cover_at_emergence_known_display(*, field=<django.db.models.fields.CharField: cloud_cover_at_emergence_known>)
get_hatchling_emergence_time_accuracy_display(*, field=<django.db.models.fields.CharField: hatchling_emergence_time_accuracy>)
get_hatchling_emergence_time_known_display(*, field=<django.db.models.fields.CharField: hatchling_emergence_time_known>)
get_light_sources_present_display(*, field=<django.db.models.fields.CharField: light_sources_present>)
get_outlier_tracks_present_display(*, field=<django.db.models.fields.CharField: outlier_tracks_present>)
hatchling_emergence_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hatchling_emergence_time_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hatchling_emergence_time_known

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hatchling_path_to_sea

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

light_sources_present

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_tracks_main_group

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_tracks_main_group_max

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_tracks_main_group_min

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
outlier_tracks_present

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

path_to_sea_comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.TurtleHatchlingEmergenceOutlierObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Dict of one or list of many “outlier_track”: { “outlier_track_photo”: “1546837474680.jpg”, “outlier_track_bearing_manual”: “180.0000000000”, “outlier_group_size”: “1”, “outlier_track_comment”: null }

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

bearing_outlier_track_degrees

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
outlier_group_size

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

outlier_track_comment

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.TurtleMorphometricObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Morphometric measurements of a turtle.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

body_depth_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

body_depth_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

body_weight_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

body_weight_g

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curved_carapace_length_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curved_carapace_length_min_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curved_carapace_length_min_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curved_carapace_length_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curved_carapace_width_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curved_carapace_width_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_body_depth_accuracy_display(*, field=<django.db.models.fields.CharField: body_depth_accuracy>)
get_body_weight_accuracy_display(*, field=<django.db.models.fields.CharField: body_weight_accuracy>)
get_curved_carapace_length_accuracy_display(*, field=<django.db.models.fields.CharField: curved_carapace_length_accuracy>)
get_curved_carapace_length_min_accuracy_display(*, field=<django.db.models.fields.CharField: curved_carapace_length_min_accuracy>)
get_curved_carapace_width_accuracy_display(*, field=<django.db.models.fields.CharField: curved_carapace_width_accuracy>)
get_maximum_head_length_accuracy_display(*, field=<django.db.models.fields.CharField: maximum_head_length_accuracy>)
get_maximum_head_width_accuracy_display(*, field=<django.db.models.fields.CharField: maximum_head_width_accuracy>)
get_straight_carapace_length_accuracy_display(*, field=<django.db.models.fields.CharField: straight_carapace_length_accuracy>)
get_tail_length_carapace_accuracy_display(*, field=<django.db.models.fields.CharField: tail_length_carapace_accuracy>)
get_tail_length_plastron_accuracy_display(*, field=<django.db.models.fields.CharField: tail_length_plastron_accuracy>)
get_tail_length_vent_accuracy_display(*, field=<django.db.models.fields.CharField: tail_length_vent_accuracy>)
handler

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

handler_id
maximum_head_length_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

maximum_head_length_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

maximum_head_width_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

maximum_head_width_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
recorder

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

recorder_id
straight_carapace_length_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

straight_carapace_length_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tail_length_carapace_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tail_length_carapace_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tail_length_plastron_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tail_length_plastron_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tail_length_vent_accuracy

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tail_length_vent_mm

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TurtleNestDisturbanceObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Turtle nest disturbance observations.

Disturbance can be a result of:

  • Predation

  • Disturbance by other turtles

  • Environmental disturbance (cyclones, tides)

  • Anthropogenic disturbance (vehicle damage, poaching, research, harvest)

Disturbance severity can range from negligible disturbance to total destruction.

Disturbance cause contains a training category to mark training or test records.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

NEST_VIABILITY_CHOICES = (('negligible', 'negligible disturbance'), ('partly', 'nest partly destroyed'), ('completely', 'nest completely destroyed'), ('na', 'nest in indeterminate condition'))
comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disturbance_cause

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disturbance_cause_confidence

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disturbance_severity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_disturbance_cause_confidence_display(*, field=<django.db.models.fields.CharField: disturbance_cause_confidence>)
get_disturbance_cause_display(*, field=<django.db.models.fields.CharField: disturbance_cause>)
get_disturbance_severity_display(*, field=<django.db.models.fields.CharField: disturbance_severity>)
observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class wastd.observations.models.TurtleNestDisturbanceTallyObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Observation of turtle track tallies and signs of predation.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disturbance_cause

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_disturbance_cause_display(*, field=<django.db.models.fields.CharField: disturbance_cause>)
get_species_display(*, field=<django.db.models.fields.CharField: species>)
no_nests_disturbed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_tracks_encountered

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
species

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TurtleNestEncounter(*args, **kwargs)[source]

Bases: wastd.observations.models.Encounter

The encounter of turtle nest during its life cycle.

The observations are assumed to follow DPaW protocol. TurtleNestEncouters by third parties can be recorded, but related observations cannot if they don’t follow DPaW protocol.

Stages:

  • false crawl (aborted nesting attempt)

  • new (turtle is present, observed during nesting/tagging)

  • fresh (morning after, observed during track count)

  • predated (nest and eggs destroyed by predator)

  • hatched (eggs hatched)

exception DoesNotExist

Bases: wastd.observations.models.Encounter.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Encounter.MultipleObjectsReturned

card_template()[source]
disturbance

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

eggs_counted

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

encounter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

encounter_ptr_id
fan_angles_measured

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()[source]

Detail url, used by Django to link admin to site.

Default: app:model-detail(**pk).

get_disturbance_display(*, field=<django.db.models.fields.CharField: disturbance>)
get_eggs_counted_display(*, field=<django.db.models.fields.CharField: eggs_counted>)
property get_encounter_type

Infer the encounter type.

TurtleNestEncounters are always nest encounters. Would you have guessed?

get_fan_angles_measured_display(*, field=<django.db.models.fields.CharField: fan_angles_measured>)
get_habitat_display(*, field=<django.db.models.fields.CharField: habitat>)
get_hatchlings_measured_display(*, field=<django.db.models.fields.CharField: hatchlings_measured>)
get_logger_found_display(*, field=<django.db.models.fields.CharField: logger_found>)
get_nest_age_display(*, field=<django.db.models.fields.CharField: nest_age>)
get_nest_tagged_display(*, field=<django.db.models.fields.CharField: nest_tagged>)
get_nest_type_display(*, field=<django.db.models.fields.CharField: nest_type>)
get_species_display(*, field=<django.db.models.fields.CharField: species>)
habitat

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hatchlings_measured

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property inferred_name

Return the first NestTag name or None.

property latitude

Return the WGS 84 DD latitude.

logger_found

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property longitude

Return the WGS 84 DD longitude.

nest_age

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nest_tagged

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nest_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
property short_name

A short, often unique, human-readable representation of the encounter.

Slugified and dash-separated:

  • Date of encounter as YYYY-mm-dd

  • longitude in WGS 84 DD, rounded to 4 decimals (<10m),

  • latitude in WGS 84 DD, rounded to 4 decimals (<10m), (missing sign!!)

  • nest age (type),

  • species,

  • name if available (requires “update names” and tag obs)

The short_name could be non-unique.

species

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class wastd.observations.models.TurtleNestObservation(*args, **kwargs)[source]

Bases: wastd.observations.models.Observation

Turtle nest observations.

This model supports data sheets for:

  • Turtle nest observation during tagging

  • Turtle nest excavation after hatching

Egg count is done as total, plus categories of nest contents following “Determining Clutch Size and Hatching Success, Jeffrey D. Miller, Research and Management Techniques for the Conservation of Sea Turtles, IUCN Marine Turtle Specialist Group, 1999.

exception DoesNotExist

Bases: wastd.observations.models.Observation.DoesNotExist

exception MultipleObjectsReturned

Bases: wastd.observations.models.Observation.MultipleObjectsReturned

air_temp

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

comments

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

egg_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property egg_count_calculated

The calculated egg count from nest excavations.

Calculated as:

no_egg_shells + no_undeveloped_eggs + no_unhatched_eggs + no_unhatched_term + no_depredated_eggs

egg_temp

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

eggs_laid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property emergence_success

Return the emergence success as percentage [0..100].

Formula after Miller 1999:

Emergence success = 100 *
    (no_egg_shells - no_live_hatchlings - no_dead_hatchlings) / (
    no_egg_shells + no_undeveloped_eggs + no_unhatched_eggs +
    no_unhatched_term + no_depredated_eggs)
property hatching_success

Return the hatching success as percentage [0..100].

Formula after Miller 1999:

Hatching success = 100 * no_egg_shells / (
    no_egg_shells + no_undeveloped_eggs + no_unhatched_eggs +
    no_unhatched_term + no_depredated_eggs)
nest_depth_bottom

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nest_depth_top

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_dead_hatchlings

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_depredated_eggs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_egg_shells

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property no_emerged

The number of hatchlings leaving or departed from nest is S-(L+D).

no_live_hatchlings

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_live_hatchlings_neck_of_nest

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_undeveloped_eggs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_unhatched_eggs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

no_unhatched_term

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

observation_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

observation_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
sand_temp

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

water_temp

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

wastd.observations.models.campaign_media(instance, filename)[source]

Return an upload file path for a campaign media attachment.

wastd.observations.models.campaign_post_save(sender, instance, *args, **kwargs)[source]

Campaign: Claim Surveys and Encounters.

wastd.observations.models.claim_encounters(survey_instance)[source]

Update Encounters within this Survey to reference survey=self.

wastd.observations.models.claim_end_points(survey_instance)[source]

Claim SurveyEnd.

The first SurveyEnd with the matching site, and an end_time within six hours after start_time is used to set corresponding end_location, end_time, end_comments, end_photo and end_source_id.

Since the end point could be taken with a different device (e.g. if primary device malfunctions), we will not filter down to the same device_id.

If no SurveyEnd is found and no end_time is set, the end_time is set to start_time plus six hours. This should allow the survey to claim its Encounters.

TODO we could be a bit cleverer and find the latest encounter on the same day and site.

wastd.observations.models.delete_observations(sender, instance, **kwargs)[source]

Delete Observations before deleting an Encounter.

See https://github.com/django-polymorphic/django-polymorphic/issues/34

wastd.observations.models.encounter_media(instance, filename)[source]

Return an upload file path for an encounter media attachment.

wastd.observations.models.encounter_pre_save(sender, instance, *args, **kwargs)[source]

Encounter pre_save: calculate expensive lookups.

Bulk updates or bulk creates will bypass these to be reconstructed later.

  • source_id: Set form short_name if empty

  • area and site: Inferred from location (where) if empty

  • encounter_type: Always from get_encounter_type

  • as_html /as_latex: Always set from get_popup() and get_latex()

wastd.observations.models.guess_area(survey_instance)[source]

Return the first Area containing the start_location or None.

wastd.observations.models.guess_site(survey_instance)[source]

Return the first Area containing the start_location or None.

wastd.observations.models.nesttagobservation_pre_save(sender, instance, *args, **kwargs)[source]

NestTagObservation pre_save: sanitise tag_label, name unnamed Encounter after tag.

wastd.observations.models.survey_media(instance, filename)[source]

Return an upload path for survey media.

wastd.observations.models.survey_post_save(sender, instance, *args, **kwargs)[source]

Survey: Claim encounters.

wastd.observations.models.survey_pre_save(sender, instance, buffer_mins=30, initial_duration_hrs=6, *args, **kwargs)[source]

Survey pre-save: sanity check and data cleaning.

If a start or end time are given as string, they are parsed into a native datetime object. If site or area are blank, they will be guessed via spatial overlap with known locations.

If the end time is not given or earlier than the start time (mostly due to data import errors), the end time will be adjusted to initial_duration_hrs after the start time. This will give the post_save signal an opportunity to claim_encounters.

If the end time is exactly initial_duration_hrs later than the start time, it will be adjusted to buffer_mins after the last encounter within.

Admin

We’re using a nicely styled admin to let trained data entry operators and curators add and update data.

Also, data analysts can search, filter, and export data from here.

wastd.observations.admin Module

Admin module for wastd.observations.

class wastd.observations.admin.AnimalEncounterAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.EncounterAdmin

Admin for AnimalEncounter.

fieldsets = (('Encounter', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('area', 'site', 'campaign', 'survey', 'where', 'location_accuracy', 'location_accuracy_m', 'when', 'observer', 'reporter', 'source', 'source_id', 'name')}), ('Animal', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('taxon', 'species', 'maturity', 'sex', 'activity', 'behaviour', 'habitat', 'health', 'cause_of_death', 'cause_of_death_confidence', 'nesting_event', 'nesting_disturbed', 'checked_for_injuries', 'scanned_for_pit_tags', 'checked_for_flipper_tags', 'laparoscopy')}), ('Recapture Status', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('sighting_status', 'datetime_of_last_sighting', 'site_of_first_sighting', 'site_of_last_sighting')}))
form

alias of django.forms.widgets.AnimalEncounterForm

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

habitat_display(obj)[source]

Make habitat human readable.

health_display(obj)[source]

Make health status human readable.

inlines = [<class 'wastd.observations.admin.MediaAttachmentInline'>, <class 'wastd.observations.admin.TagObservationInline'>, <class 'wastd.observations.admin.TurtleDamageObservationInline'>, <class 'wastd.observations.admin.TurtleMorphometricObservationInline'>, <class 'wastd.observations.admin.DugongMorphometricObservationInline'>, <class 'wastd.observations.admin.TurtleNestObservationInline'>, <class 'wastd.observations.admin.NestTagObservationInline'>, <class 'wastd.observations.admin.ManagementActionInline'>, <class 'shared.admin.CustomStateLogInline'>]
list_display = ('when', 'area', 'site', 'latitude', 'longitude', 'location_accuracy', 'location_accuracy_m', 'name_link', 'taxon', 'species', 'health_display', 'cause_of_death', 'cause_of_death_confidence', 'maturity_display', 'sex_display', 'behaviour', 'habitat_display', 'sighting_status', 'site_of_first_sighting', 'datetime_of_last_sighting', 'site_of_last_sighting', 'nesting_event', 'nesting_disturbed', 'checked_for_injuries', 'scanned_for_pit_tags', 'checked_for_flipper_tags', 'observer', 'reporter', 'source_display', 'source_id', 'status', 'encounter_type', 'owner')
list_filter = ('campaign__owner', ('area', <class 'wastd.observations.admin.AreaFilter'>), ('site', <class 'wastd.observations.admin.SiteFilter'>), 'status', 'observer', 'reporter', 'location_accuracy', 'encounter_type', 'source', 'taxon', 'species', 'health', 'cause_of_death', 'cause_of_death_confidence', 'maturity', 'sex', 'habitat', 'sighting_status', 'datetime_of_last_sighting', 'site_of_first_sighting', 'site_of_last_sighting', 'nesting_event', 'nesting_disturbed', 'checked_for_injuries', 'scanned_for_pit_tags', 'checked_for_flipper_tags', 'laparoscopy')
maturity_display(obj)[source]

Make maturity human readable.

property media
readonly_fields = ('name', 'sighting_status', 'datetime_of_last_sighting', 'site_of_first_sighting', 'site_of_last_sighting')
sex_display(obj)[source]

Make sex human readable.

sighting_status_display(obj)[source]

Make sighting status human readable.

status_display(obj)[source]

Make QA status human readable.

class wastd.observations.admin.AreaAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Area admin.

form

alias of django.forms.widgets.AreaForm

formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
list_display = ('area_type', 'name', 'w2_location_code', 'w2_place_code', 'northern_extent', 'centroid')
list_filter = ('area_type',)
property media
search_fields = ('name__icontains', 'w2_location_code__iexact', 'w2_place_code__iexact')
class wastd.observations.admin.AreaFilter(field, request, params, model, model_admin, field_path)[source]

Bases: django.contrib.admin.filters.RelatedFieldListFilter

field_choices(field, request, model_admin)[source]
class wastd.observations.admin.CampaignAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Campaign admin.

form

alias of django.forms.widgets.CampaignForm

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Restrict destination to Localities.

Plug in customisations for other FK fields here as needed.

Args:

db_field (str): The name of the FK field as defined in the Model. request (request): The request

Returns:

_type_: The modified method formfield_for_foreignkey.

inlines = [<class 'wastd.observations.admin.CampaignMediaAttachmentInline'>]
list_display = ('destination', 'start_time', 'end_time', 'owner')
list_filter = ('owner', 'viewers', ('destination', <class 'wastd.observations.admin.AreaFilter'>))
property media
search_fields = ('owner__code__icontains', 'owner__label__icontains', 'owner__description__icontains', 'comments__icontains')
class wastd.observations.admin.CampaignMediaAttachmentInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

TabularInlineAdmin for CampaignMediaAttachment.

classes = ('grp-collapse grp-open',)
extra = 0
formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
property media
model

alias of wastd.observations.models.CampaignMediaAttachment

class wastd.observations.admin.DispatchRecordInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for DispatchRecord.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.DispatchRecord

class wastd.observations.admin.DugongMorphometricObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for DugongMorphometricObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.DugongMorphometricObservation

class wastd.observations.admin.EncounterAdmin(*args, **kwargs)[source]

Bases: fsm_admin.mixins.FSMTransitionMixin, reversion.admin.VersionAdmin

Admin for Encounter with inlines for all Observations.

This admin can be extended by other Encounter Admin classes.

FIRST_COLS = ('when', 'area', 'site', 'latitude', 'longitude', 'location_accuracy', 'location_accuracy_m', 'name_link')
LAST_COLS = ('observer', 'reporter', 'source_display', 'source_id', 'status', 'encounter_type', 'owner')
autocomplete_fields = ['area', 'site', 'survey', 'campaign']
change_list_filter_template = 'admin/filter_listing.html'
date_hierarchy = 'when'
encounter_type_display(obj)[source]

Make encounter type readable.

fieldsets = (('Encounter', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('area', 'site', 'campaign', 'survey', 'where', 'location_accuracy', 'location_accuracy_m', 'when', 'observer', 'reporter', 'source', 'source_id', 'name')}),)
form

alias of django.forms.widgets.EncounterForm

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Restrict Area and Site options to Localities and Sites, and Users to active profiles.

formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
fsm_field = ['status']
get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

inlines = [<class 'wastd.observations.admin.MediaAttachmentInline'>, <class 'wastd.observations.admin.TagObservationInline'>, <class 'wastd.observations.admin.TurtleDamageObservationInline'>, <class 'wastd.observations.admin.TurtleMorphometricObservationInline'>, <class 'wastd.observations.admin.TrackTallyObservationInline'>, <class 'wastd.observations.admin.TurtleNestDisturbanceTallyObservationInline'>, <class 'wastd.observations.admin.ManagementActionInline'>, <class 'wastd.observations.admin.NestTagObservationInline'>, <class 'wastd.observations.admin.TurtleNestObservationInline'>, <class 'wastd.observations.admin.TurtleNestDisturbanceObservationInline'>, <class 'wastd.observations.admin.HatchlingMorphometricObservationInline'>, <class 'wastd.observations.admin.TurtleHatchlingEmergenceObservationInline'>, <class 'wastd.observations.admin.TurtleHatchlingEmergenceOutlierObservationInline'>, <class 'wastd.observations.admin.LightSourceObservationObservationInline'>, <class 'wastd.observations.admin.LoggerObservationInline'>, <class 'shared.admin.CustomStateLogInline'>]
latitude(obj)[source]

Make data source readable.

list_display = ('when', 'area', 'site', 'latitude', 'longitude', 'location_accuracy', 'location_accuracy_m', 'name_link', 'observer', 'reporter', 'source_display', 'source_id', 'status', 'encounter_type', 'owner')
list_filter = ('campaign__owner', ('area', <class 'wastd.observations.admin.AreaFilter'>), ('site', <class 'wastd.observations.admin.SiteFilter'>), 'status', 'observer', 'reporter', 'location_accuracy', 'encounter_type', 'source')
longitude(obj)[source]

Make data source readable.

property media

List other encounters with the same subject.

observer = <django.forms.fields.ChoiceField object>
owner(obj)[source]

Resolve owner.

readonly_fields = ('name',)
reporter = <django.forms.fields.ChoiceField object>
search_fields = ('observer__name', 'observer__username', 'name', 'reporter__name', 'reporter__username', 'source_id')
source_display(obj)[source]

Make data source readable.

class wastd.observations.admin.HatchlingMorphometricObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for HatchlingMorphometricObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'straight_carapace_length_mm', 'straight_carapace_width_mm', 'body_weight_g', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
property media
search_fields = ()
class wastd.observations.admin.HatchlingMorphometricObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for HatchlingMorphometricObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.HatchlingMorphometricObservation

class wastd.observations.admin.LightSourceObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for LightSourceObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'bearing_light_degrees', 'light_source_type', 'light_source_description', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
property media
search_fields = ()
class wastd.observations.admin.LightSourceObservationObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for LightSourceObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.LightSourceObservation

class wastd.observations.admin.LineTransectEncounterAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.EncounterAdmin

Admin for LineTransectEncounter.

fieldsets = (('Encounter', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('area', 'site', 'campaign', 'survey', 'where', 'location_accuracy', 'location_accuracy_m', 'when', 'observer', 'reporter', 'source', 'source_id', 'name')}), ('Location', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('transect',)}))
form

alias of django.forms.widgets.LineTransectEncounterForm

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

inlines = [<class 'wastd.observations.admin.MediaAttachmentInline'>, <class 'wastd.observations.admin.TrackTallyObservationInline'>, <class 'wastd.observations.admin.TurtleNestDisturbanceTallyObservationInline'>, <class 'shared.admin.CustomStateLogInline'>]
list_display = ('when', 'area', 'site', 'latitude', 'longitude', 'location_accuracy', 'location_accuracy_m', 'name_link', 'transect', 'observer', 'reporter', 'source_display', 'source_id', 'status', 'encounter_type', 'owner')
property media
class wastd.observations.admin.LoggerObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleNestDisturbanceTallyObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'logger_type', 'deployment_status', 'logger_id', 'comments', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'logger_type', 'deployment_status')
property media
search_fields = ('logger_id', 'comments')
class wastd.observations.admin.LoggerObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for LoggerObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.LoggerObservation

class wastd.observations.admin.ManagementActionAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for ManagementAction.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'management_actions', 'comments', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
property media
search_fields = ('management_actions', 'comments')
class wastd.observations.admin.ManagementActionInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

TabularInlineAdmin for ManagementAction.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.ManagementAction

class wastd.observations.admin.MediaAttachmentAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for MediaAttachment.

formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'media_type', 'title', 'thumbnail', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'media_type')
property media
search_fields = ('title',)
thumbnail(obj)[source]
class wastd.observations.admin.MediaAttachmentInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

TabularInlineAdmin for MediaAttachment.

classes = ('grp-collapse grp-open',)
extra = 0
formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
property media
model

alias of wastd.observations.models.MediaAttachment

class wastd.observations.admin.NestTagObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for NestTagObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'tag_name', 'flipper_tag_id', 'date_nest_laid', 'tag_label', 'comments', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'flipper_tag_id', 'tag_label')
property media
search_fields = ('flipper_tag_id', 'date_nest_laid', 'tag_label', 'comments')
tag_name(obj)[source]

Nest tag name.

class wastd.observations.admin.NestTagObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.StackedInline

TabularInlineAdmin for NestTagObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.NestTagObservation

class wastd.observations.admin.ObservationAdminMixin(*args, **kwargs)[source]

Bases: reversion.admin.VersionAdmin, django.contrib.admin.options.ModelAdmin

Admin mixin for Observation models.

LIST_FILTER = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
LIST_FIRST = ('pk', 'area', 'site', 'latitude', 'longitude', 'date')
LIST_LAST = ('encounter_link', 'encounter_status')
area(obj)[source]

Make data source readable.

date(obj)[source]

Make data source readable.

date_hierarchy = 'encounter__when'

A link to the encounter.

encounter_status(obj)[source]

A link to the encounter.

formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
latitude(obj)[source]

Make data source readable.

longitude(obj)[source]

Make data source readable.

property media
readonly_fields = ('encounter',)
save_on_top = True
search_fields = ('comments',)
site(obj)[source]

Make data source readable.

status(obj)[source]

Make health status human readable.

class wastd.observations.admin.SiteFilter(field, request, params, model, model_admin, field_path)[source]

Bases: django.contrib.admin.filters.RelatedFieldListFilter

field_choices(field, request, model_admin)[source]
class wastd.observations.admin.SurveyAdmin(*args, **kwargs)[source]

Bases: fsm_admin.mixins.FSMTransitionMixin, reversion.admin.VersionAdmin, django.contrib.admin.options.ModelAdmin

Survey Admin.

actions = ['merge_user']
date_hierarchy = 'start_time'
fieldsets = (('Device', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('source', 'source_id', 'device_id', 'end_source_id', 'end_device_id', 'production')}), ('Location', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('transect', 'start_location', 'end_location', 'area', 'site')}), ('Time', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('start_time', 'end_time')}), ('Campaign', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('campaign',)}), ('Team', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('start_comments', 'end_comments', 'reporter', 'team', 'start_photo', 'end_photo')}))
form

alias of django.forms.widgets.SurveyForm

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Get a form Field for a ForeignKey.

formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
fsm_field = ['status']
inlines = [<class 'wastd.observations.admin.SurveyMediaAttachmentInline'>, <class 'shared.admin.CustomStateLogInline'>]
list_display = ('__str__', 'source', 'device_id', 'end_device_id', 'area', 'site', 'start_time', 'end_time', 'reporter', 'start_comments', 'end_comments', 'status', 'production', 'owner')
list_filter = ('campaign__owner', ('area', <class 'wastd.observations.admin.AreaFilter'>), ('site', <class 'wastd.observations.admin.SiteFilter'>), 'reporter', 'status', 'production', 'device_id')
property media
owner(obj)[source]

Resolve owner.

search_fields = ('area__name', 'site__name', 'start_comments', 'end_comments', 'reporter__name', 'reporter__username')
class wastd.observations.admin.SurveyMediaAttachmentInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for SurveyMediaAttachment.

classes = ('grp-collapse grp-open',)
extra = 0
formfield_overrides = {<class 'django.contrib.gis.db.models.fields.PointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPointField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.LineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiLineStringField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.PolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.contrib.gis.db.models.fields.MultiPolygonField'>: {'widget': <leaflet.forms.widgets.LeafletWidget object>}, <class 'django.db.models.fields.files.ImageField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}, <class 'django.db.models.fields.files.FileField'>: {'widget': <class 'shared.admin.AdminImageWidget'>}}
property media
model

alias of wastd.observations.models.SurveyMediaAttachment

class wastd.observations.admin.TagObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TagObservation.

animal_name(obj)[source]

Animal name.

form

alias of django.forms.widgets.TagObservationForm

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'type_display', 'name', 'tag_location_display', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'tag_type', 'tag_location')
property media
search_fields = ('name', 'comments')
tag_location_display(obj)[source]

Make tag side human readable.

type_display(obj)[source]

Make tag type human readable.

class wastd.observations.admin.TagObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

TabularInlineAdmin for TagObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TagObservation

class wastd.observations.admin.TemperatureLoggerDeploymentInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TemperatureLoggerDeployment.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TemperatureLoggerDeployment

class wastd.observations.admin.TemperatureLoggerSettingsInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TemperatureLoggerSettings.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TemperatureLoggerSettings

class wastd.observations.admin.TrackTallyObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TrackTallyObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'species', 'nest_age', 'nest_type', 'tally', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'species', 'nest_age', 'nest_type')
property media
search_fields = ()
class wastd.observations.admin.TrackTallyObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TrackTallyObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TrackTallyObservation

class wastd.observations.admin.TurtleDamageObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleDamageObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'body_part', 'damage_type', 'damage_age', 'description', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'body_part', 'damage_type', 'damage_age')
property media
class wastd.observations.admin.TurtleDamageObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TurtleDamageObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleDamageObservation

class wastd.observations.admin.TurtleHatchlingEmergenceObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleHatchlingEmergenceObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'bearing_to_water_degrees', 'bearing_leftmost_track_degrees', 'bearing_rightmost_track_degrees', 'no_tracks_main_group', 'no_tracks_main_group_min', 'no_tracks_main_group_max', 'outlier_tracks_present', 'path_to_sea_comments', 'hatchling_emergence_time_known', 'cloud_cover_at_emergence_known', 'light_sources_present', 'hatchling_emergence_time', 'hatchling_emergence_time_accuracy', 'cloud_cover_at_emergence', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
property media
search_fields = ()
class wastd.observations.admin.TurtleHatchlingEmergenceObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.StackedInline

Admin for TurtleHatchlingEmergenceObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleHatchlingEmergenceObservation

class wastd.observations.admin.TurtleHatchlingEmergenceOutlierObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleHatchlingEmergenceOutlierObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'bearing_outlier_track_degrees', 'outlier_group_size', 'outlier_track_comment', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
property media
search_fields = ()
class wastd.observations.admin.TurtleHatchlingEmergenceOutlierObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TurtleHatchlingEmergenceOutlierObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleHatchlingEmergenceOutlierObservation

class wastd.observations.admin.TurtleMorphometricObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleMorphometricObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

handler = <django.forms.fields.ChoiceField object>
list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'curved_carapace_length_mm', 'curved_carapace_length_min_mm', 'straight_carapace_length_mm', 'curved_carapace_width_mm', 'tail_length_carapace_mm', 'tail_length_vent_mm', 'tail_length_plastron_mm', 'maximum_head_width_mm', 'maximum_head_length_mm', 'body_depth_mm', 'body_weight_g', 'handler', 'recorder', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type')
property media
recorder = <django.forms.fields.ChoiceField object>
search_fields = ()
class wastd.observations.admin.TurtleMorphometricObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.StackedInline

Admin for TurtleMorphometricObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleMorphometricObservation

class wastd.observations.admin.TurtleNestDisturbanceObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleNestDisturbanceObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'disturbance_cause', 'disturbance_cause_confidence', 'disturbance_severity', 'comments', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'disturbance_cause_confidence', 'disturbance_severity')
property media
class wastd.observations.admin.TurtleNestDisturbanceObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TurtleNestDisturbanceObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleNestDisturbanceObservation

class wastd.observations.admin.TurtleNestDisturbanceTallyObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleNestDisturbanceTallyObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'species', 'disturbance_cause', 'no_nests_disturbed', 'no_tracks_encountered', 'comments', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'species', 'disturbance_cause')
property media
search_fields = ('comments',)
class wastd.observations.admin.TurtleNestDisturbanceTallyObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Admin for TurtleNestDisturbanceTallyObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleNestDisturbanceTallyObservation

class wastd.observations.admin.TurtleNestEncounterAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.EncounterAdmin

Admin for TurtleNestEncounter.

age_display(obj)[source]

Make nest age human readable.

fieldsets = (('Encounter', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('area', 'site', 'campaign', 'survey', 'where', 'location_accuracy', 'location_accuracy_m', 'when', 'observer', 'reporter', 'source', 'source_id', 'name')}), ('Nest', {'classes': ('grp-collapse', 'grp-open', 'wide', 'extrapretty'), 'fields': ('nest_age', 'nest_type', 'species', 'habitat', 'disturbance', 'nest_tagged', 'logger_found', 'eggs_counted', 'hatchlings_measured', 'fan_angles_measured', 'comments')}))
form

alias of django.forms.widgets.TurtleNestEncounterForm

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

habitat_display(obj)[source]

Make habitat human readable.

inlines = [<class 'wastd.observations.admin.MediaAttachmentInline'>, <class 'wastd.observations.admin.NestTagObservationInline'>, <class 'wastd.observations.admin.TurtleNestObservationInline'>, <class 'wastd.observations.admin.TurtleNestDisturbanceObservationInline'>, <class 'wastd.observations.admin.HatchlingMorphometricObservationInline'>, <class 'wastd.observations.admin.TurtleHatchlingEmergenceObservationInline'>, <class 'wastd.observations.admin.TurtleHatchlingEmergenceOutlierObservationInline'>, <class 'wastd.observations.admin.LightSourceObservationObservationInline'>, <class 'wastd.observations.admin.LoggerObservationInline'>, <class 'shared.admin.CustomStateLogInline'>]
list_display = ('when', 'area', 'site', 'latitude', 'longitude', 'location_accuracy', 'location_accuracy_m', 'name_link', 'age_display', 'type_display', 'species', 'habitat_display', 'disturbance', 'comments', 'observer', 'reporter', 'source_display', 'source_id', 'status', 'encounter_type', 'owner')
list_filter = ('campaign__owner', ('area', <class 'wastd.observations.admin.AreaFilter'>), ('site', <class 'wastd.observations.admin.SiteFilter'>), 'status', 'observer', 'reporter', 'location_accuracy', 'encounter_type', 'source', 'nest_age', 'nest_type', 'species', 'habitat', 'disturbance', 'nest_tagged', 'logger_found', 'eggs_counted', 'hatchlings_measured', 'fan_angles_measured')
property media
type_display(obj)[source]

Make nest type human readable.

class wastd.observations.admin.TurtleNestObservationAdmin(*args, **kwargs)[source]

Bases: wastd.observations.admin.ObservationAdminMixin

Admin for TurtleNestObservation.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ('pk', 'area', 'site', 'latitude', 'longitude', 'date', 'eggs_laid', 'egg_count', 'egg_count_calculated', 'hatching_success', 'emergence_success', 'no_egg_shells', 'no_live_hatchlings_neck_of_nest', 'no_live_hatchlings', 'no_dead_hatchlings', 'no_undeveloped_eggs', 'no_unhatched_eggs', 'no_unhatched_term', 'no_depredated_eggs', 'nest_depth_top', 'nest_depth_bottom', 'encounter_link', 'encounter_status')
list_filter = (('encounter__area', <class 'wastd.observations.admin.AreaFilter'>), ('encounter__site', <class 'wastd.observations.admin.SiteFilter'>), 'encounter__status', 'encounter__encounter_type', 'eggs_laid')
property media
class wastd.observations.admin.TurtleNestObservationInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.StackedInline

Admin for TurtleNestObservation.

classes = ('grp-collapse grp-open',)
extra = 0
property media
model

alias of wastd.observations.models.TurtleNestObservation

API

The API is intended for programmatic access to data, mainly to batch-import and batch-export.

The rest

This concludes the documentation of the key features. The following sections document the remaining modules for completeness’ sake.

wastd.users app

WAStD’s custom user package, courtesy of pydanny’s django project template.

wastd.users.admin Module

User admin.

class wastd.users.admin.MyUserAdmin(model, admin_site)[source]

Bases: django.contrib.auth.admin.UserAdmin

add_form

alias of wastd.users.admin.MyUserCreationForm

fieldsets = (('User Profile', {'fields': ('name', 'nickname', 'aliases', 'role', 'affiliation', 'organisations', 'phone', 'alive')}), (None, {'fields': ('username', 'password')}), ('Personal info', {'fields': ('first_name', 'last_name', 'email')}), ('Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}), ('Important dates', {'fields': ('last_login', 'date_joined')}))
form

alias of wastd.users.admin.MyUserChangeForm

get_readonly_fields(request, obj=None)[source]

Hook for specifying custom readonly fields.

list_display = ('username', 'email', 'name', 'nickname', 'aliases', 'role', 'phone', 'is_superuser', 'is_staff', 'is_active', 'alive')
list_filter = ('is_superuser', 'is_staff', 'is_active', 'alive')
property media
readonly_fields = ['organisations', 'is_superuser', 'is_staff']
search_fields = ['username__icontains', 'name__icontains', 'nickname__icontains', 'aliases__icontains', 'role__icontains', 'affiliation__icontains', 'email__icontains', 'phone__icontains']
class wastd.users.admin.MyUserChangeForm(*args, **kwargs)[source]

Bases: django.contrib.auth.forms.UserChangeForm

class Meta[source]

Bases: django.contrib.auth.forms.UserChangeForm.Meta

model

alias of wastd.users.models.User

base_fields = {'affiliation': <django.forms.fields.CharField object>, 'aliases': <django.forms.fields.CharField object>, 'alive': <django.forms.fields.BooleanField object>, 'date_joined': <django.forms.fields.DateTimeField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'groups': <django.forms.models.ModelMultipleChoiceField object>, 'is_active': <django.forms.fields.BooleanField object>, 'is_staff': <django.forms.fields.BooleanField object>, 'is_superuser': <django.forms.fields.BooleanField object>, 'last_login': <django.forms.fields.DateTimeField object>, 'last_name': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'nickname': <django.forms.fields.CharField object>, 'organisations': <django.forms.models.ModelMultipleChoiceField object>, 'password': <django.contrib.auth.forms.ReadOnlyPasswordHashField object>, 'phone': <phonenumber_field.formfields.PhoneNumberField object>, 'role': <django.forms.fields.CharField object>, 'user_permissions': <django.forms.models.ModelMultipleChoiceField object>, 'username': <django.contrib.auth.forms.UsernameField object>}
declared_fields = {'password': <django.contrib.auth.forms.ReadOnlyPasswordHashField object>}
property media

Return all media required to render the widgets on this form.

class wastd.users.admin.MyUserCreationForm(*args, **kwargs)[source]

Bases: django.contrib.auth.forms.UserCreationForm

class Meta[source]

Bases: django.contrib.auth.forms.UserCreationForm.Meta

model

alias of wastd.users.models.User

base_fields = {'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>, 'username': <django.contrib.auth.forms.UsernameField object>}
clean_username()[source]
declared_fields = {'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>}
error_message = None
property media

Return all media required to render the widgets on this form.

class wastd.users.admin.OrganisationAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Organisation admin.

list_display = ('code', 'label', 'description')
property media
search_fields = ('label__icontains', 'description__icontains')

wastd.users.views Module

User views.

class wastd.users.views.MergeView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

Merge any two User profiles.

form_class

alias of wastd.users.forms.MergeForm

form_valid(form)[source]

Transfer user, show result as success message, return to new user’s detail.

get_initial()[source]

Set initial user choices to old or new user if provided.

This View can be used and populated from three URLs, providing no User PK, only the old, or both User PKs.

template_name = 'pages/default_form.html'
class wastd.users.views.TransferView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

Transfer data between two User profiles for a given Area.

form_class

alias of wastd.users.forms.TransferForm

form_valid(form)[source]

Transfer user, show result as success message, return to new user’s detail.

get_initial()[source]

Set initial user choices to old or new user if provided.

This View can be used and populated from three URLs, providing no User PK, only the old, or both User PKs.

template_name = 'pages/default_form.html'
class wastd.users.views.UserDetailView(**kwargs)[source]

Bases: shared.views.DetailViewBreadcrumbMixin, django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.detail.DetailView

User detail view.

get_context_data(**kwargs)[source]

Custom context.

get_object()[source]

Get Object by pk.

model

alias of wastd.users.models.User

class wastd.users.views.UserListView(**kwargs)[source]

Bases: shared.views.ListViewBreadcrumbMixin, export_download.views.ResourceDownloadMixin, django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.list.ListView

User list view.

filter_class

alias of wastd.users.filters.UserFilter

get_context_data(**kwargs)[source]

Custom context.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of wastd.users.models.User

paginate_by = 20
template_name = 'pages/default_list.html'
class wastd.users.views.UserRedirectView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.base.RedirectView

User redirect view.

get_redirect_url()[source]

Get redirect url: user detail.

permanent = False
class wastd.users.views.UserUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.edit.UpdateView

User update view.

fields = ['name', 'nickname', 'aliases', 'role', 'email', 'phone']
get_object()[source]

Only get the User record for the user making the request.

get_success_url()[source]

Success url: user detail.

model

alias of wastd.users.models.User

wastd.users.views.merge_users(request, old_pk, new_pk)[source]

Merge two users.

wastd.users.views.transfer_user_view(request, old_pk, new_pk, area_pk)[source]

Transfer data between two User profiles for a given Area.

wastd.observations app

Remaining modules of the observations package are documented here.

wastd.observations.views Module

Views for WAStD.

class wastd.observations.views.AnimalEncounterCreate(**kwargs)[source]

Bases: django.views.generic.edit.CreateView

form_class

alias of wastd.observations.forms.AnimalEncounterForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

model

alias of wastd.observations.models.AnimalEncounter

post(request, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

class wastd.observations.views.AnimalEncounterDetail(**kwargs)[source]

Bases: shared.views.DetailViewBreadcrumbMixin, django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Custom context.

model

alias of wastd.observations.models.AnimalEncounter

class wastd.observations.views.AnimalEncounterList(**kwargs)[source]

Bases: shared.views.ListViewBreadcrumbMixin, export_download.views.ResourceDownloadMixin, django.views.generic.list.ListView

filter_class

alias of wastd.observations.filters.AnimalEncounterFilter

get_context_data(**kwargs)[source]

Custom context.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of wastd.observations.models.AnimalEncounter

paginate_by = 20
resource_class

alias of wastd.observations.resources.AnimalEncounterResource

template_name = 'pages/default_list.html'
class wastd.observations.views.AnimalEncounterTable(data=None, order_by=None, orderable=None, empty_text=None, exclude=None, attrs=None, row_attrs=None, pinned_row_attrs=None, sequence=None, prefix=None, order_by_field=None, page_field=None, per_page_field=None, template_name=None, default=None, request=None, show_header=None, show_footer=True, extra_columns=None)[source]

Bases: django_tables2.tables.Table

A data table for AnimalEncounters.

class Meta[source]

Bases: object

Model opts.

attrs = {'class': 'table table-hover table-inverse table-sm'}
exclude = ['as_html', 'as_latex', 'polymorphic_ctype', 'encounter_ptr']
model

alias of wastd.observations.models.AnimalEncounter

base_columns = {'activity': <django_tables2.columns.base.Column object>, 'area': <django_tables2.columns.base.Column object>, 'behaviour': <django_tables2.columns.base.Column object>, 'campaign': <django_tables2.columns.base.Column object>, 'cause_of_death': <django_tables2.columns.base.Column object>, 'cause_of_death_confidence': <django_tables2.columns.base.Column object>, 'checked_for_flipper_tags': <django_tables2.columns.base.Column object>, 'checked_for_injuries': <django_tables2.columns.base.Column object>, 'comments': <django_tables2.columns.base.Column object>, 'datetime_of_last_sighting': <django_tables2.columns.datetimecolumn.DateTimeColumn object>, 'encounter_type': <django_tables2.columns.base.Column object>, 'habitat': <django_tables2.columns.base.Column object>, 'health': <django_tables2.columns.base.Column object>, 'id': <django_tables2.columns.base.Column object>, 'laparoscopy': <django_tables2.columns.booleancolumn.BooleanColumn object>, 'location_accuracy': <django_tables2.columns.base.Column object>, 'location_accuracy_m': <django_tables2.columns.base.Column object>, 'maturity': <django_tables2.columns.base.Column object>, 'name': <django_tables2.columns.base.Column object>, 'nesting_disturbed': <django_tables2.columns.base.Column object>, 'nesting_event': <django_tables2.columns.base.Column object>, 'observer': <django_tables2.columns.base.Column object>, 'reporter': <django_tables2.columns.base.Column object>, 'scanned_for_pit_tags': <django_tables2.columns.base.Column object>, 'sex': <django_tables2.columns.base.Column object>, 'sighting_status': <django_tables2.columns.base.Column object>, 'site': <django_tables2.columns.base.Column object>, 'site_of_first_sighting': <django_tables2.columns.base.Column object>, 'site_of_last_sighting': <django_tables2.columns.base.Column object>, 'source': <django_tables2.columns.base.Column object>, 'source_id': <django_tables2.columns.base.Column object>, 'species': <django_tables2.columns.base.Column object>, 'status': <django_tables2.columns.base.Column object>, 'survey': <django_tables2.columns.base.Column object>, 'taxon': <django_tables2.columns.base.Column object>, 'when': <django_tables2.columns.datetimecolumn.DateTimeColumn object>, 'where': <django_tables2.columns.base.Column object>}
class wastd.observations.views.AnimalEncounterTableView(**kwargs)[source]

Bases: wastd.observations.views.EncounterTableView

Filtered paginated TableView for AninmalEncounter.

filter_class

alias of wastd.observations.filters.AnimalEncounterFilter

formhelper_class

alias of wastd.observations.forms.AnimalEncounterListFormHelper

model

alias of wastd.observations.models.AnimalEncounter

paginate_by = 5
table_class

alias of wastd.observations.views.AnimalEncounterTable

template = 'observations/encounter.html'
class wastd.observations.views.AnimalEncounterUpdate(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

form_class

alias of wastd.observations.forms.AnimalEncounterForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

model

alias of wastd.observations.models.AnimalEncounter

post(request, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

class wastd.observations.views.EncounterDetail(**kwargs)[source]

Bases: shared.views.DetailViewBreadcrumbMixin, django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Custom context.

model

alias of wastd.observations.models.Encounter

class wastd.observations.views.EncounterList(**kwargs)[source]

Bases: shared.views.ListViewBreadcrumbMixin, export_download.views.ResourceDownloadMixin, django.views.generic.list.ListView

filter_class

alias of wastd.observations.filters.EncounterFilter

get_context_data(**kwargs)[source]

Custom context.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of wastd.observations.models.Encounter

paginate_by = 20
resource_class

alias of wastd.observations.resources.EncounterResource

template_name = 'pages/default_list.html'
class wastd.observations.views.EncounterTable(data=None, order_by=None, orderable=None, empty_text=None, exclude=None, attrs=None, row_attrs=None, pinned_row_attrs=None, sequence=None, prefix=None, order_by_field=None, page_field=None, per_page_field=None, template_name=None, default=None, request=None, show_header=None, show_footer=True, extra_columns=None)[source]

Bases: django_tables2.tables.Table

A data table for Encounters.

class Meta[source]

Bases: object

Model opts.

attrs = {'class': 'table table-hover table-inverse table-sm'}
exclude = ['as_html', 'as_latex', 'polymorphic_ctype', 'encounter_ptr']
model

alias of wastd.observations.models.Encounter

base_columns = {'area': <django_tables2.columns.base.Column object>, 'campaign': <django_tables2.columns.base.Column object>, 'comments': <django_tables2.columns.base.Column object>, 'encounter_type': <django_tables2.columns.base.Column object>, 'id': <django_tables2.columns.base.Column object>, 'location_accuracy': <django_tables2.columns.base.Column object>, 'location_accuracy_m': <django_tables2.columns.base.Column object>, 'name': <django_tables2.columns.base.Column object>, 'observer': <django_tables2.columns.base.Column object>, 'reporter': <django_tables2.columns.base.Column object>, 'site': <django_tables2.columns.base.Column object>, 'source': <django_tables2.columns.base.Column object>, 'source_id': <django_tables2.columns.base.Column object>, 'status': <django_tables2.columns.base.Column object>, 'survey': <django_tables2.columns.base.Column object>, 'when': <django_tables2.columns.datetimecolumn.DateTimeColumn object>, 'where': <django_tables2.columns.base.Column object>}
class wastd.observations.views.EncounterTableView(**kwargs)[source]

Bases: wastd.observations.views.PagedFilteredTableView

Filtered paginated TableView for Encounter.

filter_class

alias of wastd.observations.filters.EncounterFilter

formhelper_class

alias of wastd.observations.forms.EncounterListFormHelper

model

alias of wastd.observations.models.Encounter

paginate_by = 5
table_class

alias of wastd.observations.views.EncounterTable

class wastd.observations.views.HomeView(**kwargs)[source]

Bases: django.views.generic.list.ListView

HomeView.

get_context_data(**kwargs)[source]

Context data.

get_queryset(**kwargs)[source]

Queryset.

model

alias of wastd.observations.models.AnimalEncounter

template_name = 'pages/map.html'
class wastd.observations.views.LineTransectEncounterDetail(**kwargs)[source]

Bases: shared.views.DetailViewBreadcrumbMixin, django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Custom context.

model

alias of wastd.observations.models.LineTransectEncounter

class wastd.observations.views.LineTransectEncounterList(**kwargs)[source]

Bases: shared.views.ListViewBreadcrumbMixin, export_download.views.ResourceDownloadMixin, django.views.generic.list.ListView

filter_class

alias of wastd.observations.filters.LineTransectEncounterFilter

get_context_data(**kwargs)[source]

Custom context.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of wastd.observations.models.LineTransectEncounter

paginate_by = 20
resource_class

alias of wastd.observations.resources.LineTransectEncounterResource

template_name = 'pages/default_list.html'
class wastd.observations.views.PagedFilteredTableView(**kwargs)[source]

Bases: django_tables2.views.SingleTableView

Generic class for paged, filtered SingleTableView.

Inherit from this class and set the class level attributes (model etc.).

Source: http://kuttler.eu/post/using-django-tables2-filters-crispy-forms-together/

context_filter_name = 'filter'
filter_class = None
formhelper_class = None
get_context_data(**kwargs)[source]

Add the specified filter class to context.

get_queryset(**kwargs)[source]

Run the queryset through the specified filter class.

get_table(**kwargs)[source]

Paginate the table as per paginate_by and request parameters.

model = None
paginate_by = 10
table_class = None
class wastd.observations.views.SurveyDetail(**kwargs)[source]

Bases: shared.views.DetailViewBreadcrumbMixin, django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Custom context.

model

alias of wastd.observations.models.Survey

class wastd.observations.views.SurveyList(**kwargs)[source]

Bases: shared.views.ListViewBreadcrumbMixin, export_download.views.ResourceDownloadMixin, django.views.generic.list.ListView

filter_class

alias of wastd.observations.filters.SurveyFilter

get_context_data(**kwargs)[source]

Custom context.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of wastd.observations.models.Survey

paginate_by = 20
resource_class

alias of wastd.observations.resources.SurveyResource

template_name = 'pages/default_list.html'
class wastd.observations.views.TurtleNestEncounterDetail(**kwargs)[source]

Bases: shared.views.DetailViewBreadcrumbMixin, django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Custom context.

model

alias of wastd.observations.models.TurtleNestEncounter

class wastd.observations.views.TurtleNestEncounterList(**kwargs)[source]

Bases: shared.views.ListViewBreadcrumbMixin, export_download.views.ResourceDownloadMixin, django.views.generic.list.ListView

filter_class

alias of wastd.observations.filters.TurtleNestEncounterFilter

get_context_data(**kwargs)[source]

Custom context.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of wastd.observations.models.TurtleNestEncounter

paginate_by = 20
resource_class

alias of wastd.observations.resources.TurtleNestEncounterResource

template_name = 'pages/default_list.html'
wastd.observations.views.close_survey_duplicates(request, pk)[source]

Close duplicates for a given Survey PK with the request user as actor.

All duplicate Surveys will be curated and marked as “not production”. The given Survey will be curated and marked as “production”, adopt all Encounters from all duplicate surveys, and adjust its duration.

See Survey.close_duplicates() for implementation details.

wastd.observations.views.import_odka_view(request)[source]

Import all available ODK-Aggregate forms.

wastd.observations.views.reconstruct_surveys_view(request)[source]

Import all available ODK-Aggregate forms.

wastd.observations.views.resave_surveys_view(request)[source]

Re-save all Surveys.

wastd.observations.views.update_names_view(request)[source]

Reconstruct animal encounter case histories and sighting status.

Project delivery: ticking the boxes

This chapter closes the development circle by pairing functional requirements with corresponding functional, unit and view tests. The tests are documented inline with the requirements they cover; the documentation is extracted in the build process and shown below.

This chapter should read to business owners as a walk-through of their business processes. Ideally, all requirements from the detailed requirements analysis find their counterpart in the following section.

Tests are structured into:

  • Unit tests: the basics
    • data structure (model X must have field Y),

    • model functions (string representation of model X must include field Y)

  • View tests: the boring bits
    • Do all pages load?

    • Do named URLs work?

    • Are all required page HTML templates in place?

    • Do all view functions work?

  • Functional tests: the meat and potatoes
    • Business logic: following real-world scenarios

    • Permissions: which role can see / do what when?

    • Conditions: what needs to be done and present before a step can be executed?

    • Consequences: what will happen if I hit this button?

WA Strandings and WA Sea Turtles

Observations

wastd.observations.tests Module

Users

wastd.users.tests Module