database_repositories
oxytcmri.interface.repositories.database_repositories
¶
Classes:
Name | Description |
---|---|
DataBaseGateway |
Abstract base class for database access to repositories. |
DataBaseRepository |
Base class for database access to repositories. |
DataBaseCenterRepository |
Persistence layer for Center entities using a database gateway. |
DataBaseAtlasRepository |
Persistence layer for Atlas entities using a database gateway. |
DataBaseMRIExamRepository |
Persistence layer for MRIExam entities using a database gateway. |
DataBaseSubjectRepository |
Persistence layer for Subject entities using a database gateway. |
DataBaseDTINormativeValuesRepository |
Persistence layer for NormativeValue entities using a database gateway. |
DataBaseRepositoriesRegistry |
|
Attributes:
Name | Type | Description |
---|---|---|
Entity |
|
|
EntityIdentifier |
|
Entity = TypeVar('Entity')
module-attribute
¶
EntityIdentifier = TypeVar('EntityIdentifier')
module-attribute
¶
DataBaseGateway
¶
Bases: Generic[Entity]
, ABC
Abstract base class for database access to repositories.
Methods:
Name | Description |
---|---|
find_by_id |
Find an entity by its ID. |
find_by_filters |
Find an entity by filters. Those filters are the attributes of the entity, |
find_all |
Find all entities of a given type. |
save |
Save an entity to the database. |
save_list |
Save a list of entities to the database. |
delete |
Delete an entity from the database. |
update |
Update an entity in the database. |
delete_all |
Delete all entities of a given type from the database. |
find_by_id(entity_type, id_value)
abstractmethod
¶
Find an entity by its ID.
Source code in oxytcmri/interface/repositories/database_repositories.py
19 20 21 |
|
find_by_filters(entity_type, filters)
abstractmethod
¶
Find an entity by filters. Those filters are the attributes of the entity, and are modeled as a dictionary.
Source code in oxytcmri/interface/repositories/database_repositories.py
23 24 25 26 |
|
find_all(entity_type)
abstractmethod
¶
Find all entities of a given type.
Source code in oxytcmri/interface/repositories/database_repositories.py
28 29 30 |
|
save(entity)
abstractmethod
¶
Save an entity to the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
32 33 34 |
|
save_list(entities)
abstractmethod
¶
Save a list of entities to the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
36 37 38 |
|
delete(entity)
abstractmethod
¶
Delete an entity from the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
40 41 42 |
|
update(entity)
abstractmethod
¶
Update an entity in the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
44 45 46 |
|
delete_all(entity_type)
¶
Delete all entities of a given type from the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
48 49 50 51 |
|
DataBaseRepository(data_gateway, entity_type, id_extractor)
¶
Bases: Repository[Entity, EntityIdentifier]
, Generic[Entity, EntityIdentifier]
Base class for database access to repositories.
Initialize the repository with a database gateway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_gateway
|
DataBaseGateway
|
The database gateway used for accessing the database. |
required |
entity_type
|
Type[Entity]
|
The type of entity managed by this repository. |
required |
id_extractor
|
Callable[[Entity], EntityIdentifier]
|
A function to extract the ID from an entity. |
required |
Methods:
Name | Description |
---|---|
find_by_id |
|
list_all |
|
save |
|
delete |
|
Attributes:
Name | Type | Description |
---|---|---|
data_gateway |
|
|
entity_type |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
data_gateway = data_gateway
instance-attribute
¶
entity_type = entity_type
instance-attribute
¶
find_by_id(entity_id)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
79 80 81 |
|
list_all()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
83 84 |
|
save(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
86 87 |
|
delete(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
89 90 |
|
DataBaseCenterRepository(data_gateway)
¶
Bases: CenterRepository
, DataBaseRepository[Center, int]
Persistence layer for Center entities using a database gateway.
Initialize the repository with a database gateway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_gateway
|
DataBaseGateway
|
The database gateway used for accessing the database. |
required |
Source code in oxytcmri/interface/repositories/database_repositories.py
96 97 98 99 100 101 102 103 104 105 |
|
DataBaseAtlasRepository(data_gateway)
¶
Bases: AtlasRepository
, DataBaseRepository[Atlas, int]
Persistence layer for Atlas entities using a database gateway.
Initialize the repository with a database gateway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_gateway
|
DataBaseGateway
|
The database gateway used for accessing the database. |
required |
Source code in oxytcmri/interface/repositories/database_repositories.py
111 112 113 114 115 116 117 118 119 120 121 122 |
|
DataBaseMRIExamRepository(data_gateway)
¶
Bases: MRIExamRepository
, DataBaseRepository[MRIExam, MRIExamId]
Persistence layer for MRIExam entities using a database gateway.
Initialize the repository with a database gateway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_gateway
|
DataBaseGateway
|
The database gateway used for accessing the database. |
required |
Methods:
Name | Description |
---|---|
get_exam_for_subject |
|
save |
Save an MRIExam entity to the database, as well as all associated MRIData entities. |
Source code in oxytcmri/interface/repositories/database_repositories.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
get_exam_for_subject(subject_id)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
143 144 145 146 147 148 149 150 151 |
|
save(mri_exam)
¶
Save an MRIExam entity to the database, as well as all associated MRIData entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mri_exam
|
MRIExam
|
The MRIExam entity to save. |
required |
Source code in oxytcmri/interface/repositories/database_repositories.py
153 154 155 156 157 158 159 160 161 162 163 164 |
|
DataBaseSubjectRepository(data_gateway)
¶
Bases: SubjectRepository
, DataBaseRepository[Subject, SubjectId]
Persistence layer for Subject entities using a database gateway.
Initialize the repository with a database gateway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_gateway
|
DataBaseGateway
|
The database gateway used for accessing the database. |
required |
Methods:
Name | Description |
---|---|
find_subjects_by_center |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
find_subjects_by_center(center, subject_type=None)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
DataBaseDTINormativeValuesRepository(data_gateway)
¶
Bases: NormativeValueRepository
Persistence layer for NormativeValue entities using a database gateway.
Initialize the repository with a database gateway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_gateway
|
DataBaseGateway
|
The database gateway used for accessing the database. |
required |
Methods:
Name | Description |
---|---|
save |
|
save_list |
|
exists |
|
find_by_id |
|
list_all |
|
delete |
|
Attributes:
Name | Type | Description |
---|---|---|
data_gateway |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
203 204 205 206 207 208 209 210 211 212 |
|
data_gateway = data_gateway
instance-attribute
¶
save(normative_value)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
214 215 |
|
save_list(normative_values_list)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
217 218 |
|
exists(center, dti_metric, atlas, atlas_label, statistic_strategy)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
find_by_id(entity_id)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
242 243 |
|
list_all()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
245 246 |
|
delete(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
248 249 |
|
DataBaseRepositoriesRegistry(persistence_gateway)
¶
Bases: RepositoriesRegistry
Methods:
Name | Description |
---|---|
get_repository |
|
list_all_repositories |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
253 254 255 256 257 258 259 260 |
|
get_repository(entity_type)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
262 263 264 265 266 |
|
list_all_repositories()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
268 269 |
|