Archive for the ‘tips and tricks’ Category

OpenMRS Implementor Series 101 – Building a distribution package

I am not sure where this will end, however it is my way of giving back to the OpenMRS community that has provided an excellent learning platform and great support to me over the last 6 months, I have been using the software tools.

My intention is to share what I know, as a way of organising my thoughts and sharing ideas as I figure out where to add this to the OpenMRS community documentation, where it surely belongs. The flow of each of these posts will usually be to answer a very specific question that I have asked in the past, and where I think I have figured out an approach that seems to work.

UPDATE December 31, 2015: The new home for this blog post is  on the OpenMRS Wiki at https://wiki.openmrs.org/pages/viewpage.action?pageId=93358939 all further updates will be placed there

Problem Statement: How can I get an OpenMRS distribution that has all the modules that I need?

New to OpenMRS – What is Possible?

If you are new to OpenMRS and would like to see what is possible, then download the OpenMRS X.X Standalone Edition from http://openmrs.org/download/ which contains a pre-configured reference application with sample data that is ready to run in a single command.  This is note meant for production use as the embedded components are not robust enough for the growth in data collected.

Enterprise Installation like Reference Application

If the reference application provides all the modules that you need, the next step is to set-up n enterprise ready installation using a dedicated application server & database in which the Platform x.xx WAR (for Enterprise) can be installed. The modules for the reference application above can be downloaded as a zip file from the standalone edition above.

Full Control of Enterprise Installation

The last option is the most complex, and is for those implementors who want to install the enterprise edition but have control over what modules are installed or even what versions. In this case the OpenMRS distro platform is your best choice (https://github.com/openmrs/openmrs-distro-platform) which allows the building of a custom WAR file that includes the modules that you need.

The modules are defined in the pom.xml file and are accessed from the OpenMRS Maven Nexus repository (http://mavenrepo.openmrs.org/nexus/index.html#view-repositories;modules~browsestorage).

An addition to this project is for modules (pending review) but currently available at https://github.com/ssmusoke/openmrs-distro-platform is the ability to include custom modules (*.omod files) by dropping them in a folder called modules.

Please do share your comments on this style and let me know where it would fit best in the OpenMRS community documentation

 

Syzygy – Release 2 – Uganda Mobile Money Cost Estimator

Syzygy is a Uganda focused utility calculator (launched by this post https://ssmusoke.com/2015/08/11/launching-syzygy-uganda-focused-utility-calculator/), this new release adds a tool not available anywhere else allowing you to estimate the costs of a mobile money transaction. Are you sending to a registered number, unregistered or trying to withdraw from an agent or ATM?

Hope this app saves you the hassle of searching for the transaction chart which is usually hanging in the agent’s booth.

Do let us know what you think of the new release.

The link to the app is http://bit.ly/syzygy-ug

A screenshot of the new calculator is below

Mobile Money Cost Estimator

Mobile Money Cost Estimator

TechTip: Moving a Project Between Git Repositories

I tend to write these so that I do not forget them, and possibly to help others who may be face similar challenges. The question is why would somebody want to do this, well usually its because of a change in Git hosting providers or probably change in project ownership.

The process is as follows:

  1. Check the configuration of the remote repository
    local-box:change-url ssmusoke$ git remote -v
    origin https://github.com/ssmusoke/project-repo.git (fetch)
    origin https://github.com/ssmusoke/project-repo.git (push)
  2. Rename the url of the current remote repository from origin:
    local-box:change-url ssmusoke$ git remote rename origin oldrepo
    local-box:change-url ssmusoke$ git remote -v
    oldrepo https://github.com/ssmusoke/project-repo.git (fetch)
    oldrepo https://github.com/ssmusoke/project-repo.git (push)
  3. Create a new origin pointing to the new remote repository
    local-box:change-url ssmusoke$ git remote add origin https://github.com/ssmusoke/newproject-repo.git
    local-box:change-url ssmusoke$ git remote -v
    oldrepo https://github.com/ssmusoke/project-repo.git (fetch)
    oldrepo https://github.com/ssmusoke/project-repo.git (push)
    origin https://github.com/ssmusoke/newproject-repo.git (fetch)
    origin https://github.com/ssmusoke/newproject-repo.git (push)
  4. Sync the project to the new remote repository (if any issues occur the old url is still available)
  5. Delete the old url (only after confirming that everything works fine with the new url)
    git remote rm oldrepo

OpenMRS Module Development Learnings – 102

My team mates and I are completing a number of OpenMRS workshops focused on improving our module development capability. This blog post captures the unwritten lessons that we have picked up as a way of giving back our lessons to help others in the community (and will be moved to the OpenMRS Wiki once the lessons have been internalized and consolidated, as that is its natural home).
The approach is based on the following OpenMRS community articles:
  1. Creating Modules – https://wiki.openmrs.org/display/docs/Creating+Modules
  2. Creating your First Module – https://wiki.openmrs.org/display/docs/Creating+Your+First+Module
As you develop the module it is important to keep testing and verifying whatever you do especially when the module involves user interface components, extending the OpenMRS UI. The process we ended up using was as follows:
  1. Setup a module using the module creation command line utility
  2. Downloaded Spring Loaded from its maven repository http://mvnrepository.com/artifact/org.springframework/springloaded
  3. Downloaded and setup OpenMRS standalone from http://openmrs.org/download/ picking a version greater than 1.11.x which supports debugging options
  4. Once the standalone version is installed, open the openmrs-standalone-runtime.properties and add the following variables to the vm_arguments: (should all be one line – separated here for clarity)
    • -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
    • -Dmodule.development.directory={absolute path to root folder of the module}
    • -javaagent:{absolute path to spring loaded jar}
    • -noverify -Dspringloaded=inclusions=org.openmrs.module.modulepackage..* (note the two trailing dots before the *)
  5. Setup newly the module into an IDE (tested with IntelliJ & Eclipse)
  6. Installed a FileSync utility, RemoteSynchronizer for IntelliJ & FileSync (http://andrei.gmxhome.de/filesync/) for Eclipse
  7. Setup sync for the omod webapp folder into the standalone webapp folder located at WEB-INF/view/module/{modulename}
Our development workflow is smoothened out since any changes to Java classes & JSPs are automatically applied & reflected in the standalone app.
Additional Tips and Tricks
  1. Tomcat – Change the following init params in web.xml:
    • modificationTestInterval from 4 to 0, so that JSPs are automatically recompiled
    • development is true (this is the default)
  2. Intellij – the Java classes are not automatically recompiled on saving changes so there is need to run mvn package -DskipTests
  3. Follow the OpenMRS conventions as much as possible by cloning openmrs-core to see how the design of the interfaces, service layers is done. This will help get access to lots of the magic that happens behind the scenes.
  4. Java 8 will give you trouble, stick to 1. 7 as we did not try 1.6 anywhere.

Trunk or Branch based development

An interesting discussion that I had with my team mates over the last few days, whether we should create branches then merge later or keep working on the trunk within our Git based version control process. As the team is small, we are in the same premises but different locations, we agreed to move to work exclusively on the mainline for the following reasons:

  1. Reduce the amount of work having to remember which branches are active, so branches are an exception rather than the rule
  2. Adding practices like a CI pipeline (that’s additional work for all of us to setup) will provide a needed stability in the long-run as some of the projects are expected to be long running
  3. Working on the main line forces us to talk to each other, rather than IM away, so design decisions are shared across the team
  4. Branches discourage refactoring mostly due to the pain of merging refactored changes, and the fact that not everyone can benefit from the refactoring as soon as its completed – thanks to Twitter – Chris Ford

We used the following resources as research:

1. Martin Fowler – Feature Branch – http://martinfowler.com/bliki/FeatureBranch.html also talking about Feature Toggles – http://martinfowler.com/bliki/FeatureToggle.html

2. Apologists Defense of Trunk based development – http://www.tuesdaydeveloper.com/2015/05/an-apologists-defense-of-trunk-based-development/

3. What is Trunk Based Development http://paulhammant.com/2013/04/05/what-is-trunk-based-development/

4. Shades of Trunk based development – http://paulhammant.com/2014/09/29/shades-of-trunk-based-development/

What do you use with your team and why?

GeekDIY – Manually Upgrading Samsung S4 to Stock Android Lollipop 5.0.1

I would not consider myself an early adopter, neither am I a laggard, but somewhere in the middle for software upgrades. So when I heard that my Samsung Galaxy S4 would be getting Android Lollipop in December 2014, I was over the moon. What made me envious was that my colleagues with LG, Nexus and Sony devices were getting this update over the holidays.

So patiently I waited stalking the net for news on when my S4 would get an OTA update but no avail, 4 months later I am still feeling left out till, I found this post S4 Stock Lollipop came up in my Google+ feed (yes I use that) which led me to look for options of manually updating my phone to an official stock android for Samsung phones.

This led me to a guide How to get Android 5.0.1 Lollipop on the Galaxy S4  which walked me through the process.

75 minutes later, I had Lollipop 5.0.1 installed on my S4, now to understand how the new notifications & other enhancements can be leveraged for my day to day use most especially the battery life improvements.

My biggest worry was bricking the phone, so I followed the instructions to the letter, and ensured the laptop running Odin was on UPS just in case of power outage.

Tech Tip: Fixing Camera Troubles on Mac

When you use your Mac camera across multiple applications, Go-To-Meeting, Skype, Fuse, Facetime etc, you will find that it tends to not work at times and only a reboot can fix that. Well it happens because probably one of the applications did not release the camera. To fix follow the steps below:

1. Open a Terminal  (yes that black window where you can type magic commands). You can go to the Search in the top-right hand corner and type Terminal

2. Type the command below: sudo killall VDCAssistant

3. You will need to enter your password

Obviously you will ask, do I have to remember this command all the time, not really. Next time you open the terminal, click the up arrow on your keyboard and the command will appear.

Hope this helps somebody else as it does me everyday

%d bloggers like this: