func deviationDetector(params *orca.ExecutionParams) (orca.Result, error) {
var p_h float64 = Config.PriorOnReset
var p_h_e float64 = Config.PriorOnReset
var currentWindow = params.Window
var metadata = make(map[string]any, len(NewDatapoint.MetadataFields))
for _, field := range NewDatapoint.MetadataFields {
val, ok := currentWindow.Metadata[field.Name]
if !ok {
return nil, fmt.Errorf("expected field %v", field.Name)
}
metadata[field.Name] = val
}
currentVector, ok := metadata[VECTOR_FIELD_NAME]
if !ok {
return nil, fmt.Errorf("could not retreived the current vector. looking for %v", VECTOR_FIELD_NAME)
}
vLowPrec, ok := currentVector.(structpb.ListValue)
...
I don't want to have to manually parse out the struct PB values. I should expect the fields to be there... Perhaps we can do this validation behind the scenes in the SDK?
The metadata handling in the Go SDK is not great:
I don't want to have to manually parse out the struct PB values. I should expect the fields to be there... Perhaps we can do this validation behind the scenes in the SDK?