Skip to main content

Base django classes for health economics

Project description

pypi actions codecov downloads

edc-he

Health economics model, form mixins for clinicedc / Django

Declare in settings if using concrete models not included in this app:

EDC_HE_ASSETS_MODEL = "<label_lower>"
EDC_HE_HOUSEHOLDHEAD_MODEL = "<label_lower>"
EDC_HE_INCOME_MODEL = "<label_lower>"
EDC_HE_PATIENT_MODEL = "<label_lower>"
EDC_HE_PROPERTY_MODEL = "<label_lower>"

See also module intecomm_subject at https://github.com/intecomm-trial/intecomm-edc.

If you need to declare the Health Economics models in your app, use the provided model mixins.

For example, the HealthEconomicsHouseholdHead model would be declared like this:

# models.py

class HealthEconomicsHouseholdHead(
    SingletonCrfModelMixin,
    HouseholdHeadModelMixin,
    HouseholdModelMixin,
    CrfModelMixin,
    BaseUuidModel,
):

    class Meta(CrfModelMixin.Meta, BaseUuidModel.Meta):
        verbose_name = "Health Economics: Household head"
        verbose_name_plural = "Health Economics: Household head"
# forms.py

class HealthEconomicsHouseholdHeadForm(
    CrfSingletonModelFormMixin, CrfModelFormMixin, forms.ModelForm
):
    form_validator_cls = HealthEconomicsHouseholdHeadFormValidator

    def clean(self):
        self.raise_if_singleton_exists()
        raise_if_clinical_review_does_not_exist(self.cleaned_data.get("subject_visit"))
        return super().clean()
# admin.py


@admin.register(HealthEconomicsHouseholdHead, site=intecomm_subject_admin)
class HealthEconomicsHouseholdHeadAdmin(
    HealthEconomicsHouseholdHeadModelAdminMixin, CrfModelAdmin
):
    form = HealthEconomicsHouseholdHeadForm

The metadata rules may also be declared locally

# metadata_rules.py

from edc_he.rule_groups import Predicates as BaseHealthEconomicsPredicates
from edc_he.rule_groups import HealthEconomicsRuleGroup as BaseHealthEconomicsRuleGroup

class HealthEconomicsPredicates(BaseHealthEconomicsPredicates):
    app_label = "intecomm_subject"
    visit_model = "intecomm_subject.subjectvisit"

@register()
class HealthEconomicsRuleGroup(BaseHealthEconomicsRuleGroup):
    class Meta:
        app_label = "intecomm_subject"
        source_model = "intecomm_subject.subjectvisit"
        predicates = HealthEconomicsPredicates()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edc-he-0.1.29.tar.gz (88.0 kB view details)

Uploaded Source

Built Distribution

edc_he-0.1.29-py3-none-any.whl (119.8 kB view details)

Uploaded Python 3

File details

Details for the file edc-he-0.1.29.tar.gz.

File metadata

  • Download URL: edc-he-0.1.29.tar.gz
  • Upload date:
  • Size: 88.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for edc-he-0.1.29.tar.gz
Algorithm Hash digest
SHA256 9a1584424c63e9f97842451a124856c1edd4f1d08c98c84cade798a1d0ce0b13
MD5 b46d4eaadfd0844b39fab5cd1356ec04
BLAKE2b-256 1ac22c6d8fe0e5cef107ae7c920648200864deed7b07137eb5e7b6bea41b9e79

See more details on using hashes here.

File details

Details for the file edc_he-0.1.29-py3-none-any.whl.

File metadata

  • Download URL: edc_he-0.1.29-py3-none-any.whl
  • Upload date:
  • Size: 119.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for edc_he-0.1.29-py3-none-any.whl
Algorithm Hash digest
SHA256 b7ff5666a0d0fddd7540e9393608e1fd51549b87b8613e2505a235054f163a5f
MD5 b6a72b46305a5577ad0fdad05b282334
BLAKE2b-256 d555f58b6bfcac8497c3dde8fb02c46f17a3c367cf63a5ca95c42ee25c411225

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page