Models

class projects.models.Batch(*args, **kwargs)

Each time an annotator submits any annotation(s), an annotation batch is created for this annotator and a unique UUID is assigned tot his batch.

All annotated Markers (instantiated as either Inputs or Labels) and Relations (instantiated as LabelRelations) are then binded to this batch.

Parameters
  • id (AutoField) – Id

  • revision_of_id (ForeignKey to Batch) – Revision of

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • uuid (UUIDField) – Uuid

  • user_id (ForeignKey to User) – User

  • is_flagged (BooleanField) – Indicates whether the annotator has flagged the batch as having problems

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.CommonModel(*args, **kwargs)

Abstract model containing the fields for creation and update dates, as well as a stub for to_json method.

Parameters
  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class projects.models.Context(*args, **kwargs)

An instantiation of a textual context that is currently annotated. This is stored specifically in Textinator to avoid the loss of annotations if something should happen to the original data sources.

We do specify which data source a context is from, so it could be deleted, should the need arise. However, it is not deleted automatically on deletion of the data source, again, to prevent the loss of annotations in case the data source deletion was accidental.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • datasource_id (ForeignKey to DataSource) – Datasource

  • datapoint (CharField) – As stored in the original dataset

  • content (TextField) – Content

exception DoesNotExist
exception MultipleObjectsReturned
save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class projects.models.DataAccessLog(*args, **kwargs)

Holds data access logs for each annotator per project. We keep track of:

  • which datapoint and of which data source was accessed and when

  • whether at least one annotation was submitted for that datapoint

  • whether the datapoint was skipped without annotation (i.e., a new text was requested)

  • whether the user flagged anything related to this datapoint (e.g., problems with text)

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • user_id (ForeignKey to User) – User

  • project_id (ForeignKey to Project) – Project

  • datasource_id (ForeignKey to DataSource) – Datasource

  • datapoint (IntegerField) – As ordered in the original dataset

  • flags (JSONField) – Additional information provided by the annotator

  • is_submitted (BooleanField) – Indicates whether the datapoint was successfully submitted by an annotator

  • is_skipped (BooleanField) – Indicates whether the datapoint was skipped by an annotator

  • is_delayed (BooleanField) – Indicates whether the datapoint for skipped and saved for later by an annotator

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.DataSource(*args, **kwargs)

Holds a definition of a datasource. Currently we support 4 source_types:

  • plain text – input text directly in the admin interface (mostly for testing)

  • plain text files – a bunch of files hosted on the same server as Textinator

  • JSON files – a bunchf of JSON files hosted on the same server as Textinator

  • Texts API – a REST API that will be used for getting each datapoint (the endpoint should be specified)

Texts API specification is available in the example_texts_api folder of the GitHub repository.

DataSource specifies 3 different formattings:

  • plain text (without line breaks or tabs preserved)

  • formatted text (with line breaks and tabs preserved)

  • markdown

By default each DataSource is private, unless is_public switch is on.

owner of the DataSource is set automatically and is nullable. The reason behind allowing NULL values is that the data might be owned by the institution, not by the user and might also have projects connected to it. If people want their datasource deleted together with their user account, they need to request a manual deletion.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • name (CharField) – Dataset name

  • source_type (CharField) – Dataset type

  • spec (TextField) – in a JSON format

  • language (CharField) – Language of this data source

  • formatting (CharField) – text formating of the data source

  • is_public (BooleanField) – Whether to make data source available to other Textinator users

  • owner_id (ForeignKey to User) – Owner

  • post_processing_methods (ManyToManyField) – Post-processing methods

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.Input(*args, **kwargs)

Holds an instantiation of a Marker that does not require specifying the start-end boundaries of the text. This mostly concerns the cases when a user provides an input via HTML <input> tag.

Specifically this concerns MarkerVariants with the following annotation types:

  • short (long) free-text input

  • integer

  • floating-point number

  • range

group_order field specifies the order of the marker group that this MarkerVariant belongs to in the MarkerUnit (if such unit was defined) at submission time. To exemplify, let’s say there is a definition of a MarkerUnit that consists of 3 to 5 marker groups, each of which has:

  • Question marker (Q)

  • Correct answer marker (C)

In the UI, the annotator will then see the following:

[(Q, C)+, (Q, C)+, (Q, C)+, (Q, C), (Q, C)]

The groups with a (+) are mandatory for submission (since a unit should hold at least 3 groups by a specification). group_order is meaningfull only if the annotator is allowed to rank the groups within a unit. If so, then group_order specifies the order of each (Q, C) group after ranking at submission time.

Parameters
  • id (AutoField) – Id

  • revision_of_id (ForeignKey to Input) – Revision of

  • group_order (PositiveIntegerField) – At the submission time

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • content (TextField) – Content

  • marker_id (ForeignKey to MarkerVariant) – Marker

  • context_id (ForeignKey to Context) – Context

  • batch_id (ForeignKey to Batch) – Batch

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.Label(*args, **kwargs)

Holds an instantiation of a Marker that requires specifying the start-end boundaries of the text or is NOT provided via HTML <input> tag.

Specifically this concerns MarkerVariants with the following annotation types:

  • marker (text spans)

  • marker (whole text)

extra holds extra information associated with the annotation at submission time. This extra information is typically via marker actions (i.e., right-clicking a marker).

The meaning of group_order is exactly the same as for Input.

Parameters
  • id (AutoField) – Id

  • revision_of_id (ForeignKey to Label) – Revision of

  • group_order (PositiveIntegerField) – At the submission time

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • start (PositiveIntegerField) – Character-wise start position in the text

  • end (PositiveIntegerField) – Character-wise end position in the text

  • marker_id (ForeignKey to MarkerVariant) – Marker

  • extra (JSONField) – in a JSON format

  • context_id (ForeignKey to Context) – Context

  • undone (BooleanField) – Indicates whether the annotator used ‘Undo’ button

  • batch_id (ForeignKey to Batch) – Batch

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.LabelRelation(*args, **kwargs)

Holds an instantiation of a Relation.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • rule_id (ForeignKey to RelationVariant) – Rule

  • first_label_id (ForeignKey to Label) – First label

  • second_label_id (ForeignKey to Label) – Second label

  • undone (BooleanField) – Indicates whether the annotator used ‘Undo’ button

  • batch_id (ForeignKey to Batch) – Batch

  • cluster (PositiveIntegerField) – At the submission time

  • extra (JSONField) – in a JSON format

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.Marker(*args, **kwargs)

Holds the definition for each unit of annotation in Textinator, called Marker. We create each Marker only when creating a new project and can re-use Markers between the projects (all Markers are available to all users).

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • name (CharField) – The display name of the marker (max 50 characters)

  • name_en (TranslationCharField) – The display name of the marker (max 50 characters)

  • name_nl (TranslationCharField) – The display name of the marker (max 50 characters)

  • name_ru (TranslationCharField) – The display name of the marker (max 50 characters)

  • name_es (TranslationCharField) – The display name of the marker (max 50 characters)

  • name_sv (TranslationCharField) – The display name of the marker (max 50 characters)

  • name_uk (TranslationCharField) – The display name of the marker (max 50 characters)

  • code (CharField) – Marker’s nickname used internally

  • color (ColorField) – Color for the annotated text span

  • shortcut (CharField) – Keyboard shortcut for annotating a piece of text with this marker

  • suggestion_endpoint (URLField) – Endpoint for the Suggestions API

exception DoesNotExist
exception MultipleObjectsReturned
clean_fields(exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

is_part_of_relation()

Check whether a given marker is part of definition for any Relation

refresh_from_db(using=None, fields=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class projects.models.MarkerAction(*args, **kwargs)

Specifies an action that shows up after right-clicking the marker. Each action is implemented as a JavaScript plugin that should exist in static/scripts/labeler_plugins folder along with a specification of how to implement your own plugins if necessary.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • name (CharField) – Name

  • description (TextField) – Description

  • file (CharField) – a name of the JS plugin file in the /static/scripts/labeler_plugins directory

  • admin_filter (CharField) – Specifies the filter type in the data explorer interface (one of ‘boolean’, ‘range’). If empty, then this action will be excluded from data explorer.

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.MarkerContextMenuItem(*args, **kwargs)

An M2M model binding MarkerAction and MarkerVariant and holding additional information.

  • config holds a JSON configuration, specified in the JS plugin file for this action.

    By storing it here, we allow each config to be customized specifically for each MarkerVariant-MarkerAction binding.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • action_id (ForeignKey to MarkerAction) – Marker action

  • marker_id (ForeignKey to MarkerVariant) – Marker

  • verbose (CharField) – Verbose name

  • verbose_admin (CharField) – Verbose name in data explorer

  • field (CharField) – If applicable

  • config (JSONField) – Json configuration

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.MarkerPair(*args, **kwargs)

Holds a pair of markers and is used to define (constrain) the relations. For example, if the relation Refers to holds between Antecedent and Reference, then a marker pair of Antecedent and Reference will be created and assigned to that relation definition.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • first_id (ForeignKey to Marker) – First

  • second_id (ForeignKey to Marker) – Second

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.MarkerRestriction(*args, **kwargs)

Holds a definition of a count restriction that is placed on a MarkerVariant

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • variant_id (ForeignKey to MarkerVariant) – Marker variant

  • kind (CharField) – Restriction kind

  • value (PositiveIntegerField) – e.g., if restriction kind is ‘<=’ and value is ‘3’, this creates a restriction ‘<= 3’

  • is_ignorable (BooleanField) – whether the restriction can be ignored at the discretion of the annotator

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.MarkerUnit(*args, **kwargs)

Some annotation tasks might benefit from annotating groups of markers as one unit. This model stores the definitions of such units (shared across all users).

The unit configuration has two dimensions: - marker group, which is defined by a one-to-many relationship with MarkerVariant model - unit height, which provides minimum and maximum number of marker groups in this unit

minimum_required attribute defines a lower bound for a unit height, whereas size defines an upper bound.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • size (PositiveIntegerField) – Default (and maximal) number of marker groups in the unit

  • minimum_required (PositiveIntegerField) – Minimum required number of marker groups in the unit (can’t be more than size)

  • is_rankable (BooleanField) – Whether annotators should be allowed to rank marker groups in the unit

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.MarkerVariant(*args, **kwargs)

Holds a project-specific definition for a previously defined Marker. This model allows the project manager to customize a previously defined marker by:

  • specifying different color or hotkey

  • changing the annotation type of the marker (defined in settings.ANNOTATION_TYPES)

  • assigning a marker to a unit

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • project_id (ForeignKey to Project) – Project

  • marker_id (ForeignKey to Marker) – Marker template

  • nrange_id (ForeignKey to Range) – Applicable only if the annotation types are ‘integer’, ‘floating-point number’ or ‘range’. If the annotation type is ‘range’ and no numeric range is specified, the input will range from 0 to 100 by default. The values will remain unrestricted for ‘integer’ or ‘floating-point number’ types.

  • unit_id (ForeignKey to MarkerUnit) – Marker unit

  • order_in_unit (PositiveIntegerField) – Order of this marker in the unit

  • are_suggestions_enabled (BooleanField) – Indicates whether Suggestions API should be enabled for this marker (if endpoint is specified)

  • custom_suggestion_endpoint (URLField) – Custom endpoint for the Suggestions API (by default the one from the marker template is used). Activates only if suggestions are enabled.

  • custom_color (ColorField) – Customized color for the annotated text span (color of the marker template by default)

  • custom_shortcut (CharField) – Keyboard shortcut for annotating a piece of text with this marker (shortcut of the marker template by default

  • anno_type (CharField) – The type of annotations made using this marker

  • display_type (CharField) – Only applicable if annotation type is Marker (text spans)

  • display_tab (CharField) – A name of the tab to which this marker belongs (leave empty if you don’t want to have any tabs)

  • export_name (CharField) – The name of the field in the exported JSON file (English name by default)

  • choices (JSONField) – Valid only if annotation type is radio buttons or checkboxes. Up to 2 levels of nesting allowed (more than 2 is impractical for the annotator)

  • actions (ManyToManyField) – Actions associated with this marker

exception DoesNotExist
exception MultipleObjectsReturned
get_count_restrictions(stringify=True)

Get the restrictions (if any) on the number of markers per submitted instance

Args:

stringify (bool, optional): Whether to return the restrictions in a string format

Returns:

(str or list): Restrictions on the number of markers per submitted instance

max()
Returns:

int: The maximal number of markers of this kind per submitted instance

min()
Returns:

int: The minimal number of markers of this kind per submitted instance

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class projects.models.PostProcessingMethod(*args, **kwargs)

Holds function names to the post-processing methods that can be applied directly to textual data. Eligible methods are currently being pulled from projects/helpers.py, which is not a very elegant solution.

NOTE: this functionality is currently inactive and is a candidate for removal/overhaul in future releases.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • name (CharField) – Verbose name

  • helper (CharField) – Name as specified in projects/helpers.py

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.PreMarker(*args, **kwargs)

Static pre-markers to be automatically created before the annotation of a specific text begun.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • project_id (ForeignKey to Project) – Project

  • marker_id (ForeignKey to MarkerVariant) – Marker

  • tokens (TextField) – Comma-separated tokens that should be highlighted with a marker

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.Project(*args, **kwargs)

Holds a definition of each Textinator project.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • title (CharField) – Title

  • short_description (TextField) – Will be displayed on the project card

  • institution (CharField) – Institution responsible for the project

  • supported_by (CharField) – The name of the organization supporting the project financially (if applicable)

  • guidelines (HTMLField) – Guidelines for the annotation task

  • reminders (HTMLField) – Reminders for essential parts of guidelines (keep them short and on point)

  • temporary_message (HTMLField) – A temporary message for urgent communication with annotators (e.g., about maintenance work)

  • data_order (CharField) – In what order should the data be presented?

  • disjoint_annotation (BooleanField) – Should each annotator work with their own part of data?

  • show_datasource_identifiers (BooleanField) – Should data source identifiers be shown?

  • task_type (CharField) – Type of the annotation task

  • dt_publish (DateTimeField) – Publishing date

  • dt_finish (DateTimeField) – Expiration date

  • dt_updated (DateTimeField) – Updated at

  • author_id (ForeignKey to User) – Author

  • is_open (BooleanField) – Should the project be public?

  • is_peer_reviewed (BooleanField) – Should the annotations be peer reviewed?

  • allow_selecting_labels (BooleanField) – Should selecting the labels be allowed?

  • disable_submitted_labels (BooleanField) – Should submitted labels be disabled?

  • auto_text_switch (BooleanField) – Automatic mode involves showing a new text on page refresh if at least one annotation was made on it (default). If this setting is turned off, the annotator only gets a new text when they choose to click on the ‘Get new text’ button.

  • max_markers_per_input (PositiveIntegerField) – Maximal number of markers per input

  • has_intro_tour (BooleanField) – WARNING: Intro tours are currently in beta

  • language (CharField) – Language of this project

  • thumbnail (ImageField) – A thumbnail of your project (ignored if not provided)

  • video_summary (FileBrowseField) – Video introducing people to the annotation task at hand (if applicable)

  • video_remote (URLField) – A URL for video summary to be embedded (e.g. from YouTube)

  • modal_configs (JSONField) – JSON configuration for the modal windows in the project. Currently available keys for modals are: ‘flagged’

  • editing_title_regex (TextField) – The regular expression to be used for searching the annotated texts and using the first found result as a title of the batches to be edited

  • allow_editing (BooleanField) – Should editing of own annotations be allowed?

  • editing_as_revision (BooleanField) – By default editing happens directly in the annotated objects. If this setting is turned on, the original objects will remain intact and separate reivison objects will be created

  • allow_reviewing (BooleanField) – Should peer reviewing be enabled?

  • collaborators (ManyToManyField) – Collaborators

  • participants (ManyToManyField) – Participants

  • markers (ManyToManyField) – Project-specific markers

  • relations (ManyToManyField) – Project-specific relations

  • datasources (ManyToManyField) – All data sources must be of the same language as the project

exception DoesNotExist
exception MultipleObjectsReturned
data(user, force_switch=False)

Main method for getting data from the data sources and keeping track of who should annotate what.

The method proceeds as follows:

  • If the annotator has previously requested a datapoint, but neither did any annotation, nor requested a new one, show the very same datapoint again. Otherwise, proceed.

  • If the annotator did some annotation and the auto text switch is off, show the very same text again. Otherwise, proceed

  • If sampling with replacement is turned off, exclude the previously annotated data.

  • If disjoint annotation is turned on, then all previously annotated datapoints (by anyone) should be excluded, so that the sets of annotations for each annotator are disjoint.

  • If disjoint annotation is off, then exclude only data previously annotated by the current user.

  • Instantiate all datasources associated with this project

  • Choose an unannotated datapoint uniformly at random across all datasources and return it.

Args:

user (User): Current user

Returns:

DatapointInfo: The instance holding the information about the datapoint to be annotated

free_markers(intelligent_groups=False)
Returns:

QuerySet: The set of marker variants that do NOT belong to marker unit (order by annotation type)

is_ordered(parallel='*')

Check if the data order is static

Args:
parallel (str or bool, optional): indicates whether to check if the dataset order is parallel (True) or sequential (False)

or that the exact order is not important is not important (‘*’, by default)

Returns:

bool: Indicator of whether the data is to be presented in a specified (optionally, with sequential or parallel dataset order)

is_sampled(replacement='*')

Check if the data order is randomly sampled

Args:
replacement (str or bool, optional): indicates whether to the check if sampling with replacement (True) or not (False)

or that the kind is not important (‘*’, by default)

Returns:

bool: Indicator of whether the data is to be sampled (optionally, with or without replacement)

property marker_groups
Returns:

QuerySet: The set of marker variants that belong to marker unit (order by annotation type)

class projects.models.Range(*args, **kwargs)

Holds a definition for a numeric range, stores min, max and step (similar to Python’s range). Currently this is used for specifying the possible numeric ranges for marker variants of types ‘integer’, ‘floating-point value’ and ‘range’.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • min_value (FloatField) – Minimal value

  • max_value (FloatField) – Maximal value

  • step (FloatField) – Step

exception DoesNotExist
exception MultipleObjectsReturned
clean()

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

class projects.models.Relation(*args, **kwargs)

Holds a definition of a relation in Textinator. We create each Relation only when creating a new project and can re-use Relations between the projects (all Relations are available to all users).

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • name (CharField) – Name

  • name_en (TranslationCharField) – Name [en]

  • name_nl (TranslationCharField) – Name [nl]

  • name_ru (TranslationCharField) – Name [ru]

  • name_es (TranslationCharField) – Name [es]

  • name_sv (TranslationCharField) – Name [sv]

  • name_uk (TranslationCharField) – Name [uk]

  • direction (CharField) – Direction

  • shortcut (CharField) – Keyboard shortcut for marking a piece of text with this relation

  • representation (CharField) – How should the relation be visualized?

  • pairs (ManyToManyField) – Marker pairs

exception DoesNotExist
exception MultipleObjectsReturned
property between
Returns:

str: The string representation of the pairs of markers for which the relation can be annotated.

clean_fields(exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

refresh_from_db(using=None, fields=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

class projects.models.RelationVariant(*args, **kwargs)

Holds a project-specific definition for a previously defined Relation. This model allows the project manager to customize a previously defined relation by:

  • specifying different hotkey

  • specifying a different visual representation (i.e., graph or list)

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • project_id (ForeignKey to Project) – Project

  • relation_id (ForeignKey to Relation) – Relation template

  • custom_shortcut (CharField) – Keyboard shortcut for marking a piece of text with this relation (shortcut of the relation template by default)

  • custom_representation (CharField) – How should the relation be visualized? (representation of the relation template by default)

exception DoesNotExist
exception MultipleObjectsReturned
property between
Returns:

str: The string representation of the pairs of markers for which the relation can be annotated.

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class projects.models.TaskTypeSpecification(*args, **kwargs)

Holds a specification for an annotation task type and is used when a project of the pre-defined annotation type is instantiated. The specification describes markers and relations that are to be used for this annotation task.

Default specifications are created during the first startup of the server and can be found in the task_defaults.json

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • task_type (CharField) – Type of the annotation task

  • config (JSONField) – Json configuration

exception DoesNotExist
exception MultipleObjectsReturned
class projects.models.UserProfile(*args, **kwargs)

An M2M model binding User and Project and holding additional information

NOTE: the additional information is currently not in use and is a candidate for removal/overhaul in future releases.

Parameters
  • id (AutoField) – Id

  • dt_created (DateTimeField) – Autofilled

  • dt_updated (DateTimeField) – Autofilled

  • user_id (ForeignKey to User) – User

  • project_id (ForeignKey to Project) – Project

  • allowed_reviewing (BooleanField) – Whether the annotator is allowed to review for this project

exception DoesNotExist
exception MultipleObjectsReturned