eds_scikit.biology.utils.prepare_relationship
prepare_relationship_table
prepare_relationship_table(data: Data, source_terminologies: Dict[str, str], mapping: List[Tuple[str, str, str]]) -> ks.DataFrame
Create easy-to-use relationship table based on given terminologies and mapping between them.
PARAMETER | DESCRIPTION |
---|---|
data |
Instantiated [
TYPE:
|
source_terminologies |
Dictionary of concepts terminologies with their associated regex.
TYPE:
|
**EXAMPLE |
|
mapping |
Ordered mapping of terminologies based on concept_relationship table
TYPE:
|
**EXAMPLE |
|
Output
source_concept_id | source_concept_name | source_concept_code | standard_concept_id | standard_concept_name | standard_concept_code |
---|---|---|---|---|---|
3 | xxxxxxxxxxxx | CX1 | 4 | xxxxxxxxxxxx | A1 |
9 | xxxxxxxxxxxx | ZY2 | 5 | xxxxxxxxxxxx | A2 |
9 | xxxxxxxxxxxx | B3F | 47 | xxxxxxxxxxxx | D3 |
7 | xxxxxxxxxxxx | T32 | 4 | xxxxxxxxxxxx | F82 |
5 | xxxxxxxxxxxx | S23 | 1 | xxxxxxxxxxxx | A432 |
Source code in eds_scikit/biology/utils/prepare_relationship.py
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 |
|
filter_concept_sets_relationship_table
filter_concept_sets_relationship_table(relationship_table, concept_sets)
Filter relationship table using concept_sets concept codes.
PARAMETER | DESCRIPTION |
---|---|
relationship_table |
Biology relationship table
TYPE:
|
concept_sets |
List of concepts-sets to select
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
Filtered biology relationship table |
Source code in eds_scikit/biology/utils/prepare_relationship.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
concept_sets_columns
concept_sets_columns(relationship_table: DataFrame, concept_sets: List[ConceptsSet], extra_terminologies: List = List[str]) -> List[str]
Filter relationship_table keeping concepts_sets terminologies columns.
PARAMETER | DESCRIPTION |
---|---|
relationship_table |
TYPE:
|
concept_sets |
TYPE:
|
extra_terminologies |
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[str]
|
Source code in eds_scikit/biology/utils/prepare_relationship.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
prepare_biology_relationship_table
prepare_biology_relationship_table(data: Data, concept_sets: List[ConceptsSet] = None, get_all_terminologies: bool = True) -> DataFrame
Prepare biology relationship table to map concept codes based on settings.source_terminologies and settings.mapping.
PARAMETER | DESCRIPTION |
---|---|
data |
Instantiated
TYPE:
|
concept_sets |
List of concepts-sets to select
TYPE:
|
get_all_terminologies |
If True, all terminologies from settings terminologies will be added, by default True
TYPE:
|
Returns |
|
DataFrame |
biology_relationship_table to be merged with measurement
|
Source code in eds_scikit/biology/utils/prepare_relationship.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|