Handling name type for synonyms within OCL

On today’s OCL Squad Call, we uncovered some inconsistencies with how the name type for synonyms is handled in OCL. Specifically, synonyms (like “CHF” for “Congestive Heart Failure”) have a null name type in OCL’s API, but the OCL UI requires a name type, where None (not null) is one of the name types and, if chosen, None (not null) is stored.

OpenMRS’ user interface doesn’t use name types; rather, the following are properties of a concept in the edit concept form:

  • A fully-specified name
  • An optional list of synonyms
  • An optional list of search terms (i.e., “index terms”) to use for indexing, but not for display (e.g., common misspelling)
  • An optional short name (for use in flowsheet or spreadsheet, where names need to be abbreviated)

When these values are stored in the OpenMRS concept_name table, the concept_name_type is set to one of these values:

  • FULLY_SPECIFIED
  • SHORT
  • INDEX_TERM

or left empty (null) for synonyms.

Within OCL, there are corresponding NameTypes:

  • Fully-Specified
  • Short
  • Index-Term
  • None

When dictionaries (like CIEL, PIH, etc.) are imported, we are setting the name types for synonyms to “” (a blank string) per this line:

concept_name.concept_name_type if concept_name.concept_name_type else ''

In brief, for synonyms in OCL, we are currently:

  • Importing as name_type: ''
  • Storing name_type: null
  • When adding/editing in UI, using name_type: None

This is going to lead to a future where synonyms have a name_type of null or None depending on how they got into OCL.

FWIW, showing “None” in the UI like this is confusing (i.e., not a good UX):

image

Trying to decide on a way forward:

Choice Steps
Embrace ‘null’
  1. When user selects “None” name type, store null in OCL
  2. Convert null to None when editing a concept in OCL
  3. Convert any None name types to null in OCL
Embrace None
  1. Change ocl_omrs import script to set name type to None instead of empty string for synonyms
  2. Convert all null name types to None in OCL
Introduce 'Synonym`
  1. Change ocl_omrs import script to set name type to 'Synonym' instead of empty string for synonyms
  2. Change name of None name type to Synonym in OCL
  3. Convert all null or None name types to Synonym in OCL

/cc @jamlung @paynejd @sny

I would prefer either 1 or 3 because of the UX issue you mentioned. Supporting Synonym does have the nice touch of being explicit about what it’s doing.

Note that on the OpenMRS side, we actually have support for null, "None" and "Synonym", which implies that all three of these values are actually in OCL. (Our support for "Synonym" may have been an artefact of the Dictionary Manager).

Thanks @ibacher. I agree. “None” feels like Python bubbling up to OCL’s UX. Using null may be the quickest fix (i.e., just a tweak to the OCL app to translate between null in the db/API to None in the concept edit form).

Ultimately, adopting Synonym would be the most explicit solution. We wouldn’t face continuously training people to select “None” for synonyms and OCL would show synonyms as synonyms, e.g.: image

So, I’ll suggest to @jamlung & @paynejd that we embrace null on the way toward embracing Synonym. :slight_smile:

1 Like