Data manager administrative models and classes
Project description
edc-data-manager
Data manager administrative models and classes
User Roles
edc_data_manager adds the DATA MANAGER and the DATA_QUERY user groups. Members of the DATA_QUERY group can respond to existing data queries; that is edit existing data query instances. Members of the DATA MANAGER group have full access to add/change/delete any data_query.
The Data Query Model
The central model of edc_data_manager is the Data Query model. Upon reviewing the state of a research subject’s data, the data manager may decide to open a data query with the research staff. This is done by creating a new Data Query instance. The data query describes an issue for the attention of the research staff at the clinical site. A data query might be general, described by free text, or specific, indicating references to specific timepoints and form questions.
On the data query form, edc_data_manager provides access to the complete data dictionary of target model and all timepoints in the data collection schedule.
Data query status
A data manager, a member of the DATA_MANAGER group, creates a query. The data query model instance initially has a status of New.
The research staff, members of the DATA_QUERY group, can:
Open the query – indicating they are working on the issue. (Open)
Request feedback – indicating they need assistance from the data manager .(Feedback)
Resolve the query – indicating the issue is resolved. (Resolved)
This status field, managed by the research staff, is independent of the overall status of the query, which is managed by the data manager.
The data manager updates a seperate status field. He/She can: * Resolve the query (but only if the site status is also Resolved) * Resolve with an action plan
The data manager can override the status set by the research staff. For example, the data manager may decide to re-open a query.
Using Crf Query Rules to generate data queries
Data queries can be automatically generated based on CRF query rules configured in advance.
The Crf Query Rule model
Default rule handlers
The default rule handler checks the value of each question at each timepoint in the CrfQueryRule. A question represents a model field. If the model field value has been set, e.g. is not None, the question is considered answered.
Custom rule handlers
In many cases the default rule handler is too simplistic. If so, a custom rule handler can be written, registered with edc_data_manager and selected on the CrfQueryRule form.
Custom rule handlers are classes placed in the data_manager.py at the root of any app. They subclass the default rule handler, ModelHandler and override the resolved method, returning either True or False. If resolved returns True, the overall data query will be set to resolved. If False, an open query will remain open and a resolved query will be re-opened.
For example:
# data_manager.py
from ambition_subject.constants import AWAITING_RESULTS
from edc_constants.constants import NOT_DONE, YES, NO
from edc_data_manager.rule import ModelHandler
from edc_data_manager.site_data_manager import site_data_manager
class LumbarPunctureHandlerQ13(ModelHandler):
name = "lumbar_puncture_q13"
display_name = "Lumbar Puncture (Q13, 15, 21, 23, 24)"
model_name = "ambition_subject.lumbarpuncturecsf"
@property
def resolved(self):
"""Lumbar Puncture/Cerebrospinal Fluid 13, 15, 21, 23, 24.
"""
resolved = False
if self.get_field_value("csf_culture") == AWAITING_RESULTS:
pass
elif self.get_field_value("csf_culture") == NOT_DONE:
resolved = True
elif self.get_field_value("csf_culture") == YES:
if (self.get_field_value("other_csf_culture")
and self.get_field_value("csf_wbc_cell_count")
and self.get_field_value("csf_glucose")
and self.get_field_value("csf_protein")
and (self.get_field_value("csf_cr_ag")
or self.get_field_value("india_ink"))):
resolved = True
elif self.get_field_value("csf_culture") == NO:
if (self.get_field_value("csf_wbc_cell_count")
and self.get_field_value("csf_glucose")
and self.get_field_value("csf_protein")
and (self.get_field_value("csf_cr_ag")
or self.get_field_value("india_ink"))):
resolved = True
return resolved
site_data_manager.register(LumbarPunctureHandlerQ13)
You write any valid python in the resolved method, but when accessing the model fields referred to in the CrfQueryRule, it is recommended to use the get_field_value method instead of directly accessing the model instance.
Updating query rules
Query rules can be triggered manually to run from the admin action under the CrfQueryRule admin page.
If celery is enabled, the update_crf_query_rules_task will try to send proccessing to the MQ.
See also update_crf_query_rules, update_crf_query_rules_task, update_crf_query_rules_action.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file edc_data_manager-0.2.10-py3-none-any.whl
.
File metadata
- Download URL: edc_data_manager-0.2.10-py3-none-any.whl
- Upload date:
- Size: 71.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39511a04d24fd6d9081a8b88e85f4cf5eae2b519d15f6dc6c9b74da5cea2ede8 |
|
MD5 | cfc3fce14c8d88a1855c736c6b269937 |
|
BLAKE2b-256 | f3665916a5160159390d9f0000135cb9ecbe6676dd32e01d6dc22ea78ac8899e |