Awell Health Developer Hub
Dev Hub
← Back to the Marketplace
Advanced data collection

Advanced data collection

This extension allows you to collect data from your users using a variety of more advanced input types and data sources.
Forms

title: Advanced data collection

description: Collect data from your users using a variety of input types and data sources

This extension allows you to collect data from your users using a variety of more advanced input types and data sources.

Extension settings

In order to set up this extension, no settings are required.

Custom Actions

Dynamic choice selector

Standard select questions in Awell forms have a discrete set of choices to select from that are defined at the time that the form is created. If the list of choices to present to your responders isn't known at the time the form is being built, or changes often, this action allows you to load choices dynamically from a remote data source.

Dynamically-loaded choices must adhere to the following format in a list form (i.e. an array):

{
  "id": "unique-id",
  "label": "Choice label",
  "value": "Choice value"
}

Additionally, you can specify a free text search field (Options - Search query param field) to allow users to search through the choices. This is optional but highly recommended. If not specified, the choices will be fetched on question load and presented in a static list that cannot be filtered.

As an example, using the endpoint https://example.com/choices with a query parameter search (e.g. https://example.com/choices?search=QUERY where QUERY is whatever the user typed into the input), then the API is expected to return the choices based on that match the search term.

We recommend that your search logic returns an _alphabetically-sorted_ list of all options where the _lowercase_ label names _contain_ the _lowercase_ search term.

// Example search logic
const searchTerm = req.query.search
const results = []

options.forEach((option) => {
  if (option.label.toLowerCase().includes(searchTerm.toLowerCase())) {
    results.push({
      label: option.label,
      value: option.value,
      id: option.id,
    })
  }
})

const sortedResults = results.sort((a, b) => a.label.localeCompare(b.label))
res.json(results)
Pricing
Free
Custom Actions
Array fields test
Dynamic choice selector
Author
Awell
Version
1
Support
info@awellhealth.com

Other extensions