care.facility.models.patient module¶

class RationCardCategory(*values)¶

Bases: TextChoices

NON_CARD_HOLDER = 'NO_CARD'¶
BPL = 'BPL'¶
APL = 'APL'¶
class MobilityStatus(*values)¶

Bases: TextChoices

UNKNOWN = 'UNKNOWN'¶
INDEPENDENTLY_MOBILE = 'INDEPENDENTLY_MOBILE'¶
INDEPENDENTLY_MOBILE_WITH_ILLNESS = 'INDEPENDENTLY_MOBILE_WITH_ILLNESS'¶
HOME_BOUND = 'HOME_BOUND'¶
BED_BOUND = 'BED_BOUND'¶
class PatientRegistration(id, external_id, created_date, modified_date, deleted, source, facility, nearest_facility, meta_info, name, gender, phone_number, emergency_phone_number, address, permanent_address, pincode, date_of_birth, year_of_birth, death_datetime, nationality, passport_no, ration_card_category, mobility_status, is_medical_worker, blood_group, contact_with_confirmed_carrier, contact_with_suspected_carrier, estimated_contact_date, past_travel, countries_travelled_old, countries_travelled, date_of_return, allergies, present_health, ongoing_medication, has_SARI, is_antenatal, last_menstruation_start_date, date_of_delivery, ward_old, ward, local_body, district, state, is_migrant_worker, disease_status, number_of_aged_dependents, number_of_chronic_diseased_dependents, last_edited, action, review_time, created_by, is_active, date_of_receipt_of_information, test_id, date_of_test, srf_id, test_type, allow_transfer, last_consultation, will_donate_blood, fit_for_blood_donation, village, designation_of_health_care_worker, instituion_of_health_care_worker, transit_details, frontline_worker, date_of_result, number_of_primary_contacts, number_of_secondary_contacts, is_vaccinated, number_of_doses, vaccine_name, covin_id, last_vaccinated_date, cluster_name, is_declared_positive, date_declared_positive, assigned_to, geo_organization, organization_cache)¶

Bases: PatientBaseModel, PatientPermissionMixin

PATIENT_SEARCH_KEYS = ['name', 'gender', 'phone_number', 'date_of_birth', 'year_of_birth', 'state_id']¶
class SourceEnum(*values)¶

Bases: Enum

CARE = 10¶
COVID_TRACKER = 20¶
STAY = 30¶
SourceChoices = [(10, 'CARE'), (20, 'COVID_TRACKER'), (30, 'STAY')]¶
class VaccineEnum(*values)¶

Bases: Enum

COVISHIELD = 'CoviShield'¶
COVAXIN = 'Covaxin'¶
SPUTNIK = 'Sputnik'¶
MODERNA = 'Moderna'¶
PFIZER = 'Pfizer'¶
JANSSEN = 'Janssen'¶
SINOVAC = 'Sinovac'¶
VaccineChoices = [('CoviShield', 'COVISHIELD'), ('Covaxin', 'COVAXIN'), ('Sputnik', 'SPUTNIK'), ('Moderna', 'MODERNA'), ('Pfizer', 'PFIZER'), ('Janssen', 'JANSSEN'), ('Sinovac', 'SINOVAC')]¶
class ActionEnum(*values)¶

Bases: Enum

NO_ACTION = 10¶
PENDING = 20¶
SPECIALIST_REQUIRED = 30¶
PLAN_FOR_HOME_CARE = 40¶
FOLLOW_UP_NOT_REQUIRED = 50¶
COMPLETE = 60¶
REVIEW = 70¶
NOT_REACHABLE = 80¶
ActionChoices = [(10, 'NO_ACTION'), (20, 'PENDING'), (30, 'SPECIALIST_REQUIRED'), (40, 'PLAN_FOR_HOME_CARE'), (50, 'FOLLOW_UP_NOT_REQUIRED'), (60, 'COMPLETE'), (70, 'REVIEW'), (80, 'NOT_REACHABLE'), (90, 'DISCHARGE_RECOMMENDED')]¶
class TestTypeEnum(*values)¶

Bases: Enum

UNK = 10¶
ANTIGEN = 20¶
RTPCR = 30¶
CBNAAT = 40¶
TRUENAT = 50¶
RTLAMP = 60¶
POCPCR = 70¶
TestTypeChoices = [(10, 'UNK'), (20, 'ANTIGEN'), (30, 'RTPCR'), (40, 'CBNAAT'), (50, 'TRUENAT'), (60, 'RTLAMP'), (70, 'POCPCR')]¶
source¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

facility¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

nearest_facility¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

meta_info¶

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

name¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

gender¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

phone_number¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

emergency_phone_number¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

address¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

permanent_address¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

pincode¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_birth¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

year_of_birth¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

death_datetime¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nationality¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

passport_no¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

ration_card_category¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

mobility_status¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_medical_worker¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

blood_group¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contact_with_confirmed_carrier¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contact_with_suspected_carrier¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

estimated_contact_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

past_travel¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

countries_travelled_old¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

countries_travelled¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_return¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

allergies¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

present_health¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

ongoing_medication¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

has_SARI¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_antenatal¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_menstruation_start_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_delivery¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

ward_old¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

ward¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

local_body¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

district¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

state¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

is_migrant_worker¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disease_status¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_aged_dependents¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_chronic_diseased_dependents¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_edited¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

action¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

review_time¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

is_active¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_receipt_of_information¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

test_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_test¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

srf_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

test_type¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

allow_transfer¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_consultation¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

will_donate_blood¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fit_for_blood_donation¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

village¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

designation_of_health_care_worker¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

instituion_of_health_care_worker¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

transit_details¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

frontline_worker¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_result¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_primary_contacts¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_secondary_contacts¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_vaccinated¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_doses¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

vaccine_name¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

covin_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_vaccinated_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cluster_name¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_declared_positive¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_declared_positive¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

assigned_to¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

geo_organization¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

organization_cache¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>¶
objects = <care.utils.models.base.BaseManager object>¶
property is_expired: bool¶
save(*args, **kwargs) None¶

While saving, if the local body is not null, then district will be local body’s district Overriding save will help in a collision where the local body’s district and district fields are different.

It also aliases the DiseaseStatus RECOVERED to RECOVERY It also creates/updates the PatientSearch model

Parameters:
  • args (list of args - not used)

  • kwargs (keyword args - not used)

Return type:

None

get_age() str¶
annotate_diagnosis_ids(**kwargs)¶
CSV_ANNOTATE_FIELDS = {'confirmed_diagnoses': ArrayAgg(F(last_consultation__diagnoses__diagnosis_id), filter=(AND: ('last_consultation__diagnoses__verification_status', ConditionVerificationStatus.CONFIRMED))), 'differential_diagnoses': ArrayAgg(F(last_consultation__diagnoses__diagnosis_id), filter=(AND: ('last_consultation__diagnoses__verification_status', ConditionVerificationStatus.DIFFERENTIAL))), 'principal_diagnoses': ArrayAgg(F(last_consultation__diagnoses__diagnosis_id), filter=(AND: ('last_consultation__diagnoses__is_principal', True))), 'provisional_diagnoses': ArrayAgg(F(last_consultation__diagnoses__diagnosis_id), filter=(AND: ('last_consultation__diagnoses__verification_status', ConditionVerificationStatus.PROVISIONAL))), 'unconfirmed_diagnoses': ArrayAgg(F(last_consultation__diagnoses__diagnosis_id), filter=(AND: ('last_consultation__diagnoses__verification_status', ConditionVerificationStatus.UNCONFIRMED)))}¶
CSV_MAPPING = {'age': 'Age', 'confirmed_diagnoses': 'Confirmed Diagnoses', 'created_date': 'Date of Registration', 'created_date__time': 'Time of Registration', 'differential_diagnoses': 'Differential Diagnoses', 'external_id': 'Patient ID', 'facility__name': 'Facility Name', 'gender': 'Gender', 'last_consultation__category': 'Category', 'last_consultation__created_date': 'Date of first consultation', 'last_consultation__created_date__time': 'Time of first consultation', 'last_consultation__discharge_date': 'Date of discharge', 'last_consultation__discharge_date__time': 'Time of discharge', 'last_consultation__new_discharge_reason': 'Reason for discharge', 'last_consultation__route_to_facility': 'Route to Facility', 'last_consultation__suggestion': 'Decision after consultation', 'principal_diagnoses': 'Principal Diagnosis', 'provisional_diagnoses': 'Provisional Diagnoses', 'unconfirmed_diagnoses': 'Unconfirmed Diagnoses'}¶
format_as_date()¶
format_as_time()¶
format_diagnoses()¶
CSV_MAKE_PRETTY = {'confirmed_diagnoses': <function PatientRegistration.format_diagnoses>, 'created_date': <function PatientRegistration.format_as_date>, 'created_date__time': <function PatientRegistration.format_as_time>, 'differential_diagnoses': <function PatientRegistration.format_diagnoses>, 'gender': <function PatientRegistration.<lambda>>, 'last_consultation__category': <function PatientRegistration.<lambda>>, 'last_consultation__created_date': <function PatientRegistration.format_as_date>, 'last_consultation__created_date__time': <function PatientRegistration.format_as_time>, 'last_consultation__discharge_date': <function PatientRegistration.format_as_date>, 'last_consultation__discharge_date__time': <function PatientRegistration.format_as_time>, 'last_consultation__new_discharge_reason': <function PatientRegistration.<lambda>>, 'last_consultation__route_to_facility': <function PatientRegistration.<lambda>>, 'last_consultation__suggestion': <function PatientRegistration.<lambda>>, 'principal_diagnoses': <function PatientRegistration.format_diagnoses>, 'provisional_diagnoses': <function PatientRegistration.format_diagnoses>, 'unconfirmed_diagnoses': <function PatientRegistration.format_diagnoses>}¶
exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

assigned_to_id¶
consultations¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contacted_patients¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contacts¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_by_id¶
created_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deleted¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

district_id¶
external_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

facility_id¶
geo_organization_id¶
get_action_display(*, field=<django.db.models.fields.IntegerField: action>)¶
get_blood_group_display(*, field=<django.db.models.fields.CharField: blood_group>)¶
get_disease_status_display(*, field=<django.db.models.fields.IntegerField: disease_status>)¶
get_gender_display(*, field=<django.db.models.fields.IntegerField: gender>)¶
get_mobility_status_display(*, field=<django.db.models.fields.CharField: mobility_status>)¶
get_ration_card_category_display(*, field=<django.db.models.fields.CharField: ration_card_category>)¶
get_source_display(*, field=<django.db.models.fields.IntegerField: source>)¶
get_test_type_display(*, field=<django.db.models.fields.IntegerField: test_type>)¶
get_vaccine_name_display(*, field=<django.db.models.fields.CharField: vaccine_name>)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_consultation_id¶
last_edited_id¶
local_body_id¶
medical_history¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

meta_info_id¶
modified_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

nearest_facility_id¶
patient¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

patientnotes_set¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

patientsample_set¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

resourcerequest_set¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

save_without_historical_record(*args, **kwargs)¶

Save the model instance without creating a historical record.

Make sure you know what you’re doing before using this method.

state_id¶
ward_id¶
class PatientMetaInfo(id, occupation, socioeconomic_status, domestic_healthcare_support, head_of_household)¶

Bases: Model

class OccupationEnum(*values)¶

Bases: IntegerChoices

STUDENT = 1¶
BUSINESSMAN = 2¶
HEALTH_CARE_WORKER = 3¶
HEALTH_CARE_LAB_WORKER = 4¶
ANIMAL_HANDLER = 5¶
OTHERS = 6¶
HEALTHCARE_PRACTITIONER = 7¶
PARADEMICS = 8¶
ENGINEER = 10¶
TEACHER = 11¶
OTHER_PROFESSIONAL_OCCUPATIONS = 12¶
OFFICE_ADMINISTRATIVE = 13¶
CHEF = 14¶
PROTECTIVE_SERVICE = 15¶
HOSPITALITY = 16¶
CUSTODIAL = 17¶
CUSTOMER_SERVICE = 18¶
SALES_SUPERVISOR = 19¶
RETAIL_SALES_WORKER = 20¶
INSURANCE_SALES_AGENT = 21¶
SALES_REPRESENTATIVE = 22¶
REAL_ESTATE = 23¶
CONSTRUCTION_EXTRACTION = 24¶
AGRI_NATURAL = 25¶
PRODUCTION_OCCUPATION = 26¶
PILOT_FLIGHT = 27¶
VEHICLE_DRIVER = 28¶
MILITARY = 29¶
HOMEMAKER = 30¶
UNKNOWN = 31¶
NOT_APPLICABLE = 32¶
OccupationChoices = [(1, 'STUDENT'), (2, 'BUSINESSMAN'), (3, 'HEALTH_CARE_WORKER'), (4, 'HEALTH_CARE_LAB_WORKER'), (5, 'ANIMAL_HANDLER'), (6, 'OTHERS'), (7, 'HEALTHCARE_PRACTITIONER'), (8, 'PARADEMICS'), (9, 'BUSINESS_RELATED'), (10, 'ENGINEER'), (11, 'TEACHER'), (12, 'OTHER_PROFESSIONAL_OCCUPATIONS'), (13, 'OFFICE_ADMINISTRATIVE'), (14, 'CHEF'), (15, 'PROTECTIVE_SERVICE'), (16, 'HOSPITALITY'), (17, 'CUSTODIAL'), (18, 'CUSTOMER_SERVICE'), (19, 'SALES_SUPERVISOR'), (20, 'RETAIL_SALES_WORKER'), (21, 'INSURANCE_SALES_AGENT'), (22, 'SALES_REPRESENTATIVE'), (23, 'REAL_ESTATE'), (24, 'CONSTRUCTION_EXTRACTION'), (25, 'AGRI_NATURAL'), (26, 'PRODUCTION_OCCUPATION'), (27, 'PILOT_FLIGHT'), (28, 'VEHICLE_DRIVER'), (29, 'MILITARY'), (30, 'HOMEMAKER'), (31, 'UNKNOWN'), (32, 'NOT_APPLICABLE')]¶
class SocioeconomicStatus(*values)¶

Bases: IntegerChoices

VERY_POOR = 10¶
POOR = 20¶
MIDDLE_CLASS = 30¶
WELL_OFF = 40¶
class DomesticHealthcareSupport(*values)¶

Bases: IntegerChoices

NO_SUPPORT = 0¶
FAMILY_MEMBER = 10¶
PAID_CAREGIVER = 20¶
occupation¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

socioeconomic_status¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

domestic_healthcare_support¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

head_of_household¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

get_domestic_healthcare_support_display(*, field=<django.db.models.fields.SmallIntegerField: domestic_healthcare_support>)¶
get_occupation_display(*, field=<django.db.models.fields.IntegerField: occupation>)¶
get_socioeconomic_status_display(*, field=<django.db.models.fields.SmallIntegerField: socioeconomic_status>)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>¶
patientregistration¶

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class PatientContactDetails(id, patient, patient_in_contact, relation_with_patient, mode_of_contact, date_of_first_contact, date_of_last_contact, is_primary, condition_of_contact_is_symptomatic, deleted)¶

Bases: Model

class RelationEnum(*values)¶

Bases: IntEnum

FAMILY_MEMBER = 1¶
FRIEND = 2¶
RELATIVE = 3¶
NEIGHBOUR = 4¶
TRAVEL_TOGETHER = 5¶
WHILE_AT_HOSPITAL = 6¶
WHILE_AT_SHOP = 7¶
WHILE_AT_OFFICE_OR_ESTABLISHMENT = 8¶
WORSHIP_PLACE = 9¶
OTHERS = 10¶
class ModeOfContactEnum(*values)¶

Bases: IntEnum

TOUCHED_BODY_FLUIDS = 1¶
DIRECT_PHYSICAL_CONTACT = 2¶
CLEANED_USED_ITEMS = 3¶
LIVE_IN_SAME_HOUSEHOLD = 4¶
CLOSE_CONTACT_WITHOUT_PRECAUTION = 5¶
CO_PASSENGER_AEROPLANE = 6¶
HEALTH_CARE_WITH_PPE = 7¶
SHARED_SAME_SPACE_WITHOUT_HIGH_EXPOSURE = 8¶
TRAVELLED_TOGETHER_WITHOUT_HIGH_EXPOSURE = 9¶
RelationChoices = [(1, 'FAMILY_MEMBER'), (2, 'FRIEND'), (3, 'RELATIVE'), (4, 'NEIGHBOUR'), (5, 'TRAVEL_TOGETHER'), (6, 'WHILE_AT_HOSPITAL'), (7, 'WHILE_AT_SHOP'), (8, 'WHILE_AT_OFFICE_OR_ESTABLISHMENT'), (9, 'WORSHIP_PLACE'), (10, 'OTHERS')]¶
ModeOfContactChoices = [(1, 'TOUCHED_BODY_FLUIDS'), (2, 'DIRECT_PHYSICAL_CONTACT'), (3, 'CLEANED_USED_ITEMS'), (4, 'LIVE_IN_SAME_HOUSEHOLD'), (5, 'CLOSE_CONTACT_WITHOUT_PRECAUTION'), (6, 'CO_PASSENGER_AEROPLANE'), (7, 'HEALTH_CARE_WITH_PPE'), (8, 'SHARED_SAME_SPACE_WITHOUT_HIGH_EXPOSURE'), (9, 'TRAVELLED_TOGETHER_WITHOUT_HIGH_EXPOSURE')]¶
patient¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

patient_in_contact¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

relation_with_patient¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

mode_of_contact¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_first_contact¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_last_contact¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_primary¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

condition_of_contact_is_symptomatic¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deleted¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <care.utils.models.base.BaseManager object>¶
exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

get_mode_of_contact_display(*, field=<django.db.models.fields.IntegerField: mode_of_contact>)¶
get_relation_with_patient_display(*, field=<django.db.models.fields.IntegerField: relation_with_patient>)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

patient_id¶
patient_in_contact_id¶
class Disease(id, patient, disease, details, deleted)¶

Bases: Model

patient¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

disease¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

details¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deleted¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <care.utils.models.base.BaseManager object>¶
get_disease_display()¶
exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

patient_id¶
class PatientMobileOTP(id, external_id, created_date, modified_date, deleted, is_used, phone_number, otp)¶

Bases: BaseModel

is_used¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

phone_number¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

otp¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

created_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deleted¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

external_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class PatientNoteThreadChoices(*values)¶

Bases: IntegerChoices

DOCTORS = 10¶
NURSES = 20¶
class PatientNotes(id, external_id, created_date, modified_date, deleted, patient, consultation, facility, user_type, created_by, thread, reply_to, note)¶

Bases: FacilityBaseModel, ConsultationRelatedPermissionMixin

patient¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

consultation¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

facility¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_type¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

thread¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reply_to¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

note¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

consultation_id¶
created_by_id¶
created_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

deleted¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

edits¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

external_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

facility_id¶
get_thread_display(*, field=<django.db.models.fields.SmallIntegerField: thread>)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

patient_id¶
replies¶

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

reply_to_id¶
class PatientNotesEdit(id, patient_note, edited_date, edited_by, note)¶

Bases: Model

patient_note¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

edited_date¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

edited_by¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

note¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist¶

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: MultipleObjectsReturned

edited_by_id¶
get_next_by_edited_date(*, field=<django.db.models.fields.DateTimeField: edited_date>, is_next=True, **kwargs)¶
get_previous_by_edited_date(*, field=<django.db.models.fields.DateTimeField: edited_date>, is_next=False, **kwargs)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>¶
patient_note_id¶
class PatientAgeFunc(*args, **kwargs)¶

Bases: Func

Expression to calculate the age of a patient based on date of birth/year of birth and death date time.

Eg:

` PatientSample.objects.annotate(patient_age=PatientAgeFunc()) `

function = 'date_part'¶
__init__() None¶