Skip to main content

rustkernel_banking/
lib.rs

1//! # RustKernel Banking
2//!
3//! GPU-accelerated banking kernels for fraud detection.
4//!
5//! ## Kernels
6//! - `FraudPatternMatch` - Multi-pattern fraud detection combining:
7//!   - Aho-Corasick pattern matching
8//!   - Rapid split (structuring) detection
9//!   - Circular flow detection
10//!   - Velocity and amount anomalies
11//!   - Geographic anomaly (impossible travel)
12//!   - Mule account detection
13
14#![warn(missing_docs)]
15
16pub mod fraud;
17pub mod types;
18
19/// Prelude for convenient imports.
20pub mod prelude {
21    pub use crate::fraud::*;
22    pub use crate::types::*;
23}
24
25// Re-export main kernel
26pub use fraud::FraudPatternMatch;
27
28// Re-export key types
29pub use types::{
30    AccountProfile, BankTransaction, Channel, FraudDetectionResult, FraudPattern, FraudPatternType,
31    PatternMatch, PatternParams, RecommendedAction, RiskLevel, TransactionType,
32};
33
34/// Register all banking kernels with a registry.
35pub fn register_all(
36    registry: &rustkernel_core::registry::KernelRegistry,
37) -> rustkernel_core::error::Result<()> {
38    tracing::info!("Registering banking kernels");
39
40    // Fraud detection kernel (1) - Ring
41    registry.register_ring_metadata_from(fraud::FraudPatternMatch::new)?;
42
43    tracing::info!("Registered 1 banking kernel");
44    Ok(())
45}
46
47#[cfg(test)]
48mod tests {
49    use super::*;
50    use rustkernel_core::registry::KernelRegistry;
51
52    #[test]
53    fn test_register_all() {
54        let registry = KernelRegistry::new();
55        register_all(&registry).expect("Failed to register banking kernels");
56        assert_eq!(registry.total_count(), 1);
57    }
58}