Skip to main content

Mental Fitness (Spot-It)

The Mental Fitness module implements the Spot-It technique -- a behavioral questionnaire that helps members recognize stressors, identify symptoms, and receive personalized coping strategies. The flow has three stages: load reference data, generate spots (coping suggestions), and collect feedback.


How It Works

  1. Load data -- Call getSpotItTechniqueData() to retrieve the available situations, symptoms, endorsements, and success indicators.
  2. Generate spots -- Pass the member's selected situation and symptom IDs to generateSpots(). The server returns personalized coping strategies.
  3. Collect feedback -- After the member tries a coping strategy, submit their endorsement and success rating via submitSpotItFeedback().

Data Model

SpotItData

Returned by getSpotItTechniqueData(). Contains all reference data needed to build the questionnaire.

FieldTypeDescription
situationsList<SpotItSituation>Available situations the member can choose from.
symptomsList<SpotItSymptom>Available symptoms to report.
endorsementsList<SpotItEndorsement>Endorsement options for feedback.
successesList<SpotItSuccess>Success indicators for feedback.

SpotItSituation

FieldTypeDescription
idLong?Situation identifier.
detailsString?Description of the situation.

SpotItSymptom

FieldTypeDescription
idLong?Symptom identifier.
typeInt?Symptom category.
detailsString?Description of the symptom.

SpotItResult

Returned by generateSpots(). Contains the generated coping strategies.

FieldTypeDescription
requestIdString?Server-assigned request identifier.
spotsList<SpotItSpot>Generated coping strategies.

SpotItSpot

FieldTypeDescription
idLong?Spot identifier.
titleString?Short title for the coping strategy.
detailsString?Detailed description or instructions.
urlString?Optional link to additional content.

SpotItEndorsement / SpotItSuccess

Both follow the same structure:

FieldTypeDescription
idLong?Identifier used when submitting feedback.
detailsString?Display text for the option.

Load Spot-It Data

Retrieve the reference data needed to build the questionnaire UI.

lifecycleScope.launch {
val data = AFCore.mentalFitness().getSpotItTechniqueData()

// Populate situation picker
situationAdapter.submitList(data.situations)

// Populate symptom picker
symptomAdapter.submitList(data.symptoms)

// Store endorsements and successes for the feedback step
this@Activity.endorsements = data.endorsements
this@Activity.successes = data.successes
}

Generate Spots

Submit the member's selected situations and symptoms to receive personalized coping strategies.

Parameters

ParameterTypeRequiredDescription
situationIdsList<Long>YesSelected situation identifiers.
symptomIdsList<Long>YesSelected symptom identifiers.
timestampInSecondsLongYesUTC epoch timestamp.
lifecycleScope.launch {
val result = AFCore.mentalFitness().generateSpots(
situationIds = selectedSituationIds,
symptomIds = selectedSymptomIds,
timestampInSeconds = Clock.System.now().epochSeconds
)

// Display the generated coping strategies
spotsAdapter.submitList(result.spots)
}

Submit Feedback

After the member tries a coping strategy, collect their feedback to improve future recommendations.

Parameters

ParameterTypeRequiredDescription
spotIdStringYesIdentifier of the spot the member tried.
endorsementIdIntYesSelected endorsement from SpotItData.endorsements.
successIdIntYesSelected success indicator from SpotItData.successes.
feedbackString?NoOptional free-text feedback from the member.
lifecycleScope.launch {
val result = AFCore.mentalFitness().submitSpotItFeedback(
spotId = selectedSpot.id.toString(),
endorsementId = selectedEndorsement.id?.toInt() ?: 0,
successId = selectedSuccess.id?.toInt() ?: 0,
feedback = feedbackTextField.text.toString()
)

if (result.status) {
showSuccess("Thank you for your feedback")
}
}

Best Practices

  • Present a guided flow. Walk the member through situation selection, symptom selection, spot review, and feedback as distinct steps.
  • Store partial progress. If the member exits midway, save their selections so they can resume later.
  • Show spots immediately. Display coping strategies as soon as they are generated. If a spot includes a url, offer a "Learn More" link.
  • Encourage feedback. Feedback improves personalization. Prompt the member after they have had time to try a strategy.

Quick Reference

AFCore.mentalFitness().getSpotItTechniqueData()
AFCore.mentalFitness().generateSpots(situationIds, symptomIds, timestampInSeconds)
AFCore.mentalFitness().submitSpotItFeedback(spotId, endorsementId, successId, feedback)