CO
Cognizant Neuro AI

Principal Healthcare HIPAA RAG Architect • ₹24 LPA – ₹54 LPA

Healthcare HIPAA RAG & PII SafetyWith-AI Coding Allowed

Codebase 3: Enterprise Policy RAG & Salary-Leak Audit

Inspect a company HR & Policy RAG chatbot over Leave Policy Markdown and Payroll JSON. Trigger both real-world failures: (1) hallucinating intern leave carry-forward rules from cut tables, and (2) leaking Priya Sharma's confidential salary to interns due to missing RBAC pre-filtering + bloated FP64 linear scan.

System Design Perspective

PII-Redacted Clinical & Policy RAG

Before You Start (Cognizant Neuro AI)

Test Codebase 3 (`python app.py`) as an unauthorized role to see how missing pre-filtering leaks sensitive employee/patient records.

Download & Run LocallyDownload .zip
Runtime: Python 3.9+ (Pure stdlib — zero pip install required)
unzip enterprise-policy-rag.zip
cd enterprise-policy-rag
python app.py
# Open http://localhost:8100, keep Role = intern, and click Test 1 & Test 2!
VECTOR_DIM = 256  # Unnormalized FP64 dense list -> bloated memory!

# BUG 1: Fixed 180-char slicing breaks Markdown leave tables mid-row!
for i in range(0, len(raw), 180):
    self.chunks.append({"source": "hr_leave_policy.md", "access_role": "all", "text": raw[i:i+180]})

# BUG 2: Confidential payroll JSON embedded into SAME flat index!
for rec in records:
    self.chunks.append({
        "source": "payroll_confidential.json",
        "access_role": rec["required_access_role"], # NEVER checked in retrieve()!
        "text": f"Employee {rec['name']} earns annual CTC INR {rec['annual_ctc_inr']}..."
    })