INTENT Logo
Spaxiom Technical Series — Part 18

Code Examples Across Domains

Practical Spaxiom patterns for elder care, warehousing, and facilities management

Joe Scanlin

November 2025

About This Section

This section provides concrete code examples showing how Spaxiom's INTENT patterns work across different domains. Each example demonstrates the integration of sensors, temporal logic, and event-driven callbacks to create intelligent monitoring systems.

These examples illustrate the practical application of Spaxiom's abstractions in elder care, warehouse operations, and facilities management.

13. Code Examples Across Domains

13.1 Elder-care: gait instability and LLM agent

from spaxiom.intent import ADLTracker
from spaxiom.temporal import within
from spaxiom.logic import on, Condition

adl = ADLTracker(
    bed_sensor=bed_mat,
    fridge_sensor=fridge_switch,
    bath_sensor=bath_humidity,
    hall_sensor=hall_floor,
)

# Example: alert if no "walk" events in past 6 hours
no_walk_6h = ~within(
    6 * 3600,
    Condition(lambda: adl.daily_counts()["walk"] > 0)
)

@on(no_walk_6h)
def check_on_resident():
    # Agent or workflow integration here
    send_notification("No hallway walk detected in 6h for resident 12B")

13.2 Warehouse queue and congestion advisor

from spaxiom.intent import QueueFlow
from spaxiom.temporal import within
from spaxiom.logic import on, Condition

dock_queue = QueueFlow(dock_floor_sensor)

long_queue = within(300, Condition(lambda: dock_queue.length() > 8))

@on(long_queue)
def suggest_extra_worker():
    facts = {
        "queue_length": dock_queue.length(),
        "wait_time": dock_queue.wait_time(),
        "arrival_rate": dock_queue.arrival_rate(),
    }
    # Hand off to LLM to propose options (reroute trucks, open extra lane, etc.)
    call_llm_with_queue_facts(facts)

13.3 Facilities "needs service" intent

from spaxiom.intent import FmSteward
from spaxiom.logic import on, Condition

fm = FmSteward(
    door_counter=restroom_door_counter,
    towel_sensor=towel_load_cell,
    bin_sensor=bin_ultrasonic,
    gas_sensor=nh3_sensor,
    floor_sensor=wet_strip,
)

needs_service_cond = Condition(fm.needs_service)

@on(needs_service_cond)
def create_ticket():
    payload = fm.snapshot()
    cmms.create_work_order(
        summary=f"Restroom {payload['entries_approx']} entries; needs service",
        metadata=payload,
    )