Schema for Chernobyl MiniApp Settings

From MiniAppSettings.schema.yaml (chernobyl/MiniAppSettings.schema)

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

title: MiniApp Settings
description: >-
  Chernobyl `MiniApp`s define the schema of their source data and how the data should be displayed on the frontend.

type: object
additionalProperties: true
required: []

properties:
  hospitals:
    $ref: "/hospital/Permissions.schema#/definitions/Hospitals"

  tags:
    $ref: "/hospital/ProfileTags.schema"

  intents:
    title: Intents
    description: Intent phrases that will trigger this module.
    type: array
    minItems: 1
    uniqueItems: true
    items:
      type: string
      minLength: 1

  rank:
    type: number
    title: Rank
    description: "Rank of the miniapp used for deconflicting ties (default: 0)"

  rank_group:
    type: string
    title: Rank Group
    description: "Rank group used for grouping several miniapps together when clustering such that lower score miniapps with higher rank can still get priority"
    minLength: 1

  f1_beta:
    type: number
    title: F1 Beta Parameter
    description: "F1 beta parameter used for tuning precision/recall in the miniapp (default: 0.5). Higher value puts more emphasis in precision (w.r.t query)"

  perfect_requires_intent:
    type: boolean
    title: Perfect Requires Intent
    description: "Determines if `intent` is required for an answer to be `is_perfect`, when an answer is exact, it `is_perfect` and can cause it to swamp other answers (default: False)"

  specificity:
    type: number
    title: Specificity
    description: "Specificity parameter used for tuning the level of culling relevant answers in the miniapp (default: 0.5). Higher value will cull off more relevant answer"

  denoise:
    type: boolean
    title: Denoise (keep only best answers after segmentation/clustering)
    description: "Determines if only the top segment after clustering is kept (default: true)"

  timezone:
    title: Timezone
    description: Default timezone (eg. Asia/Singapore) if not specified in hospital settings (to be used for time related display information such as last synced time).
    type: string
    minLength: 1

  airtable:
    $ref: "/scalpel/TabularInterfaceSettings.schema#/properties/airtable"

  gsheets:
    $ref: "/scalpel/TabularInterfaceSettings.schema#/properties/gsheets"

  einstein:
    title: Einstein Module
    description: Configuration settings when used with Einstein.
    type: object
    properties:
      module_uid:
        title: Einstein Module UID
        description: The corresponding Einstein Module's data sources will be used during syncing
        type: string
        minLength: 1
      data_source_uid:
        title: Einstein DataSource UID
        description: The corresponding Einstein DataSource will be used during syncing
        type: string
        minLength: 1

  chemocalc:
    title: Chemocalc Settings
    description: Settings related to chemocalc
    $ref: "#/definitions/Chemocalc"

  fields:
    title: Fields
    description: The list of fields mapped to the table columns that are searchable by Jarvis in this mini-app.
    type: array
    minItems: 1
    uniqueItems: true
    items:
      $ref: "#/definitions/Field"

  sorry_message:
    title: Sorry Message
    description: Optional sorry message to display if there is an intent present without answers.
    anyOf:
      - $ref: "/jarvis/ModuleSettings.schema#/definitions/Message"
      - type: array
        title: Array of Messages
        description: Used to support more than 1 message (eg. Text and Quick Reply)
        items:
          anyOf:
            - $ref: "/jarvis/ModuleSettings.schema#/definitions/Message"

  stop_words:
    title: Stop Words
    description: Stop words to apply to this miniapp only.
    type: array
    minItems: 1
    items:
      type: string
      minLength: 1

  style:
    title: Style
    description: Configurations that affect how the data is presented to the user.
    type: object
    properties:
      table:
        title: Table
        description: Used in the table miniapp view such as for formularies, directories and documents. Displays data as a table with rows and columns that are customizable.
        $ref: "#/definitions/Table Style"

      document:
        title: Document
        description: Used in the document search miniapp view when searching for text inside a document. Displays data as sections which are linked to certain page of the document.
        $ref: "#/definitions/Document Style"

      quick_reply:
        title: Quick Reply
        description: Used to customize how the quick replies looks in the chat application.
        type: object
        properties:
          text:
            type: string
            minLength: 1

      message:
        title: Message
        description: Used to define and customize the actual chernobyl message (text, carousel, section, etc ...) in the chat application.
        $ref: "#/definitions/Message Style"

      carousel: # deprecated
        title: Carousel [deprecated]
        description: Properties related to the carousel formatting of this chat application.
        $ref: "#/definitions/Carousel Style"

      text: # deprecated
        title: Text Message [deprecated]
        description: Properties related to the text message formatting of this chat application.
        $ref: "#/definitions/Text Message Style"

      quickreply: # deprecated
        title: Quick Reply [deprecated]
        description: Used to customize how the quick replies looks in the chat application.
        type: object
        properties:
          text:
            type: string
            minLength: 1

definitions:
  field_base_properties: &field_base_properties
    key:
      title: Key
      description: Uniquely identifiable key used internally for this field. It will be used as the `key` when storing values associated with this field.
      type: string
      minLength: 1

    field_path:
      title: Field Path
      description: If the value of the cell must be a JSON. The field_path specifies the path to get to the value (eg. user_metadata.stitch_url).
      type: string
      minLength: 1

    column:
      title: Column
      description: The corresponding column name used in Airtable, CSV, or any Tabular interfaces. Defaults to the value of `key`.
      type: string

    type:
      title: Type
      description: >-
        The type of this field. This is used by Chernobyl to determine how to parse values from the source data. Defaults to `string`.

        The `boolean` type will parse the raw field value into boolean `true` _iff_ it is one of `[true, yes, 1, ok]` (case insensitive).

        The `number` and `string` type will parse the raw field value into a `float` and `string` respectively.

        The `file` type will assume the raw field value is a URL and download it to our private S3 bucket protected by Stitch.

        The `object` type will assume the raw field value is a well-formed JSON or YAML and parse it as such. An exception will be raised if it is neither.

        The `json_url` type assume the raw field is a url link to a JSON file. The contents will be read and stored internally as an object

        The `ignore` type specifies that this column is the ignore column. If this row has a value of 'ignore', then the entire row is not indexed.

        In certain Tabular interfaces which provides an "attachment" field, the `type` should be set to `file` or an error will be raised.

      enum: [boolean, number, string, strings, object, files, json_url, ignore]

    search:
      title: Search
      description: >-
        The search and indexing strategy for the value of this field.

        `default` creates a single entity phrase using the entire string.

        `name` expands the phrases using a sliding window of length 4.

        `tokenize` splits the string into tokens (using whitespaces) and creates an entity phrase for each token.

        `document` reads the JSON content (field must be type <json_url>) and indexes it under searchable_document_pages.

      enum: [default, tokenize, document, name, email]

    synonyms:
      title: Synonyms
      description: Replaces the field value with list from the synonyms.
      type: object
      additionalProperties:
        type: array
        items:
          type: string
        minItems: 1
    #end synonyms

  Field:
    type: object
    additionalProperties: false
    required: [key]
    properties:
      <<: *field_base_properties

  Table Style:
    type: object
    additionalProperties: false
    required: []
    properties:
      title:
        title: Title
        description: Header title to be shown below the logo in the table view. It can be used for the name of the miniapp, the table, etc.
        type: string
        minLength: 1

      subtitle:
        title: Subtitle
        description: Header subtitle to be shown below the title in the table view. It can be used to display more information about the miniapp.
        type: string
        minLength: 1

      prefix:
        title: Prefix
        description: Prefix to be shown below the subtitle in the table view. It can be used to display more information about the miniapp.
        type: string
        minLength: 1

      logo_url:
        title: Logo URL
        description: Logo of the hospital to be shown in the header of the table view.
        type: string
        format: uri

      logo: # deprecated
        title: Logo URL [deprecated]
        description: Logo of the hospital to be shown in the header of the table view.
        type: string
        format: uri

      row:
        title: Row
        type: object
        properties:
          title:
            title: Title
            description: Title of the row.
            type: string
          subtitle:
            title: Subtitle
            description: Subtitle displayed below the title to provide additional information to the row.
            type: string
          content:
            title: Content
            description: Content appears below the subtitle and is collapsible.
            type: string
          document_url:
            title: Document URL
            description: Appears as a linked document icon on the right. If the document has searchable pages, an additional linked magnifying glass icon will be presented which links to the document search page.
            type: string
          image_url:
            title: Image URL
            description: Image to display when row is expanded
            type: string

  Document Style:
    type: object
    additionalProperties: false
    required: []
    properties:
      title:
        title: Title
        description: Header title to be shown below the logo in the document search view.
        type: string
        minLength: 1

      subtitle:
        title: Subtitle
        description: Header subtitle to be shown below the title in the document search view. It can be used to display more information about the document.
        type: string
        minLength: 1

      prefix:
        title: Prefix
        description: Prefix to be shown below the subtitle in the table view. It can be used to display more information about the miniapp.
        type: string
        minLength: 1

      logo_url:
        title: Logo URL
        description: Logo of the hospital to be shown in the header of the document search view.
        type: string
        format: uri

      logo: # deprecated
        title: Logo URL [deprecated]
        description: Logo of the hospital to be shown in the header of the document search view.
        type: string
        format: uri

  Message Style:
    type: object
    additionalProperties: false
    required: [message_body]
    properties:
      message_body:
        title: Message Body
        description: Template for the message body to be displayed in the mini-app. The message can be carousel or text message, depending on carousel_mode. Variables can be used here. See [Prefill URL](#prefill_url) for details on the supported variables.
        anyOf:
          - $ref: "/ratatoskr/Message.schema#/definitions/text_types/Text Types"
          - $ref: "/ratatoskr/Message.schema#/definitions/container_types/Carousel Container Types"

      carousel_mode:
        title: Carousel Mode
        description: >-
          Controls how the carousels are displayed in the app.

          `one_per_app` results in only 1 carousel being shown for each query.

          `one_per_record` results in 1 carousel being shown for each record.

          If the mode is not specified, text message style will be used to display instead.

        enum: [one_per_app, one_per_record]

      entries_limit:
        title: Entries Limit
        description: The limit on the number of entries that can be displayed in the message (default to 5). Any extra entry will not be shown.
        type: integer

  Carousel Style: # deprecated
    type: object
    additionalProperties: false
    required: []
    properties:
      style:
        title: Style
        description: >-
          Controls how the carousels are displayed in the app.

          `ONE_PER_APP` results in only 1 carousel being shown for each query.

          `ONE_PER_RECORD` results in 1 carousel being shown for each record.

        enum: [ONE_PER_APP, ONE_PER_RECORD]

      logo:
        title: Logo URL
        description: The URL for the logo of the Mini App. If not set, the logo will not be shown in the carousel.
        type: string

      title:
        title: Title
        description: Title of this mini-app when displaying in carousels. See [Prefill URL](#prefill_url) for details on the supported variables. Defaults to the `name` of the mini-app.
        type: string
        minLength: 1

      subtitle:
        title: Subtitle
        description: Subtitle of this mini-app when displaying in carousels. Variables can be used here. See [Prefill URL](#prefill_url) for details on the supported variables. Defaults to `""`.
        type: string
        minLength: 1

      description:
        title: Description
        description: Description of this mini-app when displaying in carousels. Variables can be used here. See [Prefill URL](#prefill_url) for details on the supported variables. Defaults to `""`.
        type: string
        minLength: 1

      button_text:
        title: Button Text
        description: Text of the carousel button.
        type: string
        minLength: 1

      button_url:
        title: Button URL
        description: URL to open when carousel button is clicked.
        type: string
        minLength: 1

      button_kwargs:
        title: Button kwargs
        description: Keyword arguments that will be attached to the button when sent to the frontend.
        type: object

      button_text_2:
        title: Button Text 2
        description: Text of the 2nd carousel button.
        type: string
        minLength: 1

      button_url_2:
        title: Button URL 2
        description: URL to open when the 2nd carousel button is clicked.
        type: string
        minLength: 1

      button_kwargs_2:
        title: Button kwargs 2
        description: Keyword arguments that will be attached to the 2nd button button when sent to the frontend.
        type: object

  Text Message Style: # deprecated
    type: object
    additionalProperties: false
    required: []
    properties:
      text:
        title: Text
        description: Template for the text message.
        type: string
        minLength: 1

      button_text:
        title: Button Text
        description: Text of the button below the text body.
        type: string
        minLength: 1

      button_url:
        title: Button URL
        description: URL to open when the button is clicked. If not set, there will be no button.
        type: string
        minLength: 1

      button_kwargs:
        title: Button kwargs
        description: Keyword arguments that will be attached to the button when sent to the frontend.
        type: object

      limit_entries:
        title: Limit Entries
        description: The maximum number of entries displayed in the text message.
        type: integer

  Chemocalc:
    type: object
    required: [regimens, drug_dose, price_list]
    properties:
      regimens:
        title: Regimen Table
        description: Table containing the regimens names and synonyms
        $ref: "/scalpel/TabularInterfaceSettings.schema#/definitions/TabularInterface"
      drug_dose:
        title: Drug Dose Table
        description: Table containing drug information (eg. regimen, dosage information, indications, etc ...)
        $ref: "/scalpel/TabularInterfaceSettings.schema#/definitions/TabularInterface"
      price_list:
        title: Price List Table
        description: Table containing formulary item information (eg. drug, price, subsidies, etc ...)
        $ref: "/scalpel/TabularInterfaceSettings.schema#/definitions/TabularInterface"
      report:
        title: Report
        description: Settings to configure the exportable chemocalc report.
        type: object
        properties:
          left_logo_url:
            title: Left Logo
            description: URL for the left logo in report header.
            type: string
            minLength: 1
          right_logo_url:
            title: Right Logo
            description: URL for the right logo in report header.
            type: string
            minLength: 1
          center_logo_url:
            title: Center Logo
            description: URL for the center logo in report header.
            type: string
            minLength: 1
      footer:
        title: Footer
        description: HTML fragment string to display in the UI footer.
        type: string
        minLength: 1
      header:
        title: Header
        description: HTML fragment string to display in the UI header.
        type: string
        minLength: 1

[Main Page] [Schema Documentation] [Examples]