Uploaded image for project: 'OpenMRS 3.x Frontend'
  1. OpenMRS 3.x Frontend
  2. O3-2115

Patient name should be collected and rendered based on name template configuration

    XMLWordPrintable

Details

    • Undetermined

    Description

      OpenMRS core provides the capability to configure the specific name fields that are captured in a person name in a given implementation, as well as information about how to render these names. This is represented as a global property named `layout.name.format` which supports values of `short` and `long`. These specific formats have defaults, but can also be explicitly configured at startup. For example in one distribution, we choose to collect givenName, familyName, and familyName2, and to display the patient name as "familyName familyName2, givenName"

      NameTemplate nameTemplate = new NameTemplate();
      nameTemplate.setCodeName("short"); 
      
      Map<String, String> nameMappings = new HashMap<String, String>();
      nameMappings.put("givenName", "zl.givenName");
      nameMappings.put("familyName", "zl.familyName");
      nameMappings.put("familyName2", "zl.familyName2");
      nameTemplate.setNameMappings(nameMappings);
      
      Map<String, String> sizeMappings = new HashMap<String, String>();
      sizeMappings.put("givenName", "50");
      sizeMappings.put("familyName", "50");
      sizeMappings.put("familyName2", "50");
      nameTemplate.setSizeMappings(sizeMappings);
      
      List<String> lineByLineFormat = new ArrayList<String>();
      lineByLineFormat.add("familyName");
      lineByLineFormat.add("familyName2,");
      lineByLineFormat.add("givenName");
      
      nameTemplate.setLineByLineFormat(lineByLineFormat);
      
      List<NameTemplate> templates = new ArrayList<NameTemplate>();
      templates.add(nameTemplate);
      
      // we blow away the other templates here, is that a bad thing?
      nameSupport.setLayoutTemplates(templates);
      nameSupport.setDefaultLayoutFormat("short");
      

      In another of our implementations, we collect givenName, familyName, and middleName, and we use middleName to store the patient's nickname.

      This configuration is respected in the O1 and O2 interfaces, in patient registration where names are entered/edited, and in the patient chart overall (eg. the patient header, patient cards, search results, etc).

      In O3, we need to ensure these same capabilities are supported. This will require changes to at least:

      • esm-patient-registration-app: name-field.component.tsx
      • esm-patient-banner-app: patient-banner.component.tsx

      But likely this will require broadly creating a new component for rendering a person name that can be imported and included throughout the app.

      grace / fanderson / ddesimone FYI .

      Gliffy Diagrams

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                mseaton Mike Seaton
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated: