Getting started with OpenMRS was the hardest part. This post is a compilation of some technical notes on the major issues I had getting set up.
Here are my general purpose trouble-shooting tips from the early weeks of GSoC…
- Make sure database is working and has a password
- Check that subversion is updated to HEAD
– to see what revision you have, right-click on folder in Eclipse-> Properties -> Subversion
- Give Maven extra memory
- When in doubt, restart Eclipse and/ or computer
- In the event of an, “Error: Unable to connect to the database” I had a few tricks, but I’m not sure any of these would work every time.
– find and delete the .OpenMRS folder
– go to Activity Monitor and quit mysqld
– restart computer, and rebuild OpenMRS
This summer was also the first time I used the command line besides experimenting for no reason.
- (working on list of helpful OpenMRS commands)
Tomorrow is the suggested “Pencils Down” date for writing code, so this week can focus on cleaning up code, documenting everything, and getting tests in order.
I wanted to tackle some interesting issues with my project last week, the much anticipated week 12, but my mentors suggested it might be a little ambitious for the last five days and it would be best not to leave any to-do’s unchecked. I agreed, although it reminded me of the first few weeks of this summer. I was in a hurry to do so many things, but needed to slow down to do them right.
If I had the option leave school and work on projects like this forever, and learn everything I need to know as I go along… I wouldn’t, but it would be tempting. I had to learn more for this project than any CS class I’ve taken in college. It was also more real and meaningful. I can’t imagine graduating without having an experience like GSoC with OpenMRS this summer.
I hope this is the moment when the training wheels get taken away and all of a sudden I realize that I know how to ride a bike.
OpenMRS uses hibernate (the noun – the “open-source object-relational mapping tool.”) to help objects communicate with the database.
Using the Module Maven Archetype gives you the option to add a service layer. When I was setting up my module I said yes to adding a service layer just in case, and didn’t think much about it until a few weeks ago. The reason I decided to implement a MergeConceptsService was that I wanted a query from the openmrs database that wasn’t directly available using the ObsService.
The Module Maven Archetype option to add a service layer gives a module four files that make up the service layer: DAO, HibernateDAO, Service, and ServiceImpl. DAO and Service are interfaces implemented by HibernateDAO and ServiceImpl. The HibernateDAO is home to the sessionFactory, which actually connects to the database. The ServiceImpl will instantiate a DAO, and then the module controller is free to instantiate a Service.
The hibernate mapping file is unnecessary unless you are using hql to change a table.
I have yet to mention my thing for double numbers in this space. My grandpa always said they were lucky, or something. I actually didn’t know he said that until after he died. Then double numbers sort of became a family thing. This past week, I worked and accomplished more than any other week this summer. Sitting in my quiet house trying to think about how to sum it all up, I just realized that this successful week was week number 11. Figures. 🙂
I actually started with undoing most of the code I had for converting observations from one concept to another in favor of using a service method instead. I was struggling with unit tests because concepts can have different datatypes and the ObsService rejects saving a “question concept” as an “answer concept.” Good thing I was having trouble – it lead me to a thoughtful conversation about making sure certain aspects of a concept are preserved in a merge, even when an ObsService wouldn’t cause a problem.
This being week number 11 makes next week number 12 out of 12 full weeks of GSoC! How do you express freaking out via blog post? Just kidding. I’m looking forward this last real week. I’m excited and nervous about going back to school and finding out what being involved with OpenMRS will look like when I don’t have two incredible and official mentors…