"""
๐ ICD-10 Automated Clinical Coding System โ Dashboard
"""
import streamlit as st
import os
# โโ Page Config โโ
st.set_page_config(
page_title="ICD-10 AutoCoder",
page_icon="๐ฅ",
layout="wide",
initial_sidebar_state="expanded",
)
# โโ Load CSS โโ
css_path = os.path.join(os.path.dirname(__file__), "assets", "style.css")
if os.path.exists(css_path):
with open(css_path, encoding="utf-8") as f:
st.markdown(f"", unsafe_allow_html=True)
from utils.config import DATASET_STATS, TOP_20_CODES
# โโ Sidebar โโ
with st.sidebar:
st.markdown("## ๐ฅ ICD-10 AutoCoder")
st.markdown("---")
st.markdown("""
**Navigation**
- ๐ Dashboard (this page)
- ๐ฌ Live ICD Coding
- ๐ Model Comparison
- ๐ ICD-10 Browser
- ๐ Dataset Explorer
- ๐ Batch Prediction
- โ๏ธ About
""")
st.markdown("---")
st.markdown(
'
'
'Built for clinical NLP research
'
'RTX 4050 ยท 6GB VRAM ยท LoRA
',
unsafe_allow_html=True
)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# HERO SECTION
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown("""
ICD-10 Automated Clinical Coding
A hierarchical retrieval and biomedical re-ranking system for automated
ICD-10 diagnosis code assignment from clinical discharge notes.
Bilingual output (English + Traditional Chinese) across 2,863 codes.
""", unsafe_allow_html=True)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# STAT CARDS
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown('',
unsafe_allow_html=True)
c1, c2, c3, c4 = st.columns(4)
with c1:
st.markdown(f"""
{DATASET_STATS['raw_records']:,}
Clinical Records
""", unsafe_allow_html=True)
with c2:
st.markdown(f"""
{DATASET_STATS['unique_encounters']:,}
Patient Encounters
""", unsafe_allow_html=True)
with c3:
st.markdown(f"""
{DATASET_STATS['unique_codes']:,}
ICD-10 Codes
""", unsafe_allow_html=True)
with c4:
st.markdown("""
""", unsafe_allow_html=True)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ARCHITECTURE PIPELINE
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown("")
st.markdown('',
unsafe_allow_html=True)
col_l, col_r = st.columns([3, 2])
with col_l:
st.markdown("""
LAYER 1
Hierarchical TF-IDF Retriever
Chapter โ Category โ Full code scoring
Reduces 2,863 codes โ top-100 candidates
โผ
LAYER 2
ClinicalBERT Re-Ranker (LoRA)
Pairwise relevance scoring: (note, ICD description) โ score
92.5% pairwise F1 accuracy
โผ
LAYER 3
Bilingual Prediction Output
Ranked ICD codes with confidence scores
English + Traditional Chinese descriptions
""", unsafe_allow_html=True)
with col_r:
st.markdown("""
BEST BASELINE
TF-IDF + LinearSVC
0.516
Micro-F1 (Top-100)
BEST TRANSFORMER
ClinicalBERT (LoRA)
0.397
Micro-F1 (Full 2,863)
PROPOSED PIPELINE
Hierarchical Re-Ranker
0.925
Pairwise Re-ranking F1
""", unsafe_allow_html=True)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# QUICK ACCESS
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown("")
st.markdown('',
unsafe_allow_html=True)
qa1, qa2, qa3, qa4 = st.columns(4)
with qa1:
st.markdown("""
๐ฌ
Live ICD Coding
Paste a clinical note and get instant ICD-10 predictions
""", unsafe_allow_html=True)
with qa2:
st.markdown("""
๐
Model Comparison
Compare all 4 models with interactive charts
""", unsafe_allow_html=True)
with qa3:
st.markdown("""
๐
ICD-10 Browser
Search and explore all 2,863 ICD-10 codes
""", unsafe_allow_html=True)
with qa4:
st.markdown("""
๐
Batch Prediction
Upload CSV files for bulk ICD-10 coding with multi-model comparison
""", unsafe_allow_html=True)
# โโ Footer โโ
st.markdown("""
""", unsafe_allow_html=True)