Preparation
PreparationView
¶
Bases: View
View for preparation records.
This view populates the preparation resource on the Data Portal.
Source code in dataimporter/emu/views/preparation.py
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 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 139 140 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 168 169 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 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
get_voucher_data(prep)
¶
Search for the voucher record of the given prep record, returning the transformed version of it if found. There are three links which can ultimately lead to a specimen record, so this method tries them all until it gets to one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prep
|
SourceRecord
|
the prep record |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
the transformed voucher record, or None if no voucher record is found |
Source code in dataimporter/emu/views/preparation.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
is_member(record)
¶
Filters the given record, determining whether it should be included in the preparation resource or not. This view member filter checks for one of two kinds of record in order for the record to be included:
- a preparation record from the Molecular Collections sub-department
- a mammal group part record from the LS Mammals sub-department with the
DToL project tag
These two types have slightly different fields but are both preps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SourceRecord
|
the record to filter |
required |
Returns:
| Type | Description |
|---|---|
FilterResult
|
a FilterResult object |
Source code in dataimporter/emu/views/preparation.py
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 | |
is_publishable(record)
¶
Filters the given record, determining whether it matches the publishing rules for preps records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SourceRecord
|
the record to filter |
required |
Returns:
| Type | Description |
|---|---|
FilterResult
|
a FilterResult object |
Source code in dataimporter/emu/views/preparation.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
transform(record)
¶
Converts the record's raw data to a dict which will be the data presented on the Data Portal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SourceRecord
|
the record to project |
required |
Returns:
| Type | Description |
|---|---|
dict
|
a dict containing the data for this record that should be displayed on the Data Portal |
Source code in dataimporter/emu/views/preparation.py
158 159 160 161 162 163 164 165 166 167 168 169 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 | |
get_preparation_process(record)
¶
Given a record, returns a value for the preparationProcess field. This value is pulled from the EntPrePreparationMethod EMu field. The value of this field is cleaned to remove the sometimes used prefix "killing agent" which we don't want to nor need to expose on the Portal.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
the string value, or None if there is no EntPrePreparationMethod value |
Source code in dataimporter/emu/views/preparation.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
get_purpose(record)
¶
Given a record, extract the purpose of specimen value from a note text field. We don't know which note text field it will be because there's no note type, so we just look for the first note text value which starts "purpose of specimen:".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SourceRecord
|
the record |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
the purpose value or None if it was not found |
Source code in dataimporter/emu/views/preparation.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
is_on_loan(record)
¶
Checks if the given record is on loan or not. If it is, returns True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SourceRecord
|
the source record |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if it is on loan, False otherwise |
Source code in dataimporter/emu/views/preparation.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |