Untitled

 avatar
unknown
plain_text
14 days ago
1.6 kB
6
Indexable
import matplotlib.pyplot as plt
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Define nodes
nodes = {
    "Arrival": "Patient Arrival & Visual Triage",
    "Triage-In": "Triage-In: Emergency Case",
    "Registration": "Registration",
    "Emergency Flow": "Follow Emergency Patient Flow",
    "Triage-Out": "Triage-Out: Non-Emergency Case",
    "Complete Info": "Complete Patient Information",
    "Express Clinic": "Proceed to Express Clinic",
}

# Add nodes to the graph
G.add_nodes_from(nodes.keys())

# Define edges (connections)
edges = [
    ("Arrival", "Triage-In"),
    ("Arrival", "Triage-Out"),
    ("Triage-In", "Registration"),
    ("Registration", "Emergency Flow"),
    ("Triage-Out", "Complete Info"),
    ("Complete Info", "Express Clinic"),
]

# Add edges to the graph
G.add_edges_from(edges)

# Define positions for nodes
pos = {
    "Arrival": (0, 3),
    "Triage-In": (-2, 2),
    "Triage-Out": (2, 2),
    "Registration": (-2, 1),
    "Emergency Flow": (-2, 0),
    "Complete Info": (2, 1),
    "Express Clinic": (2, 0),
}

# Draw the graph
plt.figure(figsize=(10, 6))
nx.draw(G, pos, with_labels=True, node_size=5000, node_color="lightblue", edge_color="black", font_size=10, font_weight="bold")

# Add labels to nodes
labels = {key: value for key, value in nodes.items()}
nx.draw_networkx_labels(G, pos, labels, font_size=10, font_weight="bold", verticalalignment="center")

# Display the diagram
plt.title("Patient Flow Diagram", fontsize=14, fontweight="bold")
plt.show()
Editor is loading...
Leave a Comment