# krrishpandey/fraud-shield architecture

> Architecture diagram of the GitHub repository krrishpandey/fraud-shield, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krrishpandey/fraud-shield
- Repository: https://github.com/krrishpandey/fraud-shield

## Overview

FraudShield is a fraud-scoring and analyst operations product. An analyst submits a booking in the web console; the API pipeline builds features, obtains model scores, applies a cost-sensitive policy, and records the decision for review. The console also exposes audit, monitoring, learning, red-team, and passkey capabilities. The graph includes these substantial subsystems, but the README is empty and several modules were not excerpted, so unsampled relationships are omitted rather than inferred.

Main entry points: [`fraudshield/api/pipeline.py`](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/pipeline.py) (Scoring pipeline), [`fraudshield/api/app.py`](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/app.py) (HTTP API), [`fraudshield/redteam/search.py`](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/redteam/search.py) (Red-team search), [`fraudshield/learning/service.py`](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/learning/service.py) (Learning service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Analyst console"]
  node_console_app["Web application<br/>[main.tsx]"]
  node_score_view["Booking scoring<br/>[ScoreView.tsx]"]
  node_web_api["API client<br/>[client.ts]"]
end

subgraph group_decision["Scoring and decisions"]
  node_api["HTTP API<br/>[app.py]"]
  node_pipeline["Scoring pipeline<br/>[pipeline.py]"]
  node_contracts["Shared contracts<br/>[contracts.py]"]
  node_costs["Action cost model<br/>[costs.py]"]
  node_policy["Decision policy<br/>[decide.py]"]
  node_reasons["Decision reasons<br/>[reasons.py]"]
  node_explanations["Explanation generation<br/>[llm.py]"]
end

subgraph group_data["Data and models"]
  node_features["Feature generation<br/>[featurize.py]"]
  node_feature_store[("Feature history store<br/>[store.py]")]
  node_gbm["GBM scoring<br/>[gbm.py]"]
  node_laya["Laya inference<br/>[laya_client.py]"]
  node_calibration["Probability calibration<br/>[calibration.py]"]
  node_dataset["Dataset pipeline<br/>[pipeline.py]"]
  node_olist["Olist ingestion<br/>[olist.py]"]
end

subgraph group_operations["Analyst operations"]
  node_learning["Learning service<br/>[service.py]"]
  node_learning_metrics["Learning metrics<br/>[metrics.py]"]
  node_monitor["Live monitoring<br/>[live.py]"]
  node_redteam["Red-team search<br/>[search.py]"]
  node_cbpe["Drift estimation<br/>[cbpe.py]"]
end

subgraph group_identity["Identity and audit"]
  node_audit[("Audit log<br/>[log.py]")]
  node_passkey["Passkey API<br/>[passkey.py]"]
  node_webauthn["WebAuthn identity<br/>[webauthn.py]"]
end

node_analyst(("Analyst"))

node_analyst -->|"uses"| node_console_app
node_console_app -->|"routes to"| node_score_view
node_score_view -->|"submits score"| node_web_api
node_web_api -->|"sends requests"| node_api
node_api -->|"wires"| node_pipeline
node_pipeline -->|"extracts features"| node_features
node_features -->|"reads history"| node_feature_store
node_pipeline -->|"scores"| node_gbm
node_pipeline -->|"queries"| node_laya
node_pipeline -->|"calibrates"| node_calibration
node_pipeline -->|"uses costs"| node_costs
node_pipeline -->|"chooses action"| node_policy
node_policy -->|"evaluates costs"| node_costs
node_pipeline -->|"builds reasons"| node_reasons
node_pipeline -->|"requests explanation"| node_explanations
node_pipeline -->|"records decisions"| node_audit
node_api -->|"wires"| node_learning
node_learning -->|"audits changes"| node_audit
node_learning -->|"uses"| node_learning_metrics
node_api -->|"wires"| node_monitor
node_api -->|"wires"| node_redteam
node_api -->|"routes passkey"| node_passkey
node_passkey -->|"uses"| node_webauthn
node_passkey -->|"records events"| node_audit
node_dataset -->|"loads data"| node_olist
node_redteam -->|"re-featurizes"| node_features
node_redteam -->|"reads history"| node_feature_store
node_redteam -->|"re-evaluates"| node_policy
node_redteam -->|"scores alternatives"| node_gbm
node_cbpe -.->|"supports estimates"| node_monitor

click node_console_app "https://github.com/krrishpandey/fraud-shield/blob/main/web/src/main.tsx"
click node_score_view "https://github.com/krrishpandey/fraud-shield/blob/main/web/src/views/ScoreView.tsx"
click node_web_api "https://github.com/krrishpandey/fraud-shield/blob/main/web/src/api/client.ts"
click node_api "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/app.py"
click node_pipeline "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/pipeline.py"
click node_contracts "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/contracts.py"
click node_features "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/features/featurize.py"
click node_feature_store "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/features/store.py"
click node_gbm "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/models/gbm.py"
click node_laya "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/models/laya_client.py"
click node_calibration "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/models/calibration.py"
click node_costs "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/policy/costs.py"
click node_policy "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/policy/decide.py"
click node_reasons "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/policy/reasons.py"
click node_explanations "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/explain/llm.py"
click node_audit "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/audit/log.py"
click node_learning "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/learning/service.py"
click node_learning_metrics "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/learning/metrics.py"
click node_monitor "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/monitor/live.py"
click node_redteam "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/redteam/search.py"
click node_passkey "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/passkey.py"
click node_webauthn "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/identity/webauthn.py"
click node_dataset "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/data/pipeline.py"
click node_olist "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/data/olist.py"
click node_cbpe "https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/monitor/cbpe.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console_app,node_score_view,node_web_api toneBlue
class node_api,node_pipeline,node_contracts,node_costs,node_policy,node_reasons,node_explanations toneAmber
class node_features,node_feature_store,node_gbm,node_laya,node_calibration,node_dataset,node_olist toneMint
class node_learning,node_learning_metrics,node_monitor,node_redteam,node_cbpe toneRose
class node_audit,node_passkey,node_webauthn,node_analyst toneIndigo
```

## Components

### Analyst console

- [Web application](https://github.com/krrishpandey/fraud-shield/blob/main/web/src/main.tsx): `web/src/main.tsx`
- [Booking scoring](https://github.com/krrishpandey/fraud-shield/blob/main/web/src/views/ScoreView.tsx): `web/src/views/ScoreView.tsx`
- [API client](https://github.com/krrishpandey/fraud-shield/blob/main/web/src/api/client.ts): `web/src/api/client.ts`

### Scoring and decisions

- [HTTP API](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/app.py): `fraudshield/api/app.py`
- [Scoring pipeline](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/pipeline.py): `fraudshield/api/pipeline.py`
- [Shared contracts](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/contracts.py): `fraudshield/contracts.py`
- [Action cost model](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/policy/costs.py): `fraudshield/policy/costs.py`
- [Decision policy](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/policy/decide.py): `fraudshield/policy/decide.py`
- [Decision reasons](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/policy/reasons.py): `fraudshield/policy/reasons.py`
- [Explanation generation](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/explain/llm.py): `fraudshield/explain/llm.py`

### Data and models

- [Feature generation](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/features/featurize.py): `fraudshield/features/featurize.py`
- [Feature history store](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/features/store.py): `fraudshield/features/store.py`
- [GBM scoring](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/models/gbm.py): `fraudshield/models/gbm.py`
- [Laya inference](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/models/laya_client.py): `fraudshield/models/laya_client.py`
- [Probability calibration](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/models/calibration.py): `fraudshield/models/calibration.py`
- [Dataset pipeline](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/data/pipeline.py): `fraudshield/data/pipeline.py`
- [Olist ingestion](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/data/olist.py): `fraudshield/data/olist.py`

### Analyst operations

- [Learning service](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/learning/service.py): `fraudshield/learning/service.py`
- [Learning metrics](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/learning/metrics.py): `fraudshield/learning/metrics.py`
- [Live monitoring](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/monitor/live.py): `fraudshield/monitor/live.py`
- [Red-team search](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/redteam/search.py): `fraudshield/redteam/search.py`
- [Drift estimation](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/monitor/cbpe.py): `fraudshield/monitor/cbpe.py`

### Identity and audit

- [Audit log](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/audit/log.py): `fraudshield/audit/log.py`
- [Passkey API](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/api/passkey.py): `fraudshield/api/passkey.py`
- [WebAuthn identity](https://github.com/krrishpandey/fraud-shield/blob/main/fraudshield/identity/webauthn.py): `fraudshield/identity/webauthn.py`

### Other components

- **Analyst**

## Connections

- Analyst → Web application: uses (evidence: `web/src/main.tsx`)
- Web application → Booking scoring: routes to (evidence: `web/src/main.tsx`)
- Booking scoring → API client: submits score (evidence: `web/src/views/ScoreView.tsx`)
- API client → HTTP API: sends requests (evidence: `web/src/api/client.ts`)
- HTTP API → Scoring pipeline: wires (evidence: `fraudshield/api/app.py`)
- Scoring pipeline → Feature generation: extracts features (evidence: `fraudshield/api/pipeline.py`)
- Feature generation → Feature history store: reads history (evidence: `fraudshield/features/featurize.py`)
- Scoring pipeline → GBM scoring: scores (evidence: `fraudshield/api/pipeline.py`)
- Scoring pipeline → Laya inference: queries (evidence: `fraudshield/api/pipeline.py`)
- Scoring pipeline → Probability calibration: calibrates (evidence: `fraudshield/api/pipeline.py`)
- Scoring pipeline → Action cost model: uses costs (evidence: `fraudshield/api/pipeline.py`)
- Scoring pipeline → Decision policy: chooses action (evidence: `fraudshield/api/pipeline.py`)
- Decision policy → Action cost model: evaluates costs (evidence: `fraudshield/policy/decide.py`)
- Scoring pipeline → Decision reasons: builds reasons (evidence: `fraudshield/api/pipeline.py`)
- Scoring pipeline → Explanation generation: requests explanation (evidence: `fraudshield/api/pipeline.py`)
- Scoring pipeline → Audit log: records decisions (evidence: `fraudshield/api/pipeline.py`)
- HTTP API → Learning service: wires (evidence: `fraudshield/api/app.py`)
- Learning service → Audit log: audits changes (evidence: `fraudshield/learning/service.py`)
- Learning service → Learning metrics: uses (evidence: `fraudshield/learning/service.py`)
- HTTP API → Live monitoring: wires (evidence: `fraudshield/api/app.py`)
- HTTP API → Red-team search: wires (evidence: `fraudshield/api/app.py`)
- HTTP API → Passkey API: routes passkey (evidence: `fraudshield/api/passkey.py`)
- Passkey API → WebAuthn identity: uses (evidence: `fraudshield/api/passkey.py`)
- Passkey API → Audit log: records events (evidence: `fraudshield/api/passkey.py`)
- Dataset pipeline → Olist ingestion: loads data (evidence: `fraudshield/data/pipeline.py`)
- Red-team search → Feature generation: re-featurizes (evidence: `fraudshield/redteam/search.py`)
- Red-team search → Feature history store: reads history (evidence: `fraudshield/redteam/search.py`)
- Red-team search → Decision policy: re-evaluates (evidence: `fraudshield/redteam/search.py`)
- Red-team search → GBM scoring: scores alternatives (evidence: `fraudshield/redteam/search.py`)
- Drift estimation → Live monitoring: supports estimates
