Creating event metadata#

Mark a point or span in time as an event, such as a failure or an unknown state, so it can be found and reviewed. Events belong to one or more assets.

In code#

from datetime import datetime, timedelta, timezone
from nominal.core import EventType, NominalClient

client = NominalClient.from_profile("default")
asset = client.get_asset("<ri.scout.instance.asset.identifier>")
asset.create_event(
    "Overtemperature",
    EventType.ERROR,
    start=datetime(2026, 1, 1, 14, 12, tzinfo=timezone.utc),
    duration=timedelta(seconds=5),  # omit for a point in time
)
client = nominal.Client.fromProfile();
client.createEvent("<ri.scout.instance.asset.identifier>", "Overtemperature", Type="error", ...
    Timestamp=datetime("2026-01-01 14:12:00", TimeZone="UTC"), ...
    Duration=seconds(5));  % omit Duration for a point in time

LabVIEW example that creates an error event on an asset, then sets its description, labels, properties, and duration

use std::sync::Arc;
use nominal::streaming::api::clients::event::{AsyncEventService, AsyncEventServiceClient};
use nominal::streaming::api::objects::{api::Timestamp, event::{CreateEvent, EventType}};
use nominal::streaming::api::objects::scout::{rids::api::AssetRid, run::api::Duration};
use nominal::streaming::client::{async_conjure_client, conjure::{http::client::{AsyncService, ConjureRuntime}, object::SafeLong}};
use nominal::streaming::prelude::{BearerToken, ResourceIdentifier};

let config = nominal::Config::load()?;
let profile = config.get_profile("default").ok_or("no profile named default")?;
let api = async_conjure_client("events", profile.base_url().parse()?).map_err(nominal::Error::from)?;
let events = AsyncEventServiceClient::new(api, &Arc::new(ConjureRuntime::default()));
events.create_event(&BearerToken::new(profile.token())?, &CreateEvent::builder()
    .timestamp(Timestamp::new(SafeLong::new(1_767_276_720)?, SafeLong::new(0)?)) // 2026-01-01T14:12:00Z
    .duration(Duration::new(SafeLong::new(5)?, SafeLong::new(0)?))               // zero for a point in time
    .name("Overtemperature")
    .type_(EventType::Error)
    .insert_asset_rids(AssetRid(ResourceIdentifier::new("<ri.scout.instance.asset.identifier>")?))
    .build(),
).await.map_err(nominal::Error::from)?;
import (
	nominalapi "github.com/nominal-io/nominal-api-go/io/nominal/api"
	"github.com/nominal-io/nominal-api-go/io/nominal/event"
	scoutrids "github.com/nominal-io/nominal-api-go/scout/rids/api"
	runapi "github.com/nominal-io/nominal-api-go/scout/run/api"
	"github.com/palantir/pkg/rid"
)

// httpClient is a conjure-go-runtime httpclient.Client for your Nominal REST API URL,
// and token is your API key as a bearertoken.Token
assetRid, _ := rid.ParseRID("<ri.scout.instance.asset.identifier>")
event.NewEventServiceClient(httpClient).CreateEvent(ctx, token, event.CreateEvent{
	Name:      "Overtemperature",
	Type:      event.New_EventType(event.EventType_ERROR),
	Timestamp: nominalapi.Timestamp{Seconds: 1767276720}, // 2026-01-01T14:12:00Z
	Duration:  runapi.Duration{Seconds: 5},               // zero for a point in time
	AssetRids: []scoutrids.AssetRid{scoutrids.AssetRid(assetRid)},
})

In the Nominal app#

  1. In a workbook, drag across a time series chart over the span to mark, or click the chart at a point in time, and choose New event.

  2. Enter a Name, such as Overtemperature, and choose an Event level. Violation is the level that the ERROR type in code creates.

  3. Check the Timestamp, which your selection fills in, and click CREATE EVENT.