edc-reference
Pivoted reference table for EDC modules
edc_reference creates a pivoted table of CRF and Requisition records with a small subset of values that can be efficiently referenced. The module is used by edc_metadata_rules to quickly determine if a CRF or Requisition model instance exists avoiding the need to query each individual model class.
See also edc_metadata_rules
Usage and Configuration
Declare a model with the ReferenceModelMixin.
from edc_reference.model_mixins import ReferenceModelMixin
class CrfOne(ReferenceModelMixin, BaseUuidModel):
subject_visit = models.ForeignKey(SubjectVisit, on_delete=PROTECT)
report_datetime = models.DateTimeField(default=get_utcnow)
f1 = models.CharField(max_length=50)
f2 = models.CharField(max_length=50)
f3 = models.CharField(max_length=50)
f4 = models.DatetimeField(null=True)
Register the model and the relevant fields with the site global, site_reference_configs:
from edc_reference.site_reference import ReferenceModelConfig
reference = ReferenceModelConfig(
model='edc_reference.crfone',
fields=['f1', 'f4'])
site_reference_configs.register(reference)
Create a model instance:
crf_one = CrfOne.objects.create(
subject_visit=subject_visit,
f1='happiness'
f4=get_utcnow())
The Reference model will be updated:
from edc_reference.models import Reference
reference = Reference.objects.get(
identifier=self.subject_identifier,
timepoint=self.subject_visit.visit_code,
report_datetime=crf_one.report_datetime,
field_name='f1')
>>> reference.__dict__
{ ...
'datatype': 'CharField',
'field_name': 'f1',
'identifier': '1',
'model': 'edc_reference.crfone',
'report_datetime': datetime.datetime(2017, 7, 7, 13, 30, 6, 545140, tzinfo=<UTC>),
'timepoint': 'code',
'value_date': None,
'value_datetime': None,
'value_int': None,
'value_str': 'happiness',
...}
Get the value from the reference instance:
>>> reference.value
'happiness'
Model managers methods are also available, for example:
reference = Reference.objects.crf_get_for_visit(
model='edc_reference.crfone',
visit=self.subject_visit,
field_name='f1')
>>> reference.value
'happiness'
Accessing pivoted data with LongitudinalRefset
TODO
Metadata
Release files for edc-reference 0.3.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edc-reference-0.3.28.tar.gz | 54.5 kB | Without provenance | Details for edc-reference-0.3.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edc_reference-0.3.28-py3-none-any.whl | Python 3 | none | any | Details for edc_reference-0.3.28-py3-none-any.whl |
Total release size: 125.3 kB
Release files / edc-reference-0.3.28.tar.gz
| Download URL | edc-reference-0.3.28.tar.gz |
|---|---|
| Size | 54.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b48fac939c523d06f2d67891cf1ddce22bc959f65b732c4690f76df0355246d
|
|
BLAKE2b-256 checksum How to use checksums |
6c4d54034f0e23dc5327b4aa3a639257ee8802a0c160e1092f6a7239092def4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / edc_reference-0.3.28-py3-none-any.whl
| Download URL | edc_reference-0.3.28-py3-none-any.whl |
|---|---|
| Size | 70.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a975d78385b7797add3f80b74d91cff37e9cbeada97bd5c741d56174e35a07e
|
|
BLAKE2b-256 checksum How to use checksums |
254ede8cc9729fe571192a605821ec96117c61b3cc3f8569b06b07bc6cac2ac4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for edc-reference 0.3.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.