Live app: https://dur-network-visualization-uwk4hnvx6ejtpdatrthux7.streamlit.app
An interactive ego-network explorer built from public Korean DUR contraindication data.
DUR Risk Map is a prototype that transforms public ingredient-level DUR (Drug Utilization Review) data into an interactive graph structure.
Instead of reading raw contraindication tables row by row, users can:
- select an ingredient
- inspect its directly contraindicated neighbors
- review contraindication reasons
- identify whether connected drugs are flagged for vulnerable populations such as pregnancy, elderly use, or age-related contraindications
The current prototype focuses on ingredient-level ego-network exploration rather than full-network clinical decision support.
Public DUR data is highly valuable, but it is not immediately graph-ready.
In particular:
- the raw AC contraindication file is not a one-row-per-pair table
- repeated ingredient pairs appear across multiple rows
- the same pair may differ by direction pattern, detailed rule record, or update history
- vulnerable-population information is distributed across separate DUR files
This project addresses that by constructing:
- a canonical pair-based contraindication edge table
- a node table with overlay metadata
- an interactive ego-network view for selected ingredients
- interactive drug selection
- ego-network visualization centered on a selected ingredient
- full-network overview tab
- node coloring by DUR overlay category
- node sizing by network degree
- node border thickness by DUR risk flag count (1 flag → gray, 2 → orange, 3+ → crimson)
- edge thickness by source data row count (thicker = more documented relationship)
- global network min-degree slider to reduce clutter
- graph legend explaining node size, color, border, and edge thickness semantics
- selected drug detail panel including:
- pregnancy / elderly / age / therapeutic-group overlays
- dose caution
- duration caution
- directly connected contraindicated drug table
- contraindication reason preview with expandable detailed view
- top hub summary table
- sidebar filters for:
- pregnancy contraindication
- elderly caution
- age-related contraindication
- therapeutic group overlap
- top N neighbors
The current version uses the following public Korean DUR ingredient-level datasets:
OpenData_PotOpenDurIngr_AC20260312.csv— contraindicated combinationsOpenData_PotOpenDurIngr_BC20260312.csv— age-related contraindicationsOpenData_PotOpenDurIngr_CC20260312.csv— pregnancy contraindicationsOpenData_PotOpenDurIngr_FC20260312.csv— elderly cautionsOpenData_PotOpenDurIngr_GC20260312.csv— therapeutic group overlapOpenData_PotOpenDurIngr_DC20260312.csv— dose cautionOpenData_PotOpenDurIngr_EC20260312.csv— duration caution
The raw AC contraindication dataset is transformed into a canonical pair-based edge table.
- ingredient identity is defined by ingredient code
- display labels use English ingredient names, with Korean fallback when needed
- A-B and B-A are treated as the same undirected edge
- repeated raw rows are aggregated at the canonical pair level
- contraindication reasons are handled in three levels:
reason_raw: untouched source textreason_clean: deterministic normalized textreason_short: UI-friendly short text (optional LLM summarization, safe fallback)
- raw row count is preserved as metadata
A node table is created from all unique source and target ingredients appearing in the edge table.
Each node includes:
- ingredient code
- English label
- Korean label
- degree (number of directly connected contraindicated ingredients)
Additional DUR datasets are merged into the node table:
- BC → age-related contraindication
- CC → pregnancy contraindication
- FC → elderly caution
- GC → therapeutic group overlap
- DC → dose caution
- EC → duration caution
These overlays enrich interpretation of nodes and selected-drug detail panels.
A NetworkX graph is built from the edge and node tables.
- nodes store degree and overlay attributes
- edges store aggregated contraindication reason and raw row count
A Streamlit prototype provides:
- drug selector
- summary cards
- interactive Plotly ego-network
- directly connected contraindicated drug table
- expandable tables for cleaned reasons, optional raw reasons, and top hubs
A high-degree ingredient such as Rifampicin appears as a network hub because it is directly contraindicated with many other ingredients.
This does not mean it is the single most clinically dangerous drug overall.
Rather, it indicates that under the current public DUR rules, it has many direct contraindication connections in the graph.
- This is a graph exploration tool, not a real-world prescribing decision support system.
- Degree reflects network connectivity, not absolute clinical risk.
- The current prototype focuses on ego-network visualization rather than full-network exploration.
- Some contraindication reasons are long and still need better formatting.
- IC (상호작용 금기) category is not yet integrated.
dur-network-visualization/
├── app.py
├── data/
│ ├── raw/
│ │ ├── OpenData_PotOpenDurIngr_AC20260312.csv
│ │ ├── OpenData_PotOpenDurIngr_BC20260312.csv
│ │ ├── OpenData_PotOpenDurIngr_CC20260312.csv
│ │ ├── OpenData_PotOpenDurIngr_DC20260312.csv
│ │ ├── OpenData_PotOpenDurIngr_EC20260312.csv
│ │ ├── OpenData_PotOpenDurIngr_FC20260312.csv
│ │ ├── OpenData_PotOpenDurIngr_GC20260312.csv
│ │ └── OpenData_PotOpenDurIngr_IC20260312.csv
│ └── processed/
├── notebooks/
├── docs/
│ ├── 05_dev_log.md
│ └── screenshots/
│ ├── 01_home_rifampicin.png
│ ├── 02_interactive_hover.png
│ └── 03_neighbors_table.png
├── requirements.txt
└── README.md
Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtstreamlit run app.pyThen open the local Streamlit URL shown in the terminal.
- add IC and other remaining DUR categories
- improve formatting of long contraindication reasons
- add CSV download for filtered neighbor tables
- add keyword filtering for contraindication reasons
- deploy the app online
This project was built to explore how public Korean DUR rule tables can be reframed as an interactive graph structure for more intuitive medication safety exploration.


