List of models

These models generally correspond one-to-one with tables in the database.

Subjects

_images/subjects_ERD.png
class subjects.models.Project(id, json, name, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Subject(*args, **kwargs)

Bases: alyx.base.BaseModel

Metadata about an experimental subject (animal or human).

is_negative()

Genotype is -/- for all genes.

session_projects

List of projects that have at least one session with this subject.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.SubjectRequest(id, name, json, user, line, count, date_time, due_date, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

subjects.models.send_subject_request_mail_new(sender, instance=None, **kwargs)

Send en email when a subject request is created.

subjects.models.send_subject_request_mail_change(sender, instance=None, **kwargs)

Send en email when a subject’s request changes.

subjects.models.send_subject_responsible_user_mail_change(sender, instance=None, **kwargs)

Send en email when a subject’s responsible user changes.

class subjects.models.Litter(*args, **kwargs)

Bases: alyx.base.BaseModel

A litter, containing a mother, father, and children with a shared date of birth.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.BreedingPair(id, name, json, line, start_date, end_date, father, mother1, mother2, description)

Bases: alyx.base.BaseModel

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Line(id, name, json, description, target_phenotype, nickname, strain, source, source_identifier, source_url, expression_data_url, species, subject_autoname_index, breeding_pair_autoname_index, litter_autoname_index, is_active, lab)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Species(id, name, json, nickname)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Strain(*args, **kwargs)

Bases: alyx.base.BaseModel

A strain with a standardised name.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Source(*args, **kwargs)

Bases: alyx.base.BaseModel

A supplier / source of subjects.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.ZygosityRule(id, name, json, line, allele, sequence0, sequence0_result, sequence1, sequence1_result, zygosity)

Bases: alyx.base.BaseModel

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Allele(*args, **kwargs)

Bases: alyx.base.BaseModel

A single allele.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Zygosity(*args, **kwargs)

Bases: alyx.base.BaseModel

A junction table between Subject and Allele.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.Sequence(*args, **kwargs)

Bases: alyx.base.BaseModel

A genetic sequence that you run a genotyping test for.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class subjects.models.GenotypeTest(*args, **kwargs)

Bases: alyx.base.BaseModel

A junction table between Subject and Sequence.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Actions

_images/actions_ERD.png
class actions.models.ProcedureType(*args, **kwargs)

Bases: alyx.base.BaseModel

A procedure to be performed on a subject.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.Weighing(*args, **kwargs)

Bases: alyx.base.BaseModel

A weighing of a subject.

expected()

Expected weighing.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.WaterType(id, json, name)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.WaterAdministration(*args, **kwargs)

Bases: alyx.base.BaseModel

For keeping track of water for subjects not on free water.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.BaseAction(*args, **kwargs)

Bases: alyx.base.BaseModel

Base class for an action performed on a subject, such as a recording; surgery; etc. This should always be accessed through one of its subclasses.

class actions.models.VirusInjection(*args, **kwargs)

Bases: actions.models.BaseAction

A virus injection.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.Surgery(*args, **kwargs)

Bases: actions.models.BaseAction

Surgery performed on a subject.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.Session(*args, **kwargs)

Bases: actions.models.BaseAction

A recording or training session performed on a subject. There is normally only one of these per day, for example corresponding to a period of uninterrupted head fixation.

Note that you can organize sessions hierarchically by assigning a parent_session. Sub-sessions could for example corresponding to periods of time in which the same neurons were recorded, or a particular set of stimuli were presented. Top-level sessions should have parent_session set to null.

If the fields (e.g. users) of a subsession are null, they should inherited from the parent.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.EphysSession(*args, **kwargs)

Bases: actions.models.Session

This proxy class allows to register as a different admin page. The database is left untouched New methods are fine but not new fields

exception DoesNotExist

Bases: actions.models.DoesNotExist

exception MultipleObjectsReturned

Bases: actions.models.MultipleObjectsReturned

class actions.models.WaterRestriction(*args, **kwargs)

Bases: actions.models.BaseAction

Water restriction.

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.OtherAction(*args, **kwargs)

Bases: actions.models.BaseAction

Another type of action.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

actions.models.delay_since_last_notification(notification_type, title, subject)

Return the delay since the last notification corresponding to the given type, title, subject, in seconds, wheter it was actually sent or not.

actions.models.get_recipients(notification_type, subject=None, users=None)

Return the list of users that will receive a notification.

actions.models.send_pending_emails()

Send all pending notifications.

class actions.models.Notification(id, name, json, send_at, sent_at, notification_type, title, message, subject, status)

Bases: alyx.base.BaseModel

send_if_needed()

Send the email if needed and change the status to ‘sent’

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.NotificationRule(*args, **kwargs)

Bases: alyx.base.BaseModel

For each user and notification type, send the notifications for a given set of mice (none, all, mine, lab).

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.CullReason(id, name, json, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.CullMethod(id, name, json, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class actions.models.Cull(*args, **kwargs)

Bases: alyx.base.BaseModel

Culling action

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Data

_images/data_ERD.png
class data.models.DataRepositoryType(*args, **kwargs)

Bases: alyx.base.BaseModel

A type of data repository, e.g. local SAMBA file server; web archive; LTO tape

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class data.models.DataRepository(*args, **kwargs)

Bases: alyx.base.BaseModel

A data repository e.g. a particular local drive, specific cloud storage location, or a specific tape.

Stores an absolute path to the repository root as a URI (e.g. for SMB file://myserver.mylab.net/Data/ALF/; for web https://www.neurocloud.edu/Data/). Additional information about the repository can stored in JSON in a type-specific manner (e.g. which cardboard box to find a tape in)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class data.models.DataFormat(*args, **kwargs)

Bases: alyx.base.BaseModel

A descriptor to accompany a Dataset or DataCollection, saying what sort of information is contained in it. E.g. “Neuropixels raw data, formatted as flat binary file” “eye camera movie as mj2”, etc. Normally each DatasetType will correspond to a specific 3-part alf name (for individual files) or the first word of the alf names (for DataCollections)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class data.models.DatasetType(*args, **kwargs)

Bases: alyx.base.BaseModel

A descriptor to accompany a Dataset or DataCollection, saying what sort of information is contained in it. E.g. “Neuropixels raw data, formatted as flat binary file” “eye camera movie as mj2”, etc. Normally each DatasetType will correspond to a specific 3-part alf name (for individual files) or the first word of the alf names (for DataCollections)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class data.models.BaseExperimentalData(*args, **kwargs)

Bases: alyx.base.BaseModel

Abstract base class for all data acquisition models. Never used directly.

Contains an Session link, to provide information about who did the experiment etc. Note that sessions can be organized hierarchically, and this can point to any level of the hierarchy

class data.models.Dataset(*args, **kwargs)

Bases: data.models.BaseExperimentalData

A chunk of data that is stored outside the database, most often a rectangular binary array. There can be multiple FileRecords for one Dataset, which will be different physical files, all containing identical data, with the same MD5.

Note that by convention, binary arrays are stored as .npy and text arrays as .tsv

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class data.models.FileRecord(*args, **kwargs)

Bases: alyx.base.BaseModel

A single file on disk or tape. Normally specified by a path within an archive. If required, more details can be in the JSON

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class data.models.Download(id, name, json, user, dataset, first_download, last_download, count)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Misc

_images/misc_ERD.png
class misc.models.LabMember(password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined, id, is_stock_manager)

Bases: django.contrib.auth.models.AbstractUser

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.Lab(id, json, name, institution, address, timezone, reference_weight_pct, zscore_weight_pct, cage_type, enrichment, food, cage_cleaning_frequency_days, light_cycle)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.LabMembership(id, name, json, user, lab, role, start_date, end_date)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.LabLocation(*args, **kwargs)

Bases: alyx.base.BaseModel

The physical location at which an session is performed or appliances are located. This could be a room, a bench, a rig, etc.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.Note(id, name, json, user, date_time, text, image, content_type, object_id)

Bases: alyx.base.BaseModel

save(**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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.CageType(id, name, json, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.Enrichment(id, json, name, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.Food(id, json, name, description)

Bases: alyx.base.BaseModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.Housing(*args, **kwargs)

Bases: alyx.base.BaseModel

Table containing housing conditions. Subjects are linked through the HousingSubject table that contains the date_in / date_out for each Housing. NB: housing is not a physical cage, although it refers to it by cage_name. For history recording purposes, if an enrichment/food in a physical cage changes, then: 1) creates a new Housing instance 2) closes (set end_datetime) for current mice in junction table 3) creates HousingSubject records for the current mice and new Housing

save(**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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class misc.models.HousingSubject(*args, **kwargs)

Bases: alyx.base.BaseModel

Through model for Housing and Subjects m2m

save(**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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned