# Procedure\_\* tables and intended process

**URL:** <https://community.open-emr.org/t/procedure--tables-and-intended-process/6452>\
**Category:** OpenEMR Development\
**Created:** [August 10, 2010, 7:21pm UTC](https://community.open-emr.org/t/procedure--tables-and-intended-process/6452 "2010-08-10T19:21:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 10, 2010, 7:21pm UTC](https://community.open-emr.org/t/procedure--tables-and-intended-process/6452/1 "2010-08-10T19:21:07Z")

</div>

**[mwhitlaw](https://sourceforge.net/u/mwhitlaw/)** wrote on [Tuesday, August 10, 2010](https://sourceforge.net/p/openemr/discussion/202506/thread/94710737/#b5a7):

I am working to integrate a doctor with a lap.

May plan is to create HL7 order files by selecting and inserting data from and to  
the procedure\_\* tables.

I will be using java and the HAPI library to create the files.  
The lab I’m working with will handle the transport of the files  
to and from the lab. (they only work with files).

Looking at the data model for this set of tables, there seems to be  
an implied sequence to a procedure order. I would like to know if I  
have it right, so here goes:

Before any procedure\_orders can be created, there needs to be a procedure\_type. Is that a correct assumption?

The procedure\_type table has a procedure\_type field which I assume corresponds to the  
Group, Procedure Order, Discrete Result, Recommendation. Is this correct?

There is a lab\_id in the procedure\_type table. This would imply that the procedure\_type table holds an  
entry for each procedure AND lab. Also, to support this notion, the procedure\_order table does NOT have  
a lab\_id. This would lead me to the statement:  
If two labs perform the same procedure, there would have to be (at least) two entries in the procedure\_type table  
to represent that. Is this correct?

I don’t see how the lab\_id gets into the procedure\_type table. Related to this, since the  
lab\_id field is a bigint(20), it seems it would be a foreign key field to a labs table,  
but I don’t see a labs table or a table that would hold labs. What am I missing?

Again, referring to the data model:  
I see that procedure\_result points to procedure\_report which points to procedure\_order.  
Also, these foreign-key-like fields have indexes which are not unique, which would allow  
for 1 to many relationships between  
procedure\_order(1) and procedure\_report(many)  
and likewise for procedure\_report(1) to procedure\_result(many)

In other words, give the notation: 1 -\> many, these tables have the following relationship:

procedure\_order -\> procedure\_report -\> procedure\_result

Is it expected that these one to many relationships will actually occur, or is the usual case  
that there will be a one-to-one from procedure\_order to procedure\_report to procedure\_result?

Finally, I’m trying to understand the implied sequence of events between a doctor and a lab and these  
tables. This is where I am at this point:

1. Doctor requisitions an order which creates an entry in the procedure\_order table.  
2. My process pulls the new procedure\_order record and turns it into an HL7 file  
2. The specimen is put in the lab box for pickup.  
3. The lab gets the HL7 order msg file and the specimen (at very different times)  
4. The lab correlates the HL7 order with the specimen and sends back an acknowledgement of some kind  
&nbsp;&nbsp; which my process would receive and turn into a record in the procedure\_report table.  
5. The lab performs the requested test(s) on the specimen and transmits HL7 result msg file to the  
&nbsp;&nbsp; Doctor which my process receives and converts into records in the procedure\_result table.

Have I got that right?

Also, the lab I’m working with does not do step 4. In that case, would I just create a dummy record  
in the procedure\_report table?
