Leaf Tutorial

 

You can use Leaf to query de-identified data in the Mount Sinai Data Warehouse (MSDW) 2.0. Leaf is “a lightweight drag-and-drop web application that enables direct querying of arbitrary clinical databases” (Dobbins, 2019).

Table of Contents

User Access
Access Error
Log In to Leaf
Secure Access
Select Usage Information
Leaf Overview
Constructing Queries
Specify Query Parameters
Search for Concepts
Remove Concepts
Clinical Domain Details: Query Parameters
Viewing Search Results
Exporting Data
Saving Search Results
Additional Resources

 

User Access

All Mount Sinai users can access Leaf using School or Hospital login credentials:

  1. Navigate to https://leaf.mssm.edu/
  2. Log in with Mount Sinai credentials (School or Hospital)

 

 

Access Error

All Leaf users must register for user accounts. Attempts to sign in without enabled accounts will be blocked from entry (see Figure 1).

Figure 1: Login error for users with unverified accounts

Figure 1: Login error for users that are not registered Leaf users

 

 

Log in to Leaf

To access Leaf and begin querying MSDW, log in to Leaf.

 

 

Secure Access

Access Leaf through the Mount Sinai network. Access from campus directly or through a VPN tunnel using valid Mount Sinai credentials.

Note: if you have not used Leaf previously or your Mount Sinai login session to Leaf has timed out, you will be prompted to log in through a Microsoft service that Mount Sinai uses to manage user credentials (see Figure 2).

Figure 2: Leaf Sign-in (if Mount Sinai session has timed out)

Figure 2: Leaf Sign-in (if Mount Sinai session has timed out)

 

 

Select Usage Information

Leaf’s landing page asks for preliminary information:

  • Indicate your reason for using Leaf by selecting Quality Improvement or Research
  • If you have an Approved QI Documentation or an Approved IRB, consider utilizing ATLAS to access PHI. Leaf currently provides only de-identified data.
  • Note: you will only be able to access De-Identified Health Information within Leaf (see Figure 3).

Figure 3: Selection path to access De-Identified Patient Data for Research without an IRB

Figure 3: Selection path to access De-Identified Patient Data for Research without an IRB

  • On the second page, read the Program for Protection of Human Subjects access disclosure statement and select “I Agree” to consent to the terms of use.

 

 

Leaf Overview

Leaf enables you to quickly select patients who satisfy criteria from multiple medical and other domains. There are several key areas of the Leaf user interface:

Figure 4: Leaf landing page

  1. Concepts: A concept is a property that patients have to be used in Leaf queries. Example: the condition “Has Diabetes” and the vital sign “BMI under a value you specify.” Select concepts from the expandable menu, or search for concepts in the search bar above the concept menu. A key idea in Leaf is that each concept selects the subset of patients who satisfy the concept.
  2. Query Boxes: Drag and drop concepts into query boxes, which enables you to graphically combine the sets of patients obtained by concepts into a Boolean logic query.
  3. Start/Run Search: After selecting search parameters, this initiates the query. After running a query, this green button becomes “Save Query,” which you can use to save your query. The patients in the query can be reused from under the My Saved Cohorts concept (see “Concepts”).
  4. Query Status: See the status of your query while it runs; the number of patients selected by the query is displayed here after it completes.
  5. User Menu: This drop-down menu displays your role or lets you review your saved queries.
  6. Leaf Functions: “Find Patients” returns to the landing page to run new queries. After a query selects some patients, “Visualize” displays quick-reference demographic graphs about them, and “Patient List” displays a table of the patients with selected columns of patient properties. The table can be exported into a file that can be imported into a spreadsheet. Review the details of the data in the Patient List tab within the left-hand navigation.

Need Help? In the left-hand navigation column (#6 in the landing page), scroll to the bottom of the page and select the “Need Help” button to review assistance options, including directions to submit a ticket.

 

Constructing Queries

Leaf initially opens to the left-hand menu tab to “Find Patients” where you can run your search query.

  • Review the Clinical Domains available for query:
    • Conditions ICD-10-CM provide coded and descriptive diagnoses
    • Procedures (CPT4) outlines procedure, service and event codes
    • Demographics outline patient characteristics, further broken down into: AgeEthnicityGenderRace, and Vital Status
    • Encounters specifies patient visit criteria
    • Vitals provides baseline patient health criteria
    • Lab Results (LOINC) provides clinical, laboratory, and survey measurements
    • Medications (ATC) specifies medications prescribed and administered
    • Patient Cohorts specifies sets of patients.
      The acronyms in parentheses indicate the standardized medical vocabulary used to encode each clinical domain.
    • Each Concept indicates the number of patient records within the category, denoted by a faded headshot icon to the right of the concept:

    • Use the Search bar to find specific concepts to add to the query
  • The menu for each Clinical Domain expands by selecting the arrow to the left of the Domain’s name.
  • Identify a concept, click and hold the concept with your mouse, and drag the concept into a query box (see Figure 5)
  • As you build your queries, the domains can be used in any order (for example, a search for “Gender: Male” in box 1 and “Encounter: In-patient” in box 2 will produce the same set of patients as “In-patient” in box 1 and “Male” in box 2).

 

 

Specify Query Parameters

Concepts with numerical values–such as Lab Results, Vitals, and Age–can all be refined by numerical parameters. To set them, select the arrow to the right of each filter. For example, search for living adults by adding Demographics: Age to the top box (filtering for Greater Than or Equal to 18) and Vital Status: Living to the bottom half of the same box under “In the Same Encounter” (see Figure 5)

Figure 5: Adding Living Adults (age 64 or younger) parameters to the query, then removing an aspect

 

Identify up to two additional Concepts to drag and drop into the adjacent query boxes. Query box filters can adjust to custom date range, frequency, or inclusion/exclusion by selecting the arrow to the right of each filter.

 

 

Search for Concepts

Above the Concepts tree is a search bar. Enter keywords in concepts you want to quickly find concepts which contain your terms (see Figure 6)

Figure 6: Searching for specific Concepts

 

 

Remove Concepts

Remove any concept from the query boxes by clicking on it and dragging it out of the query box to anywhere else on the page. This will remove the concept from your search or enable you to replace it with a different concept.

After your search criteria is established, click the green button to “Run Query” and review results. Note: Leaf results larger than 200,000 patients will not display Visualization or Patient List data.

 

 

Clinical Domain Details: Query Parameters

Age: Patient age always refers to the patient’s age at the time a query runs. This means the same patients may not consistently appear in age-related searches that you run on different days, and that age may not correlate to the date of patient’s vitals. For example, a record for a patient born on January 1, 2000 will not appear in searches of Age: > 18 when queried on January 1, 2017, but will appear in the same search when queried after January 1, 2019.

Age, Race, Gender, and Ethnicity: these are considered immutable patient characteristics. Immutable patient characteristics are denoted by an orange human icon (see Figure 6). These characteristics cannot be combined with Encounter concepts in one query box. Doing so produces a search error (see Figure 7).

Figure 7: Query Error (Combined immutable characteristics with encounter concept in the same query box)

Figure 7: Query Error (Combined immutable characteristics with encounter concept in the same query box)

 

Encounter: An Encounter, Visit, or ICD-10-CM Condition represents patient data obtained on a specific date. Such data is denoted by a blue clock icon (refer to Figure 8). This data can include Conditions (diagnoses), Procedures (CPT Concept), Encounters, Labs, and Vitals.

Encounter concepts cannot be combined with Immutable Characteristics in a panel. Immutable characteristics are defined by present date, whereas Encounter concepts are defined by date recorded

Figure 8: immutable characteristics with orange human icons

ICD-10-CM Conditions: Conditions are structured in a tree format. Pulling one condition into a query will also pull all subsequent nodes in that tree structure. For example, searching for “Migraine (ICD10CM:G43.001-G43.D1)” will query for the “Migraine” condition and for all lower nodes in the tree as depicted in the red box in Figure 9. However, searching for a terminal node in a tree, for example “Migraine with aura, not intractable, with status migrainosis” (as depicted in orange), the search will query for only that condition.

Figure 9: Node hierarchy in a condition tree

Figure 9: Node hierarchy in a condition tree

 

Current Procedural Terminology Concept: Services, procedures, and events are structured in a tree format (similar to Conditions). These elements can also be located by typing a specific Procedure Term in the search box.

 

Vitals: Vital concepts rely on units of measurement, specifically:

  • Height is always measured in inches (US)
  • Body mass index (BMI) is always measured in kilograms per square meter
  • Body temperature is always measured in degrees Fahrenheit
  • Body weight is always measured in ounces

 

Search Logic: Leaf query boxes are connected by logical “and” operations where all concepts must be satisfied. For example, a search can find patients who are at least age 55, female, and white (see Figure 10) meeting all these criteria.

Within a query box, multiple alternatives can be connected by logical “or” operations. For example, a search can find patients who are male and are either Black/African American or Hispanic/Latino (see Figure 11).

Figure 10: Age, Gender, Race Query

Figure 11: Gender, Ethnicity either/or Query

 

Search Logic And Not: Extending search logic, adjusting query language to “And Not” to eliminate variables from the query will turn the “And Not” query box red (see Figure 12).

Figure 12: And Not Logic

Figure 12: And Not Logic

Note: a red query box specifies “And Not” logic, not a query error.

 

Search Logic In Same Encounter: Combine concepts in the same panel to query for encounters, conditions, or vitals measured at the same time (in the same encounter). Observe the difference between examples 1 and 2 below:

  • In example 1 (Figure 13) the query of patients who had a migraine (ICD-10-CM Condition) and had an emergency room visit (Encounter) at any time produces 572 patient records. This query shows individuals who, at any time, had a migraine condition and an emergency room visit encounter at (likely) separate times.
  • However, in example 2 (Figure 14) the query of patients who were diagnosed with a migraine during their visit to the emergency room produces 17 patient records. This query shows individuals who met both criteria at the same time. Note: it is not possible to combine encounter concepts with immutable patient characteristics in the same box (see Figure 7 for error).

Figure 13: Query of Migraine and Emergency Room Visit  

Figure 13: Query of Migraine and Emergency Room Visit

Figure 14: Query of Migraine and ER Visit in Same Encounter

Figure 14: Query of Migraine and ER Visit in Same Encounter

 

Date Logic: Query boxes can specify encounter date to include custom date ranges, including today, in the last 7 days or 30 days, or within a custom date range.

Dates can adjust. Use drop-down menus in the blue header of any box to specify the relative date of another encounter (such as “In the Same Encounter” and “Within +/-“ or “In the following…” time period) to customize a time frame for the query.

 

 

Viewing Search Results

Leaf provides quick overview of the data with customizable options for review. From the left-hand navigation:

  • The “Find Patients” tab (magnifying glass icon) provides your search criteria
  • The “Visualize” tab (bar graph icon) presents bar graphs and tables of general demographic data
  • The “Patient List” tab (human icon) details the queried dataset

Select a tab to view the information.

 

 

Viewing Results

Select the menu for “Basic Demographics” to add or remove fields from the dataset (see Figure 15)

Figure 15: Selecting columns for data set

 

Reorder columns by clicking and dragging column position on the dataset.

 

 

Exporting Data

After establishing dataset criteria, click the green button to “Export Data

  • Data will automatically export to a CSV spreadsheet
  • Confirm “Export” to download the file
  • The file will download locally (often into your computer’s Downloads folder) and can be opened after download

 

 

Saving Search Results

Datasets can be saved as a local file, and search queries can be saved within Leaf.

  • After exporting data to a CSV spreadsheet, downloading the file will save the data to your local machine
  • To save your search query, return to Leaf and use the left-hand navigation to return to “Find Patients
  • Select the green button to “Save Query
  • Input a designated Query Name and Category and click “Save
  • Note: Selecting “New Query” on the top menu will automatically prompt you to save your query
  • Load saved queries by navigating to the top right-hand corner, selecting your username, and selecting “Saved Queries” from the drop-down menu (see Figure 16)
  • Click the blue “Open” link next to the Saved Query title to load the query parameters
  • Click the red “x” link next to “Open” to delete the query (see Figure 16)

Figure 16: Saved Queries, Open and Delete

Figure 16: Saved Queries, Open and Delete

 

 

Additional Resources

See other resources for Leaf:

  • “Leaf Clinical Data Explorer”(Youtube, 11:04)
  • Dobbins, Nicholas, et. al. “Leaf: an open-source, model-agnostic, data-driven web application for cohort discovery and translational biomedical research.” Journal of the American Medical Informatics Association, Volume 27, Issue 1, January 2020, Pages 109–118, https://doi.org/10.1093/jamia/ocz165