Reference

Math

The Math extension provides some useful actions to perform simple mathematical operations.

The Math extension provides some useful actions to perform simple mathematical operations.

Category: Math. Adds 7 actions to a care flow.

Actions

Math adds these 7 actions to a care flow. Add one to a step, then fill in its inputs.

Assign to cohort

Deterministically assign a value to a cohort number. Given the same input and number of cohorts, the result will always be the same.

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
Input valuestringYesAny string value used to determine the cohort assignment (e.g. patient ID, hash, email). The same input will always produce the same cohort.
Number of cohortsnumericYesThe total number of cohorts to distribute inputs across. Must be an integer greater than or equal to 1.

Returns:

Data pointType
cohortNumbernumber

Deterministically assign any string value (e.g. patient ID, email, UUID) to a cohort number between 1 and a given number of cohorts. The same input will always produce the same cohort, making this action ideal for A/B testing and patient randomization.

**Inputs:

  • Input value: Any string used to determine the cohort assignment.
  • Number of cohorts: The total number of cohorts to distribute inputs across (must be >= 1).

Output:

  • Cohort number: An integer between 1 and the number of cohorts (inclusive).

Note**: When the number of cohorts changes, a patient's assigned cohort may change because the underlying hash modulo base changes. This action does not guarantee cohort stability across different values of the number of cohorts.

Calculate date difference

Calculate the difference between 2 dates in a unit of your choice.

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
Date left (minuend)dateYesThe date from which the other date (date right) is to be subtracted.
Date right (subtrahend)dateYesThe date to be subtracted from the other date (date left).
Duration unitstringYesThe unit of duration One of: seconds, minutes, hours, days, weeks, months, years.

Returns:

Data pointType
dateDifferencenumber

Calculate the difference between two dates where "date left" is the minuend and "date right" the subtrahend.

You can choose the unit in which you would like to see the difference expressed:

  1. Seconds: get the number of seconds between the given dates. Fractional seconds are truncated towards zero.
  2. Minutes: get the signed number of full (rounded towards 0) minutes between the given dates. Fractional minutes are truncated towards zero.
  3. Hours: get the number of hours between the given dates. Fractional hours are truncated towards zero.
  4. Days: get the number of full day periods between two dates. Fractional days are truncated towards zero.
  5. Weeks: get the number of full weeks between two dates. Fractional weeks are truncated towards zero.
  6. Months: get the number of full months between the given dates. Fractional months are truncated towards zero.
  7. Years: get the number of full years between the given dates.

Divide

Divide two numbers

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
DividendnumericYes
DivisornumericYes

Returns:

Data pointType
quotientnumber

Divide two numbers.

Generate random number

Generate a random number between a given range.

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
Minimum numbernumericYesThe minimum number in the range (INCLUSIVE). Should be an integer.
Maximum numbernumericYesThe maximum end of the range (INCLUSIVE). Should be an integer.

Returns:

Data pointType
generatedNumbernumber

Generates a random (whole) number that falls between the ranges of two numbers [min, max].

Multiply

Multiply a series of numbers to get a final product

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
FactornumericYes
FactornumericYes
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo
FactornumericNo

Returns:

Data pointType
productnumber

Multiply a series of numbers to get a final product.

Subtract

Calculate the difference between two numbers

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
MinuendnumericYes
SubtrahendnumericYes

Returns:

Data pointType
absoluteDifferencenumber
differencenumber

Calculate the difference between two numbers.

Sum

Calculate the sum of two or more addends

This action can be previewed in Studio before you publish.

InputTypeRequiredDescription
AddendnumericYes
AddendnumericYes
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo
AddendnumericNo

Returns:

Data pointType
sumnumber

Calculate the sum of two or more addends.

Setup and notes

This extension adds custom actions to your care flow for simple mathematical operations.

Changelog

Math changelog

Where this page comes from

The settings, actions, inputs, outputs and webhooks above are generated from the extension's own code, at @awell-health/awell-extensions v2.1.159. They match what the platform actually does rather than a description of it.

Field-level detail also appears in Awell Studio when you configure the action. Something wrong or missing? Email support@awellhealth.com.

On this page