This page gives step by step instructions on how to update the data model diagram of OpenMRS. Changes to the data model are unavoidable in a continuously developing system and having properly updated data model diagrams help the developers and users to view the changes pictorially, thus leading to a better understanding of the changes. 

The easiest way to update the Data Model diagram is to download the most recent one from the Data Model page in the MySQL Workbench format and edit it through MySQL Workbench. This guide follows that approach because creating the diagram for a new release from scratch is too troublesome. 


* (Fixed)Modified edit_privilege to correct column size
* (Fixed)Add a table to enable generic storage of serialized objects
* (Fixed)users.retired to BOOLEAN*
<changeSet id="1-fix" author="sunbiz" dbms="mysql">
		<preConditions onFail="MARK_RAN">
			<columnExists tableName="person_attribute_type" columnName="edit_privilege"/>
		<comment>(Fixed)Modified edit_privilege to correct column size</comment>
		<modifyDataType tableName="person_attribute_type" columnName="edit_privilege" newDataType="varchar(50)"/>

Common Changes and How to Apply Them in the Diagram

Adding a new table: 

Changing Table Properties:

If you want to change the properties of a certain table you have perform the following steps.

Changing Data Model Version:

Exporting the Diagrams


If you have any trouble with these post-processing steps, contact Burke Mamlin for help.

Lighten Relationship Lines

Once the SVG has been created, the following steps can be used to lighten the lines between tables (foreign key relationships):

  1. Open the SVG in a text editor capable of performing regular expression search & replace (e.g., Sublime Text 2)
  2. Perform the following search & replaces
    1. Globally replace 
      ^(<path style="fill:none;stroke-width:\[1\|3\];\[^>\]+)(rgb\(0%,0%,0%\))
    2. Globally replace 
      ^<g style="fill:rgb\(0%,0%,0%\);fill-opacity:1;">\n &nbsp;<use xlink:href="#glyph2-(\[12\])
      <g style="fill:rgb(60%,60%,60%);fill-opacity:1;">\n &nbsp;<use xlink:href="#glyph2-\1
  3. Save the changes and open the SVG.  If it worked, then the relationship lines should be lighter.

Convert SVG to PNG

Use a tool like ImageMagick to convert the SVG to a PNG file using 96 dpi:

$ convert -density 96x96 openmrs_data_model_1.9.0.svg openmrs_data_model_1.9.0.png

then create a thumbnail:

$ convert -scale 300 openmrs_data_model_1.9.0.png openmrs_data_model_1.9.0_thumb.png

Special Notes