Using Power Queries in Excel to pull the list of Apneas from the FinePointe SQL database
This article describes a method that can be used to pull a list of Apneas from the FinePointe SQL database.
Warning
It is not advisable to query data from within the SQL database; a user may inadvertently edit or delete raw data. Within the Excel, the user will only be able to read the SQL data; therefore, removing the risk of editing/deleting data.
FinePointe stores the study data in a SQL database :
The study used in this example is called "Test3" :
The Apnea analyzer stores the list of all breaths in the following SQL table :
This table will have to be merged with other tables from the study database to display : the Subject ID, the recording time (if several recordings have been made for the same animal), and the Analysis that should be taken into account (if the data has been reanalyzed).
In this example, I will list all Apneas (type 0, type 1 and type 2) for the subject called Mouse2, for the recording that was done on September 16th 2020 at 3:51:21 PM, and for the reanalysis performed on September 23rd.
Open Excel, go to the Data tab, and select Get Data > Launch Power Query Editor :
In the Power Query Editor, select New Source > Database > SQL Server :
Enter your SQL Server name and click OK :
Check "Select multiple items".
Locate your study database (bms Test3 in my case) and select the following tables :
In the Power Query Editor, select the xxttApnea table.
Configure the table to not display the normal breaths :
Proceed similarly to not display : Sniff, Erratic, Sigh, and Erratic Sigh cycles.
Select Merge Queries > Merge Queries :
Perform the following selections :
Expand the RecordingSessions column and choose to display RecordingGroupToken and SubjectSessionToken :
Select Merge Queries > Merge Queries again :
Perform the following selections :
Expand the RecordingGroups column and choose to display Description :
Select Merge Queries > Merge Queries again :
Perform the following selections :
Expand the SubjectSessions column and choose to display StartTime and SubjectToken :
Select Merge Queries > Merge Queries one last time :
Perform the following selections :
Expand the Subjects column and choose to display SubjectID :
Click Close & Load :
Hide the columns that are not relevant :
Use the following formula to convert the values in the two StartTime columns to readable format :
=IF(B2>0,(B2-504911160000000000)/(8.64*10^11) - 109205,"")
Note : this formula is valid in GMT+1 time zone during Daylight saving time. If you're in a different time zone, it has to be adapted.
And format the cells appropriately :
Hide the two 18-digit integer timestamp columns :
Then the table can be filtered to display the Apneas for the subject called Mouse2, for the recording that was done on September 16th 2020 at 3:51:21 PM, and for the reanalysis performed on September 23rd.
Comments
0 comments
Please sign in to leave a comment.