Health index technicalities
Access
HR Managers can be invited to a store in the backoffice. They can then view the health index. If an HR Manager is connected to multiple stores, a dropdown on the health index lets them switch stores. Super-admins have access to all stores' health indexes.
Filtering
When a query should be filtered, use healthIndexFilter(). On store employees that is scopeHealthIndexFilter in Domain/HealthIndex/Models/HealthIndexFilters.php. MyClicParticipantQueryBuilder::healthIndexFilter() delegates to it.
Factors
Each factor is a class under Domain/MyClic/Factors/{Questionnaire}/, for example Domain/MyClic/Factors/Pmo/Lifestyle.php. The shared contracts live next to them (Factor, HasBarGraph, HasSubFactors, HealthIndexSubFactor, HasScoreCategory).
Per-person categories are stored on my_clic_participants.scores (categorySlug()). Average-score category goes GetFactorAverageScoreAndCategoryPerStore to CalculatePartialScores to Questionnaire Engine POST /scores/calculate-partial-scores.
HasScoreCategory::categoryTitle() looks up lang/{locale}/enums/my-clic/factors.php.
Smoking
Smoking has no numeric average. Smoking::format() passes the stored answer through Domain/QuestionnaireEngine/Actions/TranslateAnswerOption.php (smoker options) and returns the translated label.