Subject

Struct Subject 

pub struct Subject { /* private fields */ }
Expand description

A subject in a pharmacometric dataset

A Subject represents a single individual with one or more occasions of data, each containing events (doses, observations) and covariates.

Implementations§

§

impl Subject

pub fn occasions(&self) -> &[Occasion]

Get a vector of references to all occasions for this subject

§Returns

A slice of all occasions for this subject

pub fn id(&self) -> &String

Get the ID of the subject

§Returns

The subject’s identifier

pub fn from_occasions(id: String, occasions: Vec<Occasion>) -> Subject

Create a new subject from one or more occasions

This is useful when you want to create a subject from specific occasions rather than building it completely from scratch.

§Arguments
  • id - The subject identifier
  • occasions - Vector of occasions to include in this subject
§Returns

A new subject containing the specified occasions

pub fn occasions_mut(&mut self) -> &mut Vec<Occasion>

Iterate over a mutable reference to the occasions

pub fn occasions_iter_mut(&mut self) -> IterMut<'_, Occasion>

Get a mutable iterator to the occasions

pub fn get_output_equations(&self) -> Vec<usize>

pub fn get_occasion_mut(&mut self, index: usize) -> Option<&mut Occasion>

Get a mutable reference to an occasion by index

§Arguments
  • index - The index of the occasion to retrieve
§Returns

An Option containing a mutable reference to the occasion if found, or None if not found

pub fn iter(&self) -> Iter<'_, Occasion>

Get an iterator over all occasions

§Returns

An iterator yielding references to occasions

pub fn iter_mut(&mut self) -> IterMut<'_, Occasion>

Get a mutable iterator over all occasions

§Returns

A mutable iterator yielding references to occasions

pub fn len(&self) -> usize

Get the number of occasions for this subject

§Returns

The number of occasions

pub fn is_empty(&self) -> bool

Check if the subject has any occasions

§Returns

true if there are no occasions, false otherwise

pub fn hash(&self) -> u64

Calculate the hash for a subject

The hash is produced over all events and all covariates of the subject, providing a unique identifier for the subject data.

§

impl Subject

pub fn nca_with_dose( &self, dose_amount: f64, route: Route, infusion_duration: Option<f64>, options: &NCAOptions, ) -> Result<NCAResult, NCAError>

Run NCA with an explicit dose on the first occasion, overriding what is embedded in the subject’s events.

Use this when you want to supply or override dose amount, route, or infusion duration without modifying the underlying data.

Trait Implementations§

§

impl Clone for Subject

§

fn clone(&self) -> Subject

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Subject

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Subject

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Subject, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Subject

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Into<Data> for Subject

§

fn into(self) -> Data

Convert a subject into a Data object

§

impl<'a> IntoIterator for &'a Subject

§

fn into_iter(self) -> <&'a Subject as IntoIterator>::IntoIter

Iterate immutably over all occasions in the subject

§

type Item = &'a Occasion

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, Occasion>

Which kind of iterator are we turning this into?
§

impl<'a> IntoIterator for &'a mut Subject

§

fn into_iter(self) -> <&'a mut Subject as IntoIterator>::IntoIter

Iterate mutably over all occasions in the subject

§

type Item = &'a mut Occasion

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, Occasion>

Which kind of iterator are we turning this into?
§

impl IntoIterator for Subject

§

fn into_iter(self) -> <Subject as IntoIterator>::IntoIter

Consumes the subject and yields owned occasions

§

type Item = Occasion

The type of the elements being iterated over.
§

type IntoIter = IntoIter<Occasion>

Which kind of iterator are we turning this into?
§

impl NCA for Subject

§

fn nca(&self, options: &NCAOptions) -> Result<NCAResult, NCAError>

NCA on the first occasion (the common case). Returns a single result.
§

fn nca_all(&self, options: &NCAOptions) -> Vec<Result<NCAResult, NCAError>>

NCA on all occasions. Returns a Vec of results.
§

impl ObservationMetrics for Subject

§

fn auc_blq( &self, outeq: usize, method: &AUCMethod, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Calculate AUC from time 0 to Tlast with explicit BLQ handling
§

fn auc_interval_blq( &self, outeq: usize, start: f64, end: f64, method: &AUCMethod, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Calculate partial AUC over a time interval with explicit BLQ handling
§

fn cmax_blq( &self, outeq: usize, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Get Cmax with explicit BLQ handling
§

fn tmax_blq( &self, outeq: usize, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Get Tmax with explicit BLQ handling
§

fn clast_blq( &self, outeq: usize, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Get Clast with explicit BLQ handling
§

fn tlast_blq( &self, outeq: usize, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Get Tlast with explicit BLQ handling
§

fn aumc_blq( &self, outeq: usize, method: &AUCMethod, blq_rule: &BLQRule, ) -> Vec<Result<f64, MetricsError>>

Calculate AUMC with explicit BLQ handling
§

fn auc( &self, outeq: usize, method: &AUCMethod, ) -> Vec<Result<f64, MetricsError>>

Calculate AUC from time 0 to Tlast
§

fn auc_interval( &self, outeq: usize, start: f64, end: f64, method: &AUCMethod, ) -> Vec<Result<f64, MetricsError>>

Calculate partial AUC over a time interval
§

fn cmax(&self, outeq: usize) -> Vec<Result<f64, MetricsError>>

Get Cmax
§

fn tmax(&self, outeq: usize) -> Vec<Result<f64, MetricsError>>

Get Tmax
§

fn clast(&self, outeq: usize) -> Vec<Result<f64, MetricsError>>

Get Clast
§

fn tlast(&self, outeq: usize) -> Vec<Result<f64, MetricsError>>

Get Tlast
§

fn aumc( &self, outeq: usize, method: &AUCMethod, ) -> Vec<Result<f64, MetricsError>>

Calculate AUMC
§

fn auc_first( &self, outeq: usize, method: &AUCMethod, ) -> Result<f64, MetricsError>

Calculate AUC for the first occasion
§

fn cmax_first(&self, outeq: usize) -> Result<f64, MetricsError>

Get Cmax for the first occasion
§

fn tmax_first(&self, outeq: usize) -> Result<f64, MetricsError>

Get Tmax for the first occasion
§

fn clast_first(&self, outeq: usize) -> Result<f64, MetricsError>

Get Clast for the first occasion
§

fn tlast_first(&self, outeq: usize) -> Result<f64, MetricsError>

Get Tlast for the first occasion
§

fn aumc_first( &self, outeq: usize, method: &AUCMethod, ) -> Result<f64, MetricsError>

Calculate AUMC for the first occasion
§

fn auc_interval_first( &self, outeq: usize, start: f64, end: f64, method: &AUCMethod, ) -> Result<f64, MetricsError>

Calculate partial AUC for the first occasion
§

fn auc_blq_first( &self, outeq: usize, method: &AUCMethod, blq_rule: &BLQRule, ) -> Result<f64, MetricsError>

Calculate AUC for the first occasion with explicit BLQ handling
§

fn cmax_blq_first( &self, outeq: usize, blq_rule: &BLQRule, ) -> Result<f64, MetricsError>

Get Cmax for the first occasion with explicit BLQ handling
§

fn auc_interval_blq_first( &self, outeq: usize, start: f64, end: f64, method: &AUCMethod, blq_rule: &BLQRule, ) -> Result<f64, MetricsError>

Calculate partial AUC for the first occasion with explicit BLQ handling
§

impl Serialize for Subject

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl SubjectBuilderExt for Subject

§

fn builder(id: impl Into<String>) -> SubjectBuilder

Create a new SubjectBuilder with the specified ID Read more
§

impl Superposition for Subject

§

fn superposition( &self, tau: f64, options: &NCAOptions, n_eval_points: Option<usize>, ) -> Result<SuperpositionResult, NCAError>

Predict steady-state profile via superposition Read more
§

fn superposition_from_nca( &self, nca_result: &NCAResult, tau: f64, n_eval_points: Option<usize>, ) -> Result<SuperpositionResult, NCAError>

Predict steady-state profile using a pre-computed [NCAResult] Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DistributionExt for T
where T: ?Sized,

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

impl<T> SendAlias for T

§

impl<T> SyncAlias for T