Class: PhqStepping

Inherits:
Object
  • Object
show all
Defined in:
app/models/phq_stepping.rb

Overview

Stepping suggestion based on Participant PHQ-9 results.

An explanation of the algorithm:

Weeks 4 - 8 If PHQ-9 >= 17 at two consecutive weeks, then “step” t-CBT If PHQ-9 < 17 at Week 5-8, then “stay” i-CBT If PHQ-9 < 5 at two consecutive weeks, schedule “post-engagement” coach call Week 9-13 If PHQ-9 >= 13 at two consecutive weeks, then “step” t-CBT If PHQ-9 < 13 and >= 5 at Week 10-13, then “stay” i-CBT If PHQ-9 < 5 at two consecutive weeks, schedule “post-engagement” coach call Week 14-20 If PHQ-9 >= 10 at two consecutive weeks, then “step” t-CBT If PHQ-9 < 10 and >= 5, then “stay” i-CBT If PHQ-9 < 5 at two consecutive weeks, schedule “post-engagement” coach call

Constant Summary collapse

DANGER_LABEL =
"danger"
SUCCESS_LABEL =
"success"
WARNING_LABEL =
"warning"
NO_SUGGESTION =
"No"
YES_SUGGESTION =
"YES"
MAX_NUM_OF_MISSING_RESPONSES =
3
LAST_WEEK_BEFORE_STEPPING =
3
DEFAULT_PERIOD_DISCONTINUE_CUTOFF =
0
FIRST_PERIOD_STEPPING_WEEK =
4
FIRST_PERIOD_DISCONTINUE_CUTOFF =
5
FIRST_PERIOD_STEPPING_CUTOFF =
17
SECOND_PERIOD_STEPPING_WEEK =
9
SECOND_PERIOD_STEPPING_CUTOFF =
13

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assessments, study_start_date) ⇒ PhqStepping

assessments = [=> score,=> score, … ]



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/models/phq_stepping.rb', line 40

def initialize(assessments, study_start_date)
  set_initial_values(assessments, study_start_date)
  return unless set_phq_score_ranges
  return unless prep_data_for_validation
  # Return if the data is unreliable, the coach needs to consult
  # and cannot use the automatic algorithm
  return unless validate_data_reliability
  # Most important test, the outcome determines whether to step
  # priority over other tests
  @step = consecutive_high_weeks?
  return if @step
  # At this point either way it has to be "No" (Don't step)
  @urgency = SUCCESS_LABEL
  # Least important test, if this returns true nothing is changed
  @stay = mid_range_scores?
  # Adds to test_range; if this returns true we suggest the coach look at
  # post engagement options.
  @release = consecutive_low_weeks?
end

Instance Attribute Details

#assessmentsObject

Returns the value of attribute assessments.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def assessments
  @assessments
end

#detailed_suggestionObject

Returns the value of attribute detailed_suggestion.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def detailed_suggestion
  @detailed_suggestion
end

#range_startObject

Returns the value of attribute range_start.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def range_start
  @range_start
end

#releaseObject

Returns the value of attribute release.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def release
  @release
end

#stayObject

Returns the value of attribute stay.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def stay
  @stay
end

#stepObject

Returns the value of attribute step.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def step
  @step
end

#suggestionObject

Returns the value of attribute suggestion.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def suggestion
  @suggestion
end

#urgencyObject

Returns the value of attribute urgency.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def urgency
  @urgency
end

#weekObject

Returns the value of attribute week.



36
37
38
# File 'app/models/phq_stepping.rb', line 36

def week
  @week
end

Instance Method Details

#resultsObject



60
61
62
63
64
# File 'app/models/phq_stepping.rb', line 60

def results
  { step?: @step, stay?: @stay, release?: @release, upper_limit: @upper_limit,
    lower_limit: @lower_limit, current_week: @week,
    range_start: @range_start }
end