subject
oxytcmri.domain.entities.subject
¶
This module contains the Subject
class which represents a subject in the Oxy-TC trial, as well as the associated value objects.
Classes:
Name | Description |
---|---|
SubjectType |
Types of subjects in the study. |
SubjectId |
Value Object representing a subject identifier. |
Subject |
A subject participating in the study. |
SubjectType
¶
Bases: str
, Enum
Types of subjects in the study.
A subject can be:
- a healthy volunteer: passed an MRI to compare DTI values with patients
- a test patient: sometimes centers needed to test an MRI on a patient
- a patient: a patient in the trial
Methods:
Name | Description |
---|---|
from_string |
Convert a string to a SubjectType. |
Attributes:
Name | Type | Description |
---|---|---|
HEALTHY_VOLUNTEER |
|
|
PATIENT |
|
|
TEST_PATIENT |
|
HEALTHY_VOLUNTEER = 'Healthy Volunteer'
class-attribute
instance-attribute
¶
PATIENT = 'Patient'
class-attribute
instance-attribute
¶
TEST_PATIENT = 'Test Patient'
class-attribute
instance-attribute
¶
from_string(value)
classmethod
¶
Convert a string to a SubjectType.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
String to convert to a SubjectType. Must be "T", "V", or "P". |
required |
Returns:
Type | Description |
---|---|
SubjectType
|
The corresponding SubjectType. |
Raises:
Type | Description |
---|---|
ValueError
|
If the string is not "H", "V", or "P" |
Source code in oxytcmri/domain/entities/subject.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
SubjectId(id)
dataclass
¶
Value Object representing a subject identifier.
The ID follows the format "XX-YY-Z" where:
- XX is the center number (01-99)
- YY is the subject number within the center (01-99)
- Z is the subject type (P, V, T)
Examples: "01-02-P", "10-03-V", "13-03-P"
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
|
center_id |
int
|
Get the center ID from the subject ID. |
subject_number |
str
|
Get the subject number within the center. |
subject_type |
SubjectType
|
Get the subject type. |
Subject(id, subject_type, center_id)
dataclass
¶
A subject participating in the study.
Can be a healthy volunteer, a patient, or a test patient.
Methods:
Name | Description |
---|---|
from_subject_id |
Create a Subject from a subject ID. |
from_string_id |
Create a Subject from its string identifier. |
Attributes:
Name | Type | Description |
---|---|---|
id |
SubjectId
|
|
subject_type |
SubjectType
|
|
center_id |
int
|
|
id
instance-attribute
¶
subject_type
instance-attribute
¶
center_id
instance-attribute
¶
from_subject_id(subject_id)
classmethod
¶
Create a Subject from a subject ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subject_id
|
SubjectId
|
The subject ID, in its value object type |
required |
Source code in oxytcmri/domain/entities/subject.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
from_string_id(id_str)
classmethod
¶
Create a Subject from its string identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id_str
|
str
|
String in the format "XX-YY-Z" where:
|
required |
Returns:
Type | Description |
---|---|
Subject
|
The created Subject instance |
Source code in oxytcmri/domain/entities/subject.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|