AnsweredAssumed Answered

Creating a bunch of time records

Question asked by dsimonson on Feb 8, 2015
Latest reply on Feb 8, 2015 by philmodjunk

Title

Creating a bunch of time records

Post

In my anesthesia record solution, I need to create a bunch of time intervals based upon the initial anesthesia start time - both 15 minute and 5 minute intervals.  I use them to plot my data observations on the graphic record.

For example, for the 15 minute intervals, if the anesthetist enters a start time of 10:00, I want to create a bunch of records (enough to cover a maximum of 10 hours, or 40) that have a field containing the start time incremented by 15 minutes.  These records also have a field showing the time block number (1 - 40).  

I want these to update any time the user changes the start time, just in case they want to correct their original entry.  “I thought I started at 9:55, but then I realized it was 10:00”.  

My first thought was to try to create 40 different fields, but I remembered Phil’s admonition about sequentially numbered fields.  So now I have a script that creates the 40 records (or, in the case of the 5-minute records, 120).  After the 40 records are created, the fields populated by the script are “surgery_case_time_15_minutes”, which is initially set to the nearest 15 minutes _prior_ to the start time, and then incremented by 900 seconds, and the “surgery_15_minute_period_#” which is just the record number.

 

                                                                                                                                                                                                                                                                                                                                               
               

surgery_15_min_period_#

               
               

surgery_case_time_15_minutes

               
               

1

               
               

10:00:00

               
               

2

               
               

10:15:00

               
               

3

               
               

10:30:00

               
               

4

               
               

10:45:00

               
               

5

               
               

11:00:00

               

Here is the script:

Create Timed Records: Create 15 minute Time Records 

#This creates the times across the top of the chart 

Set Variable [ $AnesStartTime; Value:

Case ( 

Minute ( SURGERIES::time_anes_start ) <15; Hour ( SURGERIES::time_anes_start )&":00:00"; 

Minute ( SURGERIES::time_anes_start ) >14 and Minute ( SURGERIES::time_anes_start ) <30; Hour ( SURGERIES:: 

time_anes_start )&":15:00"; 

Minute ( SURGERIES::time_anes_start ) >29 and Minute ( SURGERIES::time_anes_start ) <45; Hour ( SURGERIES:: 

time_anes_start )&":30:00"; 

Minute ( SURGERIES::time_anes_start ) >44 and Minute ( SURGERIES::time_anes_start )<60; Hour ( SURGERIES:: 

time_anes_start )&":45:00"; 

0) ] 

Set Variable [ $Counter; Value:1 ]
Set Variable [ $SurgeryId; Value:SURGERIES::_pk_surgery_id ]
Go to Layout [ “surgeries_SURG_TIMES_15_MIN” (surgeries_SURG_TIMES_15_MIN) ] Loop 

New Record/Request
 

Set Field [ surgeries_SURG_TIMES_15_MIN::_fk_surgery_id; $SurgeryID ]

Set Field [ surgeries_SURG_TIMES_15_MIN::surgery_15_min_period_#; $Counter ]
Set Field [ surgeries_SURG_TIMES_15_MIN::surgery_case_time_15_minutes; $AnesStartTime ]
Set Variable [ $AnesStartTime; Value:surgeries_SURG_TIMES_15_MIN::surgery_case_time_15_minutes +900 ]

Set Variable [ $Counter; Value:$Counter+1 ]
Exit Loop If [ $Counter = 40 ] 

End Loop
Go to Layout
[ original layout ] 

I have a similar script that updates these records should the user update the anesthesia time.  Is this the best way to do this?

I am uploading a screenshot of my graphic record in Layout view.  Note the row at the top labeled "Time" followed by the corresponding fields.  

Thanks for any help and advice.

Dan

 

Anesthesia_Record_3.jpg

Outcomes