# radiology module: dependency on emrapi

**URL:** <https://talk.openmrs.org/t/radiology-module-dependency-on-emrapi/5923>\
**Category:** Development\
**Tags:** order, radiology, emr-api\
**Created:** [April 25, 2016, 8:51am UTC](https://talk.openmrs.org/t/radiology-module-dependency-on-emrapi/5923 "2016-04-25T08:51:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teleivo](https://talk.openmrs.org/user_avatar/talk.openmrs.org/teleivo/32/2015_2.png) [@teleivo](https://talk.openmrs.org/u/teleivo)\
**Post date:** [April 25, 2016, 8:51am UTC](https://talk.openmrs.org/t/radiology-module-dependency-on-emrapi/5923/1 "2016-04-25T08:51:15Z")

</div>

Dear @judy, @sunbiz and others,

I just wanted to clarify why we chose to use the [EMR API](https://github.com/openmrs/openmrs-module-emrapi) in the [radiology module](https://github.com/openmrs/openmrs-module-radiology).

The reason is that for creating an Order via the [OpenMRS OrderService.saveOrder](https://github.com/openmrs/openmrs-core/blob/1.11.x/api/src/main/java/org/openmrs/api/OrderService.java#L100) we need to create an Encounter. An encounter can be created without a Visit but the Visit is used to group Encounters. So we thought that it would be great to also create a Visit and attach our radiology Enounter created for the RadiologyOrder to that Visit. So later it is easy to get all Encounters created during this Visit. Now the EMR API has already solved this part giving us the [EmrEncounterService](https://github.com/openmrs/openmrs-module-radiology/blob/master/api/src/main/java/org/openmrs/module/radiology/order/RadiologyOrderServiceImpl.java#L127). It not only creates a radiology Encounter for us, it also creates a Visit if there is no active Visit for the patient we want to create an order for and attaches the Encounter to that Visit. If there is an active Visit it attaches the new Encounter to this Visit.

So now because of our dependency to the EMR API we now need to install a bunch of other modules: ![](https://talk.openmrs.org/uploads/default/original/2X/0/0077f7814912b28e0d2e5e66d383fe23b003eff2.png)

I understand that this is more work for the implementer.

We could remove the dependency again, this would just mean a lot of work from our side to implement the behavior described above. We just do not have a lot of resources available for the radiology module.

Let me know what you think.

---

<div class="post-metadata">

**Author:** ![judy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/judy/32/2072_2.png) [@judy](https://talk.openmrs.org/u/judy)\
**Post date:** [April 25, 2016, 9:04am UTC](https://talk.openmrs.org/t/radiology-module-dependency-on-emrapi/5923/2 "2016-04-25T09:04:47Z")

</div>

I agree to use the platform and depend on the Emrapi

The question to the larger community is if we need to split these dependencies out of Emrapi and leave only critical ones

---

<div class="post-metadata">

**Author:** ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)\
**Post date:** [April 29, 2016, 10:41pm UTC](https://talk.openmrs.org/t/radiology-module-dependency-on-emrapi/5923/3 "2016-04-29T22:41:45Z")

</div>

Removing some dependencies from the emrapi module is discussed here:

> [@Dependencies in EMRAPI module](https://talk.openmrs.org/t/dependencies-in-emrapi-module/2839):
>
> Hi, Currently, emrapi depends on reporting, providermanagement, metadatasharing, event, webservices and appframework. Bahmni just about needs providermanagement functionalities. Is it alright to make all of these aware of modules instead of require modules? -Shruthi

There are several dependencies that can and should be removed, provided someone does the work. Anyone is welcome to do that!

---

<div class="post-metadata">

**Author:** ![teleivo](https://talk.openmrs.org/user_avatar/talk.openmrs.org/teleivo/32/2015_2.png) [@teleivo](https://talk.openmrs.org/u/teleivo)\
**Post date:** [April 30, 2016, 7:59am UTC](https://talk.openmrs.org/t/radiology-module-dependency-on-emrapi/5923/4 "2016-04-30T07:59:41Z")

</div>

Thanks for the info, I’ll have a look!
