UCUM
Okay, so first thing we should do is make a note of what unit preferences our instance administer has set.
In your instance go to administration ->globals->locale and look at the “units for visit forms field”
Now let’s figure out where this info is stored in the database. In the locale menu right click pretty much anywhere and select “view frame source.”
This will open a new tab. Look in the address bar. You see the code that is running this part of this page is in openemr/interface/super/edit_globals.php
Go ahead and find and open that file in your editor of choice and take a look around. The SQL statements I see being built go into a “globals table” let’s open phpMyAdmin and take a look in there.
So we have global names, gl_index and gl_value.
My first guess as to the one we’ll want to check is called “units of measurement” 0,1
I have my units set to the default option for visit forms.
If you go back to the html file that was opened when you inspected the frame, do a control+f search for units.
You’ll see the below:
-
<div class='row form-group'><div class='col-sm-6 font-weight-bold'>Units for Visit Forms</div><div class='col-sm-6 oe-input' title='Applies to the Vitals form and Growth Chart'> -
<select class='form-control' name='form_50' id='form_50'> -
<option value='1' selected>Show both US and metric (main unit is US)</option> -
<option value='2'>Show both US and metric (main unit is metric)</option> -
<option value='3'>Show US only</option> -
<option value='4'>Show metric only</option> -
</select>
You can see that option 1, which I have currently selected is what you see in the gl_value field in the the globals table in the database.
To confirm I’m going to switch to option 4, show metric only, save, and validate that it changed in the database.

And now it’s set to 4.
Other gl_name fields relating to units:
display_units_in_billing 0, Null
us_weight_format
So the key takeaway is that if when you run the query:
SELECT gl_value FROM globals WHERE gl_name = “units_of_measurement”
If the value is one you need to store the value in US units but also be able to display it along with metric.
If the value is two you need to store the value in metric units but also be able to display in US units.
For 3 I assume you store it as US units and 4 store as metric and you don’t need to display the other.
