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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_region': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_country': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_postalcode': (<class 'django.db.models.fields.CharField'>, {'max_length': 12, 'null': True}), '_city': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_street': (<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 0x1e5bc80>, 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:

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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_diastolic': (<class 'indivo.fields.dummy_fields.VitalSignField'>, {}), '_method': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {}), '_site': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {}), '_systolic': (<class 'indivo.fields.dummy_fields.VitalSignField'>, {}), '_position': (<class 'indivo.fields.dummy_fields.CodedValueField'>, {})}
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 0x1e5bc80>, 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 thee fields:

  • value_identifier, the system-specific identifier that represents the element (i.e. an RXNorm CUI)
  • 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_identifier': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_system': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_title': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, '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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_given': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_prefix': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_suffix': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_family': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_middle': (<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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_ncpdpid': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_adr': (<class 'indivo.fields.dummy_fields.AddressField'>, {}), '_org': (<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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
gender_choices = (('m', 'male'), ('f', 'female'))
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_tel_1': (<class 'indivo.fields.dummy_fields.TelephoneField'>, {'max_length': 255, 'null': True}), '_bday': (<class 'django.db.models.fields.DateField'>, {'null': True}), '_email': (<class 'django.db.models.fields.EmailField'>, {'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'>, {}), '_gender': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True, 'choices': (('m', 'male'), ('f', 'female'))}), '_tel_2': (<class 'indivo.fields.dummy_fields.TelephoneField'>, {'max_length': 255, 'null': True}), '_race': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_dea_number': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_preferred_language': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_ethnicity': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_name': (<class 'indivo.fields.dummy_fields.NameField'>, {'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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_value': (<class 'indivo.fields.dummy_fields.ValueAndUnitField'>, {}), '_non_critical_range': (<class 'indivo.fields.dummy_fields.ValueRangeField'>, {}), '_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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
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'))}), '_preferred_p': (<class 'django.db.models.fields.BooleanField'>, {'default': False}), '_number': (<class 'django.db.models.fields.CharField'>, {'max_length': 20, 'null': True})}
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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_value': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_unit': (<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 0x1e5bc80>, 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:

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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_min': (<class 'indivo.fields.dummy_fields.ValueAndUnitField'>, {}), '_max': (<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 0x1e5bc80>, 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.

db_type(*args, **kwargs)
get_db_prep_lookup(*args, **kwargs)
get_db_prep_save(*args, **kwargs)
get_db_prep_value(*args, **kwargs)
replacements = {'_unit': (<class 'django.db.models.fields.CharField'>, {'max_length': 255, 'null': True}), '_value': (<class 'django.db.models.fields.FloatField'>, {'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.