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 2 forks source link

Restrict FSN uniqueness to FSNs and preferred names for OpenMRS custom validation schema #1921

Open bmamlin opened 2 months ago

bmamlin commented 2 months ago

Currently, the OpenMRS custom validation schema on OCL is disallowing concepts with an FSN that matches any other non-retired name for any concept in the same locale. This uniqueness requirement should actually only apply across FSNs and preferred names in the same locale (i.e., it is allowed for a concept to have a non-preferred synonym that matches another concept's FSN in the same locale).

For CIEL v2024-09-04 (#1920) there are 41 concepts that failed import because they have an FSN that matches a non-preferred name of another concept.

tl;dr – when applying name uniqueness constraint for the OpenMRS validation schema, limit uniqueness to non-retired FSNs and preferred synonyms within the same locale. If a synonym matches the FSN but the synonym is not the preferred name, then the duplicate name should be allowed.

bmamlin commented 2 months ago

I believe the attribute_should_be_unique_for_source_and_locale method needs to be refactored or called in a manner that only considers FSNs and preferred names when checking for uniqueness. Perhaps, simply adding synonyms to the excluded name types (currently short names and index terms) would do the trick.

snyaggarwal commented 2 months ago

@bmamlin Excluding None and empty name_type along with SHORT and INDEX_TERM. This is deployed on QA and Staging.

bmamlin commented 2 months ago

deployed on QA and Staging

Awesome! Hoping it can make it to production over the next week (before the next CIEL release, which I'm assuming will probably be in 1st or 2nd week of October). Thanks!