OpenConceptLab / ocl_issues

Issues for all OCL repos. NOTE: Install ZenHub Browser Extension and request access to the OCL Roadmap board to view all issues and to contribute
4 stars 1 forks source link

OpenMRS Custom Validation Schema: All FSNs and preferred names within a locale should be unique #1665

Open bmamlin opened 1 year ago

bmamlin commented 1 year ago

When we initially defined custom validation schema rules for OpenMRS, we said fully-specified names (FSNs) should be unique across all concept names (excluding short names and index terms). During the release of CIEL v2023-09-22 (#1662), we realized this is too strict. We also discovered OCL was not routinely enforcing this rule.

Upon further reflection, we decided a more pragmatic rule would be to enforce uniqueness amongst all FSNs and preferred synonyms within a locale. So, for example, Despite being the FSN for Lactic acid (78618), "Lactic acid" should be allowed as a synonym of Serum lactate (1012) in the same locale as long as it not marked as preferred.

Note: tests for name uniqueness should be case insensitive – i.e., if "Lactic acid" is a FSN, then no concept should be able to have a preferred synonym (or FSN) in the same locale of "Lactic acid", "lactic acid", "LACTIC ACID", etc.

snyaggarwal commented 1 year ago

Some of the synonyms have no name_type attached to them, they are getting skipped in this uniqueness check. For more

bmamlin commented 1 year ago

In OpenMRS, we introduced alternative name types after we had synonyms, so all null name types are assumed to be synonyms. OCL either needs to make the same assumption or we get rid of both null and None (having both is a recipe for disaster) and explicitly use Synonym name type in OCL (updating our OpenMRS import scripts to convert null to Synonym).

In any case, what we need for the OpenMRS Custom Validation Schema is to enforce that all FSNs and preferred synonyms within the same locale are unique (ignoring case). To work with existing data this means looking across all names with name type == Fully Specified OR (name type == null AND preferred == True).

Personally, I'd prefer to replace the None name type with Synonym and make this rule look across all names with name type == Fully Specified OR ((name type == null OR name type == Synonym) AND preferred == True). Then we can start phasing out null as an option for name type, eventually eliminating the need to assume a name type (i.e., make Synonym the default). #1666 created for the name type changes.