Skip to main content

rustkernel_audit/
lib.rs

1//! # RustKernel Financial Audit
2//!
3//! GPU-accelerated financial audit kernels.
4//!
5//! ## Kernels
6//! - `FeatureExtraction` - Audit feature vector extraction for ML analysis
7//! - `HypergraphConstruction` - Multi-way relationship hypergraph construction
8
9#![warn(missing_docs)]
10
11pub mod feature_extraction;
12pub mod hypergraph;
13pub mod types;
14
15pub use feature_extraction::{FeatureConfig, FeatureExtraction};
16pub use hypergraph::{HypergraphConfig, HypergraphConstruction};
17pub use types::*;
18
19/// Register all audit kernels.
20pub fn register_all(
21    registry: &rustkernel_core::registry::KernelRegistry,
22) -> rustkernel_core::error::Result<()> {
23    tracing::info!("Registering financial audit kernels");
24
25    // Feature extraction kernel (1) - Batch
26    registry.register_batch_metadata_from(feature_extraction::FeatureExtraction::new)?;
27
28    // Hypergraph kernel (1) - Batch
29    registry.register_batch_metadata_from(hypergraph::HypergraphConstruction::new)?;
30
31    tracing::info!("Registered 2 financial audit kernels");
32    Ok(())
33}
34
35#[cfg(test)]
36mod tests {
37    use super::*;
38    use rustkernel_core::{domain::Domain, registry::KernelRegistry, traits::GpuKernel};
39
40    #[test]
41    fn test_register_all() {
42        let registry = KernelRegistry::new();
43        register_all(&registry).expect("Failed to register audit kernels");
44        assert_eq!(registry.total_count(), 2);
45    }
46
47    #[test]
48    fn test_feature_extraction_metadata() {
49        let kernel = FeatureExtraction::new();
50        let metadata = kernel.metadata();
51        assert!(metadata.id.contains("feature"));
52        assert_eq!(metadata.domain, Domain::FinancialAudit);
53    }
54
55    #[test]
56    fn test_hypergraph_construction_metadata() {
57        let kernel = HypergraphConstruction::new();
58        let metadata = kernel.metadata();
59        assert!(metadata.id.contains("hypergraph"));
60        assert_eq!(metadata.domain, Domain::FinancialAudit);
61    }
62}