childcount.models.Patient

A model representing a single resident of the catchment area. We do not document the model fields, because you can find those yourself in the code!

class childcount.models.Patient.Patient(*args, **kwargs)[source]

Holds the patient details, properties and methods related to it

GENDER_CHOICES

Patient genders

class QuerySet(model=None, query=None)[source]

This QuerySet extends the default django QuerySet with useful filters.

Hint

All of these filters take standard start and end arguments for consistency’s sake. These parameters are defined as:

  • start: start date of time period (inclusive) – datetime.datetime
  • end: end date of time period (inclusive) – datetime.datetime
age(start, end, min_days, max_days)[source]

Living patients whose age (in days) was min_days <= patient__age < max_days at the datetime end

alive(start, end)[source]

Patients who were alive at end.

created_before(cutoff)[source]

Patients who have an encounter before the specified date. The Patient.created_on() field does not work, since that just indicates when the DB row was created – not the encounter date when the patient was created.

Parameters:cutoff (datetime.datetime) – Method returns all patients with encounters on or before this date.
delivered(start, end)[source]

Women who delivered between start and end

household(start, end)[source]

Living people who are/were household heads at end

muac_eligible(start, end)[source]

180 days <= age < 5 years (5*365 days)

neonatal(start, end)[source]

0 days <= age < 28 days

over_five(start, end)[source]

5 years (5*365 days) < age

over_five_not_pregnant_recently(start, end)[source]

More than five years of age and not in pregnant_recently()

pregnant(start, end)[source]

Patients who were between 0 and 9 months pregnant at date end

pregnant_during_interval(start, end)[source]

Women who were pregnant at some point between start and end

pregnant_months(start, end, start_month, end_month, include_delivered, include_stillbirth)[source]

Uses the cached pregnant_data() call to return women who are between start_month and end_month months pregnant (inclusive).

Parameters:
  • start_month (float) – Include women who are at least start_month months pregant
  • end_month (float) – Include women who are at most end_month months pregant
  • include_delivered (bool) – Include women who have delivered their babies by time end?
  • include_stillbirth (bool) – Include women who have had a stillbirth or miscarriage before the time end?
pregnant_recently(start, end)[source]

Pregnant or within 42 days of delivery

under_five(start, end)[source]

0 days <= age < 5 years (5*365 days)

under_nine(start, end)[source]

0 days <= age < 9 years (9*365 days)

under_nine_months(start, end)[source]

0 days <= age < 9 months (270 days)

under_one(start, end)[source]

0 days <= age < 365 days

under_six_months(start, end)[source]

0 days <= age < 180 days

Patient.STATUS_CHOICES

Status options for Patients

Patient.age_in_days_weeks_months(relative_to=datetime.date(2011, 9, 19))[source]

return the age of the patient in days and in months

Parameters:relative_to (datetime.date) – Date from which to compute the patient’s age
Patient.full_name()[source]

Return the patients first and last names

Patient.humanised_age()[source]

return a string containing a human readable age

Patient.is_head_of_household()[source]

Check if patient is the head his/her own household

classmethod Patient.is_valid_health_id(health_id)[source]

Naive check if a health ID is valid

Parameters:health_id (str) – Health ID to check
Returns:bool
classmethod Patient.registrations_by_date()[source]

Number of patients registered per day

Returns:Iterable of (datetime.date, n_registrations) tuples
Patient.years()[source]

Calculate patient’s age in years

class childcount.models.Patient.PatientManager[source]

Custom manager for Patient that return our custom Patient.QuerySet model.

Previous topic

childcount.models

Next topic

childcount.models.reports

This Page