Skip to content

14.18 Architecture Decision Records (ADR Log) ​

This log records every major architectural and technical decision made across the 21-BIS-Compliance-Engine, documenting the chosen approach, alternatives evaluated, trade-offs accepted, and triggers to revisit.


Master Architecture Decisions Table ​

DecisionChosen OptionAlternatives ConsideredDeciding FactorsTrade-off AcceptedRevisit When
Backend Web FrameworkFastAPI (Python 3.11)Express.js, Flask, Django, Go Gin, Spring BootDirect in-memory zero-copy pointer sharing with Python ML/NumPy arrays; async ASGI; Pydantic v2 validationPython GIL limits single-process thread concurrencyBackend logic separates into high-throughput I/O gateway requiring Go/Rust
Vector Embedding ModelFastEmbed ONNX (bge-small-en-v1.5)OpenAI text-embedding-3-small, PyTorch SentenceTransformers, HuggingFace APIStrips away 1.2GB PyTorch dependency; cuts RAM to 60MB; runs in 14ms on CPU; zero cloud token costsCPU-bound computation at high concurrency burstsQueries exceed 1,000 RPS, requiring dedicated GPU/TensorRT inference sidecars
Vector Search EngineFAISS CPU (IndexFlatIP)Pinecone, pgvector, Weaviate, Qdrant, Milvus, ChromaDB100% exact cosine recall (no approximation loss); <0.2ms search latency; operates 100% in RAM with zero cloud feesFlat scan scales as $O(N)$ linearly with corpus sizeCorpus grows beyond 50,000 standards, requiring HNSW or IVF index quantization
Department ClassifierScikit-Learn Serialized Pipeline (v3.pkl)Fine-tuned BERT, LLM few-shot prompting, Zero-shot NLISub-0.1ms inference; deterministic closed-set routing; zero neural network computeCannot easily predict novel, unseen ministry categoriesDynamic multi-level hierarchical ministerial taxonomies are introduced
Domain Safety Guardrail4-Tier Deterministic Rules (guardrail.py)LLM moderator prompt, Llama Guard, OpenAI Moderation APISub-0.05ms execution; zero API dependencies; 100% accuracy on adversarial test suitesRequires manual maintenance of commercial keyword blacklistsUnregulated product categories become too vast for keyword lists
Readiness Scoring EngineRule-Based Weighted Checklists (gap_engine.py)LLM compliance estimation, Fuzzy neural scoring100% mathematically reproducible and auditable in legal/court proceedingsFixed criteria weights cannot capture subjective auditor nuancesDynamic clause-level severity scoring is required per product
Audit Pack Export FormatRFC 4180 CSV StreamPDF generation (Puppeteer/WeasyPrint), Excel .xlsxLightweight native Python generation with zero headless browser dependencies; directly importable into ERP/ExcelPlain text layout without visual certificate brandingEnterprise customers mandate cryptographically signed, branded PDF certificates
Conversational Intent HandlingPrefix & Substring Short-CircuitLLM intent routing, Rasa NLU, DialogflowSub-microsecond execution; prevents misinterpreting greetings as product queriesLimited flexibility for ambiguous user phrasingMulti-turn conversational dialog and context memory are added
Frontend ArchitectureReact 19 SPA + Vite 8Next.js (App Router), Vue 3, Svelte 5, AngularFast HMR (<50ms); 140KB production bundle; internal tool does not require public SEOClient-rendered (no initial server-side HTML rendering)Public SEO-indexed consumer standard search portal is launched
UI Styling StrategyInline Vanilla CSS ObjectsTailwind CSS, Material UI, styled-componentsZero build-step dependencies; zero class-name collisions; self-contained in App.jsxStyles cannot be extracted into external cached CSS filesApplication expands beyond a single dashboard into a multi-page portal
Master Knowledge Base StorageStatic JSON File (model2_corpus.json)MongoDB, PostgreSQL, SQLite, RedisImmutable, read-only dataset; loads into RAM in 0.5ms; zero database connection overheadModifying standards requires running rebuild scripts and restarting processMulti-tenant dynamic standard uploads by external contributors
Containerization StrategyPython 3.11-slim Single ContainerMulti-container Docker Compose, Alpine baseDebian slim provides pre-compiled glibc wheels for FAISS and NumPy without compiler bloat280MB image is slightly larger than Alpine (which frequently fails building FAISS)Microservices decoupling splits frontend and backend containers
API VersioningUnversioned Root Routes (/chat)URI versioning (/v1/chat), Header versioningSimple MVP demonstration interfaceBreaking changes to JSON schemas could affect existing clientsPublic developer APIs and third-party partner integrations are exposed