research.models package

Module contents

Definition of the app’s models. For an illustration of the relationship between the different models, see the Overview.

Submodules

research.models.choices module

Subclasses of the ChoiceEnum class used to represent raw and human-readable values for choices within the research.models module.

class research.models.choices.DominantHand

Bases: pylabber.utils.utils.ChoiceEnum

An Enum representing supported dominant hand options.

A = 'Ambidextrous'
L = 'Left'
R = 'Right'
class research.models.choices.Gender

Bases: pylabber.utils.utils.ChoiceEnum

An Enum representing supported gender options.

CIS = 'Cisgender'
OTHER = 'Other'
TRANS = 'Transgender'
class research.models.choices.Sex

Bases: pylabber.utils.utils.ChoiceEnum

An Enum representing supported sex options.

F = 'Female'
M = 'Male'
U = 'Other'

research.models.group module

Definition of the Group model.

class research.models.group.Group(*args, **kwargs)

Bases: django_extensions.db.models.TitleDescriptionModel, django_extensions.db.models.TimeStampedModel

Represents a unique study group (i.e. a grouping of subjects according to some experimental design in the context of a study).

mri_scans

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.

study

The study associated with this experimental group.

study_id

research.models.study module

Definition of the Study model.

class research.models.study.Study(*args, **kwargs)

Bases: django_extensions.db.models.TitleDescriptionModel, django_extensions.db.models.TimeStampedModel

Represents a single study in the database.

get_absolute_url()

Returns the canonical URL for this instance.

References

Returns

URL

Return type

str

collaborators

Researchers collaborating on this study.

group_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.

image

An optional image to supplement the description.

subjects

Subjects associated with this study.

research.models.subject module

Definition of the Subject model.

class research.models.subject.Subject(*args, **kwargs)

Bases: django_extensions.db.models.TimeStampedModel

Represents a single research subject. Any associated data model should be associated with this model.

get_absolute_url()

Returns the canonical URL for this instance.

References

Returns

URL

Return type

str

get_dominant_hand_display(*, field=<django.db.models.fields.CharField: dominant_hand>)
get_full_name()str

Returns a formatted string with the subject’s full name (first name and then last name).

Returns

Subject’s full name

Return type

str

get_gender_display(*, field=<django.db.models.fields.CharField: gender>)
get_raw_information() → pandas.core.series.Series

Temporary method to use an external table to retrieve subject information.

Returns

Subject information

Return type

pd.Series

get_sex_display(*, field=<django.db.models.fields.CharField: sex>)
save(*args, **kwargs)

Overrides the model’s save() method to process custom attributes.

Hint

For more information, see Django’s documentation on overriding model methods.

custom_attributes

Custom attributes dictionary.

date_of_birth

Subject’s date of birth.

dominant_hand

Subject’s dominant hand.

first_name

Subject’s first name.

gender

Subject’s gender.

id_number

Some representative ID number unique to this subject.

last_name

Subject’s last name.

mri_scans

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.

sex

Subject’s sex.

study_set

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.

research.models.validators module

Validators for django fields within the research.models module.

research.models.validators.not_future(value)