Skip to content

goneyak/dur-network-visualization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DUR Risk Map

Live app: https://dur-network-visualization-uwk4hnvx6ejtpdatrthux7.streamlit.app

An interactive ego-network explorer built from public Korean DUR contraindication data.

Overview

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.

Why this project?

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

Current Features

  • 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

Screenshots

Main app view

Main app view

Interactive hover

Interactive hover

Neighbor table

Neighbor table

Data Sources

The current version uses the following public Korean DUR ingredient-level datasets:

  • OpenData_PotOpenDurIngr_AC20260312.csv — contraindicated combinations
  • OpenData_PotOpenDurIngr_BC20260312.csv — age-related contraindications
  • OpenData_PotOpenDurIngr_CC20260312.csv — pregnancy contraindications
  • OpenData_PotOpenDurIngr_FC20260312.csv — elderly cautions
  • OpenData_PotOpenDurIngr_GC20260312.csv — therapeutic group overlap
  • OpenData_PotOpenDurIngr_DC20260312.csv — dose caution
  • OpenData_PotOpenDurIngr_EC20260312.csv — duration caution

Method

1. Edge construction

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 text
    • reason_clean: deterministic normalized text
    • reason_short: UI-friendly short text (optional LLM summarization, safe fallback)
  • raw row count is preserved as metadata

2. Node construction

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)

3. Overlay metadata

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.

4. Graph representation

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

5. App interface

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

Example Interpretation

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.

Limitations

  • 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.

Project Structure

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

Installation

Create and activate a virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Run the App

streamlit run app.py

Then open the local Streamlit URL shown in the terminal.

Future Work

  • 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

Author Notes

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.

About

Interactive DUR risk map for exploring contraindication networks and medication safety signals

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors