Thursday, August 27, 2009

In the code

Score 1 for UNICEF Malawi - they picked me up from the hotel this morning.

Sadly, I was unable to visit the internet cafe and sync with github. The internet cafe opens at 8 and the unicef car picked me up at 7:10.

Today was also my first day without coffee, I drank tea instead. The only coffee here is nescafe and i'm not so into it. If I am able to kick my coffee habit - then a true miracle will have occured. I am now grumpy with a bad headache. I guess its a good thing I am half way around the world from people I could seriously alienate.

Another milestone today (today is very momentus it seems) I got my 'Malawi Health' RapidSMS version up and running. Exciting Exciting. For the next few days I will be editing templates to improve data display andd data navigation.

There is a big discussion in the RapidSMS world over apps. Where in the repository should apps go, are there core apps, where should 3rd party apps go, should some of this move to a library, what about projects- are projects apps?

Well - I will leave that to the list to figure out.

What I did was create a MalawiHealth app. I've attempted to make it exensible for future Malawi Health projects.

Classes: - this contains 3 classes. a GMC class (that represents a health center). I inheret adam's Location model (from the location app). Then we have a Patient, this should probably inheret from something. Finally I have a INFSSS model that includes 5 heath indicators (muac, height,weight, oedema,diarrea) and calculators for age and malnutrition. 82 lines of code. Apparently this was originally written with the reporter app, but I think it is perhaps a good idea to build out a datamodel for clarity. - Here is where I parse the sms message. It is very brute force. I intend to spend my last few weeks working on this, especially as I get feedback from the field. Basically, I implemented a tokenizer and a bunch of conditionals that add data and send responses. It is not pretty, but not THAT ugly - and fine for v1 (74 lines).

It seems that many things I have been thinking about have already been included in RapidSMS - isn't RapidSMS awesome! I am very keen on using the Keyword parser (an app) to improve my message parsing in the coming weeks.

I have a, and templates - and this will take most of my time over the coming days. I almost forgot - my fixtures - creating fixtures right now in order to backpopulate the data with data from 2003. Got this 2 days ago from the Malawi Ministry of Health.

Some other apps I will be using are the excel exporting app (although I think this is tag library), and perpahs the ajax app, and of course the admin app (I already mentioned the locations app). I will probably add a document app (I need a better name). This will associate documents with a rapidSMS project - e.g., a sidebar of relavent & downloadable reports/powerpoint presentation etc). We are hoping to turn the Malawi INFSSS system into a one stop shop for all things INFSSS related - so I am trying to aggregate as much useful content as possible.

In this case, since I am bulding the Malawi INFSSS rapidsms system for a particular scenario, I am going to sacrifice some reusability. As I build more health systems, I will probably be able to build out a health app, but perhaps this is a future project for the 13Bit Labs.

Final note on the documentation system:
RapidSMS uses sphinx for documentation. We copied Django. Sphinx is really powerful and an awesome document management system. According to the Sphinx documentation, autogenerating code documentation was an afterthough and that is really apparent when you use the system. Yesterday I build a directory walker that generates a rst file with the classes availabe explicitly stated. Perhaps when RapidSMS is done - I can take a look at the Sphinx code base.

I have been a hermit the last 2 nights. Staying in my room/internet cafe writing code and watching Kung Fu. Tonight though I will go and hang with some of my new friends, maybe we can play bar volleyball again!

I will try not to use demorgans law to reduce all my conditionals to booleans inorder to assign them to variables

No comments:

Post a Comment