UdmEvent

Struct UdmEvent 

Source
pub struct UdmEvent {
Show 32 fields pub event_id: String, pub captured_at: DateTime<Utc>, pub event_type: EventType, pub source_id: String, pub source_type: SourceType, pub udm_version: String, pub sdk_version: String, pub identity: Option<IdentityDomain>, pub location: Option<LocationDomain>, pub motion: Option<MotionDomain>, pub power: Option<PowerDomain>, pub operational: Option<OperationalDomain>, pub navigation: Option<NavigationDomain>, pub perception: Option<PerceptionDomain>, pub safety: Option<SafetyDomain>, pub actuators: Option<ActuatorsDomain>, pub communication: Option<CommunicationDomain>, pub compute: Option<ComputeDomain>, pub ai: Option<AiDomain>, pub maintenance: Option<MaintenanceDomain>, pub context: Option<ContextDomain>, pub payload: Option<PayloadDomain>, pub manipulation: Option<ManipulationDomain>, pub hri: Option<HriDomain>, pub coordination: Option<CoordinationDomain>, pub simulation: Option<SimulationDomain>, pub thermal: Option<ThermalDomain>, pub audio: Option<AudioDomain>, pub environment_interaction: Option<EnvironmentInteractionDomain>, pub compliance: Option<ComplianceDomain>, pub provenance: Option<Provenance>, pub extensions: Option<Value>,
}
Expand description

UDM Event - The unified data model event envelope.

This is the primary structure emitted by the PhyTrace SDK. It contains:

  • Required envelope fields (event_id, timestamp, source_type)
  • Optional domain data for all 23 UDM domains
  • Provenance information for data integrity verification
  • Extension point for custom data

§Example

use phytrace_sdk::{UdmEvent, EventType, SourceType};
use phytrace_sdk::models::domains::{IdentityDomain, LocationDomain};
use phytrace_sdk::models::domains::location::LocalCoordinates;

let event = UdmEvent::new(SourceType::Amr)
    .with_event_type(EventType::TelemetryPeriodic)
    .with_identity(IdentityDomain {
        source_id: Some("robot-001".to_string()),
        ..Default::default()
    })
    .with_location(LocationDomain {
        local: Some(LocalCoordinates {
            x_m: Some(10.0),
            y_m: Some(20.0),
            ..Default::default()
        }),
        ..Default::default()
    });

Fields§

§event_id: String

Unique event identifier (UUIDv7 for time-ordering).

§captured_at: DateTime<Utc>

When data was captured at source (ISO 8601 format). Note: This matches PhyCloud’s expected field name.

§event_type: EventType

Type of event.

§source_id: String

Unique source identifier (e.g., robot-001). This is a required top-level field for PhyCloud compatibility.

§source_type: SourceType

Type of source generating this event.

§udm_version: String

UDM schema version.

§sdk_version: String

SDK version that generated this event.

§identity: Option<IdentityDomain>

Identity domain - who/what is reporting.

§location: Option<LocationDomain>

Location domain - where the source is.

§motion: Option<MotionDomain>

Motion domain - velocity, acceleration, odometry.

§power: Option<PowerDomain>

Power domain - battery, charging, energy.

§operational: Option<OperationalDomain>

Operational domain - mode, state, tasks.

§navigation: Option<NavigationDomain>

Navigation domain - localization, path, obstacles.

§perception: Option<PerceptionDomain>

Perception domain - sensors, detections.

§safety: Option<SafetyDomain>

Safety domain - e-stop, zones, violations.

§actuators: Option<ActuatorsDomain>

Actuators domain - motors, joints, grippers.

§communication: Option<CommunicationDomain>

Communication domain - network, fleet comms.

§compute: Option<ComputeDomain>

Compute domain - CPU, memory, processes.

§ai: Option<AiDomain>

AI domain - models, decisions, anomalies.

§maintenance: Option<MaintenanceDomain>

Maintenance domain - component health, diagnostics.

§context: Option<ContextDomain>

Context domain - time, facility, weather context.

§payload: Option<PayloadDomain>

Payload domain - carried items, compartments.

§manipulation: Option<ManipulationDomain>

Manipulation domain - arms, grippers, workspace.

§hri: Option<HriDomain>

HRI domain - human interaction, social navigation.

§coordination: Option<CoordinationDomain>

Coordination domain - fleet coordination, formations.

§simulation: Option<SimulationDomain>

Simulation domain - simulator info, scenarios.

§thermal: Option<ThermalDomain>

Thermal domain - temperatures, cooling.

§audio: Option<AudioDomain>

Audio domain - microphones, speakers, sounds.

§environment_interaction: Option<EnvironmentInteractionDomain>

Environment interaction domain - doors, elevators.

§compliance: Option<ComplianceDomain>

Compliance domain - certifications, safety standards.

§provenance: Option<Provenance>

Provenance information for data integrity.

§extensions: Option<Value>

Extension point for custom data.

Implementations§

Source§

impl UdmEvent

Source

pub fn new(source_type: SourceType) -> Self

Create a new UDM event with required fields.

Automatically generates a UUIDv7 event ID and sets the captured_at timestamp.

Source

pub fn with_event_type(self, event_type: EventType) -> Self

Set the event type.

Source

pub fn with_identity(self, identity: IdentityDomain) -> Self

Set the identity domain.

Source

pub fn with_location(self, location: LocationDomain) -> Self

Set the location domain.

Source

pub fn with_motion(self, motion: MotionDomain) -> Self

Set the motion domain.

Source

pub fn with_power(self, power: PowerDomain) -> Self

Set the power domain.

Source

pub fn with_operational(self, operational: OperationalDomain) -> Self

Set the operational domain.

Source

pub fn with_navigation(self, navigation: NavigationDomain) -> Self

Set the navigation domain.

Source

pub fn with_perception(self, perception: PerceptionDomain) -> Self

Set the perception domain.

Source

pub fn with_safety(self, safety: SafetyDomain) -> Self

Set the safety domain.

Source

pub fn with_actuators(self, actuators: ActuatorsDomain) -> Self

Set the actuators domain.

Source

pub fn with_communication(self, communication: CommunicationDomain) -> Self

Set the communication domain.

Source

pub fn with_compute(self, compute: ComputeDomain) -> Self

Set the compute domain.

Source

pub fn with_ai(self, ai: AiDomain) -> Self

Set the AI domain.

Source

pub fn with_maintenance(self, maintenance: MaintenanceDomain) -> Self

Set the maintenance domain.

Source

pub fn with_context(self, context: ContextDomain) -> Self

Set the context domain.

Source

pub fn with_payload(self, payload: PayloadDomain) -> Self

Set the payload domain.

Source

pub fn with_manipulation(self, manipulation: ManipulationDomain) -> Self

Set the manipulation domain.

Source

pub fn with_hri(self, hri: HriDomain) -> Self

Set the HRI domain.

Source

pub fn with_coordination(self, coordination: CoordinationDomain) -> Self

Set the coordination domain.

Source

pub fn with_simulation(self, simulation: SimulationDomain) -> Self

Set the simulation domain.

Source

pub fn with_thermal(self, thermal: ThermalDomain) -> Self

Set the thermal domain.

Source

pub fn with_audio(self, audio: AudioDomain) -> Self

Set the audio domain.

Source

pub fn with_environment_interaction( self, environment_interaction: EnvironmentInteractionDomain, ) -> Self

Set the environment interaction domain.

Source

pub fn with_compliance(self, compliance: ComplianceDomain) -> Self

Set the compliance domain.

Source

pub fn with_extensions(self, extensions: Value) -> Self

Set custom extensions.

Source

pub fn inject_license_metadata(&mut self, metadata: &LicenseMetadata)

Inject license metadata into the event’s extensions.

This is called automatically by the agent before sending events.

Source

pub fn with_provenance(self, provenance: Provenance) -> Self

Set provenance information.

Source

pub fn has_domain_data(&self) -> bool

Check if the event has any domain data.

Source

pub fn estimated_size(&self) -> usize

Get estimated size in bytes (serialized JSON).

Source

pub fn to_json(&self) -> Result<String, Error>

Serialize to JSON string.

Source

pub fn to_json_pretty(&self) -> Result<String, Error>

Serialize to pretty JSON string.

Source

pub fn from_json(json: &str) -> Result<Self, Error>

Deserialize from JSON string.

Trait Implementations§

Source§

impl Clone for UdmEvent

Source§

fn clone(&self) -> UdmEvent

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

impl Debug for UdmEvent

Source§

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

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

impl Default for UdmEvent

Source§

fn default() -> UdmEvent

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

impl<'de> Deserialize<'de> for UdmEvent

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 UdmEvent

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

impl Validate for UdmEvent

Source§

fn validate(&self) -> Result<(), ValidationErrors>

Source§

impl<'v_a> ValidateArgs<'v_a> for UdmEvent

Source§

type Args = ()

Source§

fn validate_with_args(&self, args: Self::Args) -> Result<(), ValidationErrors>

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> 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.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

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
§

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

Source§

type Output = T

Should always be Self
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 = 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>,