Insights

Case studies, with the reasoning left in.

The problem, the options we weighed, what we chose and the code that came out of it. Written the way we write handover documents for clients.

FinTech transparency at scale

HiddenFees.ae

A consumer-first platform that surfaces hidden charges across financial products and turns opaque fee structures into auditable, comparable data.

Visit HiddenFees.ae

Outcomes

  • Normalized fee schemas across heterogeneous bank disclosures
  • Sub-second comparison queries via materialized views
  • Consumer-grade UX with engineering-grade data integrity
1.1

Domain-driven fee normalization

Problem
Each institution exposes fees in different formats: flat JSON, PDF tables and legacy CSV. Without a canonical model, comparisons break down.
Decision
We introduced a FeeDescriptor pipeline: ingest → validate → map to a shared ontology → persist with provenance metadata for audit trails.
lib/fees/normalize.tstypescript
interface FeeDescriptor {
  id: string;
  category: "account" | "transfer" | "fx" | "card";
  amount: { value: number; currency: string };
  frequency: "once" | "monthly" | "annual";
  source: { institutionId: string; capturedAt: string };
}

export async function normalizeFeePayload(
  raw: unknown,
  institutionId: string,
): Promise<FeeDescriptor> {
  const parsed = FeeSchema.parse(raw);
  return {
    id: createFeeId(parsed),
    category: mapCategory(parsed.type),
    amount: { value: parsed.amount, currency: parsed.currency },
    frequency: parsed.billingCycle,
    source: { institutionId, capturedAt: new Date().toISOString() },
  };
}
1.2

Comparison API with cached aggregates

Problem
Real-time aggregation across millions of fee rows caused p95 latency spikes during peak traffic.
Decision
Materialized views refresh on a schedule; the public API reads from pre-computed comparison snapshots with stale-while-revalidate.
app/api/compare/route.tstypescript
export async function GET(req: Request) {
  const { productIds } = parseQuery(req);
  const cacheKey = `compare:${productIds.sort().join(",")}`;

  const cached = await redis.get(cacheKey);
  if (cached) {
    return Response.json(JSON.parse(cached), {
      headers: { "X-Cache": "HIT" },
    });
  }

  const snapshot = await db.comparisonSnapshot.findMany({
    where: { productId: { in: productIds } },
  });

  await redis.setex(cacheKey, 300, JSON.stringify(snapshot));
  return Response.json(snapshot, { headers: { "X-Cache": "MISS" } });
}

Governed LLM orchestration

Enterprise AI Pipelines

Production LLM workflows for regulated industries: RAG with guardrails, evaluation harnesses, and human-in-the-loop review before anything reaches end users.

Outcomes

  • Traceable prompts and retrieval context for every inference
  • Automated regression on hallucination and policy violations
  • Audit-ready logs aligned with enterprise compliance requirements
2.1

RAG pipeline with retrieval guardrails

Problem
Unbounded retrieval introduced stale policy documents and PII fragments into the context window, which is unacceptable for regulated outputs.
Decision
A staged pipeline filters chunks by classification, recency, and relevance score before assembly; blocked chunks are logged, not silently dropped.
pipelines/rag_orchestrator.pypython
async def build_context(query: str, tenant_id: str) -> RAGContext:
    chunks = await retriever.search(
        query=query,
        tenant_id=tenant_id,
        top_k=20,
    )

    filtered = [
        c for c in chunks
        if c.classification != "restricted"
        and c.score >= MIN_RELEVANCE
        and c.updated_at > policy_cutoff(tenant_id)
    ]

    guardrail_result = await policy_engine.scan(filtered)
    if guardrail_result.blocked:
        raise GuardrailViolation(guardrail_result.reason)

    return RAGContext(chunks=filtered[:8], trace_id=new_trace_id())
2.2

Evaluation harness before deploy

Problem
Model updates shipped without regression testing caused drift in factual accuracy and tone for customer-facing assistants.
Decision
Every prompt change runs through golden datasets with automated judges; deploy gates require passing thresholds on accuracy, safety, and latency.
eval/run_suite.tstypescript
const THRESHOLDS = {
  accuracy: 0.92,
  safety: 1.0,
  p95LatencyMs: 2400,
} as const;

export async function runEvalSuite(modelId: string) {
  const results = await Promise.all(
    GOLDEN_CASES.map((c) => evaluateCase(modelId, c)),
  );

  const summary = aggregate(results);
  if (summary.accuracy < THRESHOLDS.accuracy) {
    throw new DeployBlockedError("accuracy", summary);
  }
  return summary;
}

Next step

Have a system that needs the same treatment?

Tell us about it. We reply within one business day.