handlers
importing.signals.handlers
¤
Attributes¤
User = get_user_model()
module-attribute
¤
Classes¤
DataImport
¤
Bases: PermissionsBase
Model to store the data imports.
This model stores the data imports, which are, often, files with data that are uploaded to the system. The data is then processed asynchronously and stored in the database.
Attributes:
| Name | Type | Description |
|---|---|---|
station |
ForeignKey
|
Station to which the data belongs. |
format |
ForeignKey
|
Format of the data. |
rawfile |
FileField
|
File with the data to be imported. |
date |
DateTimeField
|
Date of submission of the data. |
start_date |
DateTimeField
|
Start date of the data. |
end_date |
DateTimeField
|
End date of the data. |
records |
IntegerField
|
Number of records in the data. |
observations |
TextField
|
Notes or observations about the data. |
status |
TextField
|
Status of the import. |
log |
TextField
|
Log of the data ingestion, indicating any errors. |
Functions¤
clean()
¤
Validate information and uploads the measurement data.
Source code in importing/models.py
138 139 140 141 142 143 144 145 | |
MapLayerImport
¤
Bases: PermissionsBase
Functions¤
clean()
¤
Validate the uploaded GeoTIFF and its transformed lon/lat bounds.
Source code in importing/models.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
Functions¤
ingest_data(data_import_pk)
¤
Initiate the ingestion of data into the DB.
If the status of the data import is "not queued", the request is processed. The data loaded and saved to the database. The status is updated to completed or failed depending on the outcome.
Source code in importing/tasks.py
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 | |
process_data_ingestion(sender, instance, **kwargs)
¤
Schedules the data ingestion task.
Source code in importing/signals/handlers.py
20 21 22 23 | |
set_model_permissions(sender, **kwargs)
¤
Set model-level permissions.
Source code in importing/signals/handlers.py
26 27 28 29 | |
set_object_permissions(sender, instance, **kwargs)
¤
Set object-level permissions.
Source code in importing/signals/handlers.py
13 14 15 16 17 | |