phecode_demo / app.py
Sander Su
demo app
cc25c27
import streamlit as st
import pandas as pd
import math
# Load data
@st.cache_data
def load_data():
data_url = 'https://phewascatalog.org/files/Phecode_map_v1_2_icd10cm_beta.csv'
data = pd.read_csv(data_url, encoding='ISO-8859-1')
return data
data_load_state = st.text('Loading data...')
data = load_data()
data_load_state.text('Loading data...done!')
# Create columns
left_column, right_column = st.columns(2)
# Abstract sections
abstract_sections = {
'Background': 'The PheCode system was built upon the International Classification of Diseases, Ninth Revision, Clinical Modification (ICD-9-CM) for phenome-wide association studies (PheWAS) in the electronic health record (EHR).',
'Objective': 'Here, we present our work on the development and evaluation of maps from ICD-10 and ICD-10-CM codes to PheCodes.',
'Methods': 'We mapped ICD-10 and ICD-10-CM codes to PheCodes using a number of methods and resources, such as concept relationships and explicit mappings from the Unified Medical Language System (UMLS), Observational Health Data Sciences and Informatics (OHDSI), Systematized Nomenclature of Medicine - Clinical Terms (SNOMED CT), and National Library of Medicine (NLM). We assessed the coverage of the maps in two databases: Vanderbilt University Medical Center (VUMC) using ICD-10-CM and the UK Biobank (UKBB) using ICD-10. We assessed the fidelity of the ICD-10-CM map in comparison to the gold-standard ICD-9-CM→PheCode map by investigating phenotype reproducibility and conducting a PheWAS.',
'Results': 'We mapped >75% of ICD-10-CM and ICD-10 codes to PheCodes. Of the unique codes observed in the VUMC (ICD-10-CM) and UKBB (ICD-10) cohorts, >90% were mapped to PheCodes. We observed 70-75% reproducibility for chronic diseases and <10% for an acute disease. A PheWAS with a lipoprotein(a) (LPA) genetic variant, rs10455872, using the ICD-9-CM and ICD-10-CM maps replicated two genotype-phenotype associations with similar effect sizes: coronary atherosclerosis (ICD-9-CM: P < .001, OR = 1.60 vs. ICD-10-CM: P < .001, OR = 1.60) and with chronic ischemic heart disease (ICD-9-CM: P < .001, OR = 1.5 vs. ICD-10-CM: P < .001, OR = 1.47).',
'Conclusions': 'This study introduces the initial “beta” versions of ICD-10 and ICD-10-CM to PheCode maps that will enable researchers to leverage accumulated ICD-10 and ICD-10-CM data for high-throughput PheWAS in the EHR.'
}
with left_column:
for section, content in abstract_sections.items():
with st.expander(section):
st.write(content)
# Search functionality
with right_column:
search_input = st.text_input("Search")
search_option = st.selectbox('Search by', ['icd10cm', 'icd10cm_str', 'phecode', 'phecode_str', 'exclude_range'])
if st.button('Search'):
results = data[data[search_option].astype(str).str.contains(search_input)]
# Pagination
max_pages = math.ceil(results.shape[0]/25)
page = st.slider('Page Number', 1, max_pages)
start = 25*(page-1)
end = 25*page
results = results.iloc[start:end, :]
st.write(results)