How to migrate concepts automatically from CSV files?

Is there a way to migrate concepts and concept sets automatically from CSV files on server startup, e.g., when running ‘vagrant up’ for a Bahmni instance?

Thanks, Dominic

Hi @dsurrao,

We are actively working on tackling this exact topic with the OpenMRS Initializer module. Please read through the README, in particular the Domain ‘concepts’ subsection. This is work in progress though, but perhaps would you be willing to collaborate?

This is not specific to Bahmni, but we actually are developing this in the context of the metadata management of Bahmni instances.

Thanks @mksd! I’ll take look at this.

Hi @mksd,

  • Should I build the dev branch since there is no master branch?
  • Could you please share a sample CSV file fully defining some concepts?
  • Does the current code work with OpenMRS 2.0 distributions?


Hi @dsurrao,

Should I build the dev branch since there is no master branch?

Correct. The master branch will only be created upon the first release, hopefully around early July. So you should expect this to be bumpy and changing until there is a master branch.

Could you please share a sample CSV file fully defining some concepts?

You can either look at test resources (here) or through a real work-in-progress configuration that we are working on (here). You may keep an eye on both locations as this module is under active development and will keep changing in the next few weeks.

Does the current code work with OpenMRS 2.0 distributions?

See here: Core 1.11.8+ We are developing using Bahmni 0.88, so that’s Core 2.0.3 I believe. However you may faces some issues with the metadatasharing domain with Core 2.1 because of TRUNK-5169. This is currently delaying our upgrade to Bahmni 0.89.

1 Like

Hi @mksd,

I ran into a couple of issues when building the dev branch using “mvn clean install”:

  1. A compilation error in the class, I commented out that line for now: [INFO] ------------------------------------------------------------- [ERROR] /Users/dddd/IdeaProjects/openmrs-module-initializer/api/src/test/java/org/openmrs/module/initializer/[53,65] cannot find symbol symbol: variable GLOBAL_PROP_I18N_SUPPORT location: class org.openmrs.module.addresshierarchy.AddressHierarchyConstants [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Initializer … SUCCESS [ 0.569 s] [INFO] Initializer API … FAILURE [ 2.686 s] [INFO] Initializer OMOD … SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE

  2. The unit test AddressHierarchyMessagesLoadingTest.refreshCache_shouldLoadAddressHierarchyMessages() fails. I’ve commented out that test in my local version as well.

Hi @dsurrao,

The reason why you are bumping onto those issues is because Initializer 1.0-SNAPSHOT depends on a SNAPSHOT version of Address Hierarchy that is assumed to hold the i18n support feature. However this hasn’t been merged into AH’s master branch yet.

The simple way out of this is to skip tests altogether. A more complicated way would be to clone and build our fork of AH. That way the needed JARs will in your .m2 folder. You would have to clone and build the dev branch of our fork (here).

I’ll skip tests for the build.

I also ran into runtime errors that I resolved by adding and files to the …/api/src/main/resources folder.


Thanks for reporting this, can you let me know the steps to reproduce those runtime errors that you mentioned?

The error shows during the maven build, and also on the administration page when the module is started.

ERROR - ModuleFactory.getModuleFromFile(532) |2017-05-31 08:12:31,238| Error getting module object from file initializer-1.0-SNAPSHOT.omod

org.openmrs.module.ModuleException: No message properties file for language fr

at org.openmrs.module.ModuleFileParser.getMessages(

at org.openmrs.module.ModuleFileParser.parse(

at org.openmrs.module.ModuleFactory.getModuleFromFile(

at org.openmrs.module.ModuleFactory.loadModule(

at org.openmrs.module.ModuleFactory.loadModules(

at org.openmrs.module.ModuleFactory.loadModules(

at org.openmrs.module.ModuleUtil.startup(

at org.openmrs.api.context.Context.startup(

at org.openmrs.web.Listener.startOpenmrs(

at org.openmrs.web.WebDaemon$

Thanks @dsurrao, config.xml was still referencing those two files for ‘fr’ and ‘es’ locales even though we had removed them. It is now solved and pushed in dev.