indivo.fields package

Submodules

indivo.fields.dummy_fields module

class indivo.fields.dummy_fields.AddressField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a physical address.

Creating an AddressField named ‘address’, for example, will (under the hood) create the fields:

  • address_country, the country in which the address is located
  • address_city, the city in which the address is located
  • address_postalcode, the postalcode of the address
  • address_region, the region (state, in the US) in which the address is located
  • address_street, the street address (including street number, apartment number, etc.) at which the address is located

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original address field name.

replacements = {'postalcode': (<class 'django.db.models.fields.CharField'>, {'max_length': 12, 'null': True}), 'country': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'region': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'street': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'city': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True})}
class indivo.fields.dummy_fields.BloodPressureField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a blood pressure measurement.

Creating a BloodPressureField named ‘bp’, for example, will (under the hood) create the fields:

  • bp_position, the position in which the measurement was taken (a CodedValueField)
  • bp_site, the site on the body at which the measurement was taken (a CodedValueField)
  • bp_method, the method of the measurement (a CodedValueField)
  • bp_diastolic, the diastolic blood pressure (a VitalSignField)
  • bp_systolic, the systolic blood pressure (a VitalSignField)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original bp field name.

replacements = {'position': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {}), 'diastolic': (<class 'indivo.fields.dummy_fields.VitalSignField'>, {}), 'systolic': (<class 'indivo.fields.dummy_fields.VitalSignField'>, {}), 'site': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {}), 'method': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {})}
class indivo.fields.dummy_fields.CodeField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing code data elements.

Creating a CodeField named ‘value’, for example, will (under the hood) create these fields:

  • value_identifier, the system-specific identifier that represents the element (i.e. an RXNorm LOINC)
  • value_title, the human-readable title of the element
  • value_system, the coding system used to represent the element

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original value field name.

replacements = {'identifier': (<class 'django.db.models.fields.CharField'>, {'max_length': 200, 'null': True, 'db_column': 'id'}), 'system': (<class 'django.db.models.fields.CharField'>, {'max_length': 200, 'null': True, 'db_column': 'sys'}), 'title': (<class 'django.db.models.fields.CharField'>, {'max_length': 200, 'null': True})}
class indivo.fields.dummy_fields.CodeProvenanceField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing the provenance of a Code.

Creating a CodeProvenanceField named ‘value’, for example, will (under the hood) create the fields:

  • value_source_code, URI for the source code
  • value_title, the human-readable title of the element
  • value_translation_fidelity, URI for the SMART TranslationFidelity code

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original value field name.

replacements = {'source_code': (<class 'django.db.models.fields.CharField'>, {'max_length': 200, 'null': True, 'db_column': 'sc'}), 'translation_fidelity': (<class 'django.db.models.fields.CharField'>, {'max_length': 50, 'null': True, 'db_column': 'tf'}), 'title': (<class 'django.db.models.fields.CharField'>, {'max_length': 200, 'null': True})}
class indivo.fields.dummy_fields.CodedValueField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing coded data elements.

Creating a CodedValueField named ‘value’, for example, will (under the hood) create the fields:

  • value_title, the human-readable title of the element
  • value_code_*, fields defined in CodeField
  • value_provenance_*, fields defined in CodeProvenanceField

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original value field name.

replacements = {'provenance': (<class 'indivo.fields.dummy_fields.CodeProvenanceField'>, {'db_column': 'prov'}), 'code': (<class 'indivo.fields.dummy_fields.CodeField'>, {}), 'title': (<class 'django.db.models.fields.CharField'>, {'max_length': 200, 'null': True})}
class indivo.fields.dummy_fields.DummyField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: django.db.models.fields.Field

A field that should be replaced by other fields.

replacements should be a mapping from field_suffix to (fieldclass, field_kwargs). This instructs the datamodel loader to remove this field, and for each entry in the mapping, to add a new field with the original name concatenated with field_suffix, which is an instance of class fieldclass instantiated with field_kwargs.

Eventually, when Django supports fields mapping to multiple database columns, these fields should actually manage multiple DB columns, but for now we’re just using strict substitution.

replacements = {}
class indivo.fields.dummy_fields.NameField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a person’s name.

Creating a NameField named ‘name’, for example, will (under the hood) create the fields:

  • name_family, the family (last) name of the person
  • name_given, the given (first) name of the person
  • name_middle, the middle name of the person
  • name_prefix, the prefix (i.e. ‘Mr.’, ‘Sir’, etc.) for the person’s name
  • name_suffix, the suffix (i.e. ‘Jr.’, ‘Ph.D.’, etc.) for the person’s name

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original name field name.

replacements = {'middle': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'given': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'prefix': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'family': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'suffix': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True})}
class indivo.fields.dummy_fields.OrganizationField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing an organization.

Creating an OrganizationField named ‘organization’, for example, will (under the hood) create two fields:

  • pharmacy_name, the name of the organization
  • organization_adr, the address at which the organization is located (an AddressField)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original organization field name.

replacements = {'adr': (<class 'indivo.fields.dummy_fields.AddressField'>, {}), 'name': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True})}
class indivo.fields.dummy_fields.PharmacyField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a pharmacy.

Creating a PharmacyField named ‘pharmacy’, for example, will (under the hood) create three fields:

  • pharmacy_ncpdpid, the pharmacy’s National Council for Prescription Drug Programs (NCPDP) ID number
  • pharmacy_adr, the address at which the pharmacy is located (an AddressField)
  • pharmacy_org, the name of the organization that owns the pharmacy

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original pharmacy field name.

replacements = {'org': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'adr': (<class 'indivo.fields.dummy_fields.AddressField'>, {}), 'ncpdpid': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True})}
class indivo.fields.dummy_fields.ProviderField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a medical provider.

Creating a ProviderField named ‘doc’, for example, will (under the hood) create the fields:

  • doc_dea_number, the provider’s Drug Enforcement Agency (DEA) number
  • doc_ethnicity, the provider’s ethnicity
  • doc_npi_number, the provider’s National Provider Identification (NPI) number
  • doc_preferred_language, the provider’s preferred language
  • doc_race, the provider’s race
  • doc_adr, the provider’s address (an AddressField)
  • doc_bday, the provider’s birth date
  • doc_email, the provider’s email address
  • doc_name, the provider’s name (a NameField)
  • doc_tel_1, the provider’s primary phone number (a TelephoneField)
  • doc_tel_2, the provider’s secondary phone number (a TelephoneField)
  • doc_gender, the provider’s gender, limited to m (male) or f (female)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original doc field name.

gender_choices = (('m', 'male'), ('f', 'female'), ('male', 'male'), ('female', 'female'))
replacements = {'bday': (<class 'django.db.models.fields.DateField'>, {'null': True}), 'dea_number': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'ethnicity': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'npi_number': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'adr': (<class 'indivo.fields.dummy_fields.AddressField'>, {}), 'name': (<class 'indivo.fields.dummy_fields.NameField'>, {'max_length': 255, 'null': True}), 'preferred_language': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'tel_2': (<class 'indivo.fields.dummy_fields.TelephoneField'>, {'max_length': 255, 'null': True}), 'tel_1': (<class 'indivo.fields.dummy_fields.TelephoneField'>, {'max_length': 255, 'null': True}), 'race': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'gender': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True, 'choices': (('m', 'male'), ('f', 'female'), ('male', 'male'), ('female', 'female'))}), 'email': (<class 'django.db.models.fields.EmailField'>, {'max_length': 255, 'null': True})}
class indivo.fields.dummy_fields.QuantitativeResultField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a quantitative result, and expected ranges for that result.

Creating a QuantitativeResultField named ‘lab_result’, for example, will (under the hood) create the fields:

  • lab_result_non_critical_range, the range outside of which results are ‘critical’ (a ValueRangeField)
  • lab_result_normal_range, the range outside of which results are ‘abnormal’ (a ValueRangeField)
  • lab_result_value, the actual result (a ValueAndUnitField)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original lab_result field name.

replacements = {'non_critical_range': (<class 'indivo.fields.dummy_fields.ValueRangeField'>, {}), 'value': (<class 'indivo.fields.dummy_fields.ValueAndUnitField'>, {}), 'normal_range': (<class 'indivo.fields.dummy_fields.ValueRangeField'>, {})}
class indivo.fields.dummy_fields.TelephoneField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a telephone number.

Creating a TelephoneField named ‘phone’, for example, will (under the hood) create the fields:

  • phone_type, The type of the phone number, limited to h (home), w (work), or c (cell)
  • phone_number, The actual phone number
  • phone_preferred_p, Whether or not this number is a preferred method of contact (True or False)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original phone field name.

phone_number_type_choices = (('h', 'Home'), ('w', 'Work'), ('c', 'Cell'))
replacements = {'type': (<class 'django.db.models.fields.CharField'>, {'max_length': 1, 'null': True, 'choices': (('h', 'Home'), ('w', 'Work'), ('c', 'Cell'))}), 'number': (<class 'django.db.models.fields.CharField'>, {'max_length': 20, 'null': True}), 'preferred_p': (<class 'django.db.models.fields.BooleanField'>, {'default': False})}
class indivo.fields.dummy_fields.ValueAndUnitField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing data elements with both a value and a unit.

Creating a ValueAndUnitField named ‘frequency’, for example, will (under the hood) create the fields:

  • frequency_value, the value of the element
  • frequency_unit, the units in which the value is measured

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original frequency field name.

replacements = {'unit': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), 'value': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True})}
class indivo.fields.dummy_fields.ValueRangeField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a range of values.

Creating a ValueRangeField named ‘normal_range’, for example, will (under the hood) create the fields:

  • normal_range_max, the maximum value of the range (a ValueAndUnitField)
  • normal_range_min, the minimum value of the range (a ValueAndUnitField)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original normal_range field name.

replacements = {'max': (<class 'indivo.fields.dummy_fields.ValueAndUnitField'>, {}), 'min': (<class 'indivo.fields.dummy_fields.ValueAndUnitField'>, {})}
class indivo.fields.dummy_fields.VitalSignField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x33df328>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=, []error_messages=None)

Bases: indivo.fields.dummy_fields.DummyField

A field for representing a single measurement of a vital sign.

Creating a VitalSignField named ‘bp’, for example, will (under the hood) create the fields:

  • bp_unit, the unit of the measurement
  • bp_value, the value of the measurement
  • bp_name, the name of the measurement (a CodedValueField)

When describing instances of your model (either when defining a transform output or when referencing fields using the Indivo Query API), you must refer to these field names, not the original bp field name.

replacements = {'value': (<class 'django.db.models.fields.FloatField'>, {'null': True}), 'unit': (<class 'django.db.models.fields.CharField'>, {'max_length': 25, 'null': True}), 'name': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {})}

Module contents

Indivo Fields.

Custom-defined Django Model Field subclasses used for representing Medical Data via the Django ORM.