Publishes a single production event to Fiddler asynchronously.

Input Parameter

Type

Default

Description

project_id

str

None

The unique identifier for the project.

model_id

str

None

A unique identifier for the model. Must be a lowercase string between 2-30 characters containing only alphanumeric characters and underscores. Additionally, it must not start with a numeric character.

event

dict

None

A dictionary mapping field names to field values. Any fields found that are not present in the model's ModelInfo object will be dropped from the event.

event_id

Optional [str]

None

A unique identifier for the event. If not specified, Fiddler will generate its own ID, which can be retrived using the get_slice API.

update_event

Optional [bool]

None

If True, will only modify an existing event, referenced by event_id. If no event is found, no change will take place.

event_timestamp

Optional [int]

None

The name of the timestamp input field for when the event took place. The format of this timestamp is given by timestamp_format. If no timestamp input is provided, the current time will be used.

timestamp_format

Optional [fdl.FiddlerTimestamp]

fdl.FiddlerTimestamp.INFER

The format of the timestamp passed in event_timestamp. Can be one of

  • fdl.FiddlerTimestamp.INFER
  • fdl.FiddlerTimestamp.EPOCH_MILLISECONDS
  • fdl.FiddlerTimestamp.EPOCH_SECONDS
  • fdl.FiddlerTimestamp.ISO_8601

casting_type

Optional [bool]

False

If True, will try to cast the data in event to be in line with the data types defined in the model's ModelInfo object.

dry_run

Optional [bool]

False

If True, the event will not be published, and instead a report will be generated with information about any problems with the event. Useful for debugging issues with event publishing.

PROJECT_ID = 'example_project'
MODEL_ID = 'example_model'

example_event = {
    'feature_1': 20.7,
    'feature_2': 45000,
    'feature_3': True,
    'output_column': 0.79,
    'target_column': 1
}

client.publish_event(
    project_id=PROJECT_ID,
    model_id=MODEL_ID,
    event=example_event,
    event_id='event_001',
    event_timestamp=1637344470000
)