Skip to content

Get Evaluation Data Schema

client.Evaluations.GetSchema(ctx, evaluationID, query) (*EvaluationSchemaResponse, error)
GET/v5/evaluations/{evaluation_id}/schema

Describe the data schema of an evaluation’s items.

Inspects the item data and task-result fields and returns each discovered field with its flattened key path, JSON type, source, and the number of items containing it, ordered alphabetically by field name. For large evaluations the schema may be inferred from a sample of items, in which case is_sampled is set and sample_size reports how many were analyzed. Set include_archived to include archived items in the analysis.

ParametersExpand Collapse
evaluationID string
query EvaluationGetSchemaParams
IncludeArchived param.Field[bool]Optional

Include archived items in schema analysis

ReturnsExpand Collapse
type EvaluationSchemaResponse struct{…}

Schema information for an evaluation’s item data structure

EvaluationID string

The ID of the evaluation

Fields []EvaluationSchemaResponseField

List of all discovered fields, ordered alphabetically by field_name

DataType string

JSON type: ‘string’, ‘number’, ‘boolean’, ‘object’, ‘array’, or ‘null’

FieldName string

The flattened JSON key path (e.g., ‘metadata.category’)

ItemCount int64

Number of evaluation items containing this field

minimum0
Source string

The source of the field: ‘data’ or ‘task_result_cache’

One of the following:
const EvaluationSchemaResponseFieldSourceData EvaluationSchemaResponseFieldSource = "data"
const EvaluationSchemaResponseFieldSourceTaskResultCache EvaluationSchemaResponseFieldSource = "task_result_cache"
Object stringOptional
TotalItems int64

Total number of evaluation items

minimum0
IsSampled boolOptional

Whether schema was computed from a sample of items (for large evaluations)

Object EvaluationSchemaResponseObjectOptional
SampleSize int64Optional

Number of items sampled for schema inference, if applicable

minimum0

Get Evaluation Data Schema

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  evaluationSchemaResponse, err := client.Evaluations.GetSchema(
    context.TODO(),
    "evaluation_id",
    sgpdev.EvaluationGetSchemaParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", evaluationSchemaResponse.EvaluationID)
}
{
  "evaluation_id": "evaluation_id",
  "fields": [
    {
      "data_type": "data_type",
      "field_name": "field_name",
      "item_count": 0,
      "source": "data",
      "object": "field_schema"
    }
  ],
  "total_items": 0,
  "is_sampled": true,
  "object": "evaluation_schema",
  "sample_size": 0
}
Returns Examples
{
  "evaluation_id": "evaluation_id",
  "fields": [
    {
      "data_type": "data_type",
      "field_name": "field_name",
      "item_count": 0,
      "source": "data",
      "object": "field_schema"
    }
  ],
  "total_items": 0,
  "is_sampled": true,
  "object": "evaluation_schema",
  "sample_size": 0
}