diff --git a/docs/source/index.md b/docs/source/index.md index 5ed87a46..872ae6b1 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -216,12 +216,9 @@ The summary statistics that are generated are listed below: * - total_mins_out_call - float - The duration (minute) of all outgoing calls. - * - num_uniq_in_call_or_text + * - num_uniq_individuals_call_or_text - int - - The total number of unique individuals who called or texted the subject. -* - num_uniq_out_call_or_text - - int - - The total number of unique individuals called or texted by the subject. + - The total number of unique individuals who called or texted the subject, or who the subject called or texted. The total number of individuals who the subject had any kind of communication with. * - num_s - int - The total number of sent SMS. diff --git a/docs/source/willow.md b/docs/source/willow.md index c2647148..e0ce225c 100644 --- a/docs/source/willow.md +++ b/docs/source/willow.md @@ -36,13 +36,12 @@ ___ | num_in_call | int | Total number of incoming calls | | num_out_call | int | Total number of outgoing calls | | num_mis_call | int | Total number of missed calls -| num_uniq_in_call | float | Total number of unique incoming callers | -| num_uniq_out_call | int | Total number of unique outgoing calls | -| num_uniq_mis_call | float | Total number of unique callers missed | +| num_in_caller | float | Total number of unique incoming callers | +| num_out_caller | int | Total number of unique outgoing calls | +| num_mis_caller | float | Total number of unique callers missed | | total_time_in_call | int | Total amount of minutes spent on incoming calls | | total_time_out_call | int | Total amount of minutes spent on outgoing calls | -| num_uniq_in_call_or_text | float | Total number of unique individuals who called or texted the Beiwe user | -| num_uniq_out_call_or_text | int | Total number of unique individuals who the Beiwe user called or texted | +| num_uniq_individuals_call_or_text | float | Total number of unique individuals who called or texted the Beiwe user, or who the Beiwe user called or texted. The total number of individuals with any communication contact with the Beiwe user | | num_s | float | Total number of sent SMS texts | | num_r | int | Total number of received SMS texts | | num_mms_s | int | Total number of sent MMS texts | diff --git a/forest/willow/log_stats.py b/forest/willow/log_stats.py index 2ec4a502..9c42a86a 100644 --- a/forest/willow/log_stats.py +++ b/forest/willow/log_stats.py @@ -156,12 +156,10 @@ def text_and_call_analysis(df_call: pd.DataFrame, df_text: pd.DataFrame, stamp: Returns: tuple of summary statistics containing: - num_uniq_in_call_or_text: int + num_uniq_individuals_call_or_text: int number of people making incoming calls or texts to the Beiwe - user - num_uniq_out_call_or_text: int - number of people receiving outgoing calls or texts from the - Beiwe user + user or who the Beiwe user made outgoing calls or texts to + """ # filter the data based on the timestamp @@ -192,12 +190,13 @@ def text_and_call_analysis(df_call: pd.DataFrame, df_text: pd.DataFrame, stamp: texts_in = np.array([]) texts_out = np.array([]) - num_uniq_in_call_or_text = len(np.unique(np.hstack(calls_in, texts_in))) - num_uniq_out_call_or_text = len(np.unique(np.hstack(texts_out, calls_out))) + num_uniq_individuals_call_or_text = len(np.unique(np.hstack( + calls_in, texts_in, texts_out, calls_out + ))) + return ( - num_uniq_in_call_or_text, - num_uniq_out_call_or_text + num_uniq_individuals_call_or_text, ) @@ -353,7 +352,7 @@ def comm_logs_summaries( text_and_call_stats = text_and_call_analysis(df_text, df_call, stamp, step_size, frequency) newline += list(text_and_call_stats) else: - newline += [pd.NA] * 2 + newline += [pd.NA] if df_text.shape[0] > 0: text_stats = text_analysis(df_text, stamp, step_size, frequency) @@ -378,8 +377,7 @@ def comm_logs_summaries( "num_mis_caller", "total_mins_in_call", "total_mins_out_call", - "num_uniq_in_call_or_text", - "num_uniq_out_call_or_text", + "num_uniq_individuals_call_or_text", "num_s", "num_r", "num_mms_s",