""" ๐Ÿ  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('
Project at a Glance
', 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("""
4
Trained Models
""", unsafe_allow_html=True) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # ARCHITECTURE PIPELINE # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• st.markdown("") st.markdown('
Three-Layer Pipeline Architecture
', 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('
Quick Access
', 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)