Skip to content

Toaster Notes

Benjamin Mwalimu edited this page Feb 19, 2021 · 2 revisions

Toaster Notes

This is an android view that is identified by type toaster_notes in the JSON.

Field attributes

Field Attribute Usage Required
key Unique of the field yes
type Type of the field yes
text The text to be displayed on the android view yes
toaster_type Determines what kind of toaster note to display. We have had 4 types info (bluish), warning (yellow), problem (red), positive (green) yes
text_color Helps set a different text colour other than the one set for the predefined toaster notes no
toaster_info_text Holds the text to be displayed on the info icon popup in case it's available no
toaster_info_title Holds the text to use as the info icon popup title no
relevance Holds the rules to show/hide the specific field. This can use rules engine/ the line relevance no
v_required Status to indicate whether this field is required or not no
relevance Holds the rules to show/hide the specific field. This can use rules engine/ the line relevance no
calculations Holds the link to the rules files that has a calculation affects the field in question no
openmrs_entity_parent Holds the concept id of the parent concept in OpenMRS yes
openmrs_entity Holds the entity type on OpenMRS e.g Person, Address, Concept yes
openmrs_entity_id Holds the concept id from OpenMRS no

Example JSON

{
  "key": "toaster_notes",
  "openmrs_entity_parent": "",
  "openmrs_entity": "person_attribute",
  "openmrs_entity_id": "toaster_notes",
  "type": "toaster_notes",
  "text": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
  "toaster_type": "info",
  "toaster_info_text": "This is an information note, This is an information note, This is an information note, This is an information note,This is an information note, This is an information note",
  "toaster_info_title": "Information Toaster Info Title",
  "text_color": "#FFC100",
  "relevance": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-relevance-rules.yml"
      }
    }
  },
  "calculation": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-calculation-rules.yml"
      }
    }
  }
}

Required Status

To make a field required add v_required attribute with value true. The text on the err attribute will be displayed to the user in case the field is not filled.

Rules

Calculations

  "calculation": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-calculation-rules.yml"
      }
    }
  }

The block above shows the rules engine relevance block.

Relevance

"relevance": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-relevance-rules.yml"
      }
    }
  }

The block above shows the rules engine relevance block.