How tar7nic/envint works
This repository is a compliance Q&A engine and retrieval-strategy benchmark over hospital policy documents. Its primary workflow chunks and indexes policies, retrieves evidence through a selected strategy, then generates an answer with validated citations or a refusal. The graph also preserves the benchmark and observability capabilities documented in the README. Retrieval and answer paths are supported by source excerpts; benchmark internals were not sampled, so their detailed connections are omitted.
Main entry points: main.py FastAPI routes · qa.py QA orchestration · factory.py Strategy factory · hybrid.py Hybrid fusion
Components 24
Policy ingestion
- Policy corpus
data/corpus - Clause chunker
app/ingestion/chunker.py - Embedding indexer
app/ingestion/indexer.py - Qdrant store
Retrieval strategies
- Strategy factory
app/retrieval/factory.py - Retriever interface
app/retrieval/base.py - Vector search
app/retrieval/vector.py - BM25 search
app/retrieval/bm25.py - Hybrid fusion
app/retrieval/hybrid.py - RRF fusion
app/retrieval/rrf.py - Cross-encoder reranker
app/retrieval/reranker.py
Answer generation
- QA orchestration
app/llm/qa.py - Prompt construction
app/llm/prompts.py - Citation validation
app/llm/guardrails.py - LLM client
app/llm/client.py
API and operations
- FastAPI routes
app/api/main.py - Runtime settings
app/config.py - Data contracts
app/schemas.py - Tracing and metrics
app/observability/tracing.py
Benchmark evaluation
- Strategy benchmarks
benchmark - Ranking metrics
benchmark/metrics.py - Pareto comparison
benchmark/pareto.py
Other components
- API caller
- OpenAI-compatible LLM
Connections 30
- API caller → FastAPI routes: submits query
README.md - Policy corpus → Clause chunker: chunks policies
README.md - Clause chunker → Embedding indexer: indexes chunks
README.md - Embedding indexer → Qdrant store: embeds and upserts
app/ingestion/indexer.py - FastAPI routes → Strategy factory: builds strategies
app/api/main.py - FastAPI routes → QA orchestration: answers requests
app/api/main.py - FastAPI routes → Tracing and metrics: records requests
app/api/main.py - FastAPI routes → Runtime settings: loads settings
app/api/main.py - Strategy factory → Vector search: constructs
app/retrieval/factory.py - Strategy factory → BM25 search: constructs
app/retrieval/factory.py - Strategy factory → Hybrid fusion: constructs
app/retrieval/factory.py - Strategy factory → Cross-encoder reranker: constructs
app/retrieval/factory.py - Vector search → Qdrant store: searches vectors
app/retrieval/vector.py - Vector search → Embedding indexer: embeds queries
app/retrieval/vector.py - BM25 search → Qdrant store: loads corpus
app/retrieval/bm25.py - Hybrid fusion → Vector search: retrieves candidates
app/retrieval/hybrid.py - Hybrid fusion → BM25 search: retrieves candidates
app/retrieval/hybrid.py - Hybrid fusion → RRF fusion: fuses rankings
app/retrieval/hybrid.py - Cross-encoder reranker → Hybrid fusion: gets candidates
app/retrieval/reranker.py - FastAPI routes → Retriever interface: dispatches strategy
app/api/main.py - QA orchestration → Retriever interface: retrieves evidence
app/llm/qa.py - QA orchestration → Prompt construction: builds prompt
app/llm/qa.py - QA orchestration → LLM client: requests completion
app/llm/qa.py - QA orchestration → Citation validation: validates answer
app/llm/qa.py - LLM client → OpenAI-compatible LLM: sends completion
app/llm/client.py - FastAPI routes → Data contracts: validates API data
app/api/main.py - QA orchestration → Data contracts: returns answer data
app/llm/qa.py - Strategy benchmarks → Retriever interface: compares strategies
README.md - Strategy benchmarks → Ranking metrics: scores rankings
README.md - Strategy benchmarks → Pareto comparison: plots trade-offs
README.md