Schema for Hospital Profile Settings

From ProfileSettings.schema.yaml (hospital/ProfileSettings.schema)

---
$id: https://skeleton.botmd.io/hospital/ProfileSettings.schema
$schema: http://json-schema.org/draft-07/schema#

title: Profile Settings
description: >-
  `Profile.settings` are used to store settings related to the users.
  This is often used as a NoSQL store by frontend.
  **This is WIP.**

type: object

required: []
additionalProperties: false

properties:
  legacy:
    title: Legacy Account User Config.
    description: Config in JSON to store modules config such as reminder times.

    type: object
    required: []
    additionalProperties: true
  #end properties

  notifications:
    title: Notifications
    description: Notifications related profile settings.

    type: object
    additionalProperties: false
    required: []
    properties:
      deactivated:
        title: Deactivated Notifications.
        description: A unique list of notification keys that the user opted out from.

        type: array
        uniqueItems: true
        items:
          anyOf:
            - $ref: "Settings.schema#/definitions/Notification Types"
      #end deactivated
    #end properties
  #end notifications

  emobot:
    title: Emobot
    description: Emobot related profile settings.

    type: object
    additionalProperties: false
    required: []
    properties:
      preferred_name:
        title: Preferred Name
        description: How would you like EmoBot to address you?

        type: string
        minLength: 1

      reminder_frequency:
        title: Reminder Frequency
        description: Frequency of reminder. E.g. "Weekly", "Twice Weekly" etc.

        type: string
        enum: [none, daily, weekly, twice_weekly]

      reminder_time:
        title: Reminder Time
        description: Time the reminder will be sent, e.g., "09:00", "18:00" etc.

        type: string
        pattern: '^[0-2]\d\:[0-5]\d$'

      last_reminded_on:
        title: Last Reminded On
        description: Used internally to determine when the user was last sent a reminder. This is a Posix timestamp.

        type: number
        minimum: 0

      sources_of_strengths:
        title: Sources of Strengths
        description: Where does the user derive their emotional sources of strengths.

        type: array
        items:
          type: object
          additionalProperties: false

          properties:
            label:
              title: Label
              description: Pretty human readable label for this source of strength

              type: string

            value:
              title: Value
              description: Whether this source is selected.

              type: boolean
          #end properties
        #end items

      chat_state:
        title: Chat State
        description: Used internally to keep track of the state of a user's chat with emobot. Backend use only.

        type: object
        additionalProperties: true
        required: [current, updated_on]

        properties:
          current:
            title: Current State ID
            description: The current chat state ID.
            type: string

          emotion:
            title: Emotion
            description: User's emotion based on what they say.
            type: string

          vent_count:
            title: Vent Counter
            description: No. of venting messages we've received.
            type: integer

          thinking_trap:
            title: Thinking Trap
            description: Current "Thinking trap" as part of the CBT flow.
            type: string

          feelings:
            title: Feelings
            description: Array of feelings of user when going through the CBT flow.
            type: array
            items:
              type: string

          updated_on:
            title: Updated On
            description: ISO formatted datetime of when the state was last updated.
            type: string
            format: date-time
        #end properties
      #end chat_state
    #end properties
  #end emobot

  cgh:
    title: CGH Related Metadata
    description: Metadata related to CGH 2FA

    type: object
    required: [phone_ciphertext, 2fa_verified]
    additionalProperties: false

    properties:
      2fa_verified:
        title: 2FA Approved
        description: The user has verified his/her 2FA code.
        type: boolean
      #end 2fa_verified

      phone_ciphertext:
        title: Phone Number
        description: Encrypted phone number of user.
        type: string
      #end phone_ciphertext
  #end cgh

  notified_expiry:
    title: Notified Expiry
    description: The user received the notification for expiry
    type: boolean
#end properties

[Main Page] [Schema Documentation] [Examples]