Struct Data
pub struct Data { /* private fields */ }
Expand description
The main data container for pharmacokinetic/pharmacodynamic data
Data is a collection of Subject instances, which themselves contain Occasion instances with Events. This structure represents the complete dataset for pharmacometric analysis.
§Examples
use pharmsol::*;
// Create subjects
let subject1 = Subject::builder("patient_001")
.bolus(0.0, 100.0, 0)
.observation(1.0, 5.0, 0)
.build();
let subject2 = Subject::builder("patient_002")
.bolus(0.0, 120.0, 0)
.observation(1.0, 6.0, 0)
.build();
// Create dataset with multiple subjects
let mut data = Data::new(vec![subject1]);
data.add_subject(subject2);
// Filter data
let filtered = data.filter_include(&["patient_001".to_string()]);
Implementations§
§impl Data
impl Data
pub fn subjects(&self) -> Vec<&Subject>
pub fn subjects(&self) -> Vec<&Subject>
Get a vector of references to all subjects in the dataset
§Returns
Vector of references to all subjects
pub fn add_subject(&mut self, subject: Subject)
pub fn add_subject(&mut self, subject: Subject)
pub fn get_subject(&self, id: &str) -> Option<&Subject>
pub fn get_subject(&self, id: &str) -> Option<&Subject>
pub fn get_subject_mut(&mut self, id: &str) -> Option<&mut Subject>
pub fn get_subject_mut(&mut self, id: &str) -> Option<&mut Subject>
pub fn filter_include(&self, include: &[String]) -> Data
pub fn filter_include(&self, include: &[String]) -> Data
pub fn filter_exclude(&self, exclude: Vec<String>) -> Data
pub fn filter_exclude(&self, exclude: Vec<String>) -> Data
pub fn expand(&self, idelta: f64, tad: f64) -> Data
pub fn expand(&self, idelta: f64, tad: f64) -> Data
Expand the dataset by adding observations at regular time intervals
This is useful for creating a dense grid of time points for simulations. Observations are only added if they don’t already exist at that time/outeq combination.
§Arguments
idelta
- Time interval between added observationstad
- Additional time to add after the last observation
§Returns
A new Data
object with expanded observations
pub fn iter_mut(&mut self) -> IterMut<'_, Subject>
pub fn iter_mut(&mut self) -> IterMut<'_, Subject>
Get a mutable iterator over all subjects
§Returns
A mutable iterator yielding references to subjects
pub fn get_output_equations(&self) -> Vec<usize>
pub fn get_output_equations(&self) -> Vec<usize>
Get a vector of all unique output equations (outeq) across all subjects
Trait Implementations§
§impl<'de> Deserialize<'de> for Data
impl<'de> Deserialize<'de> for Data
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Data, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Data, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<'a> IntoIterator for &'a Data
impl<'a> IntoIterator for &'a Data
§impl<'a> IntoIterator for &'a mut Data
impl<'a> IntoIterator for &'a mut Data
§impl IntoIterator for Data
impl IntoIterator for Data
§impl Serialize for Data
impl Serialize for Data
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Data
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnwindSafe for Data
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Context for T
impl<T> Context for T
fn vector_from_element<V>(&self, len: usize, value: <V as VectorCommon>::T) -> Vwhere
V: Vector<C = Self>,
fn vector_from_vec<V>(&self, vec: Vec<<V as VectorCommon>::T>) -> Vwhere
V: Vector<C = Self>,
fn vector_zeros<V>(&self, len: usize) -> Vwhere
V: Vector<C = Self>,
fn dense_mat_zeros<V>(
&self,
rows: usize,
cols: usize,
) -> <V as DefaultDenseMatrix>::Mwhere
V: Vector<C = Self> + DefaultDenseMatrix,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.