That query is still missing out one bit, checking the possible duplicates are either marked as preferred or fully specified names in the same locale because, below is the edited query
select count(cn.concept_id) as total, cn.name, cn.locale from concept_name cn inner join concept c on c.concept_id=cn.concept_id where c.retired=0 and (cn.concept_name_type ='fully_specified' or cn.locale_preferred = 1) and cn.voided=0 group by name, locale having total > 1 order by total desc; The logic that determines a duplicate gets a little more complex to write in a single query because there is a scenario where both names belong to the same concept and more, this is why i would like to know what happens if you try saving any of those concepts in the web app, if not, we will end up masking a bug in the module. Wyclif On Wed, Sep 21, 2011 at 2:31 PM, Jeremy Keiper <[email protected]> wrote: > Also, in the resulting list of duplicate names, I found three of the above. > However, I did not find HEPATOSPLENOMEGALY. I did, however, find > duplicates of one of the synonyms of it: HSM. > > > Jeremy Keiper > OpenMRS Core Developer > AMPATH / IU-Kenya Support > > > On Wed, Sep 21, 2011 at 2:26 PM, Jeremy Keiper <[email protected]> wrote: > >> I just ran the following query and found 37 duplicated unique names (that >> have not been voided) for concepts that have not been retired: >> >> select count(cn.concept_id) as total, cn.name, cn.locale from >> concept_name cn inner join concept c on c.concept_id=cn.concept_id where >> c.retired=0 and cn.voided=0 group by name, locale having total > 1 order by >> total desc; >> >> Is this possibly what is causing my problems with Metadata Sharing Module, >> and therefore the API? By the way, I'm running 1.8.2. >> >> Jeremy Keiper >> OpenMRS Core Developer >> AMPATH / IU-Kenya Support >> >> >> On Wed, Sep 21, 2011 at 1:52 PM, Jeremy Keiper <[email protected]>wrote: >> >>> When creating an export package in Metadata Sharing Module from a >>> selection of eight forms, I get the following error: >>> >>> Concept [a898a552-1350-11df-a1f1-0026b9348838] 'DERMATOPHYTOSIS' is a >>> duplicate name in locale 'en' >>> Concept [a89565ea-1350-11df-a1f1-0026b9348838] 'DECREASED SENSATION' is a >>> duplicate name in locale 'en' >>> Concept [a8a37202-1350-11df-a1f1-0026b9348838] 'HEPATOSPLENOMEGALY' is a >>> duplicate name in locale 'en' >>> Concept [a890c21a-1350-11df-a1f1-0026b9348838] 'SULFADOXINE AND >>> PYRIMETHAMINE' is a duplicate name in locale 'en' >>> >>> >>> When we first saw this error, we investigated the forms and determined >>> that three of the related concepts were incorrectly referenced in forms and >>> that two concepts referencing HSM did not have preferred names. We made >>> these changes, but are still getting these errors. Is there an API >>> restriction that is causing this validation problem? Is there something I >>> can do in SQL to test conditions that will cause this problem, so I can >>> rectify them? >>> >>> Jeremy Keiper >>> OpenMRS Core Developer >>> AMPATH / IU-Kenya Support >>> >> >> > ------------------------------ > Click here to > unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from > OpenMRS Developers' mailing list > _________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

