Service Interaction Diagram

Banking AI Document Assistant — How Services Talk to Each Other

End-to-end data flow from IBM FileNet documents to banker chat responses

AWS Services
IBM (Production)
ClickHouse — Aggregation
ChromaDB — Content RAG
Query Router
Chat UI · Streamlit Cloud
💱 USD · 🔐 Password gate · 🔄 Dual-write pipeline
API call
Data flow
Track 1 — Aggregation Queries  ·  Nova Lite NL→SQL → ClickHouse Cloud ✅ LIVE
1
📂 IBM FileNet / S3
PDF stored with
S3 object metadata
2
🐍 Python Ingestor
boto3 S3 read
metadata → 32 columns
3
🗄️ ClickHouse Cloud
clickhouse_connect
columnar store
4
🤖 Nova Lite LLM
NL → SQL
schema-aware prompt
5
🗄️ ClickHouse executes
Full dataset scan
no row limit
6
🤖 Nova Lite formats
Rows → markdown
table + insights
7
👤 Banker
Answer + data table
+ generated SQL
API calls made (per aggregation question):  bedrock-runtime.invoke_model(NL→SQL) → clickhouse_connect.query(SQL) → bedrock-runtime.invoke_model(format results)
Track 2A — Ingestion Pipeline  ·  Dual-write: ChromaDB + ClickHouse in one run
1
📂 S3 / FileNet
PDF binary +
32-field metadata tags
2
📄 pdfplumber
Text extracted
page by page
3
✂️ LangChain Splitter
500-token chunks
80-token overlap
4
🔢 Bedrock Titan
256-dim vectors
per chunk · USD
5a
📦 ChromaDB
vector + metadata
upserted (content RAG)
5b
🗄️ ClickHouse
metadata row upserted
ReplacingMergeTree
🔄 Idempotent: re-running ingest.py for the same doc is safe — ChromaDB upserts, ClickHouse ReplacingMergeTree deduplicates on latest ingested_at
🖨️ Scanned PDF path: S3 → AWS Textract OCR → joins at step 3  |  Cost: ~$1.50/1,000 pages
Track 2B — Smart Query Router  ·  Automatic intent detection per question
1
👤 Banker Query
Plain English
via Streamlit
2
🔀 Query Router
Keyword intent
detection
A
📊 Aggregation
how many · count
per year · by branch
→ ClickHouse NL→SQL
or
B
🔍 Content Search
summarise · explain
what did · show case
→ ChromaDB RAG
3
💬 Streamlit UI
Answer + data table
or source citations
Track 2C — Content RAG Pipeline  ·  Real-time semantic search per content question
1
👤 Banker Query
Plain English
content question
2
🧩 LangChain
Filter extraction
from NL query
3
🔢 Bedrock Titan
Query embedded
→ 256-dim vector
4
📦 ChromaDB
Hybrid search
vector + metadata
5
🤖 Nova Lite LLM
Answer grounded
in top-20 chunks
6
💬 Streamlit UI
Answer + citations
+ PDF links
Service-to-Service Interaction Map
From To Protocol / API What is exchanged When
Python Ingestor 🔵 AWS S3 HTTPSboto3 GetObject, HeadObject PDF binary bytes + S3 object metadata tags Ingestion batch / incremental
Python Ingestor 🔵 AWS Textract HTTPSboto3 detect_document_text() PDF pages → extracted text blocks (scanned docs only) Ingestion — scanned PDFs only
Python Ingestor 🔵 Bedrock Titan HTTPSbedrock-runtime.invoke_model() Text chunk (≤8K tokens) → 256-dim float array Ingestion — once per chunk
Python Ingestor 🟣 ChromaDB Local gRPCcollection.upsert() chunk text + 256-dim embedding + metadata dict (USD amounts) Ingestion — dual-write step 5a, once per chunk
Python Ingestor 🟢 ClickHouse Cloud HTTPS / Nativeclickhouse_connect.insert() Full metadata row: 32 columns, USD Float64 amounts, typed Dates — same ingest.py run as ChromaDB Ingestion — dual-write step 5b, once per doc · ReplacingMergeTree deduplicates
Streamlit UI 🟣 LangChain RAG Chain In-processPython function call Banker query string → result dict (answer + sources) Every question
LangChain RAG Chain 🔵 Bedrock Nova Lite (NL→SQL) HTTPSbedrock-runtime.invoke_model() Banker question + schema → valid ClickHouse SQL query Aggregation questions only (counts, trends, breakdowns)
LangChain RAG Chain 🟢 ClickHouse Cloud HTTPS / Nativeclickhouse_connect.query() Generated SQL → result rows (full dataset, no row limit) Aggregation questions only
LangChain RAG Chain 🔵 Bedrock Nova Lite (format) HTTPSbedrock-runtime.invoke_model() Raw ClickHouse result rows → formatted markdown answer + insights Aggregation questions only
LangChain RAG Chain 🔵 Bedrock Titan HTTPSbedrock-runtime.invoke_model() Query text → 256-dim embedding vector Content questions only
LangChain RAG Chain 🟣 ChromaDB Local gRPCcollection.query() Query vector + metadata filters → top-20 chunks + scores Content questions only
LangChain RAG Chain 🔵 Bedrock Nova Lite (RAG) HTTPSbedrock-runtime.invoke_model() System prompt + retrieved chunks + question → answer text with doc citations Content questions only
Streamlit UI 👤 Banker Browser HTTP / WebSocketStreamlit server Rendered chat UI, answer text, source cards, S3 PDF links Continuous session
Banker Browser 🔵 AWS S3 HTTPSPre-signed URL PDF binary → rendered in browser tab When banker clicks "View PDF"
IBM FileNet (Prod) 🐍 Python Ingestor REST / CMISFileNet Content Engine REST API PDF binary + FileNet object properties Production — replaces S3 boto3 calls
POC → Production: What Changes vs What Stays
🔄 Swap (config change only)
S3 bucket IBM FileNet P8 FileNetLoader replaces S3FileLoader
Nova Lite Claude Haiku 3 1 line: LLM_MODEL = "..."
ChromaDB pgvector on RDS Same LangChain interface
Streamlit Cloud FastAPI + React Same RAG chain backend
✅ Stays identical
✓  Chunking logic (RecursiveCharacterTextSplitter)
✓  Titan Embeddings API call
✓  Hybrid retrieval (vector + metadata filters)
✓  Banking system prompt
✓  Source citation logic
Security & Compliance Layer — Applied Across All Services
🔐
IAM Role-Based Access
Each banker's session scoped to their branch and assigned cases. AWS IAM + FileNet ACLs enforced at every API call.
📋
Audit Logging
Every query, every retrieved document chunk and every LLM call logged to CloudWatch for FCA compliance and review.
🛡️
PII Redaction
Account numbers and sensitive fields masked before sending context to external LLM endpoints. On-premise option via IBM watsonx.
🔒
Data Residency
All data stays within AWS region. S3, Bedrock and ChromaDB operate in the same region. FileNet on-premise in production.