Skip to content

onconova.research.models.project

Project

Bases: BaseModel

Represents a research project with associated metadata, members, and status.

Attributes:

Name Type Description
objects QueryablePropertiesManager

Custom manager for querying project properties.

leader ForeignKey[User]

The user responsible for the project and its members.

members ManyToManyField[User]

Users that are part of the project, managed through ProjectMembership.

clinical_centers ArrayField[CharField]

List of clinical centers involved in the project.

title CharField

Unique title of the project.

summary CharField

Description of the project.

ethics_approval_number CharField

Ethics approval number for the project.

status CharField

Current status of the project, chosen from ProjectStatusChoices.

data_constraints JSONField

Data constraints associated with the project.

clinical_centers class-attribute instance-attribute

data_constraints class-attribute instance-attribute

description property

Returns the title of the project as its description.

Returns:

Type Description
str

The title of the project.

ethics_approval_number class-attribute instance-attribute

leader class-attribute instance-attribute

members class-attribute instance-attribute

objects class-attribute instance-attribute

status class-attribute instance-attribute

summary class-attribute instance-attribute

title class-attribute instance-attribute

is_member(user)

Checks if the given user is a member of the project.

A user is considered a member if they are included in the project's members list or if they are the project leader.

Parameters:

Name Type Description Default

user

User

The user to check for membership.

required

Returns:

Type Description
bool

True if the user is a member or the leader, False otherwise.

Source code in onconova/research/models/project.py
def is_member(self, user: User) -> bool:
    """
    Checks if the given user is a member of the project.

    A user is considered a member if they are included in the project's members list
    or if they are the project leader.

    Args:
        user (User): The user to check for membership.

    Returns:
        (bool): True if the user is a member or the leader, False otherwise.
    """
    return user in self.members.all() or user == self.leader

ProjectDataManagerGrant

Bases: BaseModel

Represents a grant of data management permissions for a specific user (manager) on a project.

Attributes:

Name Type Description
member ForeignKey

Reference to the User who is granted data management permissions.

project ForeignKey

Reference to the Project under which the permission is granted.

revoked BooleanField

Indicates whether the authorization has been revoked.

validity_period DateRangeField

The period during which the grant is valid.

is_valid AnnotationProperty

Annotated property indicating if the grant is currently valid, based on the revoked status and validity period.

description property

Returns a formatted string describing the data manager role for a project member, including the member's username, project title, validity period, and revoked status if applicable.

is_valid class-attribute instance-attribute

member class-attribute instance-attribute

project class-attribute instance-attribute

revoked class-attribute instance-attribute

validity_period class-attribute instance-attribute

ProjectMembership

Bases: Model

Represents the membership of a user in a project.

Attributes:

Name Type Description
member ForeignKey

Reference to the user who is part of the project.

project ForeignKey

Reference to the project the user is associated with.

date_joined DateField

The date when the user joined the project.

Constraints

Ensures that each user can only be a member of a project once (unique combination of project and member).

date_joined class-attribute instance-attribute

member class-attribute instance-attribute

project class-attribute instance-attribute

Meta

constraints class-attribute instance-attribute

ProjectStatusChoices

Bases: TextChoices

An enumeration representing the possible statuses of a project.

Attributes:

Name Type Description
PLANNED

Indicates the project is planned but not yet started.

ONGOING

Indicates the project is currently in progress.

COMPLETED

Indicates the project has been finished.

ABORTED

Indicates the project was stopped before completion.

ABORTED class-attribute instance-attribute

COMPLETED class-attribute instance-attribute

ONGOING class-attribute instance-attribute

PLANNED class-attribute instance-attribute

runner