Dealing with Metric units vs Imperial

3 views
Skip to first unread message

OKB

unread,
Dec 9, 2013, 4:53:48 PM12/9/13
to implem...@openmrs.org
How do we all deal with imperial units vs metric and vice versa?
In some cases, values may have to be converted from one to the other and back and that may cause precision issues discussed previously for temperature.

Specifically, when recording values like patient height and weight, how do you enter that data into an obs while maintaining consistency?

Thanks!

Hannan, Terry J (DHHS)

unread,
Dec 9, 2013, 5:01:19 PM12/9/13
to implem...@openmrs.org

I thought this topic was discussed extensively earlier this year or last year and where Burke had a major input.

 

Dr Terry J. Hannan MBBS;FRACP;FACHI;FACMI
Consultant Physician
Clinical Associate Professor  School of Human Health Sciences,
University of Tasmania Department of Medicine, Launceston General Hospital
Charles Street Launceston 7250

Past President Australasian College of Health Informatics(2007-9)

Visiting Professor, Universita di Modena, e reggio emelia, Italy (Sept-Nov 2010)

 

Moderator: http://www.ghdonline.org/

 

Ph. 61 3 6348 7578
Mob. 0417 144 881
Fax 61 3 6348 7577
Email terry....@dhhs.tas.gov.au

 

Web/Blog: www.austemrs.com.au

 

Skype: thehannans

--
OpenMRS Implementers: http://go.openmrs.org/implementers
Post: implem...@openmrs.org
Unsubscribe: implementers...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/

To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.




CONFIDENTIALITY NOTICE AND DISCLAIMER
The information in this transmission may be confidential and/or protected by legal professional privilege, and is intended only for the person or persons to whom it is addressed. If you are not such a person, you are warned that any disclosure, copying or dissemination of the information is unauthorised. If you have received the transmission in error, please immediately contact this office by telephone, fax or email, to inform us of the error and to enable arrangements to be made for the destruction of the transmission, or its return at our cost. No liability is accepted for any unauthorised use of the information contained in this transmission.

OKB

unread,
Dec 9, 2013, 5:08:51 PM12/9/13
to implem...@openmrs.org
You are right in that it was discussed, but I saw no definitive strategy for dynamically dealing with it other than to pick a standard and convert.

If that is the case, any examples of robust conversion code snips would be greatly appreciated.
I am using some basic math to do the conversion, but I'd rather not reinvent the wheel if it's been done already.

Thanks!

Hannan, Terry J (DHHS)

unread,
Dec 9, 2013, 5:10:48 PM12/9/13
to implem...@openmrs.org

I could be brazen enough to say “all go metric” however I am not sure how that would be received J

Darius Jazayeri

unread,
Dec 9, 2013, 5:48:30 PM12/9/13
to implementers
In Mirebalais we have the following code snippets. (The idea is that you'd typically fill out the metric field, but if you want you can go to the associated imperial field, and put a value there, which is converted to metric, and written into the metric field. And then we store metric obs.

            var fahrenheitExitHandler = {
                handleExit: function (fieldValue) {
                    if (fieldValue && fieldValue.value()) {
                        setValue('temperature_c.value', convertFahrenheitToCelcius(fieldValue.value()));
                        jq('#temperature_f').val('');
                    }
                    return true;
                }
            }

            var convertFahrenheitToCelcius = function(tempFahrenheit) {
                return ((tempFahrenheit - 32) * 5 / 9).toFixed(1);
            }

            var lbsExitHandler = {
                handleExit: function (fieldValue) {
                    if (fieldValue && fieldValue.value()) {
                        setValue('weight_kg.value', convertLbsToKg(fieldValue.value()));
                        getField('weight_kg.value').change() // trigger change event so BMI is updated
                        jq('#weight_lbs').val('');
                    }
                    return true;
                }
            }

            var convertLbsToKg = function(weightLbs) {
                return (weightLbs / 2.2).toFixed(1);
            }

            var inchesExitHandler = {
                handleExit: function (fieldValue) {
                    if (fieldValue && fieldValue.value()) {
                        setValue('height_cm.value', convertInchesToCm(fieldValue.value()));
                        getField('height_cm.value').change()
                        jq('#height_inches').val('');
                    }
                    return true;
                }
            }

            var convertInchesToCm = function(heightInches) {
                return (heightInches * 2.54).toFixed(1);
            }

-Darius

Hannan, Terry J (DHHS)

unread,
Dec 9, 2013, 5:50:44 PM12/9/13
to implem...@openmrs.org

Darius, this demonstrates why OpenMRS is such a wonderful project with people like yourself! Inspiring!. Terry

 

Dr Terry J. Hannan MBBS;FRACP;FACHI;FACMI
Consultant Physician
Clinical Associate Professor  School of Human Health Sciences,
University of Tasmania Department of Medicine, Launceston General Hospital
Charles Street Launceston 7250

Past President Australasian College of Health Informatics(2007-9)

Visiting Professor, Universita di Modena, e reggio emelia, Italy (Sept-Nov 2010)

 

Moderator: http://www.ghdonline.org/

 

Ph. 61 3 6348 7578
Mob. 0417 144 881
Fax 61 3 6348 7577
Email terry....@dhhs.tas.gov.au

 

Web/Blog: www.austemrs.com.au

 

Skype: thehannans

 

OKB

unread,
Dec 9, 2013, 10:43:42 PM12/9/13
to implem...@openmrs.org
Thanks for the code Darius, it's greatly appreciated!

Burke Mamlin

unread,
Dec 9, 2013, 11:41:02 PM12/9/13
to implem...@openmrs.org
In most cases, medical care uses metric units.  These can be converted to imperial units for display.  When data need to be collected in imperial units, convert to metric and store enough precision to reproduce the imperial units as entered when converting back later for display.  As a last resort, store metric or imperial data using unit-specific concepts and manage the conversion on demand (and prepare to apologize to anyone trying to use the data later). :-)

-Burke


OKB

unread,
Dec 11, 2013, 4:14:10 PM12/11/13
to implem...@openmrs.org
We have decided to use metric only for storing observation data as you suggested, however I'd like to make things easy for data entry personnel.

I could do one of the following:

1) Create new observations and collect imperial values, then convert as you recommended and store metric values using javascript.
2) Insert an online calculator to convert between metric and imperial values.

I'm leaning towards your approach being cleaner and easier to learn especially with a new system.

Considering there are very few places this will occur, i think it's an acceptable trade-off to duplicate observations like height and weight.

Any further thoughts are welcome!

Ope

Darius Jazayeri

unread,
Dec 11, 2013, 5:20:37 PM12/11/13
to implementers
Hi Ope,

You will probably be better off if you store all the obs using metric units. If someone is querying/exporting data, you want them to be able to just fetch all obs of one concept, not to have to fetch two different concepts, and convert.

(We chose an inline calculator. The best approach depends on your use case, and how common it is for someone to do metric vs imperial.)

-Darius


To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.

OKB

unread,
Dec 11, 2013, 5:33:13 PM12/11/13
to implem...@openmrs.org
Can you give me some idea how you implemented the in-line calculator?
I have been researching this all day.

Darius Jazayeri

unread,
Dec 11, 2013, 5:47:11 PM12/11/13
to implementers
Hi Ope,

I included some code earlier in this thread that does this by have two fields (e.g. one for cm, one for inches, and if you fill out in the inches one, it converts the data, populates the cm field, and clears the in field). This worked for us, as users are doing high-volume keyboard-only entry. The whole form is here: https://github.com/PIH/openmrs-module-mirebalais/blob/master/omod/src/main/webapp/resources/htmlforms/vitals.xml

-Darius

Ope Bakare

unread,
Dec 11, 2013, 5:52:10 PM12/11/13
to implem...@openmrs.org
Darius,
Thanks so much!

My apologies, I made an error on the use of the code snippets posted yesterday.

I'll be giving this a try tonight.

Ope Bakare

unread,
Dec 16, 2013, 1:47:13 PM12/16/13
to implem...@openmrs.org
Darius,
I have been a bit tied up so I didn't get a chance to test this until today.

Can you clarify one thing for me; where is the function jq declared?

It is used quite a bit in the code, but since I don't have it included in my openMRS system, there are errors in javascript.

Thanks!

Ope

P.S. This is an example snip of code I'm referring to:


// fahrenheit to celcius converter

            var fahrenheitExitHandler = {
                handleExit: function (fieldValue) {
                    if (fieldValue && fieldValue.value()) {
                        setValue('temperature_c.value', convertFahrenheitToCelcius(fieldValue.value()));
                        jq('#temperature_f').val('');
                    }
                    return true;
                }
            }

Darius Jazayeri

unread,
Dec 16, 2013, 5:15:52 PM12/16/13
to implementers
Hi Ope,

jq is jQuery. In your OpenMRS installation you should use $j instead.

-Darius
Reply all
Reply to author
Forward
0 new messages