Subject

Struct Subject 

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

Source§

impl Subject

Source

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

Source

pub fn id(&self) -> &String

Get the ID of the subject

§Returns

The subject’s identifier

Source

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

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

Source

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

Iterate over a mutable reference to the occasions

Source

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

Get a mutable iterator to the occasions

Source

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

Source

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

Source

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

Get an iterator over all occasions

§Returns

An iterator yielding references to occasions

Source

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

Get a mutable iterator over all occasions

§Returns

A mutable iterator yielding references to occasions

Source

pub fn len(&self) -> usize

Get the number of occasions for this subject

§Returns

The number of occasions

Source

pub fn is_empty(&self) -> bool

Check if the subject has any occasions

§Returns

true if there are no occasions, false otherwise

Source

pub fn hash(&self) -> u64

Calculate the hash for a subject

The hash takes into account all events, so that if a subject is modified, it will not produce the same likelihood when simulated with the same support point. Note that covariates are not included in the hash, but a method exists to hash covariates if needed.

Source§

impl Subject

Source

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§

Source§

impl Clone for Subject

Source§

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

impl Debug for Subject

Source§

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

Formats the value using the given formatter. Read more
Source§

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

Source§

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

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

impl Display for Subject

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Into<Data> for Subject

Source§

fn into(self) -> Data

Convert a subject into a Data object

Source§

impl<'a> IntoIterator for &'a Subject

Source§

fn into_iter(self) -> Self::IntoIter

Iterate immutably over all occasions in the subject

Source§

type Item = &'a Occasion

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Occasion>

Which kind of iterator are we turning this into?
Source§

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

Source§

fn into_iter(self) -> Self::IntoIter

Iterate mutably over all occasions in the subject

Source§

type Item = &'a mut Occasion

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, Occasion>

Which kind of iterator are we turning this into?
Source§

impl IntoIterator for Subject

Source§

fn into_iter(self) -> Self::IntoIter

Consumes the subject and yields owned occasions

Source§

type Item = Occasion

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Occasion>

Which kind of iterator are we turning this into?
Source§

impl NCA for Subject

Source§

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

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

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

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

impl ObservationMetrics for Subject

Source§

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

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

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

Get Cmax with explicit BLQ handling
Source§

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

Get Tmax with explicit BLQ handling
Source§

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

Get Clast with explicit BLQ handling
Source§

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

Get Tlast with explicit BLQ handling
Source§

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

Calculate AUMC with explicit BLQ handling
Source§

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

Calculate AUC from time 0 to Tlast
Source§

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

Calculate partial AUC over a time interval
Source§

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

Get Cmax
Source§

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

Get Tmax
Source§

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

Get Clast
Source§

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

Get Tlast
Source§

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

Calculate AUMC
Source§

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

Calculate AUC for the first occasion
Source§

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

Get Cmax for the first occasion
Source§

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

Get Tmax for the first occasion
Source§

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

Get Clast for the first occasion
Source§

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

Get Tlast for the first occasion
Source§

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

Calculate AUMC for the first occasion
Source§

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

Calculate partial AUC for the first occasion
Source§

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

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

Get Cmax for the first occasion with explicit BLQ handling
Source§

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

impl Serialize for Subject

Source§

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

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

impl SubjectBuilderExt for Subject

Source§

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

Create a new SubjectBuilder with the specified ID Read more
Source§

impl Superposition for Subject

Source§

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

Predict steady-state profile via superposition Read more
Source§

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> SendAlias for T

§

impl<T> SyncAlias for T