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 error;
65pub mod fabric;
66pub mod gui;
67pub mod kernels;
68pub mod models;
69
70pub use error::{AccNetError, Result};
71
72/// Prelude for convenient imports.
73pub mod prelude {
74 pub use crate::models::{
75 AccountFlags,
76 AccountMetadata,
77 // Core types
78 AccountNode,
79 AccountSemantics,
80 AccountType,
81 // Network
82 AccountingNetwork,
83 AggregatedFlow,
84 BalanceSide,
85 // Temporal
86 BehavioralBaseline,
87 BookingPatternType,
88 Decimal128,
89 FlowDirection,
90 FlowFlags,
91 // Patterns
92 FraudPattern,
93 FraudPatternType,
94 GaapViolation,
95 GaapViolationRule,
96 GaapViolationType,
97 GpuNetworkHeader,
98 GraphEdge,
99 HybridTimestamp,
100 // Journal entries
101 JournalEntry,
102 JournalEntryFlags,
103 JournalLineItem,
104 LineItemFlags,
105 LineType,
106 NetworkSnapshot,
107 NetworkStatistics,
108 SeasonalPattern,
109 SeasonalityType,
110 SolvingMethod,
111 TemporalAlert,
112 TemporalAlertType,
113 TimeGranularity,
114 TimeSeriesMetrics,
115 // Flows
116 TransactionFlow,
117 ViolationSeverity,
118 };
119
120 pub use crate::fabric::{
121 AnomalyInjectionConfig, ChartOfAccountsTemplate, CompanyArchetype, DataFabricPipeline,
122 GeneratorConfig, PipelineConfig, PipelineEvent, TransactionGenerator,
123 };
124
125 pub use crate::analytics::{AnalyticsEngine, AnalyticsSnapshot, RiskScore};
126
127 pub use crate::actors::{CoordinatorConfig, GpuActorRuntime, GpuAnalyticsResult};
128}
129
130/// Version information.
131pub const VERSION: &str = env!("CARGO_PKG_VERSION");
132
133/// Crate name.
134pub const NAME: &str = env!("CARGO_PKG_NAME");