Example: Multi-Pathway Events

Person receiving bad news with thought bubble showing single event branching into multiple pathways

Some events map to more than one ITS pathway. For example, prolonged financial strain can increase both Thwarted Belongingness (TB) and Perceived Burdensomeness (PB). This example shows how to model a single complex event and see multiple pathways move together.

The Scenario

An employee experiences sustained financial strain after a job disruption. The event affects their sense of belonging at work and increases perceived burden on family. We track both pathways without creating two separate events.

Step 1: Create the Event

use behaviorsim_rs::entity::EntityBuilder;
use behaviorsim_rs::enums::{EventPayload, EventType, LossType, Species};
use behaviorsim_rs::event::EventBuilder;
use behaviorsim_rs::simulation::Simulation;
use behaviorsim_rs::types::{Duration, EntityId, Timestamp};

let sam = EntityBuilder::new()
    .id("sam")
    .species(Species::Human)
    .age(Duration::years(31))
    .build()?;

let reference = Timestamp::from_ymd_hms(2024, 1, 1, 0, 0, 0);
let mut sim = Simulation::new(reference);
sim.add_entity(sam, reference);

let sam_id = EntityId::new("sam").unwrap();
let financial_strain = EventBuilder::new(EventType::ExperienceStrainFinancial)
    .target(sam_id.clone())
    .severity(0.8)
    .payload(EventPayload::Loss {
        loss_type: LossType::Resource,
    })
    .build()?;

Step 2: Check Pathway Coverage

use behaviorsim_rs::processor::compute_its_factors;
use behaviorsim_rs::types::Timestamp;

let event_time = Timestamp::from_ymd_hms(2024, 2, 5, 0, 0, 0);
sim.add_event(financial_strain, event_time);

let handle = sim.entity(&sam_id).unwrap();
let state = handle.state_at(Timestamp::from_ymd_hms(2024, 3, 1, 0, 0, 0));
let factors = compute_its_factors(state.individual_state());

println!("TB: {:.2}", factors.thwarted_belongingness);
println!("PB: {:.2}", factors.perceived_burdensomeness);
println!("AC: {:.2}", factors.acquired_capability);

Why This Matters

  • Single source of truth: One event carries the full psychological interpretation.
  • Accurate risk modeling: Multi-pathway events accelerate convergence.
  • Cleaner simulation logs: No duplicate events needed.

Use multi-pathway events for real-world situations that simultaneously impact belongingness and burdensomeness, like financial strain, prolonged isolation, or relationship disruption.