app.utils package

Submodules

app.utils.adherence module

Module for monitoring patient medication adherence.

app.utils.adherence.adherence_by_drug_name(prescriptions, measure='general')[source]

Return average adherence rates by drug name. e.g. {‘Acetominophen: 0.89’, ‘Ibuprofen: 0.73’} prescriptions: list - list of Prescription objects measure: string - measure of adherence, either ‘general’

(taking the right number of pills expected) or ‘ontime’ (taking pills at the right time)

app.utils.adherence.get_adhering_patients(user)[source]

Return the list of patients currently taking all medication on time.

app.utils.adherence.get_all_patients(user)[source]

Return unprescribed, deviating, and adhering patients (in order).

app.utils.adherence.get_days_until_refill(curr_date, next_refill_date)[source]

Return number of days until next refill. If curr_date > next_refill_date, for instance, if refill was not fulfilled

in time, then days until refill is still 0.

curr_date: datetime - the date against which next refill date is compared next_refill_date: datetime

app.utils.adherence.get_deviating_patients(user)[source]

Return the list of patients currently deviating from their prescriptions.

app.utils.adherence.get_next_refill_date(last_refill_date, duration, duration_unit, refills, refill_num)[source]

Return next refill date based on most recent (last) refill date and dosage information.

last_refill_date: datetime duration: int duration_unit: string - either ‘day’, ‘week’, or ‘month’ refills: int - number of refills for entire treatment refill_num: int - the refill the patient is currently on

app.utils.adherence.get_unprescribed_patients(user)[source]

Return the list of patients currently without any prescriptions.

app.utils.adherence.least_adhered_by_drug_name(prescriptions, n=5, measure='general')[source]

Get least adhered to medications by drug name. prescriptions: list - list of Prescription objects n: int - how many to return measure: string - measure of adherence, either ‘general’

(taking the right number of pills expected) or ‘ontime’ (taking pills at the right time)

app.utils.adherence.most_adhered_by_drug_name(prescriptions, n=5, measure='general')[source]

Get most adhered to medications by drug name. prescriptions: list - list of Prescription objects n: int - how many to return measure: string - measure of adherence, either ‘general’

(taking the right number of pills expected) or ‘ontime’ (taking pills at the right time)

app.utils.ploting module

Module for plotting adherence trends and analytics.

app.utils.ploting.plot_adherence_rates_over_time(patients, prescriptions)[source]

Plot on-time and on-track adherence rates over time. TODO: use real data