Best approach for Lab Test Order functionality?

Hi everyone,

The requirement is to allow doctors to order lab tests and the lab to give results. Considering the deadlines, I must go to a simple solution, if necessary a temporary solution.

I thought of the following flow : The doctor fills in a ‘Lab Test Order’ form with some tests (Question CIEL:1271, possible answers CIEL:300, CIEL:302…) And then the lab technician edits that form to see the tests ordered and to enter tests results (ie : tests answers for the specific tests concepts). The doctor is then able to look at the form and see the tests results.

(That would apply as well to Medication order, and X-Ray order)

First question:

  • Am I looking at it the right way ?

If yes, I want to :

  1. Displays a drop-down list of all possible answers of a Concept (CIEL:1271 - Tests ordered)
  2. Add the possibility to click on an “Add” button to add as many tests as I want
  3. Use the answer to that 1st question (for instance CIEL:300 is an answer to CIEL:1271) to display a field to answer to that last concept (possible answer of CIEL:300 is a numeric value)

I’ve achieved to do (1) with this article : by default the <obs> tag will display a list of all possible answers of a concept.

<obs id="tests" conceptId="CIEL:1271" >

**I've achieved to do (2)** with that [article][2] : there is some JavaScript, combined with the <repeat> tag to add button that displays more lists (however, that is limited to a given number of *obs* and that creates a navigation problem with keyboard Tabulation - but that's ok for now)
*The JavaScript:*
<script type="text/javascript">
		if(jQuery){
		jQuery(document).ready(function(){
		jQuery('#1-removeEntry').remove();
		jQuery('#10-addEntry').remove();
		jQuery('#1-toggleContainer').show();

		jQuery('#11-removeEntry').remove();
		jQuery('#20-addEntry').remove();
		jQuery('#11-toggleContainer').show();
		});


		jQuery(document).ready(function(){
		jQuery('button.addEntry').live("click", function(){
		var correctedAddButtonId = parseFloat(this.id) + 1;
		var contentAddId = "#" + correctedAddButtonId + "-toggleContainer";
		jQuery(contentAddId).toggle(true);
		jQuery('#' + this.id).toggle(false); jQuery('#' + parseFloat(this.id) + '-removeEntry').toggle(false);
		return false;});
		});

		jQuery(document).ready(function(){
		jQuery('button.removeEntry').live("click", function(){
		var correctedRemoveButtonId = parseFloat(this.id) - 1;
		var contentAddId = "#" + parseFloat(this.id) + "-toggleContainer";
		jQuery(contentAddId).toggle(false);
		jQuery( ':input:not(:button)', contentAddId).val([]);
		jQuery('#' + correctedRemoveButtonId + '-addEntry').toggle(true); jQuery('#' + correctedRemoveButtonId + '-removeEntry').toggle(true);

		return false;});

		});
		}
	</script>

The markup:

<repeat>
	<template>
		<div id="{n}-toggleContainer" style="display:none;">
			<p>
				<obs conceptId="CIEL:1273" labelText="Where"/>                                   
				<button id="{n}-addEntry" class="addEntry"><strong>+</strong></button><button id="{n}-removeEntry" class="removeEntry"><strong>-</strong></button>
			</p>

		</div>
	</template>
	<render n="1"/>
	<render n="2"/>
	<render n="3"/>
	<render n="4"/>
</repeat>

**Finally, I've achieved to do (3)** with the <when> tag
<p>
	<obs id="tests" conceptId="CIEL:1271" >                                   	
		<controls>
			<when value="CIEL:856" thenDisplay="#result-tests" />
		</controls>
	</obs>
</p>
<span id="result-tests">
	<p>
		<obs conceptId="CIEL:856" showUnits="true"/>
	</p>
</span>

Second question:

  • How to put that all together to get the result that I want ? that is put (3) into (2)

Thanks for sharing ideas !

Hi @mksrom, were you ever able to get an answer to this question? If you got it working properly, would you mind sharing your completed form?

Hi! So sorry for the late reply, I just joined. Just a quick introduction, my name is Daniel and I am a medical graduate currently awaiting placement as a doctor and I am learning programming in the meantime in hopes to implement a medical record system in the future until I stumbled upon openMRS.

I just happened to come across your post and the code has yet to make sense to me, but I am able to provide some insight on the flow. Generally it looks quite alright, but I think it could add some steps to account for some errors in between. It also depends on the investigation that is ordered. Investigation is a general term used to refer to a test, whether blood or by imaging. So in terms of blood, the flow would as follows:

  1. An order is normally done by form.
  2. Somebody takes the blood from the patient, either nurse or doctor.
  3. Same somebody send blood to the pathology lab, whether by hand or pneumatic tube.
  4. Lab receives, places it to be processed via machine
  5. Results obtained, and inputted into system.

Sometimes things might go wrong in between: the blood could have clotted while sitting in the laboratory, someone might have collected the blood twice, or even results might have been mixed up. Therefore, we have to account for certain ‘human’ errors:

  1. Statuses could be made. Possibly ‘Ordered’ so that the lab knows to expect the sample. ‘Collected’ so that the people handling the ward knows somebody has already collected the blood sample. ‘Sent’ so that the lab knows it was sent to them. ‘Completed’ so that everybody knows the results are back. Lastly, ‘Clotted’ can be added to state that the sample was not viable for processing, and has to be taken again. In which, a new order can be filled. Some people might not see that the sample has ‘clotted’ until much later, so therefore a sort of ‘notification’ pane might help in informing quickly.

  2. Some hospitals make it clear that they do not process the blood until an order is made online. This is to minimise mix-ups.

@arbaughj, Well yes, we have a basic solution with HTML Form Entry. It is far from being a real solution or anything close, but at the time we had very short deadlines and had to provide something.

So here is the workflow of the form:

1/ Doctor opens the form and orders the tests he wants:

Once done, saves the form:

2/ The laboratory technician edits the form from the Patient Dashboard:

The form is displayed differently in Edit mode and the Lab guy can enter tests results:

He saves the form.

3/ Then Doctor can see Lab results:


The form is available here: https://github.com/mekomsolutions/openmrs-module-lfhcforms/blob/dev/omod/src/main/webapp/resources/htmlforms/lab-test-order.html

Note that:

  • This form refers to our client’s Concept Dictionary (LFHC) and not only CIEL. You need to remove all reference to those concepts.

  • In the Header, the form defines its metadata:

    formAddMetadata=“yes” formUILocation=“patientDashboard.visitActions” formOrder=“8” formIcon=“icon-stethoscope” formShowIf=“” formDisplayStyle=“Simple”

    You can just delete that, you don’t need it.

  • In order to display nicely the View mode (the Encounter list of the Patient Dashboard) we apply handleViewMode() Javascript function to the form:

handleViewMode(“074c6c42-7f24-46dc-87d4-e71951207d22”);

available in the sources: https://github.com/mekomsolutions/openmrs-module-lfhcforms/blob/dev/omod/src/main/webapp/resources/scripts/handleViewMode.js (sorry the indents in this file are not clean, don’t know why)

  • i18n messages will not work.

##Conclusion As you can see, this wasn’t really built in a way to be easily shared with people. We are hoping to move to a more complete and reliable solution in the future (we would like OrderEntryUi to provide a good base for all kind of orders: x-ray, lab tests, medication, blood transfusion…)

Thanks

Thank you for giving detailed information on a real case workflow. I think that will be very valuable once someone starts to look into a good Lab Test Ordering functionality for OpenMRS.

For now there is no Lab Test Order module, and ordering tests with the technology cited earlier in this thread (HTML Form Entry) is not really a good idea. I think it works for a very simple workflow only.

By the way @arbaughj, you can have a look at all our forms in the repo https://github.com/mekomsolutions/openmrs-module-lfhcforms/tree/dev/omod/src/main/webapp/resources/htmlforms Diagnostic Imaging, Drug Order… Hope that helps.

Sorry, I am new, and would like to ask a few things so I am clearer next time and hopefully kick-start to developing. Do explain if you are free!

As you mentioned earlier, there is no Lab Test Order module, and the things you cited earlier in a HTML form Entry. However, if you were to implement these HTML forms, would they not be part of openMRS as a module? Or do you mean they have to be hard-coded into Java so they exist as a data-type?

Yes, they would. If you implement OpenMRS, you would need to create a module. Or alternatively (and maybe more simple) you could fork the referenceapplication module, customize it and add your forms in it to make it your own.

See the documentation of HTML Form Entry module HTML Form Entry Module - Documentation - OpenMRS Wiki And if I remember well, the forms XML file can be simply dropped into this folder https://github.com/openmrs/openmrs-module-referenceapplication/tree/master/omod/src/main/webapp/resources/htmlforms to be automatically added at restart.

Thanks @mksrom for the clear and useful description of your lab order form. It looks very simple and practical. Thanks for sharing this. If I run into more questions, I will surly ask.

This is the general idea; however, it’s worth noting that we often make loose bindings between the request (order entry) and fulfillment for several reasons. For example:

  • What is requested and what is done are not always a 1-to-1 match. For example, doctors don’t typically order HEMATOCRIT, HEMOGLOBIN, MEAN CORPUSCULAR VOLUME, etc. as separate tests, since these are generally run as a group by a single machine. The doctor will order COMPLETE BLOOD COUNT or FULL HEMOGRAM, the test is run, and the individual results (HEMOGLOBIN, HEMATOCRIT, and 6-8 others) are reported by the lab. Likewise, the doctor might order DRUG A, but the pharmacy automatically substitutes DRUG B based on equivalency, price, availability, and local policies.
  • In some places, parts of this workflow are done on paper or in separate systems.
  • When facilities grow in size, systems like Laboratory, Pharmacy, Radiology, etc. inevitably grow into separate systems focused on the workflow of those departments. In many cases, these systems are purchased separately and the challenge becomes one of integrating them with an order entry system and EMR.

The first example (orders & fulfillment often are not 1-to-1 matches) is the reason that you will find observations (results) in the OpenMRS model offer an optional link (foreign key) to the original order, allowing for the linkage with a looser coupling and ability to tolerate a greater variety of real world workflows.

Cheers,

-Burke :burke:

Hi, are the forms still available? the link is leading to nowhere.

Hi @shelly, this was done a long time ago and the module has since then be removed.

I would suggest you look into the Order Entry UI module https://wiki.openmrs.org/display/projects/Order+Entry+UI

1 Like

greetings to yo @mksrom Thanks for the good work you are doing, am interested in using your form for labs but this https://github.com/mekomsolutions/openmrs-module-lfhcforms/tree/dev/omod/src/main/webapp/resources/htmlforms link is not available, may you please provide a new link for this resource Thank your for your help Hillary