Occasion

Struct Occasion 

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

An occasion within a subject’s dataset

An Occasion represents a distinct period of data collection for a subject, such as a hospital visit or dosing regimen. It contains events (doses, observations) and time-varying covariates.

Implementations§

§

impl Occasion

pub fn events(&self) -> &[Event]

Get a vector of references to all events in this occasion

§Returns

A slice of all events in this occasion

pub fn index(&self) -> usize

Get the index of the occasion

§Returns

The occasion index (0-based)

pub fn add_covariate(&mut self, name: String, covariate: Covariate)

Add a covariate to this occasion

§Arguments
  • name - Name of the covariate
  • covariate - The covariate to add

pub fn covariates(&self) -> &Covariates

Get a reference to the covariates for this occasion

§Returns

Reference to the occasion’s covariates, if any

pub fn covariates_mut(&mut self) -> &mut Covariates

Get a mutable refernce to the covariates for this occasion

§Returns

Reference to the occasion’s covariates, if any

pub fn add_observation( &mut self, time: f64, value: f64, outeq: usize, errorpoly: Option<ErrorPoly>, censored: Censor, )

Add an Observation event to the Occasion

pub fn add_missing_observation(&mut self, time: f64, outeq: usize)

Add a missing Observation event to the Occasion

pub fn add_observation_with_error( &mut self, time: f64, value: f64, outeq: usize, errorpoly: ErrorPoly, censored: Censor, )

Add a missing Observation with a custom ErrorPoly to the Occasion

This is useful if you want a different weight for the observation

pub fn add_bolus(&mut self, time: f64, amount: f64, input: usize)

Add a Bolus event to the Occasion

pub fn add_infusion( &mut self, time: f64, amount: f64, input: usize, duration: f64, )

Add an Infusion event to the Occasion

pub fn events_mut(&mut self) -> &mut Vec<Event>

Get a mutable reference to the events

pub fn events_iter_mut(&mut self) -> IterMut<'_, Event>

Get a mutable iterator to the events

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

Get an iterator over all events

§Returns

An iterator yielding references to events

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

Get a mutable iterator over all events

§Returns

A mutable iterator yielding references to events

pub fn len(&self) -> usize

Get the number of events in this occasion

§Returns

The number of events

pub fn is_empty(&self) -> bool

Check if the occasion has any events

§Returns

true if there are no events, false otherwise

§

impl Occasion

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, overriding what is embedded in the occasion.

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 Occasion

§

fn clone(&self) -> Occasion

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 Occasion

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Occasion

§

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

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

impl Display for Occasion

§

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

Formats the value using the given formatter. Read more
§

impl<'a> IntoIterator for &'a Occasion

§

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

Iterate immutably over all events in the occasion

§

type Item = &'a Event

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, Event>

Which kind of iterator are we turning this into?
§

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

§

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

Iterate mutably over all events in the occasion

§

type Item = &'a mut Event

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, Event>

Which kind of iterator are we turning this into?
§

impl IntoIterator for Occasion

§

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

Consumes the occasion and yields owned events

§

type Item = Event

The type of the elements being iterated over.
§

type IntoIter = IntoIter<Event>

Which kind of iterator are we turning this into?
§

impl NCA for Occasion

§

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 Occasion

§

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 Occasion

§

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 Superposition for Occasion

§

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