|
14 | 14 |
|
15 | 15 | class AlchemyPower(ModelBase): |
16 | 16 | """ |
17 | | - SQLAlchemy ORM model representing precomputed statistical power results |
18 | | - for a specific experiment, criterion, alternative hypothesis, and |
19 | | - Monte-Carlo simulation setup. |
20 | | -
|
21 | | - Each row contains a unique combination of: |
22 | | - - criterion type and its parameters, |
23 | | - - sample size, |
24 | | - - alternative hypothesis and its parameters, |
25 | | - - Monte-Carlo simulation count, |
26 | | - - significance level. |
27 | | -
|
28 | | - The uniqueness of these combinations is enforced by |
29 | | - the ``uq_power_unique`` constraint. |
30 | | -
|
31 | | - Attributes: |
32 | | - id (int): Primary key of the record. |
33 | | - experiment_id (int): Identifier of the experiment this power result |
34 | | - belongs to. |
35 | | - criterion_code (str): Code of the statistical criterion used |
36 | | - (e.g., test type). |
37 | | - criterion_parameters (str): JSON-encoded or serialized parameters |
38 | | - of the criterion. |
39 | | - sample_size (int): Sample size for which the power value was |
40 | | - computed. |
41 | | - alternative_code (str): Code of the alternative hypothesis used |
42 | | - in the simulation. |
43 | | - alternative_parameters (str): JSON-encoded or serialized parameters |
44 | | - of the alternative hypothesis. |
45 | | - monte_carlo_count (int): Number of Monte-Carlo simulations performed. |
46 | | - significance_level (float): Significance level (alpha) used |
47 | | - for the test. |
48 | | - results_criteria (str): Serialized result of the power computation, |
49 | | - typically containing power values or related statistics. |
50 | | - """ |
| 17 | + SQLAlchemy ORM model representing precomputed statistical power results |
| 18 | + for a specific experiment, criterion, alternative hypothesis, and |
| 19 | + Monte-Carlo simulation setup. |
| 20 | +
|
| 21 | + Each row contains a unique combination of: |
| 22 | + - criterion type and its parameters, |
| 23 | + - sample size, |
| 24 | + - alternative hypothesis and its parameters, |
| 25 | + - Monte-Carlo simulation count, |
| 26 | + - significance level. |
| 27 | +
|
| 28 | + The uniqueness of these combinations is enforced by |
| 29 | + the ``uq_power_unique`` constraint. |
| 30 | +
|
| 31 | + Attributes: |
| 32 | + id (int): Primary key of the record. |
| 33 | + experiment_id (int): Identifier of the experiment this power result |
| 34 | + belongs to. |
| 35 | + criterion_code (str): Code of the statistical criterion used |
| 36 | + (e.g., test type). |
| 37 | + criterion_parameters (str): JSON-encoded or serialized parameters |
| 38 | + of the criterion. |
| 39 | + sample_size (int): Sample size for which the power value was |
| 40 | + computed. |
| 41 | + alternative_code (str): Code of the alternative hypothesis used |
| 42 | + in the simulation. |
| 43 | + alternative_parameters (str): JSON-encoded or serialized parameters |
| 44 | + of the alternative hypothesis. |
| 45 | + monte_carlo_count (int): Number of Monte-Carlo simulations performed. |
| 46 | + significance_level (float): Significance level (alpha) used |
| 47 | + for the test. |
| 48 | + results_criteria (str): Serialized result of the power computation, |
| 49 | + typically containing power values or related statistics. |
| 50 | + """ |
| 51 | + |
51 | 52 | __tablename__ = "power" |
52 | 53 |
|
53 | 54 | id: Mapped[int] = mapped_column(Integer, primary_key=True) # type: ignore |
@@ -77,23 +78,24 @@ class AlchemyPower(ModelBase): |
77 | 78 |
|
78 | 79 | class AlchemyPowerStorage(AbstractDbStore, IPowerStorage): |
79 | 80 | """ |
80 | | - SQLAlchemy-backed storage implementation for persisting and retrieving |
81 | | - statistical power calculation results. |
82 | | -
|
83 | | - This class manages CRUD operations for :class:`AlchemyPower` entities, |
84 | | - providing a database-backed implementation of the ``IPowerStorage`` interface. |
85 | | - It stores and queries power computation results based on combinations of |
86 | | - criterion settings, sample size, alternative hypothesis parameters, |
87 | | - Monte-Carlo configuration, and significance level. |
88 | | -
|
89 | | - The storage must be explicitly initialized by calling :meth:`init` before any |
90 | | - database operations can be performed. |
91 | | -
|
92 | | - Attributes: |
93 | | - session (SessionType): A SQLAlchemy session shared across all instances. |
94 | | - _initialized (bool): Internal flag indicating whether the storage |
95 | | - was properly initialized via :meth:`init`. |
96 | | - """ |
| 81 | + SQLAlchemy-backed storage implementation for persisting and retrieving |
| 82 | + statistical power calculation results. |
| 83 | +
|
| 84 | + This class manages CRUD operations for :class:`AlchemyPower` entities, |
| 85 | + providing a database-backed implementation of the ``IPowerStorage`` interface. |
| 86 | + It stores and queries power computation results based on combinations of |
| 87 | + criterion settings, sample size, alternative hypothesis parameters, |
| 88 | + Monte-Carlo configuration, and significance level. |
| 89 | +
|
| 90 | + The storage must be explicitly initialized by calling :meth:`init` before any |
| 91 | + database operations can be performed. |
| 92 | +
|
| 93 | + Attributes: |
| 94 | + session (SessionType): A SQLAlchemy session shared across all instances. |
| 95 | + _initialized (bool): Internal flag indicating whether the storage |
| 96 | + was properly initialized via :meth:`init`. |
| 97 | + """ |
| 98 | + |
97 | 99 | session: ClassVar[SessionType] |
98 | 100 |
|
99 | 101 | def __init__(self, db_url: str): |
|
0 commit comments