Skip to content

Commit

Permalink
don't distinguish between incoming and outgoing calls/texts
Browse files Browse the repository at this point in the history
  • Loading branch information
clementzach committed Sep 15, 2023
1 parent e0b6cd8 commit 0f552f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
7 changes: 2 additions & 5 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 4 additions & 5 deletions docs/source/willow.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
22 changes: 10 additions & 12 deletions forest/willow/log_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)


Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand Down

0 comments on commit 0f552f5

Please sign in to comment.