# senthilmmurugesan/cnx-hackathon architecture

> Architecture diagram of the GitHub repository senthilmmurugesan/cnx-hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/senthilmmurugesan/cnx-hackathon
- Repository: https://github.com/senthilmmurugesan/cnx-hackathon

## Overview

This repository is a Databricks drug-safety question-answering agent backed by adverse-event data. Its main workflow accepts a user question, uses a LangGraph tool-calling agent to retrieve drug and safety information, and returns a readable risk summary. Separate notebooks load source tables and prepare drug names for optional vector-based normalization. The excerpts show the agent structure and table loading, but do not expose the SQL function definitions or full tool wiring, so those links are documented rather than inferred from unseen code.

Main entry points: [`driver.py`](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py) (Drug safety agent), [`nb-create-vector.py`](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-vector.py) (Drug-name index), [`tables.sql`](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/tables.sql) (Safety tables), [`nb-create-input-tables.py`](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-input-tables.py) (Input table loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent runtime"]
  node_agent["Drug safety agent<br/>[driver.py]"]
  node_workflow["LangGraph workflow<br/>[driver.py]"]
  node_model["Serving model"]
  node_tools["Retrieval tools<br/>[driver.py]"]
end

subgraph group_data["Safety data"]
  node_sql["Safety SQL functions<br/>[functions.sql]"]
  node_tables[("Safety tables<br/>[tables.sql]")]
  node_vector[("Drug-name index")]
end

subgraph group_setup["Data preparation"]
  node_inputs["Input table loader"]
  node_tool_setup["Tool notebook<br/>[nb-create-tools.py]"]
end

node_user(("Questioner"))

node_user -->|"asks"| node_agent
node_agent -->|"runs"| node_workflow
node_workflow -->|"invokes"| node_model
node_workflow -->|"dispatches"| node_tools
node_tools -.->|"queries"| node_sql
node_tools -.->|"normalizes"| node_vector
node_agent -->|"answers"| node_user
node_inputs -->|"writes"| node_tables
node_vector -->|"reads"| node_tables

click node_agent "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py"
click node_workflow "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py"
click node_tools "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py"
click node_sql "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/functions.sql"
click node_tables "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/tables.sql"
click node_vector "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-vector.py"
click node_inputs "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-input-tables.py"
click node_tool_setup "https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-tools.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent,node_workflow,node_model,node_tools toneBlue
class node_sql,node_tables,node_vector toneAmber
class node_inputs,node_tool_setup toneMint
class node_user toneIndigo
```

## Components

### Agent runtime

- [Drug safety agent](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py): `driver.py`
- [LangGraph workflow](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py): `driver.py`
- **Serving model**
- [Retrieval tools](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/driver.py): `driver.py`

### Safety data

- [Safety SQL functions](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/functions.sql): `functions.sql`
- [Safety tables](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/tables.sql): `tables.sql`
- [Drug-name index](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-vector.py): `nb-create-vector.py`

### Data preparation

- [Input table loader](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-input-tables.py): `nb-create-input-tables.py`
- [Tool notebook](https://github.com/senthilmmurugesan/cnx-hackathon/blob/main/nb-create-tools.py): `nb-create-tools.py`

### Other components

- **Questioner**

## Connections

- Questioner → Drug safety agent: asks (evidence: `driver.py`)
- Drug safety agent → LangGraph workflow: runs (evidence: `driver.py`)
- LangGraph workflow → Serving model: invokes (evidence: `driver.py`)
- LangGraph workflow → Retrieval tools: dispatches (evidence: `driver.py`)
- Retrieval tools → Safety SQL functions: queries (evidence: `driver.py`)
- Retrieval tools → Drug-name index: normalizes (evidence: `driver.py`)
- Drug safety agent → Questioner: answers (evidence: `driver.py`)
- Input table loader → Safety tables: writes (evidence: `nb-create-input-tables.py`)
- Drug-name index → Safety tables: reads (evidence: `nb-create-vector.py`)
