Module Skeleton Package

So I needed to explain to someone how to create a module and I figured I’d just create a skeleton project that people can build off of if they want. Similar to what we did with @sjpadgett’s fax/sms module.

So I put together this sample skeleton project with instructions on how to create a very loosely coupled custom module. Its rudimentary right now but I plan on adding to it over time.

You can install it in your OpenEMR project via packagist by using a
composer require adunsulag/oe-module-custom-skeleton

The link on packagist is here:
https://packagist.org/packages/adunsulag/oe-module-custom-skeleton

The github if you want to fork it and use it for your own custom modules is here: https://github.com/adunsulag/oe-module-custom-skeleton

5 Likes

This is a good tool to use for developers to know. I have used this to help make minimal changes to the codebase.

Hi guys, that is really useful, thank you very much! I was able to install this module and play with it a little bit.

Could you please let me know if there are any descriptions/thoughts on architecture approach for loosely coupled modules and how they should be integrated?

I see there are few situations:

  1. Module don’t use any third-party components and extends functionality of the system using existing functionality and PHP.
  2. Module use third-party components (I assume Telehealth module does it) and need to send data to those components and get data from them. In this case is there an ability to store those third party components on the server there OpenEMR installed or it’s better to keep them outside on a separate server? Or let’s say this can be a decision of each installation?

I ask because work on AI/ML module for some illnesses prediction and it would be easy if I can keep using python (as I see dockerized developer version already has python installed)

We haven’t given much thought to installing any non-php service via modules as our module architecture now is all delivered via composer which will not allow you to tell the target OS to install other software. In my view the best approach is to communicate to 3rd parties that are not written in PHP is via a REST api. Its scalable, allows you to move things around, and follows the micro-services architecture pattern. Where you store this 3rd party service is up to you. You can store it on the same service and communicate via sockets, move it to some other service, or whatever.

If you will be installing a 3rd party service alongside OpenEMR on the same target OS, you can make calls out to the system via any kind of php exec call or via sockets, or some other kind of IPC mechanism in php. This is the most secure communication and also the fastest but you’ll have scaling issues.

Another option that will have better scaling characteristics would be to leverage the MySQL database or REDIS as your communication layer. It all comes down to your comfort level with the various technologies and your functional requirements for reliability, availability, and speed.

I want to mention that there’s nothing really stopping you as the module writer from making calls out to python but we currently have no mechanism for you to install python via a module if its not already available in the target OS. I believe most linux installs have python installed but I can’t attest to windows or mac environments if that will be the case.

Now that said if you are trying to deploy your module to the widest available audience there’s nothing preventing you from going off a static linking approach and bundling up whatever python runtimes and libraries you need to execute inside your module that will get downloaded from your git repository via composer.

One thing to bear in mind if you have to follow any privacy laws such as HIPAA or GPDR is the passing around of PHI data between services. Whatever you develop as a 3rd party will need to protect the PHI data as well as provide an audit log of who viewed/modified data as well as when it was viewed/modified. This is handled at the core SQL level inside of OpenEMR and if you operate outside that, you’ll need to make sure you are handling all the compliance aspects yourself.

1 Like

Challenge for new developer is there are multiple approaches listed / found if they just type “openemr modules”. Top hits are :

  1. ZH version of Zend modules
  2. @sjpadgett’s Fax module
  3. @htuck’s Patient Privacy module page.
  4. @juggernautsei/LifeMesh’s Telehealth module page.
  5. Several references in various posts to any and every function as a module - e.g. Scheduling, Inpatient, Inventory, Rx, FHIR - refer to “Globals”…

Not sure if there is way to lead new users along a decision tree but at least some index page may help. And of course each of the pages above should let viewer know about that page.

1 Like

Hi @mdsupport
Just to be clear, my contribution in your list was strictly to provide a page where devs can post summaries of their modules for potential users to read about and contact them if they want to use the modules. The Patient Privacy module is all @ken 's work; I only massaged his quick summary and wikified it.

Gotta say, one centralized repo of descriptions of the modules available for OpenEMR may be one of the better ideas, but nobody heard about it so it isn’t going anywhere.
Best- HT

1 Like

I think your index page would be a great central location we can push people too. So far the modules I’ve created (outside of the skeleton module) have been for private companies which they have yet to release to the broader community, if they start pushing them to the community I’ll make sure to add them to that wiki page.

Hi @adunsulag -
Thanks for the push, as it were :slight_smile: If you have any questions about getting your stuff on the wiki, feel free to ask.
But of course, maybe being listed all together here is as centralized as they’re going to get!

  • HT