50 lines
1.5 KiB
Rust
50 lines
1.5 KiB
Rust
//! SQLite-based protocol/database system for RustyNeuro session persistence
|
|
//!
|
|
//! This crate provides persistence for MEG/EEG analysis sessions, similar to
|
|
//! Brainstorm's protocol system. It stores:
|
|
//!
|
|
//! - Protocols (top-level containers)
|
|
//! - Subjects with demographics and anatomy paths
|
|
//! - Recordings with metadata
|
|
//! - Epochs, forward models, inverse operators
|
|
//! - SSP projectors and ICA models
|
|
//!
|
|
//! # Example
|
|
//!
|
|
//! ```no_run
|
|
//! use rtx_neuro_db::NeuroDatabase;
|
|
//! use std::path::PathBuf;
|
|
//!
|
|
//! #[tokio::main]
|
|
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
//! // Open or create database
|
|
//! let db = NeuroDatabase::open("my_protocol.db").await?;
|
|
//!
|
|
//! // Create a protocol
|
|
//! let protocol = db.create_protocol("My Study", PathBuf::from("/data/study")).await?;
|
|
//!
|
|
//! // Add subjects
|
|
//! let subject = db.create_subject(&protocol.id, "sub-01").await?;
|
|
//! db.set_subject_anatomy(&subject.id, Some("/freesurfer/sub-01".to_string())).await?;
|
|
//!
|
|
//! // List all protocols
|
|
//! let protocols = db.list_protocols().await?;
|
|
//! println!("Found {} protocols", protocols.len());
|
|
//!
|
|
//! Ok(())
|
|
//! }
|
|
//! ```
|
|
|
|
pub mod database;
|
|
pub mod error;
|
|
pub mod protocol;
|
|
pub mod schema;
|
|
pub mod subject;
|
|
|
|
// Re-exports
|
|
pub use database::NeuroDatabase;
|
|
pub use error::{DatabaseError, Result};
|
|
pub use protocol::Protocol;
|
|
pub use schema::{SCHEMA_VERSION, check_schema_version, create_schema};
|
|
pub use subject::Subject;
|