Emerging patterns in MoTech

For sometime now, I have been working on an open source project called MoTech. MoTech in essence is a platform for enabling mobile based solutions in the health care space. MoTech enables such systems by providing modules that can be used across these projects thus reducing the development time of these systems.

Building a generic module is rot with problems. There’s every opportunity that someone decides to become an architectural astronaut and come up with modules that no one understands, lest use. Hence at MoTech, we decided to pick up a couple of systems that are supposed to use the platform and develop them along side the core platform. Any common functions across the two implementations become candidate modules for the platform.

We have written a handful of modules for the platform now. Attempting to classify them, most of the modules are similar to the libraries we come across everyday. They abstract out a set of flows that implement the desired function. But a couple of modules are very interesting in that, their design is fundamentally of a different kind, which are explained below.

Scriptable Data environments

One function that appears to be common in mobile health domain is the capture of adherence to drugs/visits and perform analyses on them. At an abstract level, the module must provide ability to collect and store adherence information over time and let the consumers make decisions on them. As the designer of the module, one cannot make any assumption on the kind of analyses that will be performed by the consumers on the data and thus, the module cannot possibly provide any intelligence on top of data.

Initially it was considered that capture of time related data is good enough as a function to qualify as a module, but one has to admit that it is not much of a value add. One inspired moment later, it was conceived that if the module provided ability to execute user written scripts on the data that it has, implementers can avoid going through the pain to write code to read the data, and also paves the way for sharing these scripts with each other in a multi tenant environment. This would add significant value in the said multi-tenant environment especially when a set of standard analyses are already in place that others could reuse, thus reducing time taken to perform analytics on adherence data.

Form schema 

Mhealth systems that were being developed on MoTech had another common functionality of data collection. Implementers wanted to spin up forms that would capture the necessary data very quickly. The traditional way of creating a HTML form, creating controller and services was proving to be too expensive. Hence MoTech has adopted a pattern that is already seen in projects like RapidFTR and Datawinners, which provides the implementers the ability to define form schemas using JSON and MoTech would take care of rendering the form on the UI and provide default CRUD operations through the form. This seems to be fairly adopted and well known pattern as there is a jQuery library which takes in form schema definitions and generate HTML forms.

Tenant extensions

A Multi tenant system in essence allows a single instance of a software system to serve multiple clients. The complexity of the multi tenant system is directly proportional to the complexity of the domain model of the system. Motech is a multi tenant system. Fortunately, since MoTech is a platform, the scope of MoTech’s domain model is small enough to keep this complexity under control.

There’re two ways to go about building a generic platform which is brought out well by Guy Steele in his excellent talk about the Java platform at OOPSLA. Steele argues that the best way to build a generic system is to use the “market approach” where users contribute to the development of the system as opposed to the “cathedral approach” where one person designs the entire system.In accordance with the market approach, MoTech currently wants to expriment with the idea of an implementor module providing services to other modules. Again this is an approach that is already  seen in industry with products like sales force and to some extent, android etc.

Quote for the day,

“If I have seen farther than others, it is because I was standing on the shoulders of giants.” – Sir Issac Newton



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s