client.publish_event

Publishes a single production event to Fiddler asynchronously.

Input ParameterTypeDefaultDescription
project_idstrNoneThe unique identifier for the project.
model_idstrNoneA 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.
eventdictNoneA 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_idOptional [str]NoneA unique identifier for the event. If not specified, Fiddler will generate its own ID, which can be retrived using the get_slice API.
update_eventOptional [bool]NoneIf True, will only modify an existing event, referenced by event_id. If no event is found, no change will take place.
event_timestampOptional [int]NoneThe 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_formatOptional [fdl.FiddlerTimestamp]fdl.FiddlerTimestamp.INFERThe 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_typeOptional [bool]FalseIf 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_runOptional [bool]FalseIf 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
)