Skip to main content

MNSI form/model for the clinicedc/edc and other django projects

Project description

pypi actions codecov downloads

edc-mnsi

Django classes for the Michigan Neuropathy Screening Instrument (MNSI).

MNSI scores are calculated in signals.py through a call to the MnsiCalculator and stored in two calculated fields on the model. The two calculated fields can also be viewed as read only on the form in Admin.

See also:

edc_mnsi has an Mnsi model. If the default model does not meet your needs, you can use the Mnsi model mixin, MnsiModelMixin, and declare a custom Mnsi model in your app.

# models.py
from edc_mnsi.model_mixins import MnsiModelMixin
from edc_model import models as edc_models
# a custom mixin
from ..model_mixins import CrfModelMixin


class Mnsi(
    MnsiModelMixin,
    CrfModelMixin,
    edc_models.BaseUuidModel,
):
    class Meta(MnsiModelMixin.Meta, CrfModelMixin.Meta, edc_models.BaseUuidModel.Meta):
        pass

Add the following to settings if using a custom Mnsi model:

EDC_MNSI_MODEL = "my_app.mnsi"

Note: settings.EDC_MNSI_MODEL is needed by edc_mnsi.auths.py to find the Mnsi model. This is applicable if you are using edc_auth.

A custom admin class will be needed for your custom Mnsi model. Here is an example of a custom admin class that refers to fields added to the custom Mnsi model and adds a custom modeladmin mixin.

Note: In your custom admin you should unregister the default admin class before registering your custom admin class.

# admin.py
from django.contrib import admin
from django_audit_fields import audit_fieldset_tuple
from edc_crf.admin import crf_status_fieldset_tuple
from edc_mnsi.admin_site import edc_mnsi_admin
from edc_mnsi.fieldsets import calculated_values_fieldset
from edc_mnsi.fieldsets import get_fieldsets as get_mnsi_fieldsets
from edc_mnsi.model_admin_mixin import MnsiModelAdminMixin, radio_fields
from edc_mnsi.models import Mnsi as DefaultMnsi
from edc_model_admin.history import SimpleHistoryAdmin

# your app's admin site
from ..admin_site import my_app_admin
# your custom form
from ..forms import MnsiForm
# your custom model
from ..models import Mnsi
# a custom mixin
from .modeladmin import CrfModelAdmin

# customize the fieldsets as needed
def get_fieldsets():
    fieldset = (
        None,
        {
            "fields": (
                "subject_visit",
                "report_datetime",
                "mnsi_performed",
                "mnsi_not_performed_reason",
            )
        },
    )

    fieldsets = (fieldset,) + get_mnsi_fieldsets()
    fieldsets += (crf_status_fieldset_tuple,)
    fieldsets += (calculated_values_fieldset,)
    fieldsets += (audit_fieldset_tuple,)
    return fieldsets

# customize radio_fields
radio_fields.update(crf_status=admin.VERTICAL)
# unregister the default model
edc_mnsi_admin.unregister(DefaultMnsi)

@admin.register(Mnsi, site=meta_subject_admin)
class MnsiAdmin(
    MnsiModelAdminMixin,
    CrfModelAdmin,
    SimpleHistoryAdmin,
):
    form = MnsiForm
    fieldsets = get_fieldsets()
    radio_fields = radio_fields

Made with Django

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-mnsi-0.1.17.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

edc_mnsi-0.1.17-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file edc-mnsi-0.1.17.tar.gz.

File metadata

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

File hashes

Hashes for edc-mnsi-0.1.17.tar.gz
Algorithm Hash digest
SHA256 ad2d8bf51889ebbec15dbe8f7f8d5c60fa09c1a5fad5b46332b848ae0c717c2e
MD5 9ca6f5ca9c4df7dd1c6d7a9e24c1be7e
BLAKE2b-256 c0c6f49b86368a33bf85681862b547ab36773b2ce55590f6a3a59599509bc20b

See more details on using hashes here.

File details

Details for the file edc_mnsi-0.1.17-py3-none-any.whl.

File metadata

  • Download URL: edc_mnsi-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 48.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_mnsi-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 2ad2e7eae90a17385acf9ac7aa4e4f03b40ab0a15cee521ec54885543c061fb4
MD5 fcd159653180725110e75a102411deed
BLAKE2b-256 4051d5aa40fa32dff91a056421087b187276f0bc67c40825d249ce325e3e3084

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