Query Builder

Instructional Guide

The Query Builder is a search application designed to allow the user to create, edit, and filter patient data. Our goal is to provide you with a tool to positively affect patient quality and safety.

MARCQI Coordinating Center 10/27/2015 © MARCQI 2/23/17

Query Builder

Table of Contents

What is a Query Builder? ...... 3

Writing a Query ...... 3

Accessing the Query Builder ...... 5 Left Panel ...... 6 Name...... 7 Folder ...... 7 Help ...... 8 The Query Screen ...... 9

Review of the Query Builder Sections ...... 10 Data Elements ...... 10 Display...... 11 Sorting (Optional) ...... 11 Criteria ...... 11 Sharing ...... 12 Results ...... 12

Create a Query ...... 13

Display Elements ...... 14 Add Selections to the Display ...... 15 Customize your Query ...... 18

Criteria ...... 20 Conditional Operator ...... 21 More About Conditional Operators in the Criteria Pane ...... 23 Building Criteria ...... 25 Critical Thinking ...... 26 Complex Queries ...... 27 Using the Sort Feature from the Sorting Panel ...... 29

Saving Queries ...... 30

Copy a Query ...... 30

Exporting your Query ...... 30

Share a Query/Give Copy ...... 34

Archiving a Query ...... 37

1 Query Builder

Create a New Folder ...... 38

Practice and Reporting ...... 39

2 Query Builder

Query Builder Overview

What is a Query Builder? The query builder provides the functionality to write a specific question of the MARCQI database, which will then provide specific data pulled out of the database in response to the question.

The query builder allows the user to:

• Create site or surgeon specific reports based upon raw data. • Use the most up to date data entered into the database. • Filter and edit information to fit the proposed question. • Save and share the query results with other users within your site. Note: The build of a query can be shared with others outside of your site, if needed, by special request. Place an SRS ticket explaining who you would like to receive your query. This action is completed by Ortech.

Writing a Query When considering the query you are going to write, the form or section where the information can be found in the database will help you to understand where the data can be found in the query. For example, if you want to pull information regarding a lab result, consider the name of the field you are seeking, and in which data element that field may be found. Specific information regarding a particular lab may be found in the hospitalization section (pre or post), lab section, and any other factors about the lab that may impact your results.

3 Query Builder

Writing a query requires practice to determine the location of your specific criteria, and patience to design a query that extracts the absolute data for which you are searching.

Several options for your queries are available depending upon the frequency they will be used, the view, or who may need to access the same query:

• Sorted • Shared • Saved • Exported

We will discuss these options more in depth as we go through the functionality of the query builder.

4 Query Builder

Using the Query Builder

Accessing the Query Builder The query builder can be accessed from within the database by using your user logon. This is the same logon used for entering patient information, cases, events, and accessing your data mart.

Note: You will only be able to retrieve the results that pertain to your particular institution.

1. Log into the system with your username and password.

2. Select (Options) from the left panel pane. Result: The listing of available actions displays. 3. Select Query Builder (Beta). Note: You may need to wait a few moments for the system to load the query builder. Result: The Query Builder page displays.

5 Query Builder

Components of the Query Builder

Once the query builder opens, you will note the display is similar to the data mart display.

Left Panel Query actions are in the top of the left panel header.

Save Query Remove Query Create a New Folder

Add New Query Copy Query Archive Queries

Below the header are designated folders, similar to what can be found in the Datamart.

Once you have built and saved some queries, they will display under the folder you have designated.

Queries can be viewed by clicking the + to open the folder.

6 Query Builder

Name Name your query; this will help you to organize and store your queries. Try to keep the name short, but be as descriptive as possible.

Folder The dropdown option will display the available folder to store your query.

7 Query Builder

Help

Hover over any Question Mark to display informational text boxes, example of the Data Elements and Criteria help screens:

8 Query Builder

The Query Screen As you build your query, you will see some fields that are required or optional:

Section Required Optional

Name X

Folder X

Display X

Criteria X

Sorting X

Sharing X

Result N/A N/A

The more information you provide, the more specific your query results.

• Using the folder option will help you to organize queries that you may reuse at a later time. • Sorting provides a means to better view your results. • Sharing allows others to use and view your query.

9 Query Builder

Review of the Query Builder Sections The query builder consists of several panes, or sections, to display the data elements and criteria you have selected for your query. These sections give you the ability to search for information which is organized to mimic data entry, the conditions for your data, and how your data will display.

Note: This view may be very different depending upon which browser is used. , , Mozilla, and work the best; works but many have difficulty with exporting their queries with this browser!

Data Elements This section lists the available elements, or sections, of the forms of a case. Use this section to help identify, and to select, the areas where you will find your data fields. The data elements are set up to closely match the forms of each case. Entire sections can be selected by clicking in the checkbox in front of the section name.

10 Query Builder

Open each section by clicking the side arrow to display precise data elements:

Select the specific data element desired within the section.

Display The specific fields you want to see in your results. Think of this section as the titles of the ‘headers’, or column, on an Excel spreadsheet.

Sorting (Optional) How you would like to see the results display- Ascending or Reverse Ascending.

Criteria The conditions under which you want to see those display fields in the results (for example, a specific time frame or surgeon). Criteria are what you will use to pull your data; keep this section precise- too much criteria will result in a very slow query or no results at all. Start with a limited number of conditions and build upon your successful foundation!

The criteria pane can also be manually adjusted to better fit your selections by hovering over the blue line above the Criteria pane until the vertical arrowed line displays, and then adjusting the pane to fit.

11 Query Builder

Sharing The list of other available users with whom you can share, or give a copy of the created query, displays.

Results Once you have selected the fields for your query, results will display in this section.

12 Query Builder

Create a Query

Create a Query To create a new query, carefully consider if there is an existing query that may meet your need, or if not, consider the data elements you wish to display and the sections in the form they may be found.

1. Click at the top left panel to load the new query form. 2. Enter a name for the query in the Name pane.

For this class, enter Practice Query_ (date). 3. In the Folder pane, click , select the folder that best describes the type of query you are building, to store your query, if appropriate. For this class, select Audit Queries.

13 Query Builder

Display Elements The Data Elements section shows you which tables in the database are available to pull data.

• Each table has multiple fields within it that you can use to refine your search. • To view which fields exist in each table, click on the arrow to the left of the table name to expand the field list.

• Again, think of these display elements as your Excel spreadsheet column labels, which become a list of the items you would like to see. 1. Select the checkbox of Case Data elements. Note: A check mark in the Case checkbox will select the ENTIRE section of case elements. This is a large amount of display options, consider carefully before selecting entire sections.

14 Query Builder

2. Click the side arrow next to this section to expand the details. Result: The detail data elements in the form display as check marked. The display elements are the same fields found in the form on the database.

3. Deselect the checkbox in front of Case. Result: The checkmarks no longer displayed for each field in the case section. 4. Click in the checkbox next to the elements for the fields to display in the query (Side, Joint, and Actual Date of Surgery).

Add Selections to the Display Icons in the lower section of the Data Element pane can either add selections to the Display or Criteria panels with one click, or remove previous selections.

15 Query Builder

Hover over each icon to see its action:

Select None This option will delete any previous selections for display.

Click to add the selected data elements to the Add to Display Panel Display pane. You can select multiple data elements to add all at once.

Click to add the selected data elements to the Add to Criteria Panel Criteria pane.

1. Click to move the selected elements to the Display panel. Data elements can also be added to the display panel individually, especially if only missing a single display element. 2. Review the sections of the Display panel

Expression Defines the base category and name of the section from where the display element was selected. Not modifiable. Title Repeats the expression, but can be modified to a user friendly title. Sorting Allows for sorting capability: Not sorted Ascending, or Descending.

16 Query Builder

3. Return to the Data Elements section, click the “Select None” icon ( ) to remove any prior data element selections you had chosen for display purposes.

Important Note:

• If the is not selected prior to continuing onto selecting criteria, you may see duplications in your Display panel, or with items you do not wish to include as your column headers. This could result in additional work to delete or modify the display elements.

4. From the Display Panel, click the hyperlink [Add new Data Element to list]. Result: Individual Data Element categories display for selection:

a. Hover over the section, and then individual element to display. b. Case>Care Provider Last Name> c. Enter. Result: Data Element for Case Care Provider Last Name now displays.

17 Query Builder

Customize your Query Changing how your query displays can be helpful if you want to present your data and customize to more familiar terminology. From the Title column:

1. Click Case Actual Date of Surgery, (the default value shown in the Title column from the Display section). Result: A pane displays around the title name. 2. Use your cursor to highlight the words Case Actual Date of Surgery or backspace to remove the words. 3. Type in the new name DOS. 4. Click Enter (or outside of the box in the white space if using a mouse). Result: Wait a few seconds! The screen will then refresh to show the new name under the Title column.

5. Click Result: Additional options display.

18 Query Builder

6. Select Move down to move the Side below the Joint. Notes: a. Hover over the word, Sorting to select ascending or descending order at this time.

b. These sorting options can also be configured in the Sorting pane.

19 Query Builder

Criteria The Criteria placed in this section define the parameters of the data to be ‘pulled’ or queried. Think of your criteria as the logic for your question; the system will filter your data based upon your entries in this section. Several important notes:

• While you can run a general query without criteria, this field will narrow your results. • Data placed into this section can determine how quickly your query is processed, and can also make or break the query! • There is no need to pull all of the same elements you listed for the display- this section is used to tell the application how to put limits, or filters, on what you want to see. • Start with less and build criteria as needed.

1. From the Data Element pane, select the Criteria (conditions), you wish to use for filtering your results. • Case:  Actual Date of Surgery

2. Click (Add to Criteria). Result: The selections now display in the Criteria section.

20 Query Builder

Note: Selections can be made from the Data Elements section or directly in the pane as we did in the Display section.

Conditional Operator Depending on the type of data element you have added for Criteria, different conditional operators will be available.

• A conditional operator allows the user to assign parameters to the fields to aid in returning filtered results. • For example, for data elements that are date fields, the operator can be some variation of “is”, and selecting a value will prompt you to select a calendar date from a date picker control box. This is particularly useful if you are looking for data that occurred between a specific range of dates, and the use of “is between” would allow for the assignments of the range of dates. 3. Click Is in the Actual Date of Surgery criteria. Result: All available conditional operators display. 4. Select ‘is between’. 5. Select the dates from the calendars by clicking on the displayed dates. 6. Click Update Results.

21 Query Builder

Result: Review Names of Surgeons displayed in the Result panel. 7. Return to the Data Elements panel. 8. Select “Case > Care Provider Last Name”. Notes: The starts with conditional operator can be modified by clicking on the words, “start with”, and making an alternative selection. This type of conditional operator for text (enter value) allows you to enter a specific word or partial word that is found in your data.

9. Click (Add to Criteria). 10. Type in your physician champion’s name. 11. Click Enter outside in the white area. 12. Click Update Result.

Result: The Query Builder will process your request:

Note: A cancel button is available if the query request seems to be taking a long period of time to process and you need to cancel out of the query. Results: Your basic query displays in the result section.

22 Query Builder

Review:

o The headers (titles) of the columns o Do the results displayed fit your request?

Notes: • If No Results displays, review selected criteria and revise if necessary.

• If you continue to see “No Results” after the Update Results process appears to have finished, this is usually an indication that there was no data to display for the conditions you specified. • If you believe this has been in error, please review the data elements and conditions you’ve specified to ensure there are no typos etc. and try to run the Update Results again.

More About Conditional Operators in the Criteria Pane Using conditional operators to further clarify and filter your query request. These selections help the system to eliminate or add desired data fields to your query. The conditional operators will display in blue and underlined ( ) in the same fashion as a hyperlink.

23 Query Builder

Not all of the conditional operators offer the same selections; different criteria have different conditions for selection. As you design your query, open the conditions to ensure you have the most appropriate selection.

Some of the conditions will display pre entered selections, click the Yes to see the options:

OR

Some of the conditions require that you actually type in the field to request your display criteria.

24 Query Builder

Tips n Tricks

• All: When using All, think of this as the term ‘and’; you would like the first criteria, and the second criteria, and the third, etc.

 This will only pull criteria to match all of your selections.

• Any: When using Any, think of this as the term ‘or’; you would like the first criteria, or the second, or the third, etc.

 This will pull criteria to match any of your selections, and is a much broader search condition.

• Not All and None: Rarely used. This would be used to exclude specific criteria versus including into your query.

Building Criteria

Criteria may also be selected while in the criteria pane to add to an existing query. This can be completed by clicking or . The available selections will display when you hover over each data element. Let’s try this as we continue to build our query.

25 Query Builder

From the Criteria pane:

1. Click Add new Criteria. 2. Hover your mouse over Hospitalization. 3. Move across to the Labs option. 4. Select MRSA Screening. Result: The MRSA Screening selection displays in the Criteria pane. Note: The MRSA screening defaulted to ‘is equal to’ with an option to select a value. 5. Click [select value]. Result: Available selections will display. 6. Select Yes. 7. Click Update Result. Result: The results pane will display those patients who have had a screening. 8. Return to the Criteria pane, modify the MRSA Screening is equal to No. 9. Click Update Result. Result: Note the difference between the two choices.

Critical Thinking Question: Why didn’t your results show the heading of MRSA? 1. Return to the Display pane. 2. Click Add new data element to list. 3. Select Hospitalization > Labs > MRSA Screening. 4. Click Update Results. Result: Your MRSA Screening now has a Header in the query.

26 Query Builder

Complex Queries When thinking about a query and adding in criteria, carefully review what you would like to display versus what elements are needed for the query to actually pull the parameters of the display. Asking the system to use too many criterions create a query that does not process. In this area, less is more!

One criterion we haven’t reviewed is the Events category; you will note when Events are selected, you will be able to opt for a filtering of all or certain events by using the conditional operator:

From the Criteria pane:

1. Select Add new Criteria (blue hyperlink). 2. Hover on Event. 3. Move mouse to the right and select Event Type. 4. Click is equal to. Result: conditional selections display:

5. Click is in list. 6. Click [select value].

27 Query Builder

Result: The available events display. Note: The checkboxes in front of the events allow for single or multiple selections.

7. Select the appropriate events to include for your criteria. Note: For example, if the query is designed to search for any dislocations and fractures during a given time period, click the boxes in front of each of these event types.

8. Click Apply Selection. Result: Dislocation and fracture now display at the end of the sentence, . 9. Click Update Result. Result: The Query will display the selected display elements using the events selected to filter for only those selected events, if available.

28 Query Builder

Using the Sort Feature from the Sorting Panel Queries can also be sorted to provide additional organization as you are creating them, or once saved, can be reopened and sorted as desired. You can first sort the query in an ascending or descending selection by more than one criterion by building a list of sorting options. The query will sort by the first data element selected, and then by subsequent selections in the order they are entered.

From the sorting pane:

1. Click Add new data element to list. 2. Select Case > Actual date of surgery. 3. Click Ascending to select sorting option. Note: If a second sorting option is

desired, start from step 1 and select additional elements.

29 Query Builder

Saving and Exporting your Query

Saving Queries If everything is functioning the way you want it, please save your query. Save each time you make a change or addition to your query.

1. Click the “Save Query” icon ( ) to retain it. Results: • The name of the query will display on the Query Builder screen. • The results of the query will display in the Data Mart, under the folder structure you specified.

Copy a Query It is very important to copy a query before making any changes if it is a query that you are happy with! Once you reopen an existing query, make any changes and then resave it, the query has been overwritten. Remembering to copy will save you from having to rebuild basic queries that you may need on a regular basis.

Exporting your Query To export your query to a spreadsheet, recommended practice is to first save your query. Exporting the query in the selected format is browser dependent, and the most consistent success has been found to name and save prior to this action.

1. Name your query (if not previously completed). 2. Save your query (to a file if appropriate).

30 Query Builder

Note: If no folder is selected, the query will display by default under the folder set. 3. Review results. 4. Select Export Query. Result: The Query Export Options window displays.

Notes: • Privacy: Consider who will review this query and to what level they want to see the data: a. Identified: Do you want your query to display patient level data? For example, this may include patient demographic information and case date. b. De-identified: Will display case ID, but no patient level data. • Export As: Determine the desired format of your spreadsheet. 5. Select the Query Export Options. 6. Click Export. Result: Spreadsheet pane displays in the lower left corner of the computer screen under the left panel pane.

31 Query Builder

Note: Depending on your browser, the file may open automatically – or you may be prompted to open/save. 5. Click the spreadsheet pane. Result: You may get a warning regarding the format. Select Yes to continue. 6. Name and Save your query in its spreadsheet format to your selected destination.

Filtering the Query:

At the current time, there are some systems with Excel© that are having difficulty with filtering; if you experience this problem, please try the following:

1. Select the "Actual date of surgery" column in the spreadsheet you've downloaded. 2. From the "Data" tab at the top of Excel, click "Text to Columns". 3. On the first screen, leave the radio button on "delimited" and click Next. 4. Uncheck any of the delimiter boxes (ALL checkboxes should be empty on this screen) and click Next. 5. Under column data format, choose Date and select YMD from the drop down. 6. Click Finish.

32 Query Builder

Result: Now when you click on the Filter arrow at the top of the Actual date of surgery column, it should show you the proper date filters, including the custom option of filtering with a date range”.

33 Query Builder

Share a Query/Give Copy Once you have created a query, you have the option to share or give a copy to the other users shown in the Sharing (Optional) list at any time during the original query build, or after the fact. You must save or resave your query, after selecting additional user names, to enable this function.

Note: These options may be dependent upon your access to the system.

• Share: This allows another user at your site to run your query results from the Data Mart. • Give Copy: Allows other users at your site to modify the actual query build in the Query Builder.

Share a Query 1. Click on the query name you want to share from your left panel (if you don’t already have it open). Result: The query details open into the Display and Criteria panels. Note: If you are in the process of building your query, select the Share option when saving. 2. Go to the Sharing panel and click the checkbox next to the name of the user with whom you want to share the query.

34 Query Builder

3. Ensure the ‘button’ is nearest to Share. 4. Click Save. Result: The query now displays in the other users Data Mart “Shared with Me” folder and can be reviewed.

Give Copy 1. Click on the query name you want to open from your left panel (if you don’t already have it open). Result: The query details open into the Display and Criteria panels. Note: If you are in the process of building your query, select the Give Copy option when saving. 2. Go to the Sharing panel and click the checkbox next to the name of a user you want to give an editable version of the new query to (users would need to have received access to the Query Builder). 3. Click the words Give Copy or move the slider towards the words Give Copy. 4. Click Save.

Result: You will receive a confirmation window:

35 Query Builder

The user account the query was given to now has access to your query in the Query Builder “Shared with Me” folder, and can modify it to meet their needs. Note: If you would like to share or give a copy of a query to a user that is not is your sharing list, please place an SRS ticket. Ortech can manually share a query with another user at a different site upon request.

36 Query Builder

Archiving a Query The left panel display of the Query Builder can become filled with queries as you continue to build customized queries. To keep only the queries you currently use more easily accessible, the ability to archive previously created queries is an option.

To archive a query:

1. Navigate to the Query Builder left panel.

2. Click on the Archive Queries button at the top of the left panel

Results: • All queries should now have an open check box beside them:

• The Cancel icon now displays in the top of the left panel. Click this icon to Cancel the action of archiving any queries.

3. Check the box beside any query that you want to mass move to the Archive folder:

37 Query Builder

4. Click the Move Selected Queries icon at the top of the left panel:

5. Confirm a yellow Archived Queries folder now appears in the left panel and the queries you selected now appear under it:

Create a New Folder If there is not a folder name available that describes your query, a new folder can be created:

38 Query Builder

Practice and Reporting As you can see, working in the query builder can result in very specific, detailed reports. The more you practice and work with manipulating your requests, the more in depth you will be able to drill down into your own data.

Important Note:

The data retrieved from the Query Builder is in its raw state, and has not been reviewed, or “scrubbed” by the Quality Institute; this may result in a difference between what is reported on the Quarterly Reports and the results retrieved by using the Query Builder.

As testing partners with MARCQI and Ortech, we look to you to help us evaluate the Query Builder should you run into challenges; please provide:

• The specific query written (screenshots are welcome) • Challenges you encountered • Questions  Results  Functionality • Suggestions for Improvement

If you have any questions or need help building a query, please feel free to contact the Coordinating Center

39