ringkernel_accnet/lib.rs
1//! # RingKernel Accounting Network Analytics
2//!
3//! GPU-accelerated accounting network analysis with real-time visualization.
4//!
5//! This crate transforms traditional double-entry bookkeeping into a graph
6//! representation, enabling advanced analytics like:
7//!
8//! - **Fraud Pattern Detection**: Circular flows, threshold clustering, Benford violations
9//! - **GAAP Compliance**: Automated violation detection for accounting rules
10//! - **Behavioral Anomalies**: Time-series based anomaly detection
11//! - **Network Metrics**: Centrality, PageRank, community detection
12//!
13//! ## Architecture
14//!
15//! ```text
16//! ┌─────────────────┐ ┌──────────────────┐ ┌────────────────┐
17//! │ Data Fabric │────▶│ GPU Kernels │────▶│ Visualization │
18//! │ (Synthetic Gen) │ │ (CUDA/WGSL) │ │ (egui Canvas) │
19//! └─────────────────┘ └──────────────────┘ └────────────────┘
20//! │ │ │
21//! ▼ ▼ ▼
22//! ┌─────────────────┐ ┌──────────────────┐ ┌────────────────┐
23//! │ Journal Entries │ │ Network Analysis │ │ Graph Layout │
24//! │ Transaction Gen │ │ Fraud Detection │ │ Flow Animation │
25//! │ Anomaly Inject │ │ Temporal Analysis│ │ Analytics UI │
26//! └─────────────────┘ └──────────────────┘ └────────────────┘
27//! ```
28//!
29//! ## Quick Start
30//!
31//! ```rust,ignore
32//! use ringkernel_accnet::prelude::*;
33//!
34//! // Create a network
35//! let mut network = AccountingNetwork::new(entity_id, 2024, 1);
36//!
37//! // Add accounts
38//! let cash = network.add_account(
39//! AccountNode::new(Uuid::new_v4(), AccountType::Asset, 0),
40//! AccountMetadata::new("1100", "Cash")
41//! );
42//!
43//! // Add flows
44//! network.add_flow(TransactionFlow::new(
45//! source, target, amount, journal_id, timestamp
46//! ));
47//!
48//! // Run analysis
49//! network.calculate_pagerank(0.85, 20);
50//! ```
51//!
52//! ## GPU Kernel Types
53//!
54//! 1. **Journal Transformation** - Methods A-E for converting entries to flows
55//! 2. **Network Analysis** - Suspense detection, GAAP violations, fraud patterns
56//! 3. **Temporal Analysis** - Seasonality, trends, behavioral anomalies
57
58#![warn(missing_docs)]
59#![warn(clippy::all)]
60
61pub mod actors;
62pub mod analytics;
63pub mod cuda;
64pub mod fabric;
65pub mod gui;
66pub mod kernels;
67pub mod models;
68
69/// Prelude for convenient imports.
70pub mod prelude {
71 pub use crate::models::{
72 AccountFlags,
73 AccountMetadata,
74 // Core types
75 AccountNode,
76 AccountSemantics,
77 AccountType,
78 // Network
79 AccountingNetwork,
80 AggregatedFlow,
81 BalanceSide,
82 // Temporal
83 BehavioralBaseline,
84 BookingPatternType,
85 Decimal128,
86 FlowDirection,
87 FlowFlags,
88 // Patterns
89 FraudPattern,
90 FraudPatternType,
91 GaapViolation,
92 GaapViolationRule,
93 GaapViolationType,
94 GpuNetworkHeader,
95 GraphEdge,
96 HybridTimestamp,
97 // Journal entries
98 JournalEntry,
99 JournalEntryFlags,
100 JournalLineItem,
101 LineItemFlags,
102 LineType,
103 NetworkSnapshot,
104 NetworkStatistics,
105 SeasonalPattern,
106 SeasonalityType,
107 SolvingMethod,
108 TemporalAlert,
109 TemporalAlertType,
110 TimeGranularity,
111 TimeSeriesMetrics,
112 // Flows
113 TransactionFlow,
114 ViolationSeverity,
115 };
116
117 pub use crate::fabric::{
118 AnomalyInjectionConfig, ChartOfAccountsTemplate, CompanyArchetype, DataFabricPipeline,
119 GeneratorConfig, PipelineConfig, PipelineEvent, TransactionGenerator,
120 };
121
122 pub use crate::analytics::{AnalyticsEngine, AnalyticsSnapshot, RiskScore};
123
124 pub use crate::actors::{CoordinatorConfig, GpuActorRuntime, GpuAnalyticsResult};
125}
126
127/// Version information.
128pub const VERSION: &str = env!("CARGO_PKG_VERSION");
129
130/// Crate name.
131pub const NAME: &str = env!("CARGO_PKG_NAME");