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. |
DataBaseRegionOfInterestRepository |
Persistence layer for RegionOfInterest entities using a database gateway. |
DataBaseBrainLesionsVolumeRepository |
Persistence layer for BrainLesionsVolume 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
20 21 22 | |
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
24 25 26 27 | |
find_all(entity_type)
abstractmethod
¶
Find all entities of a given type.
Source code in oxytcmri/interface/repositories/database_repositories.py
29 30 31 | |
save(entity)
abstractmethod
¶
Save an entity to the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
33 34 35 | |
save_list(entities)
abstractmethod
¶
Save a list of entities to the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
37 38 39 | |
delete(entity)
abstractmethod
¶
Delete an entity from the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
41 42 43 | |
update(entity)
abstractmethod
¶
Update an entity in the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
45 46 47 | |
delete_all(entity_type)
¶
Delete all entities of a given type from the database.
Source code in oxytcmri/interface/repositories/database_repositories.py
49 50 51 52 | |
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 |
|---|---|
exists |
|
find_by_id |
|
list_all |
|
save |
|
delete |
|
Attributes:
| Name | Type | Description |
|---|---|---|
data_gateway |
|
|
entity_type |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
data_gateway = data_gateway
instance-attribute
¶
entity_type = entity_type
instance-attribute
¶
exists(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
80 81 82 | |
find_by_id(entity_id)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
84 85 86 | |
list_all()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
88 89 | |
save(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
91 92 | |
delete(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
94 95 | |
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
101 102 103 104 105 106 107 108 109 110 | |
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
116 117 118 119 120 121 122 123 124 125 126 127 | |
DataBaseRegionOfInterestRepository(data_gateway)
¶
Bases: RegionOfInterestRepository, DataBaseRepository[RegionOfInterest, str]
Persistence layer for RegionOfInterest 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
133 134 135 136 137 138 139 140 141 142 143 144 | |
DataBaseBrainLesionsVolumeRepository(data_gateway)
¶
Bases: BrainLesionsVolumeRepository
Persistence layer for BrainLesionsVolume 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 |
|---|---|
exists |
Check if a BrainLesionsVolume entity exists in the database. |
find_by_id |
|
list_all |
|
save |
|
delete |
Delete a BrainLesionsVolume entity from the database. |
Attributes:
| Name | Type | Description |
|---|---|---|
data_gateway |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
150 151 152 153 154 155 156 157 158 159 | |
data_gateway = data_gateway
instance-attribute
¶
exists(entity)
¶
Check if a BrainLesionsVolume entity exists in the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
BrainLesionsVolume
|
The BrainLesionsVolume entity to check for existence. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the entity exists, False otherwise. |
Source code in oxytcmri/interface/repositories/database_repositories.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
find_by_id(entity_id)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
186 187 | |
list_all()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
189 190 | |
save(brain_lesions_volume)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
192 193 | |
delete(entity)
¶
Delete a BrainLesionsVolume entity from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
BrainLesionsVolume
|
The BrainLesionsVolume entity to delete. |
required |
Source code in oxytcmri/interface/repositories/database_repositories.py
195 196 197 198 199 200 201 202 203 204 | |
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
210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
get_exam_for_subject(subject)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
225 226 227 228 229 230 231 232 233 | |
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
235 236 237 238 239 240 241 242 243 244 245 246 | |
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 |
Source code in oxytcmri/interface/repositories/database_repositories.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
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 |
|
get_by_parameters |
|
find_by_id |
|
list_all |
|
delete |
|
Attributes:
| Name | Type | Description |
|---|---|---|
data_gateway |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
271 272 273 274 275 276 277 278 279 280 | |
data_gateway = data_gateway
instance-attribute
¶
save(normative_value)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
282 283 | |
save_list(normative_values_list)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
285 286 | |
exists(center, dti_metric, atlas, atlas_label, statistic_strategy)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
get_by_parameters(center, dti_metric, atlas, atlas_label, statistic_strategy)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
find_by_id(entity_id)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
338 339 | |
list_all()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
341 342 | |
delete(entity)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
344 345 | |
DataBaseRepositoriesRegistry(persistence_gateway)
¶
Bases: RepositoriesRegistry
Methods:
| Name | Description |
|---|---|
get_repository |
|
list_all_repositories |
|
Source code in oxytcmri/interface/repositories/database_repositories.py
349 350 351 352 353 354 355 356 357 358 | |
get_repository(entity_type)
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
360 361 362 363 364 | |
list_all_repositories()
¶
Source code in oxytcmri/interface/repositories/database_repositories.py
366 367 | |