Skip to main content

AnalyzeEngine

Struct AnalyzeEngine 

Source
pub struct AnalyzeEngine<'a> { /* private fields */ }
Expand description

Analysis workflow engine.

Implementations§

Source§

impl<'a> AnalyzeEngine<'a>

Source

pub async fn study_summary(&self, deck: &str, days: u32) -> Result<StudySummary>

Get a summary of study activity.

§Arguments
  • deck - Deck to analyze (use “*” for all decks)
  • days - Number of days to include
§Example
let engine = Engine::new();
let stats = engine.analyze().study_summary("Japanese", 30).await?;
println!("Reviewed {} cards", stats.total_reviews);
Source

pub async fn find_problems( &self, query: &str, criteria: ProblemCriteria, ) -> Result<Vec<ProblemCard>>

Find problem cards (leeches).

§Arguments
  • query - Anki search query to filter cards
  • criteria - Criteria for identifying problems
§Example
let engine = Engine::new();
let problems = engine.analyze()
    .find_problems("deck:Japanese", ProblemCriteria::default())
    .await?;
for card in problems {
    println!("Problem card: {} - {:?}", card.front, card.reason);
}
Source

pub async fn retention_stats(&self, deck: &str) -> Result<RetentionStats>

Get retention statistics for a deck.

§Arguments
  • deck - Deck to analyze
§Example
let engine = Engine::new();
let retention = engine.analyze().retention_stats("Japanese").await?;
println!("Average ease: {}%", retention.avg_ease / 10);
Source

pub async fn deck_audit(&self, deck: &str) -> Result<DeckAudit>

Perform a comprehensive audit of a deck.

Returns detailed information about deck contents including card counts, tag distribution, empty fields, duplicates, and scheduling state.

§Arguments
  • deck - Deck name to audit
§Example
let engine = Engine::new();
let audit = engine.analyze().deck_audit("Japanese").await?;

println!("Deck: {}", audit.deck);
println!("Total cards: {}", audit.total_cards);
println!("Total notes: {}", audit.total_notes);
println!("Leeches: {}", audit.leech_count);
println!("Suspended: {}", audit.suspended_count);
println!("New: {}, Learning: {}, Review: {}",
    audit.new_cards, audit.learning_cards, audit.review_cards);

for (model, count) in &audit.cards_by_model {
    println!("  {}: {} cards", model, count);
}
Source

pub async fn study_report(&self, deck: &str, days: u32) -> Result<StudyReport>

Generate a comprehensive study report.

Combines multiple statistics into a single overview including activity summary, performance metrics, problem cards, and upcoming workload.

§Arguments
  • deck - Deck to analyze (use “*” for all decks)
  • days - Number of days to include in the report
§Example
let engine = Engine::new();
let report = engine.analyze().study_report("Japanese", 7).await?;

println!("Study Report for {}", report.deck);
println!("Reviews: {} ({:.1}/day)", report.total_reviews, report.average_reviews_per_day);
println!("Retention: {:.1}%", report.retention_rate * 100.0);
println!("Study streak: {} days", report.study_streak);
println!("Leeches: {}", report.leeches.len());
println!("Due tomorrow: {}", report.due_tomorrow);
Source

pub async fn compare_decks( &self, deck_a: &str, deck_b: &str, options: CompareOptions, ) -> Result<DeckComparison>

Compare two decks for overlap and differences.

Analyzes notes in both decks based on a key field, identifying:

  • Notes unique to each deck
  • Exact matches (identical key field values)
  • Similar notes (fuzzy matching above threshold)
§Arguments
  • deck_a - Name of the first deck
  • deck_b - Name of the second deck
  • options - Comparison options (key field and similarity threshold)
§Example
let engine = Engine::new();

let comparison = engine.analyze()
    .compare_decks("Japanese::Core", "Japanese::Extra", CompareOptions {
        key_field: "Front".to_string(),
        similarity_threshold: 0.85,
    })
    .await?;

println!("Only in Core: {}", comparison.only_in_a.len());
println!("Only in Extra: {}", comparison.only_in_b.len());
println!("Exact matches: {}", comparison.exact_matches.len());
println!("Similar: {}", comparison.similar.len());

for pair in &comparison.similar {
    println!("  {:.0}% similar: '{}' vs '{}'",
        pair.similarity * 100.0,
        pair.note_a.key_value,
        pair.note_b.key_value);
}
Source

pub async fn study_plan( &self, deck: &str, options: PlanOptions, ) -> Result<StudyPlan>

Generate a study plan with recommendations.

Creates a plan for a study session based on due cards, new cards, and target study time. Provides recommendations for optimizing the session.

§Arguments
  • deck - Deck to plan for
  • options - Planning options (target time, new card ratio, etc.)
§Example
let engine = Engine::new();

let plan = engine.analyze()
    .study_plan("Japanese", PlanOptions {
        target_time_minutes: 30,
        new_card_ratio: 0.2,
        prioritize_leeches: true,
        ..PlanOptions::default()
    })
    .await?;

println!("Estimated time: {} minutes", plan.estimated_time);
println!("Reviews: {}, New: {}", plan.review_count, plan.new_count);

for rec in &plan.recommendations {
    println!("- {}", rec);
}

Trait Implementations§

Source§

impl<'a> Debug for AnalyzeEngine<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AnalyzeEngine<'a>

§

impl<'a> !RefUnwindSafe for AnalyzeEngine<'a>

§

impl<'a> Send for AnalyzeEngine<'a>

§

impl<'a> Sync for AnalyzeEngine<'a>

§

impl<'a> Unpin for AnalyzeEngine<'a>

§

impl<'a> !UnwindSafe for AnalyzeEngine<'a>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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