From ReminderSettings.schema.yaml (cleo/ReminderSettings.schema
)
---
$id: https://skeleton.botmd.io/cleo/ReminderSettings.schema
$schema: http://json-schema.org/draft-07/schema#
title: Reminder Settings
description: Schema for storing reminder settings which include schedules.
type: object
additionalProperties: false
required: [schedule]
properties:
timezone:
title: Timezone
description: The timezone for the reminder schedule. Defaults to clinic timezone (or `UTC` if that is not set).
type: string
minLength: 1
#end timezone
schedule:
title: Schedule
description: Describes the reminder schedule, triggers, actions, etc.
type: object
additionalProperties: false
anyOf:
- required: [action, start_trigger]
- required: [action, end_trigger]
- required: [action, recurring_frequencies]
properties:
action:
title: Action
description: The action to take when reminder is triggered. Actions are implemented in `cleo/types/reminder/actions.py`.
$ref: "#/definitions/ReminderAction"
#end action
start_trigger:
title: Start Trigger
description: Describes how this reminder can be triggered. This usually refers to a pre-determined event. If unspecified, we assume the reminder starts immediately.
$ref: "#/definitions/TriggerRule"
#end start_trigger
end_trigger:
title: End Trigger
description: Describes when this reminder is canceled. This usually refers to a pre-determined event. If unspecified, we assume the reminder never ends.
$ref: "#/definitions/TriggerRule"
#end end_trigger
recurring_frequencies:
title: Recurring Frequencies
description: An array of `RecurringFrequency` objects to describe the reminder logic. This is used for recurring reminders.
type: array
minItems: 1
items:
$ref: "/kronos/RecurringFrequency.schema"
#end recurring_frequencies
#end properties
#end schedule
follow_up_intervals:
title: Follow Up Intervals
description: Sends a follow up reminder if the patient did not submit to the first reminder event. This is an array of intervals in seconds after the first ReminderEvent. Note that the maximum value for an interval is 43200 seconds (i.e., 12 hours).
type: array
items:
title: Interval
type: integer
exclusiveMinimum: 0
maximum: 43200
#end follow_up_intervals
recent_submission:
title: Recent Submission
description: Describes how submissions are attached to `ReminderEvent`s.
type: object
required: []
additionalProperties: false
minProperties: 1
properties:
before:
title: Before
description: Submissions that were submitted `before` seconds before the reminder will be attached to the `ReminderEvent`. Defaults to 14400 seconds.
type: number
exclusiveMinimum: 0
#end before
after:
title: After
description: Submissions that were submitted `after` seconds after the reminder will be attached to the `ReminderEvent`. Defaults to 14400 seconds.
type: number
exclusiveMinimum: 0
#end after
#end properties
#end recent_submission
metadata:
title: Metadata for reminder
description: Metadata of this reminder.
additionalProperties: true
cron_expressions:
title: Deprecated (Cron Expressions)
description: This field has been deprecated.
type: array
uniqueItems: true
frontend:
title: Frontend (DEPRECATED)
description: This field has been deprecated. Use `schedule` instead.
type: object
additionalProperties: false
required: [times, every, every_unit]
properties:
times:
title: Times
description: An array of reminder times in `%H:%M` format. Reminders will be sent at this time of the day as determined by the frequency and local timezone.
type: array
items:
title: Time
description: Times are always in `%H:%M` format. Assume local timezone as determined by above.
type: string
pattern: "^(?P<hour>00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24):(?P<minute>00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59)$"
every:
title: Every
description: Reminders will be sent `every` `every_unit` (e.g., days, weeks, etc).
type: integer
minimum: 1
every_unit:
title: Every Unit
description: Reminders will be sent every `every` `every_unit` (e.g., days, weeks, etc).
enum: [day, week, month]
days_of_week:
title: Days of Week
description: For reminders every `WEEK`, the days of the week for which we will remind. Required when `every_unit` is `WEEK`.
type: array
minItems: 1
items:
title: Day
enum: [mon, tue, wed, thu, fri, sat, sun]
#end properties
#end frontend
#end properties
definitions:
ReminderAction:
type: object
additionalProperties: false
anyOf:
- required: [type, send_template]
- required: [type, send_reminder]
- required: [type, enrollment]
- required: [type, discharge]
- required: [type, program_enrollment]
- required: [type, program_discharge]
- required: [type, program_discharge_with_enrollment]
- required: [type, noop]
properties:
type:
title: Type
description: The type of reminder action. This is a fixed set.
enum: [send_template, send_reminder, enrollment, discharge, noop, program_enrollment, program_discharge, program_discharge_with_enrollment]
program_condition:
title: Program Condition
description: Trigger if metadata-entries matches the condition
required: [filter, validator]
type: object
properties:
filter:
$ref: "/scalpel/FilterSettings.schema"
validator:
title: Validator
description: Method to validate if filter fullfill condition.
enum: [exist, count, not_exist]
count:
title: Count
description: Number of expected metadata entries.
type: integer
minimum: 1
event_condition:
title: Event Condition
description: Trigger if metadata-entries matches the condition
required: [filter, validator]
type: object
properties:
filter:
$ref: "/scalpel/FilterSettings.schema"
validator:
title: Validator
description: Method to validate if filter fullfill condition.
enum: [exist, count, not_exist]
count:
title: Count
description: Number of expected metadata entries.
type: integer
minimum: 1
send_template:
title: Send Template
description: This action sends a template message to the patient-form.
type: object
additionalProperties: false
required: [purpose]
properties:
purpose:
title: Purpose
description: Template set purpose to send. If `purpose` is `REMINDER`, there are additional logic involved.
type: string
minLength: 1
#end purpose
template_set:
title: Template Set
description: Template set `name` or `uid`. This should align with `purpose`.
type: string
minLength: 1
#end template_set
#end properties
#end send_template
send_reminder:
title: Send Reminder
description: This action sends a reminder message to the patient-form.
type: object
additionalProperties: false
required: []
#end send_reminder
discharge:
title: Discharge
description: This action discharges a patient-form.
type: object
additionalProperties: false
required: []
#end discharge
enrollment:
title: Enrollment
description: This action enroll patient into new monitoring form.
type: object
additionalProperties: false
required: [monitoring_formset_uid]
properties:
monitoring_formset_uid:
title: Monitoring Formset UID
description: Monitoring formset where patient will be enroll into.
type: string
minLength: 1
program_discharge:
title: Program Discharge
description: This action discharges a patient-program.
type: object
additionalProperties: false
required: []
program_enrollment:
title: Program enrollment
description: This action enroll patient into new clinic program.
type: object
additionalProperties: false
required: [clinic_program_uid]
properties:
clinic_program_uid:
title: Clinic Program UID
description: Clinic program where patient will be enroll into.
type: string
minLength: 1
program_discharge_with_enrollment:
title: Program discharge with enrollment
description: This action discharges a patient-program and enroll patient into a new clinic program.
type: object
additionalProperties: false
required: [clinic_program_uid]
properties:
clinic_program_uid:
title: Clinic Program UID
description: Clinic program where patient will be enroll into after discharge from existing patient-program.
type: string
minLength: 1
noop:
title: Noop
description: This action does nothing except display a debug log message.
type: object
additionalProperties: false
required: []
#end noop
#end properties
#end ReminderAction
TriggerRule:
type: object
additionalProperties: false
required: [event]
properties:
event:
title: Trigger
description: The event that will trigger a reminder. This is a hardcoded set of values.
enum: [date_of_birth, exact, never, enrollment, discharge, event, condition, clinical_parameter, program_enrollment, program_discharge, program_clinical_parameter, program_condition]
#end event
duration:
title: Duration
description: Amount of time before/after the `trigger`ing event. This is expressed as an integer multiple of `unit`. Defaults to 0.
type: integer
minimum: 0
#end duration
unit:
title: Unit
description: The unit of measurement for `duration`.
enum: [minute, hour, day, week, month, year]
#end unit
time_of_day:
title: Time of Day
description: |-
The time of the day to recur the event at. This field should not be set when unit is `minute` or `hour`.
By default, the event will occur exactly `duration x unit` after the `trigger` event.
This is useful for overriding the time of the day such as `08:00` instead of some arbitrary time.
type: string
pattern: "^(?P<hour>00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24):(?P<minute>00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59)$"
#end time_of_day
clinical_parameter_uid:
title: Clinical Parameter UID
description: Clinical parameter that is datetime type to be used as the trigger.
type: string
clinical_parameter_name:
title: Clinical Parameter Name
description: Clinical parameter that is datetime type to be used as the trigger.
type: string
condition:
title: Condition
description: Trigger if metadata-entries matches the condition
required: [filter, validator]
type: object
properties:
filter:
$ref: "/scalpel/FilterSettings.schema"
validator:
title: Validator
description: Method to validate if filter fullfill condition.
enum: [exist, count, not_exist]
count:
title: Count
description: Number of expected metadata entries.
type: integer
minimum: 1
exact_trigger_on:
title: Trigger On
description: Date time for Exact event to execute.
type: string
format: date-time
#end exact_trigger_on
is_after:
title: Is After
description: "`True` if the reminder is triggered `duration` after the event and `false` if reminder is triggered `duration` before the event. Defaults to `true`."
type: boolean
#end is_after
require_enrollment:
title: Require Enrollment
description: "If `true`, it will require an enrolled patient form for form related reminders and will not trigger for discharged patient forms. Does not apply to event reminders. Defaults to `true`."
type: boolean
#end require_enrollment
require_program_enrollment:
title: Require Program Enrollment
description: "If `true`, it will require an enrolled patient program for program related reminders and will not trigger for discharged patient programs. Does not apply to event reminders. Defaults to `true`."
type: boolean
#end TriggerRule
#end definitions