jsibley / convert-rmd-to-iniz

A tool for converting the payload of the OpenMRS Reference Metadata module into files compatible with the Initializer module.
0 stars 1 forks source link

Existing concepts may interfere with Iniz concept loading if 'Name:locale' is the same. #7

Open jsibley opened 4 years ago

jsibley commented 4 years ago

For some reason, the initial database import (from classpath://openmrs-platform.sql) when a server is created using the SDK includes 2 concepts with 10 concept_names each (specifically the 'Yes' and 'No' answer concepts, though not the CIEL versions - different UUIDs).

Iniz fails when trying to insert the same concepts since the name:locale combo is already in use. This causes a cascade failure due to those concepts not being available when later concepts that depend on them are defined.

ERROR - CsvParser.process(198) |2019-10-09 16:39:51,249| An OpenMRS object could not be constructed or saved from the following CSV line: 
[false, N/A, Misc, 1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, Generic answer to a question., No, Non, Non, SNOMED CT:373067005;AMPATH:1066;PIH:1066;PIH Malawi:1066;CIEL:1066, Нет, null, False, Fo, Faux, کسی سوال کا عام جواب, Muzima, ኣይትጥቀምን, No, Falso, No, Falso, Não, Falso, না, نہیں, null, null, null, null, null, null, null, null, null]
org.openmrs.api.DuplicateConceptNameException: 'Não' is a duplicate name in locale 'pt'
... causes cascade failure later...
WARN - HibernateConceptDAO.getConceptByName(1739) |2019-10-09 16:40:00,086| No concept found for '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
ERROR - CsvParser.process(198) |2019-10-09 16:40:00,087| An OpenMRS object could not be constructed or saved from the following CSV line: 
[false, Coded, Diagnosis, 140238AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, An abnormal elevation of body temperature, usually as a result of a pathologic process., Fever, Fièvre, Fyèv, SNOMED CT:386661006;ICD-10-WHO:R50.9;PIH:3722;AMPATH:157;AMPATH:5945;PIH:5945;3BT:10049305;ICPC2:A03;CIEL:140238;IMO ProblemIT:27348, null, 1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, null, null, null, null, Umuriro, null, fiebre, null, null, null, null, null, null, null, homa, null, null, null, null, Sốt, koorts, null, null]
java.lang.IllegalArgumentException: The object identified by '1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' could not be found in database. The parent or encompassing object referencing the following list was therefore not created/updated: [1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA].

It is beyond the scope of this script to be able to handle clearing out any existing concepts in the database. That is a step that will need to be done externally. Without those concepts in the database, Iniz is able to completely import all of the CSV content generated by this script.

mks-d commented 4 years ago

@jsibley

Iniz fails when trying to insert the same concepts

Which config. is driving Iniz to insert the same concepts again?

jsibley commented 4 years ago

These 3 XML files in the RMD payload all have definitions for CIEL concepts 1065 and 1066 which have the same name:locale as the ones pre-loaded by the initial database load:

Reference_Application_Concepts-24.xml Reference_Application_Diagnoses-11.xml Reference_Application_Order_Entry_and_Allergies_Concepts-18.xml

@mks-d

mks-d commented 4 years ago

@jsibley isn't this a question of using 'preferred theirs' vs 'preferred ours' when Iniz is loading the MDS packages?

jsibley commented 4 years ago

@mks-d These aren't getting loaded from MDS packages, they're from CSV. Does that setting effect CSV loading also? If so, I will try that and see if it fixes things.