Sunday, June 17, 2007

A Tale of Four Fonts

This post is a rant.

This is driving me nuts. I'm struggling to find a font in OpenOffice that is consistent size across Windows, Linux, and OS X. Not only do they not all have the same selection of fonts (they don't even all have Helvetica or Georgia!), but the same font appears differently on all of them. Here are some screenshots using Times New Roman, bold, 11 point.

1. Windows

2. Linux

3. OS X using the X11 OpenOffice

4. OS X using NeoOffice

Saturday, June 16, 2007

OpenOffice XForms and Bindings

Good news! In my last post, I complained about OpenOffice's lack of control when dragging elements from the data navigator to your document window to create bindings automatically. It seemed that you were limited to a LabelField and TextBox, and you could only replace the TextBox with a limited number of controls.

Further research has shown me that these two controls are actually grouped together - hence the lack of control over them. I found that you can ungroup them and you have two separate controls, and can then replace the TextBox with whatever you want.

Here's an example of how to do this in OpenOffice. I'll use the "patient.birthday" which we'll need to change to a date field. (Note that the following screenshots are from an awesome program called NeoOffice, an OS X port of OpenOffice that currently uses version 2.1. I've been trying it out, and so far it seems really really cool.)
1. Drag an element from the data navigator to your document. It will look like this:

2. Ungroup the controls. This can be done via Format | Group | Ungroup, or by adding the Ungroup button to your toolbar:

3. You can then click on the individual controls and edit them. Here we'll replace the TextBox with a date field:

4. You can make a pretty calendar-like date select field by setting the "Dropdown" property to "Yes" (thanks to omarc55 for this tip!):

5. All of your XML data from the schema should be there:

6. You can now also change the LabelField to read something more user-friendly like "Date of Birth:".

I'm pleased as punch to have found this. It should make creating this forms MUCH easier. It also opens up form creation to the less technically-inclined people out there.

Friday, June 15, 2007

Form design in OpenOffice

(Note: After you've read this, see my follow-up post.)

This past week I've been working with InfoPath and OpenOffice.org side-by-side to compare what InfoPath can do vs. what OpenOffice can do. I've started creating the Adult Initial Encounter form in OpenOffice, and so far I've been quite pleased with the results (as have the rest of the OpenMRS gang). Here's a screenshot of part of the form:


I'm noticing that while InfoPath has a lot of drag-and-drop functionality, OpenOffice leaves much of it for the user to do. For example, in order to create a binding in InfoPath, you simply drag an element from the schema over to the document. You can then change what type of control it is (text field, radio button, date field, etc) and it will be nice and bound to your schema:

In OpenOffice, this isn't quite as easy. While you can drag an element from the data navigator directly to the document, you don't seem to have much control over what type of form control gets added. As you can see from the picture, it defaults to a simple text field with a label that I can't seem to change. While it allows you to replace the control with other controls, your choices are very limited. Hopefully this will be further developed in future versions:

In order to bind everything in OpenOffice, I've been selecting the binding from a drop-down list in the data tab of the control properties window. While this is perfectly doable, it's a bit tedious. I've posed a question to the OpenOffice Users mailing list about this, so hopefully I'll have an answer soon.

If there's no better way to do this in the GUI, it's possible that I may be able to write a script that edits the XML files in the .odt file that OpenOffice generates that fills in all of the bindings and default values. Both the InfoPath .xsn files and OpenOffice .odt files are zip files that contain XML and style sheets defining how the forms look and behave.

When the forms are submitted, they send an XML file to a remote server which then has some XSLT which translates the data to HL7. Here's an example of what this looks like, taken from the first screenshot, question 11a, "Is the patient or their partner currently using any form of family planning?":

If the user of the form checks the "Oral Contraceptive Pills" box, the <oral_contraception/> element is set to true, and 780^ORAL CONTRACEPTION^99DCT is the HL7 that is submitted.

I'm currently working on the rest of this form, and I'll start work on the others once it's finished. While the Adult Initial Visit form is rather large and tedious, I figure it's a good place to start because it will have a lot of reusable elements that I can copy and paste into other forms.

I'm pretty pleased with progress so far - I think things are going along quite nicely. Comments?

Monday, June 4, 2007

Week One - Getting Started

After meeting with my mentor and organization admin, my task for the first week has been laid out for me. I'm going to walk through the process of creating and using a form in InfoPath, and document how it works with OpenMRS. This serves three purposes: first it will allow me to understand this process and learn how everything works together. Second, it will show me what needs to be done in OpenOffice, and I'll find out what OOo can already do vs. what I need to make it do. Third, it will allow me to write documentation for this on the wiki for the benefit of other developers and the implementors. Keep an eye here for the documentation as I write it.

Note: I'll write more on this post when I return home to where the stuff I already have done is.

Thursday, May 31, 2007

Summer of Code as a Learning Experience

As I watched Summer of Code students discussing their projects on the IRC channel, something occurred to me: while SoC is a fantastic learning experience, there isn't much student-to-student learning. Student coders can learn from their projects, mentors, books, Google, etc, but not as much from each other.

I'd love to see more explanation of what other students are doing. Many of the students are light years ahead of me in terms of coding abilities, and I think there's a lot I could learn from them. There are so many projects working with concepts I don't understand and I would like to.

People seem to be blogging a lot more this year than they did last year, and that's awesome. The Planet SoC feed seems to be busier this year as well. We should use this increase in blog popularity to teach each other about what we're doing. Not just saying what our project deals with, but taking the time to explain concepts and maybe even mini tutorials - teaching in general.

Anyone else with me?

XForms/OpenOffice Resources

I'm going to use this post to collect useful resources that I find regarding XForms and OpenOffice (and general OpenMRS info). I'll update it as I find more, and I encourage anyone that has anything to add to leave comments.

Using XForms in Office Applications
The OpenOffice.org XML Project
OpenOffice.org module xforms
Wordpress search for "XForms" tag
W3C's XForms Specification
OpenMRS - Administering FormEntry
OpenMRS - InfoPath Notes
OpenMRS Data Model
GUI Architectures (useful MVC info)
OpenMRS - HL7
Office 2003 XML Reference Schemas

Tuesday, May 29, 2007

OpenMRS on OS X

I successfully got OpenMRS up and running on OS X. Instructions can be found here.
Just for fun, here's a screenshot.

Monday, May 28, 2007

Cloud

Hooray, I have a cloud now. Thanks to this frivolous motion post. The larger the word, the more frequently I've used that tag, and vice-versa. Click on any word to see all posts with that tag. Very cool.

One Laptop Per Child Game Jam

According to this PCWorld article, One Laptop Per Child is holding an educational game development jam on June 8th. Oh how I wish I actually had game development skills since this is something I'm very, very much interested in.

If anyone reading this plans to participate, please let me know what you plan on doing! I'd love to know. Also, if anyone has an idea and wants a Python coder, I might be interested...

Saturday, May 26, 2007

More Widgetry

I'm getting a little better with Dashcode now, although not at the point past simple RSS feeds. I'd like to learn how to add configs to filter the feeds by tags, but I'm not quite there yet.

I've made a simple reader for PlanetSoC, which can be found here. Hopefully this will be useful to someone...please let me know if any suggestions/comments.

UPDATE: Dashcode doesn't show the author of posts by default it seems. Big thanks to KillerX for modifying the Widget so it now shows author names!

Friday, May 25, 2007

OpenMRS Widget

I've just been playing with OS X's Dashcode beta, which is a preview of the Dashboard development IDE in Leopard. It's pretty cool, although a lot of very useful features aren't implemented yet, so you have to open up the Widget and manually change several things to customize your Widget.

As my first Widget, I created an RSS feed reader for the OpenMRS feed. If you're running OS 10.4.3+, you can grab the Widget here. I want to make this something that's actually useful to people, so if you have any comments or suggestions, please let me know.

Book Reviews

In preparation for both Google Summer of Code and my computer science writing course's final paper, I read several books. Since both subjects are about open-source software, I bought three books on this topic:

The first was Open Sources 2.0, edited by Chris DiBona (of Google fame), Danese Cooper, & Mark Stone. I thought this book was just a second edition to Open Sources: Voices from the Open Source Revolution, but it turns out it's more of a second volume. I'll have to get the other one to read as well.
This book really blew me away and kept my interest. It's a collection of essays regarding creating open-source software and the culture around it. The introduction takes the reader to the Burning Man festival, and compares its culture with that of open-source. I found that this introduction really got me in the mood for the rest of the book. A few chapters that I found particularly interesting were Chris DiBona's "Open Source and Proprietary Software Development", Jeremy Allison's "A Tale of Two Standards", and Bruno Souza's "How Much Freedom Do You Want?" Considering the wide range of topics covered on both proprietary and open-source software development, I feel that anyone and everyone interested in writing software professionally should have to read this book.

The second was Producing Open Source Software by Karl Fogel. This book could very well be considered "The" book on administrating and participating in open-source projects (and in fact, its subtitle is "How to Run a Successful Free Software Project"). Fogel gives an overview of all of the components of open-source projects, as well as things that can go wrong and ways to prevent them from doing so. In terms of books for my paper, I probably could have just read this one and had all the information I needed. Definitely a good read and highly recommended.

The last was The Success of Open Source by Steven Weber. Since I had already read Producing Open Source Software, I found this book to be mostly a rehashing of information. It focuses more on administrata, law, and culture rather than the specific components of free software, but Fogel's book had a lot of that as well. In terms of writing style, I found it to be a bit dry but interesting enough to keep me reading. A good read if you're interested in the above topics, but not so much if you'd rather get into the more technical side of things.

In order to prepare for my work with OpenMRS, I picked up a few books about XForms, XML schema, and OpenOffice.org macros.

The first book I started reading was Definitive XML Schema by Priscilla Walmsley. This is a pretty good (and thick) book with everything you'd need to know about XML schema. There are plenty of examples to look at and understand, and Walmsley seems to give pretty sufficient treatment to the topics covered. I chose this book over the O'Reilly version because O'Reilly's seemed too dry and terse for what I needed.

I'm currently working through XForms Essentials, an O'Reilly book by Micah Dubinko. So far I'm loving it. It gives an introduction to XML forms (and tells why they're better than HTML forms), and describes all of the components that make up XForms. Examples are given, and this book could also serve as an XForms reference since it gives listings and descriptions of things like XPath functions and XForms datatypes. Definitely worth picking up if you're looking to work with XForms.

I haven't had a chance to sink my teeth into it yet, but I also picked up OpenOffice.org Macros Explained by Andrew Pitonyak, published by Hentzenwerke Publishing (I make special mention of the publisher here because their motto is "Moving from Windows to Linux", and I'd like to explore what other books they have on this subject at some point). While I haven't read much of it yet, it looks like a pretty solid guide to working with OpenOffice.org macros and using the OpenOffice.org Basic language. It should also serve as a handy reference for when I need to look up a specific function. Unfortunately, it doesn't seem to go into advanced topics like accessing the OpenOffice.org API from Python/Java(script)/etc.

All in all, some really exciting books. Open Sources 2.0 is probably the coolest, so pick it up. Also, I have several more books on my Amazon wishlist, so feel free to be my best friend and buy me one =)

Thursday, May 24, 2007

First Post

Here's the inaugural post for my new blog which I hope will be filled with my general thoughts and experiences with coding, and most importantly, my progress for my summer internship with OpenMRS.

I'll be working on their data entry tools to migrate them from proprietary software like InfoPath to open-source tools like OpenOffice.org which utilize XForms. I'm extremely excited and can't wait to get started!