Skip to content

Commit

Permalink
feat: added 4 more activity types!
Browse files Browse the repository at this point in the history
- all_new_consistent
- all_new_vital
- all_became_inconsistent
- all_became_unvital
  • Loading branch information
amindadgar committed Oct 16, 2023
1 parent 02f21d0 commit a23a698
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tc_core_analyzer_lib/assess_engagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def compute(
all_about_to_disengage,
all_disengaged_in_past,
all_inconsistent,
all_new_consistent,
all_new_vital,
all_became_inconsistent,
all_became_unvital,
):
"""
Assess engagment levels for all active members in a time period
Expand Down Expand Up @@ -277,6 +281,26 @@ def compute(
all_disengaged_were_consistently_active[str(w_i)] = set()
all_disengaged_were_newly_active[str(w_i)] = set()

# # # DETECT CHANGES SINCE LAST PERIOD # # #
if w_i - WINDOW_D >= 0:
all_new_consistent[str(w_i)] = (
all_consistent[str(w_i)] - all_consistent[str(w_i - WINDOW_D)]
)
all_new_vital[str(w_i)] = (
all_vital[str(w_i)] - all_vital[str(w_i - WINDOW_D)]
)
all_became_inconsistent[str(w_i)] = (
all_consistent[str(w_i - WINDOW_D)] - all_consistent[str(w_i)]
)
all_became_unvital[str(w_i)] = (
all_vital[str(w_i - WINDOW_D)] - all_vital[str(w_i)]
)
else:
all_new_consistent[str(w_i)] = set()
all_new_vital[str(w_i)] = set()
all_became_inconsistent[str(w_i)] = set()
all_became_unvital[str(w_i)] = set()

return (
graph,
all_joined,
Expand All @@ -300,4 +324,8 @@ def compute(
all_about_to_disengage,
all_disengaged_in_past,
all_inconsistent,
all_new_consistent,
all_new_vital,
all_became_inconsistent,
all_became_unvital,
)

0 comments on commit a23a698

Please sign in to comment.