Procedues and Laboratory Exchange

drbowen wrote on Monday, November 29, 2010:

This post is a continuation of a couple of different threads:

Procedure Howto:

https://sourceforge.net/projects/openemr/forums/forum/202506/topic/3843489

LEN is working in 4.0

https://sourceforge.net/projects/openemr/forums/forum/202506/topic/3862251

The marked flexibility of the ”Procedures” makes it difficult to get started with the configuration.  I spent quite a few hours this week end configuring the “Procedures” area to accept LabCorp data for the Laboratory Exchange Network being developed by Jeremy Wallace and MI-Squared.  I dumped the SQL statements that were used for this configuration and Tony McCormick is posting these to Jeremy Wallace’s  GIT hub where the laboratory results module are posted:

https://github.com/jwallace00/openemr/commit/fa2c9490c49ab9c0a171fbd98c13bcd2504a778c

I used Rod Roarks’s flexible structure to creat a new level called “Department” and set up the orders using the following general structure:

Laboratory (LabCorp Referral Labs)
   -Chemistry              Chemistry Department             (department)
      -Amylase, Serum  001396    CPT Code: 82150            (order)
         Amylase, Serum                                     (result)
      -Basic Metabolic Panel (8)   322758   CPT Code: 80048 (order)
        |BUN                                                (result)
        |BUN/Creatinine Ratio                               (result)
        |Calcium, Serum                                     (result)
        |Carbon Dioxide, Total                              (result)
        |Chloride, Serum                                    (result)
        |Creatinine, Serum                                  (result)
        |eGFR                                               (result)
        |eGFR AfricanAmerican                               (result)
        |Glucose, Serum                                     (result)
        |Potassium, Serum                                   (result)
        |Sodium, Serum                                      (result)
 

This conforms with the usual practice of a single clinic using one reference laboratory. 

I decided to set the top level categories as

Laboratory (referral lab) LabCorp
Laboratory (in-house)
Radiology  (in-house)

The problems that I have run into include:

1) no clear ability to enter diagnosis codes
2) The reference laboratories usually have some logic to verify that a valid diagnosis has been entered.  Invalid diagnoses or if frequency of the most recent last similar lab, cause the generation of an Advance Beneficiary Notification (ABN).

I have started a Radiology Order Section with the intent of using this for in-house x-rays at my office.  The out-side x-ray referrals are likely more like a “referral” Than a laboratory.  The plain x-rays that we perform in our office are somewhat simpler and can likely handled like laboratories.  There is a possibility that an additional field may need to be added to help with this process.  Something like a free form text box for an extended comment from the referring practitioner to the radiologist.

Referrals for laboratories and x-rays both require a similar logic:  checking that the ordered laboratory / x-ray has a valid diagnosis in order to make sure that the diagnostic service, lab or x-ray will be a covered service.  Then generation of an ABN if it is not a covered service.

Sam Bowen, MD
http://oemr.org

drbowen wrote on Monday, November 29, 2010:

There were three tables that were touched by these changes:

1) users
2) list_options
3) procedure_type

Users - The Addr Book where the reference laboratory facility information values are held are stored in users.

(2, ‘’, ‘’, 0, ‘’, NULL, ‘’, ‘’, ‘InHouse’, ‘’, ‘’, ‘’, ‘’, 0, 0, 1, ‘’, ‘’, ‘Laboratory’, ‘’, ‘’, ‘’, ‘’, ‘In House Laboratory’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, 1, ‘’, NULL, 0, ‘ord_lab’, NULL, NULL, NULL, ‘’, ‘’),

(3, ‘’, ‘’, 0, ‘’, NULL, ‘Burlington’, ‘’, ‘LabCorp’, ‘’, ‘’, ‘’, ‘’, 0, 0, 1, ‘’, ‘’, ‘Laboratory’, ‘’, ‘’, ‘’, ‘’, ‘Laboratory Corporation of America’, ‘’, ‘1447 York Court’, ‘’, ‘Burlington’, ‘NC’, ‘27215-3361’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘1-800-762-4344’, ‘’, ‘’, ‘Laboratory Director: William F. Hancock, MD’, 1, ‘’, NULL, 0, ‘ord_lab’, NULL, NULL, NULL, ‘’, ‘’);

List_options - I added several different sample types that are necessary for normal functioning of the laboratory.

(‘proc_type’, ‘dpt’, ‘Department’, 15, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘semen’, ‘Semen’, 60, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘blood-whole’, ‘Whole Blood’, 10, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘body-fluid’, ‘Body Fluid’, 11, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘serum’, ‘Serum’, 12, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘serum-frozen’, ‘Serum, Frozen’, 14, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘plasma’, ‘Plasma’, 16, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘plasma-frozen’, ‘Plasma, Frozen’, 18, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘cervix’, ‘Cervix’, 20, 0, 0, ‘’, ‘’),

(‘proc_specimen’, ‘saliva’, ‘Saliva’, 40, 0, 0, ‘’, ‘’);

Procedure_type – I started with an empty table and created 172 insert statements.

Using this set of SQL insert statements will provide with the majority of the common laboratories ordered by typical primary care practitioners.  It should also give a much easier idea of how to modify this for your own use.

Sam Bowen, MD
http://oemr.org

bradymiller wrote on Monday, November 29, 2010:

hey,
Put a quick code review of  Jeremy Wallace’s code on his github commit:
http://github.com/jwallace00/openemr/commit/fa2c9490c49ab9c0a171fbd98c13bcd2504a778c
-brady

tmccormi wrote on Wednesday, December 01, 2010:

This is contributed by Dr Bowen as part of improving how to setup the Procedure Orders, specifically for Labs and the labcorp LEN. It should be generally useful. Comments?

Tables include adds to proc_type, list_options and users (address book)

https://sourceforge.net/tracker/?func=detail&aid=3124221&group_id=60081&atid=1245239

-Tony

bradymiller wrote on Thursday, December 02, 2010:

hey,

Put a new code review of Jeremy Wallace’s revised  Lab Exchange here:
http://sourceforge.net/tracker/index.php?func=detail&aid=3125004&group_id=60081&atid=1245239#

Would be very helpful if other developers also reviewed this, especially giving input to item #2 in my review.

I recommend not using github to review this code since multiple commits (and moderate amounf ot whitespace/indentation changes), Recommend merging his branch to your local repo and then doing a git diff to your master with the -w setting.

-brady

sunsetsystems wrote on Saturday, December 04, 2010:

I’m a bit confused.  Where is the current code that I should review?

Rod
www.sunsetsystems.com

stephen-smith wrote on Saturday, December 04, 2010:

bradymiller
I recommend not using github to review this code since multiple commits (and moderate amounf ot whitespace/indentation changes), Recommend merging his branch to your local repo and then doing a git diff to your master with the -w setting.

I suppose it’s not absolutely required, but the whitespace / indentation changes should probably be dropped when possible to keep the patch small and easy to both review and combine.  My general rule is if there are no functional changes on a line, there should not be any non-functional changes (e.g. whitespace) on that line.

bradymiller wrote on Saturday, December 04, 2010:

hey,
Ideally, code reviews will only involve functional lines and a single commit to review on github, but that will not always be the case. We should be able to review code that:
1) Is spread over multiple commits
2) Is not totally up to date (for example in a few days this code is now 8 or so commits behind)
3) Has formatting(spacing/indentation) changes in less mature code blocks (for example all the spacing/indentation are in one file that is relatively new, so expect loops/spacing to change)

Very easy with git to get around all three above issues (use Jeremy’s code to be reviewed as an example):
1) git remote add jwallace00 git://github.com/jwallace00/openemr.git
2) git fetch jwallace00
3) git checkout -b test_wallace (do this from your most uptodate master branch)
4) git pull jwallace00 openemr.branch_len

At this point, can test the code, and can review it via:
git diff -w master (remove spacing/indentation differences)
or
git diff master (include spacing/indentation differences).

-brady

sunsetsystems wrote on Saturday, December 04, 2010:

I added a couple of comments to the tracker item:

https://sourceforge.net/tracker/index.php?func=detail&aid=3125004&group_id=60081&atid=1245239

Rod
www.sunsetsystems.com