Working with Person Attribute Types


Create a New Person Attribute Type

  • Go to Administration screen
  • Click Manage Person Attributes Types
  • Click Add New Person Attribute
  • Field definitions:
    • Name: Any string you want to recognize this type by. Spaces should not be used
    • Format: Most likely it will be java.lang.String. Other possibilities are org.openmrs.User and org.openmrs.Concept
    • Foreign Key: The only time a foreign key value is needed is when you are using a separate table for the answers. A good example of this is the Civil Status attr that links to the concept civil status for its possible answers.
    • Searchable: Whether or not this attribute is included in searches
    • Description: Text blob describing this type

Listing and Viewing of Person Attribute Types

Person attributes can be included in search screens and edit screens. Separate attributes by commas.

  • "Listing" refers to a search listing after someone types a few characters into a search box.
  • "Viewing" refers to the display and edit pages of a patient/user. Attributes to be shown on the patient dashboard and short patient edit screens. Note: All attributes are shown on administration patient and user edit screens.
  • Once you add attributes here, they will show up headed like PersonAttributeType.NameOfAttributeType. To get a display name for this you need to add an entry to your custom messages file like so:
PersonAttributeType.<attribute name>=Attribute Name


Using Person Attribute Types on Forms

  • Create a field of type "database element". Set the `table` to be "person_attribute" and the `attribute` to be "value".
  • If you want them to then appear with data in the forms, you need to be able to define a default value.
    • Person attribute data must be entered in the webapp on one of the edit patient pages. Attributes can be viewed in infopath by setting the field's `Default Value` to: ${patient.attributeMap.Cell} (if "Cell" is the attribute type name)