Leaf Tutorial

 

You can use Leaf to query the 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).

 

SET UP USER ACCESS

First-time Leaf users must request access.

  1. Navigate to the Service Desk
  2. Click “Query Tool Access Request Form”
  3. Complete the form, noting Platform is “Leaf” and Data Source is “MSDW 2.0 De-identified”
    • Only de-identified data is available in Leaf. For PHI or Datamart access, consider utilizing the Atlas platform with your Mount Sinai School credentials.

 

Once you receive an email confirmation that your account is set up:

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

 

ACCESS ERROR

All Leaf users must be granted administrative access. Attempts to sign in without having administrative permission will be blocked from entry (see Figure 1).

Figure 1: Login error for users with unverified accounts

Figure 1: Login error for users with unverified accounts

 

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 Microsoft (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 query intent by selecting  Quality Improvement or Research
  • If you have an Approved QI Documentation or an Approved IRB, consider utilizing Atlas to access PHI. There is currently only de-identified data available through Leaf.
  • 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 search for de-identified patient records and data using dynamic search criteria. There are several key areas in Leaf:

Figure 4: Leaf Overview

Figure 4: Leaf Overview

  1. Concepts: Select concepts from the expandable menu, or search for concepts in the search barabove the concept menu
  2. Query Boxes: Drag and drop concepts into query boxes, which enables you to graphically combine concepts into a Boolean logic query
  3. Initiate/Run Query: After selecting search parameters, this initiates the query. After running a query, this green button becomes “Save Query” to save your search parameters
  4. Query Status: See the status of your query in real time; the number of patients in the search displays here once the query is complete
  5. User Menu: This drop-down menu displays your role, help you log out, or review saved searches in Leaf
  6. Leaf Functions: “Find Patients” returns to the landing page to run new queries; “Visualize” displays quick-reference demographic graphs, and “Patient List” displays columns of data after a query has been run. 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:
    • Demographics outline patient characteristics, further broken down into: AgeEthnicityGenderRace, and Vital Status
    • Encounters specifies patient visit criteria
    • ICD-10-CM Conditions provides coded and descriptive diagnoses
    • Vitals provides baseline patient health criteria
    • Each Concept indicates the number of patient records within the category, denoted by a faded human icon to the right of the concept:

    • Use the Search bar to find specific concepts to add to the query
    • Other domains in development will open soon: CPT4 Procedures, LOINC Labs, and RxNorm Drugs
  • Individual Concept menus expand by selecting the arrow to the left of each Concept category
  • 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 data set if “In-patient” were in box 1 and “Male” in box 2)

 

SPECIFY QUERY PARAMETERS

Some concepts can 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 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), 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

 

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

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