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    use rustkernel_core::traits::GpuKernel;
39
40    tracing::info!("Registering banking kernels");
41
42    // Fraud detection kernel (1)
43    registry.register_metadata(fraud::FraudPatternMatch::new().metadata().clone())?;
44
45    tracing::info!("Registered 1 banking kernel");
46    Ok(())
47}
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52    use rustkernel_core::registry::KernelRegistry;
53
54    #[test]
55    fn test_register_all() {
56        let registry = KernelRegistry::new();
57        register_all(&registry).expect("Failed to register banking kernels");
58        assert_eq!(registry.total_count(), 1);
59    }
60}