Background
OpenMRS now has a few different mechanism for adding custom datatypes to the system. This wasn't planned; rather, it happened organically. Our hope is to bring these mechanisms closer together in design with the hope to eventually combine them into a single approach that meets all needs. First, we'll provide a brief history of how we've gotten to the point we are now.
When the person
table was initially introduced into OpenMRS, all implementations were constrained to use the same attributes. Then, a bright young Ugandan (~dkayiwa) suggested that we introduce the same flexibility of an entity-attribute-value (EAV) approach into the person
table as we had done with our observations in the obs
table. This approach allows implementations to virtually extend the person table to meet local needs. For example, in Tanzania, they wanted to track "ten cells", which are a type of addressing used in Tanzania. To accomplish this flexibility, we added a person_attribute
table to contain implementation-specific data about persons and a person_attribute_type
table to define the new "attributes" (virtual columns) for the person table. Using this mechanism, an implementation in Tanzania could define a new person attribute for "ten cell" and use it to store data for each person in their system. Person attributes have been widely used & appreciated, since they allow OpenMRS to meet local needs by making local extensions to the data model.
In an unrelated effort, we had designed a method for handling complex observations. One of the primary features of OpenMRS is to gather observations about patients (pulse, weight, test results, answers to questions, etc.). Sometimes these data can be more complex than a simple number or string. For example, storing an chest x-ray image, an electrocardiogram of the patient's heart rhythm, or a lab results for culture results that is delivered as a large document. Complex observations were designed to accommodate these observational data – i.e., data that aren't primitive datatypes.
Placeholder for discussion regarding how we converge:
- generic AttributeType as introduced for Visit
- person attribute types
- complex obs handlers