Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Admin Patient Header

Anonymous edited this page Dec 18, 2023 · 1 revision

Patient Header

Table of contents

Introduction

A patient header is available on every patient-related page. It contains some patient data (e.g. name, gender, age, identifiers etc.). This patient header is fully configurable.

Structure of the patient header

The header consists of two parts:

  • Title section - This is the most eye-catching section, it might consist of two sub-sections:
    • Main data we want to display - Usually it will be patient name/patient identifier.
    • Extra data that we want to display next to the main data, e.g. age, gender.
  • Attributes section - This is a section displayed below the title section. Attributes in this section will be displayed in Label: Value pattern, e.g. Identifier: 1A42D3. The attributes are displayed in a column, with a maximum of 4 attributes below the other. If more attributes are shown they will be shown in the next column(s), again with a maximum of 4

Basic template of the app definition

The configuration is done in the app definition cfl.configurablePatientHeader. Apart from the few standard fields in each app definition, a config section with titleFields and attributeFields sections is required, so the basic structure of app definition might look like this:

{
   "id":"cfl.configurablePatientHeader",
   "description":"Used to configure fields/buttons displayed in patient header",
   "extensions":[
      {
         "id":"cfl.configurablePatientHeader.customHeader"
      }
   ],
   "config":{
      "titleFields":[
         
      ],
      "attributeFields":[
         
      ]
   }
}

Above configuration will display an empty patient header:

Fields configuration

Each field configuration is a regular JSON object that consists of a few keys and values. Possible keys are:

  • label - defines label displayed in patient header, this value usually will be empty in titleFields section and mainly used in attributeFields section, static text or translation key can be used here
  • name - defines property name from backend used to fetch data, it will almost always be used, but may be empty, it can be any Person Attribute, Patient Identifier or any patient-related field (addresses,birthdate,voidReason,activeAttributes,patientId,personDateCreated,dateVoided,uuid,birthdateEstimated,deathdateEstimated,voidedBy,changedBy,familyName,personDateChanged,voided,id,activeIdentifiers,personDateVoided,personAddress,personCreator,givenName,allergyStatus,person,personVoidReason,birthdateFromAge,personId,causeOfDeath,isPatient,gender,attributeMap,dead,allAttributeMap,dateCreated,patient,deathDate,personChangedBy,birthDateTime,class,dateChanged,creator,identifiers,personVoided,personName,patientIdentifier,names,causeOfDeathNonCoded,personVoidedBy,attributes,birthtime,middleName,age).

Please be aware that it requires some technical knowledge to know what and in what form these fields contain (some fields can be empty or may contain values that are not displayable)

  • type - may be empty, if empty then default value text is used, possible values:
    • text - defines that fetched value will be displayed as it is
    • date - defines that fetched value is a date
    • location - defines that fetched value contains a location uuid
    • static - defines that we just want to display some hardcoded value, this only works together with the ‘value’ key, in this case the ‘name’ key is not used (so may be empty)
  • mainTitleField - possible values: true/false, can be omitted, only needed for titleFields section, defines whether fetched value should be displayed in main data or extra data subsection, default value: false
  • format - works only together with ‘date’ key, defines the date format in which the value is displayed
  • value - works only together with ‘static’ key, displays defined value

Buttons configuration

Patient header may contain two buttons placed on the right side:

  • Delete patient - button for deleting the patient, it is displayed in the patient header only on the patient dashboard
  • Update status - button for updating the patient status, it is displayed in the patient header on every patient-related page

How to configure them?

Above buttons can be shown/hidden via properties in the config section (so outside of the tittleFields and attributeFields sections):

  • deleteButtonOnPatientDashboardVisible - defines whether the delete button is visible or not in the patient header on the patient dahsboard, default value: false
  • updateStatusButtonVisible - defines whether the update status button is visible or not in the patient header, default value: false

Configuration examples and its results

{
   "id":"cfl.configurablePatientHeader",
   "description":"Used to provide patient header UI extensions",
   "extensions":[
      {
         "id":"cfl.patientDashboard.secondLineFragments.customHeader",
         "extensionPointId":"cfl.patientHeader.fragments",
         "extensionParams":{
            "provider":"cflcore",
            "fragment":"patientHeaderCfL"
         }
      }
   ],
   "config":{
      "titleFields":[
         {
            "label":"",
            "name":"givenName",
            "type":"text",
            "mainTitleField":true
         },
         {
            "label":"",
            "name":"familyName",
            "type":"text",
            "mainTitleField":true
         },
         {
            "label":"",
            "name":"age",
            "type":"text",
            "mainTitleField":false
         },
         {
            "label":"",
            "name":"gender",
            "type":"text",
            "mainTitleField":false
         }
      ],
      "attributeFields":[
         
      ],
      "deleteButtonOnPatientDashboardVisible":true,
      "updateStatusButtonVisible":false
   }
}

will display:

{
   "id":"cfl.configurablePatientHeader",
   "description":"Used to provide patient header UI extensions",
   "extensions":[
      {
         "id":"cfl.patientDashboard.secondLineFragments.customHeader",
         "extensionPointId":"cfl.patientHeader.fragments",
         "extensionParams":{
            "provider":"cflcore",
            "fragment":"patientHeaderCfL"
         }
      }
   ],
   "config":{
      "titleFields":[
         {
            "label":"",
            "name":"givenName",
            "type":"text",
            "mainTitleField":true
         },
         {
            "label":"",
            "name":"familyName",
            "type":"text",
            "mainTitleField":true
         },
         {
            "label":"",
            "name":"age",
            "type":"text",
            "mainTitleField":false
         },
         {
            "label":"",
            "name":"gender",
            "type":"text",
            "mainTitleField":false
         }
      ],
      "attributeFields":[
         {
            "label":"cfl.patientHeader.id.label",
            "name":"OpenMRS ID",
            "type":"text"
         },
         {
            "label":"cfl.patientHeader.location.label",
            "name":"LocationAttribute",
            "type":"location"
         },
         {
            "label":"cfl.patientHeader.phoneNumber.label",
            "name":"Telephone Number",
            "type":"text"
         },
         {
            "label":"cfl.patientHeader.status.label",
            "name":"Person status",
            "type":"text"
         }
      ],
      "deleteButtonOnPatientDashboardVisible":true,
      "updateStatusButtonVisible":true
   }
}

will display:

{
   "id":"cfl.configurablePatientHeader",
   "description":"Used to provide patient header UI extensions",
   "extensions":[
      {
         "id":"cfl.patientDashboard.secondLineFragments.customHeader",
         "extensionPointId":"cfl.patientHeader.fragments",
         "extensionParams":{
            "provider":"cflcore",
            "fragment":"patientHeaderCfL"
         }
      }
   ],
   "config":{
      "titleFields":[
         {
            "label":"",
            "name":"givenName",
            "type":"text",
            "mainTitleField":true
         },
         {
            "label":"",
            "name":"familyName",
            "type":"text",
            "mainTitleField":true
         },
         {
            "label":"",
            "name":"age",
            "type":"text",
            "mainTitleField":false
         },
         {
            "label":"",
            "name":"gender",
            "type":"text",
            "mainTitleField":false
         }
      ],
      "attributeFields":[
         {
            "label":"SHIP ID",
            "name":"SHIP ID",
            "type":"text"
         },
         {
            "label":"columnNames.Birthdate",
            "name":"birthdate",
            "type":"date",
            "format":"DD MMM YYYY"
         },
         {
            "label":"columnNames.Gender",
            "name":"gender",
            "type":"text"
         },
         {
            "label":"columnNames.phoneNumber",
            "name":"Telephone Number",
            "type":"text"
         },
         {
            "label":"registerPatient.steps.nationality.label",
            "name":"Nationality",
            "type":"text"
         },
         {
            "label":"registerPatient.fields.locationAttribute",
            "name":"LocationAttribute",
            "type":"location"
         },
         {
            "label":"Static value",
            "name":"",
            "type":"static",
            "value":"Example value"
         },
         {
            "label":"Civil status",
            "name":"Civil status",
            "type":"text"
         },
         {
            "label":"Status",
            "name":"Person status",
            "type":"text"
         }
      ],
      "deleteButtonOnPatientDashboardVisible":true,
      "updateStatusButtonVisible":true
   }
}

will display:

Clone this wiki locally