Wiki Spaces
Documentation
Projects
Resources
Get Help from Others
Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack
Primary mentor | |
Backup mentor | TBD |
Assigned to | TBD |
It is challenge for developers, especially those working on large distributions, to maintain test data which is consistent with their production environments. For example, developers may want to write unit tests for an indicator report that includes most of the metadata and concepts used by the distribution.
This project would seek to provide a mechanism by which developers can easily generate a test dataset file for use in unit tests, which includes a configurable subset of their entire concept dictionary. It's important that developers can configure what is included in the final dataset file so that they can keep it as small as possible to keep unit test times as fast as possible - it's obviously not feasible to load an entire dictionary like CIEL into memory for each unit test.
It's common for an OpenMRS distribution to list the concepts it uses in classes of static constants, e.g.
public class Dictionary { public static final String ABACAVIR = "70056AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; public static final String ADULT_INPATIENT_SERVICE = "160536AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; public static final String ANTENATAL_CASE_NUMBER = "161655AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; ... }
Classes like this would be the inputs for the plugin. The plugin when invoked would:
The output file would use the XML dataset format currently used to provide test data in uni tests, e.g.
<dataset> <concept concept_id="70056" retired="0" datatype_id="4" class_id="3" is_set="0" creator="1" date_created="2006-12-17 00:00:00.0" version="" changed_by="1" date_changed="2012-11-28 20:05:26.0" retired_by="1" uuid="70056AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> <concept_name concept_id="70056" name="Ziagen" locale="en" creator="1" date_created="2007-10-18 09:35:54.0" concept_name_id="100397" voided="0" voided_by="1" void_reason="" uuid="100397BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" locale_preferred="false"/> <concept_name concept_id="70056" name="ABACAVIR" locale="en" creator="1" date_created="2006-12-17 00:00:00.0" concept_name_id="3277" voided="0" voided_by="1" uuid="3277BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" concept_name_type="FULLY_SPECIFIED" locale_preferred="true"/> <concept_name concept_id="70056" name="ABC" locale="en" creator="1" date_created="2012-11-28 20:05:26.0" concept_name_id="110802" voided="0" voided_by="1" uuid="110802BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" concept_name_type="SHORT" locale_preferred="false"/> <concept_name concept_id="160536" name="Adult inpatient service" locale="en" creator="1" date_created="2012-06-12 02:19:56.0" concept_name_id="108856" voided="0" voided_by="1" uuid="108856BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" concept_name_type="FULLY_SPECIFIED" locale_preferred="true"/> <concept concept_id="161655" retired="0" datatype_id="1" class_id="7" is_set="0" creator="1" date_created="2013-04-26 14:32:16.0" version="" changed_by="1" retired_by="1" uuid="161655AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> <concept_numeric concept_id="161655" units="" precise="0"/> <concept_name concept_id="161655" name="ANC ID" locale="en" creator="1" date_created="2013-04-26 14:32:16.0" concept_name_id="123687" voided="0" voided_by="1" uuid="123687BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" concept_name_type="SHORT" locale_preferred="false"/> ... </dataset>
The plugin itself could be configured in a project's POM something like this example:
<plugin> <groupId>org.openmrs.contrib.maven</groupId> <artifactId>conceptdataset-maven-plugin</artifactId> <version>1.0</version> <configuration> <includeClasses> <includeClass>org.openmrs.module.kenyaemr.Dictionary</includeClass> </includeClasses> <connectionUrl>jdbc:mysql://localhost/openmrs</connectionUrl> <outputFile>${basedir}/src/test/resources/test-concepts.xml</outputDirectory> </configuration> </plugin>
And when run would request database credentials, e.g.
mvn conceptdataset:generate Enter database username: root Enter database password: ********
10 Comments
user-e8f90
Hi Rowan,
I'm Ujitha Iroshan ,third year undergraduate from Department of Computer Science and Engineering University of Moratuwa Sri Lanka.And currently doing my internship in WSO2 inc. I'm very interest in this project and I would like to join this project as my GSoC project 2014. I have worked in several projects with Java,Mysql and Maven so I think it would be an advantage for the project. I would like to know more details about this project and how can I contact you in order to discuss about the project?.
Thank you
Rowan Seymour
Hi Ujitha, I can see your email address on the mailing list so I'll drop you an email...
user-e8f90
Thanks for the details Rowan
user-69c9d
Hey!!
Can you give me your email id?? I have loads of questions to ask.
Rowan Seymour
rowanseymour at gmail dot com
Akshika Wijesundara
Hi Rowan.
I have been a very active member in the OPENMRS community during the past three months,I have fixed couple of bugs related to Hibernate and Liquibase issues and many other issues as well.I am pretty much interested in working on this project. Is there anything that I should read before submitting the proposal. Other than what is mentioned here. Thank you. Waiting for a quick reply.
Rafal Korytkowski
Rowan, please consider using https://github.com/openmrs/openmrs-module-dataexchange for this project.
I've written this module to export concepts in the dbunit format, which can be easily imported in unit tests. We use this module in OpenMRS 2.x to export and import all concepts included in the reference application.
See http://devtest02.openmrs.org:8080/openmrs/module/dataexchange/export.form and http://devtest02.openmrs.org:8080/openmrs/module/dataexchange/import.form
The UI is pretty harsh, but Concepts exported from the export page are ready to install calling executeXmlDataSet in tests or can be imported into another instance of OpenMRS from the import page. There's also API you can use in some module's activator to import them automatically, see https://github.com/openmrs/openmrs-module-referencemetadata/blob/master/api/src/main/java/org/openmrs/module/referencemetadata/ReferenceMetadataActivator.java#L86
Darius Jazayeri
Also, since the time of writing, I have extended the metadatadeploy module to also support creating concepts.
But it's tedious to create these manually, so it would be great if that mechanism could read input that was exported from OCL.
Rowan Seymour
Rafal Korytkowski, Darius Jazayeri I'm not on that project anymore but the KenyaEMR guys might have a use for it. One of the last things I did was create Distro Tools Maven Plugin and the plan was that in conjunction with this project, a developer could just add a concept identifier to a file, run a maven task, and have it generate files for referencing that concept in code, forms and tests (by fetching data from OCL). That was the dream
Ivange Larry Ndumbe
I would like to work on this project. Request for more information