How sunilt808/traceacc1 works
Purpose and Entrypoints
TraceAcc Pro is a governed AML/money-muling operations platform: clients submit datasets and requests; admins route and release work; analysts detect suspicious transaction patterns; investigators turn escalations into evidence-backed cases and final reports. The backend FastAPI application starts at backend/main.py; the role-routed React SPA starts at money-muling-frontend/src/main.jsx and defines application routes in money-muling-frontend/src/App.jsx.
Frontend Workspaces
The React/Vite client presents distinct client, admin, TraceLab analyst, and InvoSpace investigator experiences. Authentication and JWT-backed session state are centralized in money-muling-frontend/src/context/AuthContext.jsx; API access/token injection is centralized in money-muling-frontend/src/services/api.js. Global analysis result state is held in money-muling-frontend/src/context/AnalysisContext.jsx. Key investigative views include graph visualization, pattern analysis, case work, and intelligence dossiers under money-muling-frontend/src/components/pages/GraphViewer.jsx, money-muling-frontend/src/components/pages/AnalystPatternsPage.jsx, and money-muling-frontend/src/components/pages/InvestigatorIntelPage.jsx.
API, Identity, and Workspace Boundary
FastAPI route modules expose REST operations for authentication, workflow, analysis, cases, reports, audit, datasets, notifications, and intelligence under backend/api/routes/. JWT authentication dependencies and current-workspace resolution form the request boundary in backend/api/deps.py; RBAC policy is defined in backend/core/permissions.py. The API is organized around domain endpoints rather than a separate BFF layer; principal integrations are browser-to-API REST calls.
Governed AML Lifecycle
A service request is accepted/rejected, assigned to a workspace, analyzed, escalated as alerts, converted to cases, investigated, reviewed, sealed, and released to the client. Domain persistence covers organizations/users, requests, workflow instances, assignments, alerts, cases, reports, evidence, messaging, notifications, and immutable activity/audit records. Core models reside in backend/models/service_request.py, backend/models/workflow_instance.py, and backend/models/analysis_job.py; lifecycle APIs are concentrated in backend/api/routes/workflow.py, backend/api/routes/service_requests.py, and backend/api/routes/reports.py. Audit and notification services are explicit side-effect boundaries in backend/services/audit_service.py and backend/services/notification_service.py.
Analysis Ingestion and Graph Pipeline
Uploaded CSV/XLSX transaction data is parsed into an in-memory directed transaction graph, then analyzed rather than persisted as normalized transaction/account tables. The input/graph boundary is backend/utils/csv_parser.py and backend/utils/graph.py. The advanced analysis endpoint in backend/api/routes/analysis.py invokes the scoring pipeline and stores its result in analysis-job metadata, enabling downstream reports and Intel Hub queries without re-analysis. Graph and analyst-facing retrieval operations are exposed through backend/api/routes/graph.py, backend/api/routes/patterns.py, and backend/api/routes/intel.py.
Detection and Scoring Core
The detection core combines topology, behavioral, temporal, community, and unsupervised anomaly signals. backend/detectors/pattern_suite.py orchestrates the standardized 15-pattern output; backend/detectors/hybrid_engine.py fuses detector families into account risk scores; backend/detectors/ml_anomaly.py provides Isolation Forest, LOF, and DBSCAN. Individual NetworkX-based graph detectors include cycle/fan/layering logic in backend/detectors/cycle.py, backend/detectors/fan.py, and backend/detectors/layering.py. High-risk results become alerts and feed investigation/case routes.
Supervised DC-LCG Model Path
The optional DC-LCG PyTorch model is trained from labeled or weakly supervised datasets, saved as versioned .pt artifacts, loaded through a registry, and fused as an additional hybrid-score dimension during advanced analysis. This train/serve boundary is implemented by backend/api/routes/dclcg.py, backend/detectors/dclcg/train.py, and backend/detectors/dclcg/inference.py; artifacts live in backend/models_artifacts/. It produces illicit probabilities, disguise scores, and evidence paths for analyst explanations.
Persistence, Deployment, and External Services
SQLAlchemy persistence is configured in backend/db/database.py, with schema evolution in backend/alembic/. PostgreSQL/Supabase is the intended production database, with SQLite fallback. The stack uses Python/FastAPI/Uvicorn, NetworkX, scikit-learn, PyTorch, React 18/Vite, Axios, and Cytoscape.js. Backend serverless deployment configuration exists at backend/vercel.json; frontend hosting automation targets Firebase via .github/workflows/firebase-hosting-merge.yml.
Main entry points: main.py FastAPI application · hybrid_engine.py Hybrid detection and scoring · workflow_instance.py Request-to-report lifecycle · App.jsx Application routes
Components 18
React workspaces
Role-specific client, admin, analyst, and investigator experiences.
- Role-routed React SPA
money-muling-frontend/src/main.jsx - Application routes
money-muling-frontend/src/App.jsx - JWT session state
money-muling-frontend/src/context/AuthContext.jsx - API client · Injects access tokens into browser REST requests.
money-muling-frontend/src/services/api.js - Analyst and investigator views · Graph, pattern, case, and intelligence workspaces.
money-muling-frontend/src/components/pages/GraphViewer.jsx
FastAPI boundary
REST endpoints enforce authenticated workspace access and RBAC.
- FastAPI application
backend/main.py - Auth and workspace boundary · Resolves JWT principal and current workspace.
backend/api/deps.py - RBAC policy
backend/core/permissions.py - Lifecycle APIs · Requests, workflow, reports, cases, audit, datasets, and notifications.
backend/api/routes/workflow.py - Analysis and intelligence APIs · Advanced analysis, graph, patterns, and Intel Hub retrieval.
backend/api/routes/analysis.py
Analysis pipeline
Transaction graphs are scored and retained in analysis-job metadata.
- CSV/XLSX transaction graph · Input data is parsed rather than normalized into transaction tables.
backend/utils/csv_parser.py - Hybrid detection and scoring · Combines 15-pattern, topology, behavior, temporal, community, and anomaly signals.
backend/detectors/hybrid_engine.py - Unsupervised anomaly models · Isolation Forest, LOF, and DBSCAN signals.
backend/detectors/ml_anomaly.py - DC-LCG model path · Versioned supervised model adds illicit probability, disguise score, and evidence paths.
backend/api/routes/dclcg.py
Governed lifecycle
Requests progress through workflow, alerts, cases, reports, and release.
- Request-to-report lifecycle · Assignment, analysis, escalation, investigation, review, sealing, and client release.
backend/models/workflow_instance.py - Audit and notifications · Immutable activity records and user notifications.
backend/services/audit_service.py
Persistence and deployment
- Operational database · PostgreSQL/Supabase production store with SQLite fallback.
backend/db/database.py - Versioned model artifacts
Connections 21
- Role-routed React SPA → Application routes: mounts
- Application routes → JWT session state: uses session
- Application routes → Analyst and investigator views: routes roles to
- JWT session state → API client: supplies JWT
- Analyst and investigator views → API client: REST calls
- API client → FastAPI application: browser REST
- FastAPI application → Auth and workspace boundary: protects routes with
- Auth and workspace boundary → RBAC policy: enforces
- FastAPI application → Lifecycle APIs: serves
- FastAPI application → Analysis and intelligence APIs: serves
- Lifecycle APIs → Request-to-report lifecycle: advances
- Analysis and intelligence APIs → CSV/XLSX transaction graph: parses uploads
- CSV/XLSX transaction graph → Hybrid detection and scoring: analyzes graph
- Unsupervised anomaly models → Hybrid detection and scoring: contributes signals
- DC-LCG model path → Hybrid detection and scoring: adds score dimension
- Versioned model artifacts → DC-LCG model path: loads and saves
- Hybrid detection and scoring → Request-to-report lifecycle: creates alerts and analysis results
- Analysis and intelligence APIs → Request-to-report lifecycle: stores analysis metadata
- Request-to-report lifecycle → Operational database: persists governed records
- Lifecycle APIs → Audit and notifications: emits side effects
- Audit and notifications → Operational database: records activity