I’m seeking help trying to create a Flag Field to catch add-on laboratory tests and have provided attached Excel workbook and QVW consisting of ER orders for a single day. 


By definition each ER patient is assigned a unique Accession number and 1 or more lab tests can be ordered. An add-on test is defined as any unique Accession with 2 or more tests where 1 or more of the tests has a Order Time Stamp 10 minutes greater than the “minimum” Order Time  Stamp.  By way of example in the image below the “Minimum” timestamp for this accession is 9:30 AM and the “DiffAuto” test was ordered 19 minutes after the original order so a the new “TestAddOn” flag field would be “True” or = 1.


The data set I am using is large so, optimizing the creation of this Test Add-on Flag withing the script is important.  Suggestions would be appreciated.