forked from ExposuresProvider/icees-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
107 lines (73 loc) · 2.02 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"""Data models."""
from typing import Any, Dict, List, Literal, Optional, Union
from pydantic import BaseModel
Comparator = Literal[
"<",
">",
"<=",
">=",
"=",
"<>",
]
class Correction(BaseModel):
method: Literal[
"bonferroni",
"sidak",
"holm-sidak",
"holm",
"simes-hochberg",
"hommel",
"fdr_bh",
"fdr_by"
]
class CorrectionWithAlpha(BaseModel):
method: Literal[
"fdr_tsbh",
"fdr_tsbky"
]
alpha: float
class Comparison(BaseModel):
operator: Comparator
value: Any
class Between(BaseModel):
operator: Literal["between"]
value_a: Any
value_b: Any
class In(BaseModel):
operator: Literal["in"]
values: List[Any]
Qualifier = Union[Comparison, Between, In]
FeaturesImplicit = Dict[str, Qualifier]
class FeatureExplicit(BaseModel):
feature_name: str
feature_qualifier: Qualifier
year: Optional[int]
Feature = Union[FeaturesImplicit, FeatureExplicit]
Features = Union[FeaturesImplicit, List[FeatureExplicit]]
class FeatureExplicit2(BaseModel):
feature_name: str
feature_qualifiers: List[Qualifier]
year: Optional[int]
FeaturesImplicit2 = Dict[str, List[Qualifier]]
Feature2 = Union[FeaturesImplicit2, FeatureExplicit2]
Features2 = Union[FeaturesImplicit, List[FeatureExplicit2]]
class FeatureAssociation(BaseModel):
feature_a: Feature
feature_b: Feature
check_coverage_is_full: bool = False
class FeatureAssociation2(BaseModel):
feature_a: Feature2
feature_b: Feature2
check_coverage_is_full: bool = False
class AllFeaturesAssociation(BaseModel):
feature: Feature
maximum_p_value: float
correction: Optional[Union[Correction, CorrectionWithAlpha]]
check_coverage_is_full: bool = False
class AllFeaturesAssociation2(BaseModel):
feature: Feature2
maximum_p_value: float
correction: Optional[Union[Correction, CorrectionWithAlpha]]
check_coverage_is_full: bool = False
class AddNameById(BaseModel):
cohort_id: str