O3 proposal - flexible configuration of name fields in Patient Registration

Summary

Configuration of name fields in the O3 patient registration form is too limited to support needs of different locales. Related to 03-2115 - Patient name should be collected and rendered based on name template configuration

Discussion

At present, the ‘Name’ section of the O3 Patient Registration form appears to support only limited configuration. The form allows entry of First Name, Middle Name and Family Name with options to show or hide the Middle Name field or reverse the display order of fields.

Screenshot of reference app:

Name field configuration from esm-patient-registration-app/src/config-schema.ts:

  fieldConfigurations: {
    name: {
      displayMiddleName: boolean;
      allowUnidentifiedPatients: boolean;
      defaultUnknownGivenName: string;
      defaultUnknownFamilyName: string;
      displayCapturePhoto: boolean;
      displayReverseFieldOrder: boolean;
    };

This limitation is problematic in latin america, where we use given_name, middle_name, family_name and family_name2 fields.

In the O1 and O2 patient registration interfaces, the interface was defined/configured by specifying name templates via a global layout.name.format property as per Wiki: Customizing Name Layouts

Thanks to recent developments, the configured name format may be used for displaying patient names as per 03-2115. However, the patient registration app ought to support a flexible configuration of name entry fields. It probably makes sense to make this configurable via name templates.

Additional notes:
With respect to supported names, the FHIR specification supports names annotatated with their ‘use’ e.g. ‘usual’, ‘maiden’, ‘official’, ‘nickname’ etc. On the other hand, whilst the OpenMRS db allows multiple names to be stored per patient, the only associated metadata is a single boolean ‘preferred’ flag. The O2 documentation suggests collecting additional names as additional person attributes.

Design Proposal

  • Enable configuration of name fields in the patient registration app by specifying which name template to use; the name template defines which fields will be displayed, and in which order.
  • Enable collection of 2 names; one ‘preferred’ and one ‘alternate’. Each may use a different name template. Preferred name is mandatory (but may be ‘unknown’). Alternate name is optional.

Configuration schema would resemble:

  fieldConfigurations: {
    name: {
	  template: string;      // name template to use for capturing patient's preferred name, e.g. 'short', 'long',... Default is 'short'.
	                         // the name template defines which fields are displayed and in which order.
	  allowUnidentifiedPatients: boolean;
	  defaultUnknownPatientName: {		// values supplied if patient is unknown, applied to name template.
	    prefix: string;
		givenName: string;
		middleName: string;
		familyPrefix: string;
		familyName: string;
		familyName2: string;
		familyNameSuffix: string;
		degree: string;
	  }
	  displayCapturePhoto: boolean;
	}
	alternateName: {
	  label: string;		// default 'Alternate Name'.  But how to support localisation? Should this be a concept id?
	  template: string;		// name template to use for capturing patient's alternative name.
	                        // if empty (the defauly), alternative name fields are not displayed.
	}
	...
  }

As an example of layout, the following the configuration:

  fieldConfigurations: {
    name: {
      nameTemplate: latinamerica;  // givenName, middleName, familyName, familyName2
      allowUnidentifiedPatients:...
    }
    alternateName: {
      label: 'Known As';
      template: givenFamily;       // givenName, familyName
    }
  }

could produce a layout resembling:

  Full Name:
    First Name:
	[==============]
    Middle Name:
	[==============]
	Family Name:
	[==============]
	Second Family Name:
	[==============]
	
  Known As:
    First Name:
	[===============]
	Family Name:
	[===============]

Questions:

  • I think we lose the ability to label a name field as optional… for example, at present the middle name field is labelled ‘Middle Name (optional)’. Is that important?
  • I’m not sure what the implications of capturing a ‘preferred’ name and an optional ‘alternative’ name might be, as opposed to the current O2 solution of using person attributes…
  • What is the correct way to configure the label for the alternate name section?

Thoughts/suggestions? I’m new to OpenMRS, so be gentle… :slight_smile:

5 Likes

I’m :100:% in favour of making i18n/regionalization a first class concern, so these kinds of thoughts and proposals are awesome.

Looks like O3’s registration is not at par with what used to be possible with O1 and O2 and that’s definitely not ok. Furthermore making the registration’s configuration point to an OpenMRS-wide name template sounds like the better approach.

Cc @ibacher @mseaton @mogoodrich @mksrom

Additional findings:

  • the existing REST API for retrieving NameTemplate only returns the template specified by the “layout.name.template” Global Property. There is currently no API for retrieving an arbitrary NameTemplate by name or id.
  • there already exists some code in the Patient Registration app to display ‘alternateName’ fields; as far as I can tell these fields are displayed only for editing existing patients where the patient already has 2 names registered. (That is, the existing FHIR record for the patient contains 2 names.) See for example patient-registration-utils.ts
  • a Name Template includes information on which fields are mandatory and which are optional. So we can put an ‘(optional)’ label on optional fields.
  • in the configuration proposal above, if no name template is specified, the default should be the name template specified for the"layout.name.template" Global Property .

This would be an extremely useful enhancement.

Yeah, the main issue here has been that the name template was not exposed directly in any way so that there was previously no way to write the registration app to take advantage of this. All of these proposals are definitely a net-benefit for the application.

2 Likes

I have raised Epic O3-3299 to begin tracking implementation.

The first task is to augment the REST API…

1 Like

Wow @xprlgjf your approach is awesome! From your clear post to how you’ve documented in the OMRS Issue Tracker - bravo!! :clap: :clap:

1 Like