---
title: "Labs"
author: "Anobel Odisho, MD MPH
"
subtitle: "Epi 231 - EHR Data for Clinical Research"
output:
ioslides_presentation:
css: aocustom.css
self_contained: yes
incremental: false
output: ioslides_presentation
widescreen: true
smaller: true
transition: faster
code_folding: true
---
```{r, include=FALSE}
# baseline knitr options
knitr::opts_chunk$set(echo = F, warning = F, message = F, cache = F)
library(odbc) # Loads the ODBC drivers
library(DBI) # Allows you to pass SQL to database
library(dbplyr) # use dplyr style commands to extract data from SQL databases
library(tidyverse) # data cleaning
library(knitr) # Rmarkdown and table display
library(DT) # Interactive tables in markdown
library(ggplot2) # making charts
library(ggthemes)
library(htmlwidgets)
library(ucsftheme)
```
```{r}
source("connect_deidcdw.R")
```
## Intro
- Ontology: LOINC
- Key Challenges
## LOINC
- Logical Observation Identifiers Names and Codes (loinc.org)
- Ontology for labs and clinical measurements
+ Laboratory LOINC
+ Clinical LOINC
- Goal is interoperability
- Uniquely identify every possible lab
## LOINC
- Component (analyte): substance or entity measured or observed
- Property: e.g., mass concentration, numeric fraction
- Time: point in time
- Specimen (system): e.g., blood, cerebrospinal fluid
- Scale: e.g., qualitative, quantitative, ordinal, nominal
- Method: optional, procedure used to make observation
## LOINC - CBC

## LOINC - Creatinine
{width=60%}
## LOINC - PSA

## LOINC - Prostate

## Lab Lifecycle

## Key Challenges
- Same lab, different name
- Same test, different body fluid
- Different labs, different reference ranges
- per-hospital variation in devices used
- Consistency in units and normal ranges
- Calculated values that require other clinical data (eGFR)
- Lack of good groupers
## Key Challenges
- Erroneous results
- Results change over time
+ micro: may be negative at first, but subsequently positive
+ erroneous corrected
## Key Lab Tables
- LabDim: Info about the laboratories themselves
- LabComponentDim: info about the lab tests
- LabTestFact: data about the test itself
- LabComponentResultFact: actual test results
- LabTestComponentResultMappingFact: linking LabTestFact to LabComponentResultFact
