How-toFor engineers

Work with forms

Render a form, evaluate its conditional logic on every answer, and submit responses in the string format the API expects.

Rendering an Awell form yourself means fetching the questions, evaluating conditional logic as the user answers, and submitting the response.

If you'd rather not build this, Navi does it for you.

Evaluate conditional logic on every answer

Forms can hide and show questions based on earlier answers. A mutation evaluates all of a form's conditional logic and tells you which questions should be visible or hidden.

Call it every time the user answers any question, so they only ever see the relevant questions.

Evaluating once at the start gives you the right questions for an empty form and the wrong ones from the second answer onward.

Send every answer value as a string

Form responses are polymorphic, so an answer value is always sent as a string.

Awell validates and deserializes on its side, and rejects a value that doesn't match the data point's value type. So the string has to be the right shape for the underlying type:

Question typeData point typeSend
DatedateAn ISO 8601 string
Number, slidernumberThe number as a string
Single selectas definedThe answer's value, not its label
Multiple selectas definedThe selected values
Short/long textstringThe text

For a single select, send the value the option carries, not the label the user saw. See Encode questions and answer options.

Specifying who answered

When submitting, you can specify which user the response is attributed to. Do it, because an unattributed clinical answer is a gap in the record.

Reading responses back

A separate query returns a submitted form response, including the data points it produced. Use it to confirm what Awell stored rather than assuming your submission was interpreted as intended.

Next steps

On this page