Hey everyone. Summer of Code 2007 is now finished, and we have gone quite a long way since we started laying the foundations for the Logic Service.
So, how far have we actually gone? In terms of architecture, things are pretty much wrapped up. The foundations seem solid enough, as they endured different types of requests that we have encountered so far. In terms of what's implemented, there are 5 functional Rules, 2 datasources, 2 levels of request caching and a bunch of other stuff. We have a clear path of what's ahead of us, and will be striving towards making the Logic Service a key service in OpenMRS. As the Logic Service isn't in its infant stages anymore, testing and feature requests are a must. Burke and I will continue to improve the Logic Service with the help of you, the interested developer.
If you already haven't, check out the Rule HOWTO to see what's it all about. It will help you form a clearer picture of just what you can do with the Logic Service, even in this early development stages. (Yes, it's still "early", but not "infant".) And if you don't like something you see, let us know!
Now, what do we plan to do next? Burke suggested that we introduce something called "LogicRequest". This request object will serve as a single container for all the stuff that gets thrown between different layers - the cohort of patients, the LogicCriteria object, the index date relative to this request and the cached data for this request. The idea is very good, as it will create a sort of a "context" for a given query, and also allow us to support per-request caching. More on this when it's up and running.
So, as you probably guessed from this post, I'm staying a part of the community, and I'm proud of it - this has been an amazing summer! I'm sure it will continue in the same fashion. ;-)
Yesterday I was involved in the OpenMRS weekly developer's call, which was almost completely dedicated to logic service development. Burke and I received some very helpful advice, and there were also questions and concerns that helped see what are other developer's expectations of logic service. I discussed those things with Burke over e-mail today, added them to my TODO list, and will start acting on them one-by-one.
Currently, I'm in the process of creating the HIV POSITIVE example rule. I plan on making a Rule-HOWTO on the wiki, and I'll use this rule as an example, since it will help developers get a programmer's look on how things will be done once they start writing their own rules. I'll post an update about this as soon as it is finished (should be in a couple of days).
Although I didn't blog about it, that issue with Spring is now resolved. The problem was inadequate project cleaning - I cleaned the project with Eclipse -> Project -> Clean, while it was necessary to clean it with "ant clean" and then with Eclipse -> Project -> Clean. Not a very nice experience, since it took quite some time to nail down the bugger. :-)
The function that will be handling the conversion from Logic service's LogicCriteria object into Hibernate's Criteria object is almost done. I have added most of the functionality that will be required of logic criteria, and the basic requests (as mentioned in my previous post) should be handled 100%.
But. When I started the JUnit testing, Spring started to spit some ugly stuff at me. Very rude. I have little knowledge of Spring, so I asked Burke if he could help me understand what went wrong. That said, I have no way of knowing if the stuff actually works until I run some live tests.
Still, I committed the changes, so everyone interested (or eager to help me resolve this issue and beat Burke to it ;-) ) is welcome to browse the code.
Our first simple test works and retrieves all CD4 COUNTs for a given set of patients. This is great news, and proves that our model's got what it takes. Of course, problems can (and probably will) arise as we build more and more advanced functionalities, but we're looking forward to coping with them. :)
Also, logic criteria is now implemented, and it's giving people the opportunity to express their queries in a simple way. For example:
new LogicCriteria("CD4 COUNT").lt(200).within(Duration.months(6))
Although the LogicCriteria class is now functional, an important part of the logic service is yet to be implemented - the routine(s) to convert the LogicCriteria into Hibernate's own Criteria object, which can then be passed to the database layer. Stay tuned! ;-)
Hey all. Long time no write. This was definitely not because there was no activity - on the contrary. Burke and I have been very actively discussing, hacking, flaming and thinking through the numerous decisions regarding the skeleton of the logic service. Now, after a couple of weeks of intensive brain and finger work, we finally came to a point where we are very satisfied with what we've accomplished and need input from people.
The skeleton is finished, technical overview is available, code is available via Trac, and everyone's invited to read through both and share their thoughts with us.
So, the Logic Service Project's wiki page has been set up.
As you can see (you looked at that wiki page, right?), what we're going to create here is a very flexible logic engine. It will be easy to use (and that's a MUST!) and yet prove to have some brains of it's own. It will achieve this by abstracting a couple of very important concepts.
In terms of interaction with the end user (medical staff), the only visible part of the logic engine will be the Rule Builder (working title ;) ) and the results retrieved by using the created rules. Now, this sounds pretty straightforward, but actually the interesting part is that the user will be able to apply the created rule to a number of different data sources. Hopefully he/she won't even know where the results came from, as OpenMRS will expose very few (if any) internal concepts to the user. The fewer concepts exposed, the better, and that will be a challenge.
What stood out to me as the coolest concept we'll introduce (among those listed on the wiki) is decision support. Basically it will add the "brains" to the engine - it will do the thinking for you. For example, if a patient is HIV positive and hasn't had a CD4 count in 6 months, then OpenMRS will report to our medical staff user that a CD4 count is advised. No need to browse through results and try to figure it out on your own. Perhaps these "decision rules" can even be run automatically as a background task every once in a while, so that when our medical person, say, turns on her laptop in the morning, she will have a list of recommended actions for all the users that need some kind of attention.
That's my (very basic, still) view of the situation, people. This will definitely be a fun summer!
Oh and by the way, <cheesy>I really must praise the code style used throughout the logic service skeleton, created by Burke Mamlin (my mentor).</cheesy> No really. I've seen good code, and I've seen some awful-eye-distorting-don't-look-at-it-too-much code, and this one's got my thumbs up.






