# adhesh23/doc-commenter-sync-using-suprsend architecture

> Architecture diagram of the GitHub repository adhesh23/doc-commenter-sync-using-suprsend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adhesh23/doc-commenter-sync-using-suprsend
- Repository: https://github.com/adhesh23/doc-commenter-sync-using-suprsend

## Overview

Commentor Sync polls Google Docs for unresolved comments, excludes the authenticated user’s comments, and persists new comments for deduplication. A separate classification step labels stored comments through NVIDIA NIM; notification then resolves document-owner metadata, sends one idempotent SuprSend event per categorized comment, and marks accepted events sent. SuprSend batches events into a digest for the document owner. The notifier and classifier read/write SQLite directly. Digest batching is documented, but its implementation is external to this repository; the workflow spec is present in the tree.

Main entry points: [`notifier.py`](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/notifier.py) (Notify pending), [`drive_client.py`](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/drive_client.py) (Poll & filter), [`classifier.py`](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/classifier.py) (Classify comments), [`store.py`](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/store.py) (Comment store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Comment collection"]
  node_drive_poll["Poll &amp; filter<br/>[drive_client.py]"]
  node_comment_store[("Comment store<br/>[store.py]")]
  node_poll_state[("Poll state<br/>[store.py]")]
end

subgraph group_processing["Comment processing"]
  node_classifier["Classify comments<br/>[classifier.py]"]
end

subgraph group_delivery["Notification delivery"]
  node_notifier["Notify pending<br/>[notifier.py]"]
  node_metadata["Resolve document owner<br/>[drive_client.py]"]
  node_event_payload["Build event payload<br/>[notifier.py]"]
  node_batch_workflow["Batch digest events"]
  node_digest_email["Digest email"]
end

subgraph group_integrations["External services"]
  node_drive_api["Google Drive"]
  node_nim["NVIDIA NIM"]
  node_suprsend["SuprSend events"]
end

node_operator(("Operator"))
node_document_owner(("Document owner"))

node_operator -->|"runs poll"| node_drive_poll
node_drive_poll -->|"lists comments"| node_drive_api
node_drive_api -->|"returns comments"| node_drive_poll
node_drive_poll -->|"deduplicates and saves"| node_comment_store
node_drive_poll -->|"updates poll time"| node_poll_state
node_operator -->|"runs classification"| node_classifier
node_classifier -->|"reads pending comments"| node_comment_store
node_classifier -->|"requests category"| node_nim
node_nim -->|"returns category"| node_classifier
node_classifier -->|"writes categories"| node_comment_store
node_operator -->|"runs notification"| node_notifier
node_notifier -->|"reads categorized comments"| node_comment_store
node_notifier -->|"requests owner metadata"| node_metadata
node_metadata -->|"fetches document metadata"| node_drive_api
node_drive_api -->|"returns metadata"| node_metadata
node_notifier -->|"builds per-comment event"| node_event_payload
node_event_payload -->|"dispatches event"| node_suprsend
node_suprsend -.->|"batches events"| node_batch_workflow
node_batch_workflow -.->|"delivers digest"| node_digest_email
node_digest_email -.->|"sends to owner"| node_document_owner
node_suprsend -->|"returns acceptance"| node_notifier
node_notifier -->|"marks accepted sent"| node_comment_store

click node_drive_poll "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/drive_client.py"
click node_comment_store "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/store.py"
click node_poll_state "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/store.py"
click node_classifier "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/classifier.py"
click node_notifier "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/notifier.py"
click node_metadata "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/drive_client.py"
click node_event_payload "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/notifier.py"
click node_batch_workflow "https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/suprsend_workflow_spec.md"

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_drive_poll,node_comment_store,node_poll_state toneBlue
class node_classifier toneAmber
class node_notifier,node_metadata,node_event_payload,node_batch_workflow,node_digest_email toneMint
class node_drive_api,node_nim,node_suprsend toneRose
class node_operator,node_document_owner toneIndigo
```

## Components

### Comment collection

- [Poll & filter](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/drive_client.py): `drive_client.py`
- [Comment store](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/store.py): `store.py`
- [Poll state](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/store.py): `store.py`

### Comment processing

- [Classify comments](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/classifier.py): `classifier.py`

### Notification delivery

- [Notify pending](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/notifier.py): `notifier.py`
- [Resolve document owner](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/drive_client.py): `drive_client.py`
- [Build event payload](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/notifier.py): `notifier.py`
- [Batch digest events](https://github.com/adhesh23/doc-commenter-sync-using-suprsend/blob/master/suprsend_workflow_spec.md): `suprsend_workflow_spec.md`
- **Digest email**

### External services

- **Google Drive**
- **NVIDIA NIM**
- **SuprSend events**

### Other components

- **Operator**
- **Document owner**

## Connections

- Operator → Poll & filter: runs poll
- Poll & filter → Google Drive: lists comments
- Google Drive → Poll & filter: returns comments
- Poll & filter → Comment store: deduplicates and saves
- Poll & filter → Poll state: updates poll time
- Operator → Classify comments: runs classification
- Classify comments → Comment store: reads pending comments
- Classify comments → NVIDIA NIM: requests category
- NVIDIA NIM → Classify comments: returns category
- Classify comments → Comment store: writes categories
- Operator → Notify pending: runs notification
- Notify pending → Comment store: reads categorized comments
- Notify pending → Resolve document owner: requests owner metadata
- Resolve document owner → Google Drive: fetches document metadata
- Google Drive → Resolve document owner: returns metadata
- Notify pending → Build event payload: builds per-comment event
- Build event payload → SuprSend events: dispatches event
- SuprSend events → Batch digest events: batches events
- Batch digest events → Digest email: delivers digest
- Digest email → Document owner: sends to owner
- SuprSend events → Notify pending: returns acceptance
- Notify pending → Comment store: marks accepted sent
