OpenHIM modules

Hello everyone,

i just read a lot of data when i was searching how to create an openHIM mediator to connect with openMRS.

So i wanted to ask which is the best way to make/create an openHIM mediator.

Thanks,
omar

Hi Omar,

It may be helpful to think of a mediator as a web service, but one that is first accessed through OpenHIM and which reports back to OpenHIM on requests it processes.

So, a program makes a request to example.com/mymediator, which is managed by OpenHIM. OpenHIM authenticates the request then routes it to /mymediator (your web service). The mediator processes the response and in addition it provides log information to OpenHIM which returns the response to the requesting program.

Mediators can live anywhere, on any server, and they can be written in any language. They can be very simple or complex web services but they still need to authenticate with OpenHIM, and pass log information back to OpenHIM for the requests that they receive (and OpenHIM logs each request coming in).

So, I would suggest getting OpenHIM up and running, then do the tutorial for mediators. OpenHIM is an API server which puts its state in mongo, and a static administrative console, which is served by a web server of your choice. See the github repo for openhim-core and openhim-console to see how to get them up. They are just node apps, and there are lots of tutorials on how to get set up in javascript and node.

Then, see the docs for the tutorial. When you want to write your own, there's already scaffolding for javascript and java.

HTH

Hi Richard and Omar

Thanks Omar for reaching out: here is the mediator documentation that Richard refered to: http://openhim.readthedocs.io/en/latest/dev-guide/mediators.html

Also I suggest having a look at some of the existing medator code: http://openhim.org/mediators.html to get a feel for how others have done this.

May I ask, what do you want to connect/share from OpenMRS or have OpenMRS consume from the OpenHIM?

···

On Mon, Jul 3, 2017 at 3:40 AM, Richard Stanley richardlstanley@gmail.com wrote:

Hi Omar,

It may be helpful to think of a mediator as a web service, but one that is first accessed through OpenHIM and which reports back to OpenHIM on requests it processes.

So, a program makes a request to example.com/mymediator, which is managed by OpenHIM. OpenHIM authenticates the request then routes it to /mymediator (your web service). The mediator processes the response and in addition it provides log information to OpenHIM which returns the response to the requesting program.

Mediators can live anywhere, on any server, and they can be written in any language. They can be very simple or complex web services but they still need to authenticate with OpenHIM, and pass log information back to OpenHIM for the requests that they receive (and OpenHIM logs each request coming in).

So, I would suggest getting OpenHIM up and running, then do the tutorial for mediators. OpenHIM is an API server which puts its state in mongo, and a static administrative console, which is served by a web server of your choice. See the github repo for openhim-core and openhim-console to see how to get them up. They are just node apps, and there are lots of tutorials on how to get set up in javascript and node.

Then, see the docs for the tutorial. When you want to write your own, there’s already scaffolding for javascript and java.

HTH

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Regards
Carl Fourie

Senior Program Manager | Digital Health Division

Jembi Health Systems | SOUTH AFRICA
Mobile: +27 71 540 4477 | Office: +27 21 701 0939 | Skype: carl.fourie17
E-mail: carl.fourie@jembi.org

Physical Address: Unit 3B, 5A-C, Tokai on Main, 382 Main Road, Tokai, Cape Town, South Africa (Map Link)

Email Disclaimer:

This e-mail contains proprietary and confidential information some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail and then deleting same. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this e-mail. Jembi Health Systems NPO, its subsidiaries and associated companies is not liable for the security of information sent by e-mail and accepts no liability of whatsoever nature for any loss, damage or expense resulting, directly or indirectly, from the access of this e-mail or any attachments hereto.

Hello Richard and Carl,

Thank you for your replies i belive they’ll be of great help.

As for openMRS I want to connect it with openHIM and test if I can share data (medical record) from one instance of openMRS (as a POS) to another instance of openMRS (as an infrastructure services ) via openHIM.

Best regards,

Omar

Hello everyone,

i followed the tutorial : http://openhim.readthedocs.io/en/latest/tutorial/3-creating-a-passthrough-mediator.html#java-mediator

but i ran into this error :

[INFO] [compiler:compile {execution: default-compile}]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/hie/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,28] > expected
[ERROR] /home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,13] not a statement
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,28] > expected
/home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,13] not a statement

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Mon Jul 03 11:11:44 CET 2017
[INFO] Final Memory: 24M/172M
[INFO] ------------------------------------------------------------------------
hie@HIE:~$

Can anyone help me and tell me how to fix it ?

Best regards,
Sabri

Hi Sabri,

It seems to be complaining about something at line 30 of the DefaultOrchestrator.java class. It could be that there is a syntax error in that line or that the version of java you are using does not support that syntax. Could you show us the line that is producing the issue?

Cheers,

Ryan

···

On Mon, Jul 3, 2017 at 12:16 PM sabri barbaria sabribarbar@gmail.com wrote:

Hello everyone,

i followed the tutorial : http://openhim.readthedocs.io/en/latest/tutorial/3-creating-a-passthrough-mediator.html#java-mediator

but i ran into this error :

[INFO] [compiler:compile {execution: default-compile}]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/hie/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,28] > expected
[ERROR] /home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,13] not a statement
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,28] > expected
/home/hie/src/main/java/tutorial/DefaultOrchestrator.java:[30,13] not a statement

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Mon Jul 03 11:11:44 CET 2017
[INFO] Final Memory: 24M/172M
[INFO] ------------------------------------------------------------------------
hie@HIE:~$

Can anyone help me and tell me how to fix it ?

Best regards,
Sabri

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ryan Crichton

Lead Developer, Jembi Health Systems | SOUTH AFRICA

Mobile: +27845829934 | Skype: ryan.graham.crichton
E-mail: ryan@jembi.org

Hi Ryan

I had the same issue with line 30 Map <String, String="">headers = new HashMap<>(); and had to replace it with Map <String, String>headers = new HashMap<>();
to allow a successful run. Is there a recommended java version for the mediators.

Regards
Gichangi

Hi Gichangi

For me I build the mediator with java version 1.8 and maven3

Best regards

Hi,

I believe that may just be a mistake in the docs. I’l fix it what has worked here.

Cheers,

Ryan

···

Ryan Crichton

Lead Developer, Jembi Health Systems | SOUTH AFRICA

Mobile: +27845829934 | Skype: ryan.graham.crichton
E-mail: ryan@jembi.org