Module ImportFrom alias alias alias ImportFrom alias ImportFrom alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias Import alias Assign NameStore Dict FunctionDef arguments args NameParam defaults body Import alias Return Call AttributeLoad NameLoad attr Call AttributeLoad Call NameLoad NameLoad attr decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpMod Call AttributeLoad NameLoad attr Num If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return ListLoad orelse Pass Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore ListLoad Expr Call AttributeLoad NameLoad attr BinOpSub Call NameLoad NameLoad Num Call NameLoad NameLoad Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore NameLoad If CompareEq NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr orelse Assign NameStore NameLoad Assign NameStore Dict If CompareEq NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str keyword NameLoad attr Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str If Call AttributeLoad NameLoad attr NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad orelse Assign NameStore Call NameLoad Call NameLoad AttributeLoad NameLoad attr Call NameLoad BinOpAdd NameLoad Call NameLoad keyword Num If CompareEq SubscriptLoad NameLoad Index Str NameLoad body Assign NameStore BinOpAdd NameLoad Call NameLoad keyword Num orelse Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str If Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad NameLoad attr BinOpMod Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Call NameLoad NameLoad keyword NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return Call NameLoad NameLoad NameLoad NameLoad decorator_list NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Call NameLoad Str keyword NameLoad Call NameLoad Str Call NameLoad Str Call NameLoad Str keyword NameLoad Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Assign NameStore Dict Str Str If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword Str keyword NameLoad keyword NameLoad Assign SubscriptStore NameLoad Index Str Dict Str Str Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Num Assign SubscriptStore NameLoad Index Str Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Call AttributeLoad NameLoad attr NameLoad keyword Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore Call NameLoad ListComp SubscriptLoad NameLoad Index Str comprehension NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call NameLoad NameLoad Assign NameStore ListLoad Assign NameStore Num Assign NameStore Num For NameStore Call NameLoad Num NameLoad body Assign NameStore Call NameLoad keyword NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad Call NameLoad Lambda arguments args NameParam defaults CompareIsNot NameLoad NameLoad NameLoad Assign NameStore ListComp Call AttributeLoad NameLoad attr NameLoad Dict comprehension NameStore NameLoad Assign NameStore ListLoad Assign NameStore Call NameLoad For NameStore NameLoad body AugAssignAdd NameStore Num Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index Str If CompareGt Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Str Index Str If CompareGt Call NameLoad NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str orelse Assign NameStore Dict Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Str Index Str Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index Num Index Str Index Str IfExp CompareEq Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index Str AugAssignAdd NameStore Num orelse Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index Str If CompareGt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index Str AugAssignAdd NameStore Num orelse Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad Call NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Assign NameStore Dict Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore NameLoad If CompareIn Str AttributeLoad NameLoad attr body TryExcept body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str handlers ExceptHandler type NameLoad body Pass If CompareIn Str AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad orelse Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr If CompareIn Str AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore AttributeLoad BinOpSub NameLoad NameLoad attr Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad keyword NameLoad If CompareGt Call NameLoad NameLoad Num body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str SubscriptLoad SubscriptLoad NameLoad Index Num Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad SubscriptLoad NameLoad Index Num Index Num orelse Assign SubscriptStore NameLoad Index Str Num Assign SubscriptStore NameLoad Index Str Num Return NameLoad decorator_list
N/A datetime datetime timedelta time dateutil.parser parser django.core.cache cache N/A json casexml.apps.case.models CommCareCase corehq.apps.api.es ReportXFormES corehq.util.dates iso_string_to_datetime iso_string_to_date dimagi.utils.dates force_to_datetime dimagi.utils.parsing json_format_date pact.enums PACT_DOMAIN pact.lib.quicksect IntervalNode pact.utils get_patient_display_cache get_report_script_field N/A logging N/A cached_schedules N/A get_seconds N/A N/A d N/A N/A N/A time N/A N/A N/A time mktime N/A N/A N/A force_to_datetime d utctimetuple N/A CHWPatientSchedule N/A object N/A __init__ N/A N/A self username intervaltrees raw_schedule N/A N/A N/A N/A self username username N/A N/A self intervals intervaltrees N/A N/A self raw_schedule raw_schedule N/A scheduled_for_date N/A N/A self date_val N/A N/A N/A 
        For a given date, return the array of pact_ids that are scheduled for visiting.  This will check the activate date by using the internal interval tree.
        Parameter:  datetime value
        Returns: array of pact_ids
         N/A day_of_week N/A N/A N/A date_val isoweekday 7 N/A N/A N/A N/A N/A self intervals has_key day_of_week N/A N/A N/A N/A N/A N/A day_tree N/A N/A self intervals N/A day_of_week N/A results N/A N/A N/A N/A day_tree intersect N/A N/A get_seconds date_val 0.1 N/A get_seconds date_val N/A N/A N/A x N/A N/A N/A results append N/A x other N/A results N/A get_schedule N/A N/A cls chw_username override_date N/A None N/A N/A 
        Generate schedule object for a given username
         N/A cached_schedules None N/A N/A override_date None N/A N/A nowdate N/A N/A datetime utcnow N/A N/A nowdate override_date N/A day_intervaltree N/A N/A N/A cached_schedules None N/A N/A db N/A N/A CommCareCase get_db N/A chw_schedules N/A N/A N/A N/A db view pact/chw_dot_schedules key chw_username all N/A to_cache N/A N/A item chw_schedules N/A N/A single_sched N/A item N/A value N/A N/A N/A to_cache append single_sched N/A N/A N/A cache set N/A %s_schedule chw_username N/A N/A json dumps to_cache 3600 N/A cached_arr to_cache N/A N/A cached_arr N/A N/A json loads cached_schedules N/A single_sched cached_arr N/A N/A day_of_week N/A int N/A single_sched N/A day_of_week N/A N/A N/A day_intervaltree has_key day_of_week N/A N/A daytree N/A day_intervaltree N/A day_of_week N/A N/A daytree N/A IntervalNode N/A get_seconds N/A datetime min N/A get_seconds N/A nowdate N/A timedelta days 10 N/A N/A N/A single_sched N/A ended_date None N/A N/A enddate N/A nowdate N/A timedelta days 9 N/A N/A enddate N/A iso_string_to_datetime N/A single_sched N/A ended_date N/A startdate N/A iso_string_to_datetime N/A single_sched N/A active_date N/A case_id N/A single_sched N/A case_id N/A N/A N/A single_sched has_key error N/A N/A N/A N/A logging error N/A Error, no pactid: %s N/A single_sched N/A error N/A N/A N/A daytree insert N/A get_seconds startdate N/A get_seconds enddate other case_id N/A N/A day_intervaltree N/A day_of_week daytree N/A N/A cls chw_username day_intervaltree cached_arr N/A classmethod N/A dots_submissions_by_case N/A N/A case_id query_date username N/A None N/A N/A 
    Actually run query for username submissions
    todo: do terms for the pact_ids instead of individual term?
     N/A xform_es N/A ReportXFormES PACT_DOMAIN N/A script_fields N/A doc_id pact_id encounter_date username visit_type visit_kept contact_type observed_art observed_non_art observer_non_art_dose observed_art_dose pillbox_check scheduled N/A get_report_script_field _id is_known True N/A get_report_script_field form.pact_id N/A get_report_script_field form.encounter_date N/A get_report_script_field form.meta.username is_known True N/A get_report_script_field form.visit_type N/A get_report_script_field form.visit_kept N/A get_report_script_field form.contact_type N/A get_report_script_field form.observed_art N/A get_report_script_field form.observed_non_art N/A get_report_script_field form.observed_non_art_dose N/A get_report_script_field form.observed_art_dose N/A get_report_script_field form.pillbox_check.check N/A get_report_script_field form.scheduled N/A term_block N/A form.#type dots_form N/A N/A username None N/A N/A N/A term_block N/A form.meta.username username N/A query N/A N/A xform_es by_case_id_query PACT_DOMAIN case_id terms term_block date_field form.encounter_date.#value startdate query_date enddate query_date N/A N/A query N/A sort N/A received_on asc N/A N/A query N/A script_fields script_fields N/A N/A query N/A size 1 N/A N/A query N/A from 0 N/A res N/A N/A xform_es run_query query N/A N/A N/A json dumps res indent 2 N/A res N/A get_schedule_tally N/A N/A username total_interval override_date N/A None N/A N/A 
    Main entry point
    For a given username and interval, get a simple array of the username and scheduled visit (whether a submission is there or not)  exists.
    returns (schedule_tally_array, patient_array, total_scheduled (int), total_visited(int))
    schedul_tally_array = [visit_date, [(patient1, visit1), (patient2, visit2), (patient3, None), (patient4, visit4), ...]]
    where visit = XFormInstance
     N/A N/A override_date None N/A N/A nowdate N/A N/A datetime utcnow N/A chw_schedule N/A N/A CHWPatientSchedule get_schedule username N/A N/A nowdate override_date N/A chw_schedule N/A N/A CHWPatientSchedule get_schedule username override_date nowdate N/A patient_case_ids N/A set N/A N/A x N/A case_id N/A x N/A chw_schedule raw_schedule N/A patient_cache N/A get_patient_display_cache N/A list patient_case_ids N/A ret N/A N/A total_scheduled 0 N/A total_visited 0 N/A n N/A range 0 total_interval N/A N/A td N/A timedelta days n N/A visit_date N/A nowdate td N/A scheduled_case_ids N/A N/A chw_schedule scheduled_for_date visit_date N/A patient_case_ids N/A set N/A filter N/A N/A N/A x N/A N/A x None scheduled_case_ids N/A dereferenced_patient_info N/A N/A N/A patient_cache get x N/A N/A x patient_case_ids N/A visited N/A N/A dp N/A parser N/A case_id patient_case_ids N/A N/A total_scheduled 1 N/A search_results N/A dots_submissions_by_case case_id visit_date username username N/A submissions N/A N/A search_results N/A hits N/A hits N/A N/A N/A len submissions 0 N/A N/A pillbox_check_str N/A N/A N/A submissions N/A 0 N/A fields N/A pillbox_check N/A N/A N/A len pillbox_check_str 0 N/A N/A pillbox_check_data N/A N/A json loads pillbox_check_str N/A anchor_date N/A N/A dp parse N/A N/A pillbox_check_data get anchor N/A N/A pillbox_check_data N/A N/A anchor_date N/A datetime min N/A encounter_date N/A N/A dp parse N/A N/A N/A submissions N/A 0 N/A fields N/A encounter_date N/A N/A N/A N/A submissions N/A 0 N/A fields N/A has_pillbox_check N/A N/A N/A N/A anchor_date date N/A N/A encounter_date date Yes No N/A N/A N/A visited append N/A N/A submissions N/A 0 N/A fields N/A total_visited 1 N/A N/A search_results N/A dots_submissions_by_case case_id visit_date N/A other_submissions N/A N/A search_results N/A hits N/A hits N/A N/A N/A len other_submissions 0 N/A N/A N/A N/A visited append N/A N/A other_submissions N/A 0 N/A fields N/A total_visited 1 N/A N/A N/A N/A visited append None N/A N/A N/A ret append N/A visit_date N/A zip dereferenced_patient_info visited N/A N/A ret patient_case_ids total_scheduled total_visited N/A chw_calendar_submit_report N/A N/A request username interval N/A 7 N/A N/A Calendar view of submissions by CHW, overlaid with their scheduled visits, and whether they made them or not. N/A return_context N/A N/A N/A return_context N/A username username N/A total_interval interval N/A N/A interval N/A request GET N/A N/A N/A N/A total_interval N/A int N/A N/A request GET N/A interval N/A N/A N/A ValueError N/A N/A N/A N/A enddate N/A request GET N/A N/A end_date_str N/A N/A N/A request GET get enddate N/A json_format_date N/A N/A datetime utcnow N/A end_date N/A iso_string_to_date end_date_str N/A N/A end_date N/A N/A N/A N/A datetime utcnow date N/A N/A startdate N/A request GET N/A N/A start_date_str N/A N/A N/A request GET get startdate N/A json_format_date N/A N/A datetime utcnow N/A start_date N/A iso_string_to_date start_date_str N/A total_interval N/A N/A end_date start_date days N/A N/A ret patients total_scheduled total_visited N/A get_schedule_tally username total_interval override_date end_date N/A N/A N/A len ret 0 N/A N/A N/A return_context N/A date_arr ret N/A N/A return_context N/A total_scheduled total_scheduled N/A N/A return_context N/A total_visited total_visited N/A N/A return_context N/A start_date N/A N/A ret N/A 0 N/A 0 N/A N/A return_context N/A end_date N/A N/A ret N/A -1 N/A 0 N/A N/A N/A return_context N/A total_scheduled 0 N/A N/A return_context N/A total_visited 0 N/A return_context N/A