Patients System: programming for the people

It’s in our human nature to want to help and assist the ones in need. Sometimes we wish we had the time to help more, and sometimes we need people to help us instead, but the question that came up for me was:

How can I help people as a software developer?

Last summer I joined with a group of friends an initiative called “Manos a la Obra“, as part of the Engineering and Computer Science staff, to teach the basics about computers in a small town called “Carmen del Sauce”. But additionally, I started a web application project to help doctors, making a Patient Clinic History Management System, so they can have real-time and easy statistics gathering of people’s diseases they treat and assist.

There’s plenty of initiatives for people to help others through programming/developing software, you just need look finer in your hometown, and have ideas to share.

This blog post is about PPS, the Patients System I made helped by doctors and close friends, with Node.js, Jade Template Engine, Express MVC Framework, Mongo DB and PhoneGap.

First of all a little system architecture for a wider perspective:

PPS Architecture

The system has 2 parts:

  • Web Application
  • PhoneGap application companion.

The Web Application was made with:

The screenshots of the whole Android Application can be seen by clicking here or in the picture below. In the picture I’m showing one of the sections of the Form, with the Reset button and the Submit.


The application had a main menu, a search list and only one form to submit, but the difficult part was that they were almost 70 fields to submit (4 sheets of A4 sized paper), so at this point I had to rethink the way that I can submit the form. At last, I decided that the application had to be able to save a partial form, and save it incrementally. so nothing gets lost in the rush. There are a few fields which are required though, like the Name, the ID and the Age.

One big time saver for this app, was jQuery Mobile and its collapsibles (aka “accordions” if you used jQuery UI before), which helped me to separate the form data and classify it in sections like in the real paper form. This way, the doctors could enter a section in the form, expand the collapsible, enter the data, and save it if they wanted to have a partial form from the patient. The doctor could hold the whole form and access the data he wanted just clicking/touching the collapsible section.

The authentication was very simple at that time, using a single password with Passport.js, because of the limited scope, but in the future this app is going to be able to login with a facebook, twitter or google account.

And for the DB, Mongo with Mongoose ODM (Object-Document Mapper) offered a really fast implementation with javascript syntax, so I didn’t have to switch my mind to a SQL language to make all the CRUD operations, and include these operations into my main server without loosing legibility.

The PhoneGap application was tricky at first, and I kept it as simple as I could, once again because of the application’s scope and the time remaining for the deliverable.

As a main introduction to phonegap I will say that it is a big time saver for very focused web developers. If you already have a web app made in html5, you can make a WebView in Android and load static html code that can interact with your mobile device, almost like a normal Android Application. It still has some limitations like there is no Calendar plugin support, and that in my case I had to fix the datepicker plugin, which has code in javascript and Java.

The best thing of PhoneGap is that it intends to ease the development of small/short-scope mobile apps. You can’t do complex stuff, with big amounts of data processing, but you can send them to a server that really can and have a really good presentation in your mobile device without the need of Android UI skills, and leveraging of your previous Web design templates.

I had to make a cell phone companion, because of the poor reliability of the local internet/3G service and the high cost expenses of Argentina’s cellphone carriers. The option was to leverage the local SQLite DB in Android phones and synchronize this data with the server “on demand” with a Sync button. This was just as complex as adding a new button on the Menu interface and have a REST call to the main server (where the Web app resides) to save the new data and update the existing one.

As PhoneGap doesn’t work with Jade TE, I had to copy/paste the static html, to have a base. The logic was very similar but in this case I had to get my hands dirty with SQL instructions inside String variables. Also, I had to modify the DatePicker plugin to make it work with my Time Zone and Date Format.

The integration went very good in the end, and the application is in its first releases for testing. We had a very good start and I think that the second spin for this app is going to be greater.

Last but not least, I would like to thank all the people and friends that helped in testing for the first releases and the organizers of “Manos a la Obra” initiative, and special thanks to all the geek staff (which I’m proudly part of) at Pastoral Universitaria de Rosario, for its collaboration and continuous support all along this year in this project.


Leave a Reply

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

You are commenting using your 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