Skip to content

Instantly share code, notes, and snippets.

@ek
Last active March 29, 2022 13:57
Show Gist options
  • Save ek/df25fd90b41619857794bc5b32a811b2 to your computer and use it in GitHub Desktop.
Save ek/df25fd90b41619857794bc5b32a811b2 to your computer and use it in GitHub Desktop.
Process to compute opportunity scores for Jobs to be Done survey analysis

Process to compute opportunity scores for Jobs to be Done survey analysis

Inputs

  • Given an array of outcomes.
  • Given an array of responses to a survey on importance and satisfaction ratings for each of the outcomes.
  • Given the response ratings are 1-5.
  • IMP = 10 x % Very or Extremely important
  • SAT = 10 x % Very or Extremely satisfied
  • OPP = IMP + MAX (IMP-SAT, 0)
  • Values of 4 or 5 are considered Very or Extremely important / satisfied

Process

  1. For each outcome, create two arrays:
  • Importance Rating Array
  • Satisfaction Rating Array
  1. Insert the corresponding response ratings into these arrays.

  2. Compute aggregate values as 10 x % Very or Extremely satisfied (rating of 4 or 5) within the arrays

  3. Use these aggregate values to compute opportunity score - OPP = IMP + MAX (IMP-SAT, 0)

outcomes.forEach(outcome => {

  // create arrays
  outcome.importanceArray = []
  outcome.satisfactionArray = []
  
  this.responses.forEach(response => {
  
    // get data from response
    imp = response[outcome.questionkey+'_a1']
    sat = response[outcome.questionkey+'_a2']
    
    // insert data into arrays
    outcome.importanceArray.push(imp)
    outcome.satisfactionArray.push(sat)
    
  })
  
  // Calculate the aggregate importance for each outcome
  // IMP = 10 x % Very or Extremely important
  outcome.importance = computeAggregate(outcome.importanceArray)
  
  // Calculate the aggregate satisfaction for each outcome
  // SAT = 10 x % Very or Extremely satisfied
  outcome.satisfaction = computeAggregate(outcome.satisfactionArray)
  
  // OPP = IMP + MAX (IMP-SAT, 0)
  outcome.opportunity = outcome.importance + Math.max((outcome.importance - outcome.satisfaction), 0)
}

// compute aggregate values from array - 10 x % Very or Extremely satisfied
function computeAggregate(arr) {
  var sum = 0;
  var i = 0;
  for(i; i < arr.length; i++ ) {
    // values of 4 or 5 are considered Very or Extremely important
    if( arr[i] > 3) { sum++ }
  }
  var percentVery = sum/arr.length
  return percentVery * 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment