Awell Health Developer Hub
Developer Hub

This query allows us to fetch the form details for all form defintions in a published care flow/pathway. Want to learn more about how to display the form in your UI and conditionally show/hide the correct questions based on the response? Click here!

All forms vs. forms that will be completed

Please note that this query returns all forms in a published care flow or pathway but that this doesn't necessarily mean that all these forms will be completed as that is dependent on the logic built into the care flow.

See the example below:

  • There are 3 forms: Form A, B, and C.
  • However, Form B is only activated when the subject is a male and Form C when the subject is a female
  • The query will return all published forms in the care flow or pathway so Form A, B, and C but depending on the workflow some forms might never be completed.
Get forms query
Depending on the care flow, some forms might never be completed.

Metadata

Form and question metadata is returned in all form queries as a JSON string rather than a JSON object. This is because the metadata is defined in Studio as a JSON string and we want to avoid any potential parsing errors. You can parse the metadata string into a JSON object in your application (for example, using JSON.parse in JavaScript/TypeScript, json.loads in Python or json_decode in PHP or Ruby).

Request

Query

  • graphql
01query GetFormsForPublishedPathway(
02 $pathway_definition_id: String!
03 $release_id: String
04) {
05 forms(
06 pathway_definition_id: $pathway_definition_id
07 release_id: $release_id
08 ) {
09 forms {
10 id
11 definition_id # static id from Studio
12 title
13 key # form key set in Studio
14 metadata # JSON metadata string set in Studio
15 questions {
16 id
17 definition_id # static id from Studio
18 title # string or html string (for description questions)
19 key # question key set in Studio
20 dataPointValueType
21 questionType
22 metadata # JSON metadata string set in Studio
23 options {
24 id
25 value
26 label
27 }
28 rule {
29 # visibility conditions of a question
30 boolean_operator
31 conditions {
32 id
33 reference # definition id of the question this condition is based on
34 operator
35 operand {
36 type
37 value
38 }
39 }
40 }
41 }
42 }
43 }
44}

Variables

The release_id is optional. If not specified, we return the forms for the latest published version of the care flow or pathway.

  • json
01{
02 "pathway_definition_id": "{{PATHWAY_DEFINITION_ID}}",
03 "release_id": "{{PATHWAY_RELEASE_ID}}"
04}