i2b2 Sample Queries for Tips, Tools and Inherent Logic

advertisement
i2b2 Sample Queries for Tips, Tools and Inherent Logic
Important notes:

Most queries will run in under a minute. As you add more concepts and qualifiers to a query, it
may take longer and longer to process. Once the query timer (on the right hand side in the
query status pane) has gone past ~300 seconds, the query will most likely never “complete” in
the query status window. However, it will run to completion in the background. This has to do
with communication with the remote server (in Kansas City) on which i2b2 resides. Do a rightclick in the Previous Queries window, and select “refresh all’ from the menu. Your query should
be at the top of the stack. Open (by clicking the “+”), and the status will show if it is still
processing, or has finished. Once finished, you can drag the query from Previous Queries to the
Query Tool and drop it in the Query name box. The results will appear in the Query Status
window. Even if you log out, the query will run in the background.
 If you are building your own queries, start with the most restrictive concept in Group 1, and
proceed outward in successive groups with broader concepts. The i2b2 logic will start with
Group 1, and then review each subsequent concept against the patients that met Group 1
criterion, and so forth. Therefore, queries built from most to least restrictive (e.g. group 1 =
diagnosis; group 2 = sex; group 3 = visit type) will typically return results faster than queries built
the other way.
1) Sample query to determine the number of inpatient and outpatients in the system. Open Ontology,
and expand Visit Types
a) Drag and drop Inpatient folder to Group 1
i) Run a simple count of patients -> the default is set to number of patients which provides an
aggregated count
ii) Number of patients meeting criteria as of 11SEPT2013: 65,305
iii) Clear the query (next to “run query”)
b) Drag and drop Outpatient folder to Group 1
i) Note: Counts are unique per patient so a patient who has had 50 Outpatient visits would
count as “1”
ii) Number of patients meeting criteria as of 11SEPT2013: 429,946
c) Create query: Inpatient in group 1 and Outpatient in group 2
i) Note: patients must have been BOTH an inpatient at some point AND an outpatient at some
point to qualify for this patient group
ii) Number of patients meeting criteria as of 11SEPT2013: 54,820
d) Create query: Inpatient OR Outpatient (add both to group 1)
i) The count returned will include patients who ever had an inpatient OR an outpatient visit
ii) Note: this number will be smaller than Inpatient PLUS Outpatient by exactly the number of
patients who met both criteria.
iii) Number of patients meeting criteria as of 11SEPT2013: 440,431
2) Produce a list of all patients with a hemochromatosis diagnosis
a) First open ontology…. diagnoses….endocrine, nutritional, metabolic disorders…Other metabolic
disorders….disorders of mineral metabolism…disorders of iron metabolism
Version 1.0 August 5, 2013
Page 1
i2b2 Sample Queries for Tips, Tools and Inherent Logic
b) Or….use Find Terms/Search by Name: hemochromatosis
c) Bring over 3 terms into query
i) Run first on just number of patients
ii) Rerun search, selecting age and gender in “run query” menu
(1) Counts are returned for age and gender
iii) Next click patient list to create a patient set, and run query
iv) When query completes, select Analysis Tools (upper right) -> Demographics (1 patient set)
v) In Previous Query window, open query to patient set level, drag and drop the patient set
and see analysis graphs (note: language is NOT populated, as shown by the @ sign)
3) Test a lab value – Hgb A1c
a) Search by names, “starting with” “Hgb A1”
b) Select LOINC value for Hgb A1c 4548-4 (this LOINC has HMC data as shown by patient counts to
the right of the term
i) You can also search the Ontology: Hematology->hematology normal variant->hemoglobin
A1->hemoglobin A1c->hemoglobin A1c Bld-Ser-Plas-> 4548-4
c) Drag it over and set value to limit the results to a sicker population:
i) Set it at >6 %, and run number of patients only
ii) When complete, do a second query ->Right click on term in group 1, and “set value”
iii) Set it at >10% and run number of patients only
4) Practice using the Find Terms qualifiers
a) Click on the Find Terms tab
b) Enter “resection”, and run with qualifier set at the default “contains”
c) Change qualifier to “starting with” and run again
d) i2b2 is very “literal”, so using “exact” will only be successful if you also know the code that
follows the term and likewise “ending with” will also search on the coded number following the
text string.
e) Note: there is no current way to limit the search to a particular Ontology folder. Therefore, a
search on Hepatitis A yields both lab tests and diagnoses.
5) Narrow down a population by adding qualifiers and looking for relationships (note – these queries
may take a while. See bullet point 1 at top).
a) Find the ICD code for alcohol withdrawal -> Find Terms…search by names…alcohol withdrawal.
Select code 291.81 and add to Group 1.
i) Run query -> result should be ~ 309 patients
b) Next date restrict the search to 01/01/2013 onward (click on dates in Group 1, put a check in
the “from” box, and change date to 01/01/2013)
i) Run query -> results should be ~69 patients
c) Next add a medication….. navigate terms -> medications -> Central Nervous System Agents ->
Anxiolytics, Sedatives and Hypnotics -> select Benzodiazepines and add it to group 2
i) Run query -> results should be ~55 patients
Version 1.0 August 5, 2013
Page 2
i2b2 Sample Queries for Tips, Tools and Inherent Logic
(1) Note: This cohort now represents patients who had a diagnosis of Alcohol Withdrawal
since 01/01/2013 AND had benzodiazepines as an inpatient at any time (at any time
represented by data in the i2b2 database, which is from January 2011 forward).
d) Next date restrict Benzodiazepines to 1/1/2013 onward
i) Run query -> result should be ~47 patients
(1) Note: This cohort now represents patients who had a diagnosis of Alcohol Withdrawal
since January 2013, AND were administered benzodiazepines since January 2013, but
there is no temporal relationship set. In other words, there is no way to know if the
diagnosis and the medication were from the same visit or different visits, and which
occurred first.
e) Next apply a Temporal Constraint of “selected groups occur in the same financial encounter”
(i.e. the same visit) for both the Diagnosis and Benzodiazepines
i) Run query -> result should be about 36 patients
(1) Note: This cohort now represents patients who had a diagnosis of alcohol withdrawal
and were treated with benzodiazepines at the same visit. While it is possible that the
benzodiazepines preceded the treatment, this is an excellent proxy to determine if the
PSHMC alcohol withdrawal protocol is being followed.
f) Rename query (right click in Previous Query pane/rename) for later use in exercise Number 8 ->
Export the data
6) Find patients with MI and stent placement (either drug eluting or non-drug eluting), occurring in the
same OOS (financial encounter), so far this year:
a) Search ontology….diagnoses….diseases of the circulatory system…..ischemic heart
disease….acute MI ICD9 code 410 (note: there are subcategories for deeper drilling if needed) ->
add to group 1
i) Click on date box, and check box, change From date to 01/01/2013
b) Search Ontology…..procedures…...operations on the cardiovascular system….operations on
vessels of the heart….removal of coronary artery obstruction and insertion of stents
i) Select “insertion of drug eluting stents” -> add to Group 2
ii) Select “insertion of non-drug eluting stents” -> add to group 2 as well to create an “OR”
clause
iii) Click on Dates box in left top of query column and check the box, change From date to
01/01/2013
c) Select Temporal Constraint -> Occurs in the same financial encounter
d) Run query -> check number of patients only
e) Draw Timeline to visualize data:
i) First rerun query, with patient list checked as well as number of patients to create a “patient
set”. Results may take a bit longer to return.
ii) When done, and query appears in Previous Queries pane, select Analysis Tools ->Timeline
(you will need to scroll)
iii) In Previous Query window, open query to patient set level, drag and drop the patient set to
the box that says “drop a small patient set here”
Version 1.0 August 5, 2013
Page 3
i2b2 Sample Queries for Tips, Tools and Inherent Logic
iv) Next, return to the Ontology, and find each of the 3 concepts that built this query (Acute MI,
Insertion of drug eluting and non-drug eluting stent) and drag each over to the concepts
box.
v) Click View results
vi) Timeline will return patients in groups of 10
vii) Try the zoom and pan functions
7) Query within a query :
Build a query to see if there is a relationship between iron deficiency anemias and mood disorders
i)
First build a query on patients with iron deficiency anemia and a lab test for iron -> search
diseases of the blood…iron deficiency anemias (280) -> group 1; then search laboratory ->
chemistry -> Iron -> Iron Bld-Ser-Plas (LP42658-2) -> group 2 -> run query (patient count and
patient list)
ii) When complete, right click on query in previous queries window, and rename query to Iron
Deficiency Anemia
iii) Click the “Clear” button
iv) Next, pull the query called Iron Deficiency Anemia query over and drop it into Group 1.
(1) This creates an already selected group of patients against whom i2b2 will search for the
next set of criteria.
v) From Ontology, select Mental Disorders -> Neurotic Disorders, Personality Disorders and
Other Nonpsychotic Mental Disorders and add that folder to group 2 (Note: query may take
several minutes or more. You can always log out and return. Look for your query in Previous
Query window.)
vi) Run query -> patient counts and patient set (patient list)
vii) When complete, change from Find Patients to Analysis Tools, -> Timeline
viii) Grab the patient set from the Previous queries window, and drop it into “drop a small
patient set here” in the Timeline
ix) Add the concepts (from ontology) you want to look at into the concepts field -> perhaps just
the anemia folder and the neurotic disorders folder (i.e. lab test for iron may not be
necessary to look for relationship).
x) Run Timeline by clicking View results – this may take a few minutes.
xi) Click on one of the tick marks to see the associated code (in example below, ICD9 is 300.00 –
Anxiety, dissociative and somatoform disorders)
Version 1.0 August 5, 2013
Page 4
i2b2 Sample Queries for Tips, Tools and Inherent Logic
8) Exporting data using the ExportXLS plug-in:
a) Return to Find Patients
b) Rerun the query from exercise 5 (drag from Previous Queries window to Query Tool) or build a
query on patients with a diagnosis of alcohol withdrawal who were prescribed benzodiazepines
at the same encounter (find terms-> search by names -> alcohol withdrawal -> pick code 291.81
and add it to group 1; navigate terms -> medications -> Central Nervous System Agents ->
Anxiolytics, Sedatives and Hypnotics -> select Benzodiazepines and add it to group 2). Select
Temporal Constraint -> Occurs in the same financial encounter. Set the date range to limit the
size of the patient set for this example (click on dates in Group 1, put a check in the “from” box,
and change date to 01/01/2013 (note: because “occurs in the same encounter” is already
selected, it is not necessary to select the same date range for Group 2)
c) Run query -> select both “number of patients” and “patient list”
d) When query is complete, change from Find Patients to Analysis Tools, -> ExportXLS
e) Open the query, and drag the patient set over to the patient set box
f) Select the concepts to be exported (important note: the patient set consists only of the patients
who met the specified criteria. The criteria do not “travel along” with the patient set. You can
now select criteria that were not in the query to see if they apply to the defined patient set,
and/or choose the criteria (concepts) in the original query to find out additional data)
i) Drag over alcohol withdrawal from the ontology (either find terms, or find it via navigation
(291.81)
g) Search for benzodiazepines: Medications-> CNs drug-> anxiolytics->benzodiazepines
h) Add a lab test -> Laboratory -> chemistry -> electrolytes and drag the electrolyte parent folder
over to the concept box
i) Select formatting (see i2b2 User Guide for detailed instructions) -> choose the third (of 4)
formatting option for this example
j) Select fields to be displayed if interested (sex ,age, vital status, race)
Version 1.0 August 5, 2013
Page 5
i2b2 Sample Queries for Tips, Tools and Inherent Logic
k) Choose Resolve Concept/Modifier code (this resolves the code into its underlying text name
(e.g. 4548-4 = Hgb A1C). Using this option does increase the time it takes for the export table to
be produced.
l) Click View results
m) Data can then be exported into an excel file or a csv by clicking the button at the top of the page
Version 1.0 August 5, 2013
Page 6
Download