Skip to main content

ClaimsLedger

Struct ClaimsLedger 

Source
pub struct ClaimsLedger {
    pub claims: Vec<Claim>,
    /* private fields */
}
Expand description

The claims ledger — persistable via to_json / from_json, like the calibration store.

Fields§

§claims: Vec<Claim>

All claims (pending, validated, falsified).

Implementations§

Source§

impl ClaimsLedger

Source

pub fn new() -> Self

Create an empty ledger.

Source

pub fn record( &mut self, statement: &str, domain: &str, source_date: i64, predicted_outcome: &str, confidence: f64, falsification_criteria: &str, ) -> Claim

Record a new pending claim.

Returns the stored claim. The falsification criterion is mandatory — a claim that cannot be falsified is not a claim.

Source

pub fn resolve( &mut self, claim_id: &str, validated: bool, event: &str, event_date: i64, source: Option<String>, ) -> Result<Claim, String>

Resolve a claim against a validation event.

validated: true marks the claim validated and credits points equal to the verified lead time in weeks. validated: false marks it falsified — recorded as a miss, which is part of the track record.

Source

pub fn status(&self) -> Value

Aggregate ledger status: totals, score, average lead, falsified count.

Source

pub fn list( &self, domain: Option<&str>, status: Option<ClaimStatus>, ) -> Vec<Claim>

List claims, optionally filtered by domain and status.

Source

pub fn calibration(&self) -> ClaimCalibration

Calibration report over resolved (validated + falsified) claims with statutory default k.

Source

pub fn calibration_with_k(&self, k: f64) -> ClaimCalibration

Calibration report over resolved (validated + falsified) claims with custom empirical-Bayes prior strength k.

Source

pub fn calibrated_confidence(&self, raw: f64) -> f64

Empirical-Bayes calibrated confidence for a raw confidence with statutory default k.

Shrinks the raw confidence toward the observed hit rate, weighted by resolved sample size (w = n/(n + k)). Identity when nothing is resolved — the record is never edited, only re-read through the lens of its own track record.

Source

pub fn calibrated_confidence_with_k(&self, raw: f64, k: f64) -> f64

Empirical-Bayes calibrated confidence with custom prior sample weight k.

Source

pub fn to_json(&self) -> Value

Serialize to JSON for persistence.

Source

pub fn from_json(&mut self, value: &Value) -> Result<(), String>

Restore from persisted JSON.

Trait Implementations§

Source§

impl Clone for ClaimsLedger

Source§

fn clone(&self) -> ClaimsLedger

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ClaimsLedger

Source§

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

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

impl Default for ClaimsLedger

Source§

fn default() -> ClaimsLedger

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ClaimsLedger

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 Serialize for ClaimsLedger

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

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

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.