Input: the answers file¶
The agent receives one JSON object: the SurveyJS response data for a completed questionnaire, keyed by field ID.
{
"client_full_name": "…",
"client_dob": "1974-03-09",
"health_conditions": ["High cholesterol", "Thyroid disorder"],
"nut_ffq": { "Fresh fruit": "Daily", "Red meat & offal": "Occasionally" },
"meas_weight": 78, "meas_weight__unit": "kg"
}
What the shapes mean¶
The value's JSON type follows from the question's SurveyJS type. Reading a
value with the wrong expectation is the most common way to corrupt a menu
silently, so the mapping is worth knowing.
SurveyJS type |
JSON value | Example |
|---|---|---|
text, comment |
string | "Two 20-minute sessions" |
text with inputType: "number" |
number | 78 |
text with inputType: "date" |
YYYY-MM-DD string |
"1974-03-09" |
boolean |
the valueTrue / valueFalse string — "Yes" / "No", not true / false |
"Yes" |
radiogroup, dropdown |
one choice string | "2–3 L" |
checkbox |
array of choice strings | ["Wine", "Beer"] |
rating |
number within rateMin–rateMax |
4 |
matrix |
object, row label → column label | { "Eggs": "Daily" } |
paneldynamic |
array of objects | [{ "product_name": "…", "dosage": "…" }] |
expression |
number, computed by SurveyJS | 26.99 |
file, signaturepad |
ignore — not menu input |
Booleans are strings
"health_surgeries": "Yes" is a string. Every boolean field in this
questionnaire declares valueTrue: "Yes", so a truthiness test on the raw
value passes for "No" as well. Compare to "Yes" explicitly.
Absence¶
Most fields are optional, and an unanswered field is simply absent from the
object — not null, not "". Three further rules:
clearInvisibleValues: "onHiddenContainer"is set on the survey. A conditional field whose trigger never fired is removed from the data, so its absence is meaningful: it means the question was never asked, not that it was skipped.- Absent is not zero. A missing
nut_caffeinemeans unknown, not caffeine-free. Never substitute a default and then reason from it as though the client had said it. - Absence is recorded, not resolved. Where a missing field changes the menu, the menu says so — see the Assumptions section in the JSON schema.
Units¶
Three fields are paired with a __unit companion, and one pair is
pre-converted for you by the survey's calculatedValues:
| Value | Unit field | Pre-converted |
|---|---|---|
meas_height |
meas_height__unit (cm / in) |
meas_height_cm |
meas_weight |
meas_weight__unit (kg / lb) |
meas_weight_kg |
meas_weight_self |
meas_weight_self__unit |
— |
test_squat_est_1rm |
test_squat_est_1rm__unit |
— |
test_deadlift_est_1rm |
test_deadlift_est_1rm__unit |
— |
Prefer meas_height_cm and meas_weight_kg. They exist precisely so the
agent never does unit conversion itself. If they are absent, fall back to the
raw field plus its unit field, and convert with 1 in = 2.54 cm,
1 lb = 0.453592 kg.
meas_bmi and meas_whr are expression fields — SurveyJS computes them.
Do not recompute; if present, use them.
The sections, and what step 1 wants from each¶
Full field lists are in the JSON. This is the orientation.
| Section | Fields | Menu-relevant? |
|---|---|---|
| 1. About you | client_* |
Yes — age, gender, occupation, work activity |
| 2. Health & medical history | parq_*, health_* |
Yes — screening, conditions, supplements, allergies, alcohol, smoking |
| 3. Systems review | sys_* |
Yes — digestive symptoms, menstrual status, red flags |
| 4. Injuries & movement | inj_* |
Rarely — only via nut_eating_limitation |
| 5. Activity & training history | act_* |
Yes — activity factor |
| 6. Goals & motivation | goal_* |
Yes — direction of the energy adjustment, obstacles |
| 7. Nutrition & hydration | nut_* |
Yes — the richest section; pattern, FFQ, cooking, hydration |
| 8. Sleep, stress & recovery | life_* |
Yes — meal timing, shift work, energy crashes |
| 9. Measurements & assessments | meas_*, screen_*, test_* |
Yes — height, weight, BP, waist |
| 10. Preferences & logistics | pref_* |
Some — budget, travel, accessibility |
| 11. Consent & sign-off | consent_*, sign_* |
Gate only — see below |
The consent gate¶
Section 11 is not menu content, but it is a precondition. Before step 3 runs:
consent_accuracymust be"Yes"— otherwise the answers are not warranted accurate and nothing should be derived from them.consent_data_processingmust be"Yes".consent_clearance_confirm— where any PAR-Q trigger fired, this must be"Yes". If a trigger fired and this is absent or"No", that is a stop condition, not a caveat. See step 2.
A missing consent is not something to work around, note as an assumption, or proceed past. It stops the run.
Section 9 may be empty¶
Section 9 is filled by the coach at a baseline appointment, so a questionnaire
completed by the client alone will have no meas_* values at all. Height and
weight are the only two the menu genuinely requires, and section 9 offers a
self-reported fallback for weight in meas_weight_self. How to proceed when
even that is missing is covered in
step 3.