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
- Load data -- Call
getSpotItTechniqueData()to retrieve the available situations, symptoms, endorsements, and success indicators. - Generate spots -- Pass the member's selected situation and symptom IDs to
generateSpots(). The server returns personalized coping strategies. - 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.
| Field | Type | Description |
|---|---|---|
situations | List<SpotItSituation> | Available situations the member can choose from. |
symptoms | List<SpotItSymptom> | Available symptoms to report. |
endorsements | List<SpotItEndorsement> | Endorsement options for feedback. |
successes | List<SpotItSuccess> | Success indicators for feedback. |
SpotItSituation
| Field | Type | Description |
|---|---|---|
id | Long? | Situation identifier. |
details | String? | Description of the situation. |
SpotItSymptom
| Field | Type | Description |
|---|---|---|
id | Long? | Symptom identifier. |
type | Int? | Symptom category. |
details | String? | Description of the symptom. |
SpotItResult
Returned by generateSpots(). Contains the generated coping strategies.
| Field | Type | Description |
|---|---|---|
requestId | String? | Server-assigned request identifier. |
spots | List<SpotItSpot> | Generated coping strategies. |
SpotItSpot
| Field | Type | Description |
|---|---|---|
id | Long? | Spot identifier. |
title | String? | Short title for the coping strategy. |
details | String? | Detailed description or instructions. |
url | String? | Optional link to additional content. |
SpotItEndorsement / SpotItSuccess
Both follow the same structure:
| Field | Type | Description |
|---|---|---|
id | Long? | Identifier used when submitting feedback. |
details | String? | Display text for the option. |
Load Spot-It Data
Retrieve the reference data needed to build the questionnaire UI.
- Android (Kotlin)
- iOS (Swift)
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
}
let data = try await AFCore.shared.mentalFitness().getSpotItTechniqueData()
self.situations = data.situations
self.symptoms = data.symptoms
self.endorsements = data.endorsements
self.successes = data.successes
Generate Spots
Submit the member's selected situations and symptoms to receive personalized coping strategies.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
situationIds | List<Long> | Yes | Selected situation identifiers. |
symptomIds | List<Long> | Yes | Selected symptom identifiers. |
timestampInSeconds | Long | Yes | UTC epoch timestamp. |
- Android (Kotlin)
- iOS (Swift)
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)
}
let result = try await AFCore.shared.mentalFitness().generateSpots(
situationIds: selectedSituationIds,
symptomIds: selectedSymptomIds,
timestampInSeconds: Int64(Date().timeIntervalSince1970)
)
self.spots = result.spots
self.spotsCollectionView.reloadData()
Submit Feedback
After the member tries a coping strategy, collect their feedback to improve future recommendations.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spotId | String | Yes | Identifier of the spot the member tried. |
endorsementId | Int | Yes | Selected endorsement from SpotItData.endorsements. |
successId | Int | Yes | Selected success indicator from SpotItData.successes. |
feedback | String? | No | Optional free-text feedback from the member. |
- Android (Kotlin)
- iOS (Swift)
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")
}
}
let result = try await AFCore.shared.mentalFitness().submitSpotItFeedback(
spotId: String(selectedSpot.id ?? 0),
endorsementId: Int32(selectedEndorsement.id ?? 0),
successId: Int32(selectedSuccess.id ?? 0),
feedback: feedbackTextField.text
)
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
- Android (Kotlin)
- iOS (Swift)
AFCore.mentalFitness().getSpotItTechniqueData()
AFCore.mentalFitness().generateSpots(situationIds, symptomIds, timestampInSeconds)
AFCore.mentalFitness().submitSpotItFeedback(spotId, endorsementId, successId, feedback)
try await AFCore.shared.mentalFitness().getSpotItTechniqueData()
try await AFCore.shared.mentalFitness().generateSpots(situationIds:symptomIds:timestampInSeconds:)
try await AFCore.shared.mentalFitness().submitSpotItFeedback(spotId:endorsementId:successId:feedback:)