Skip to content

Quote Response

You've calculated a price. Now you choose which columns to send back in the API response - the final premium, any breakdown fields, a reference ID. Everything not listed here is still calculated but stays internal.

When to use

Use this to define the API response for live pricing. For saving results to a file (batch scoring), use Data Output instead. You can use both in the same pipeline.

Each incoming connection is one frame. A single frame is the usual case; several frames let the response nest child arrays, such as each quote's drivers. Each array level of the response takes one frame: two frames that would both fill the top-level objects (or both fill one nested array) are rejected. Join them upstream with an Edge Join or Transform node, or map one of them into a child array. The node assembles the response document from the mapping described below.

The panel

The node's panel has no tabs: its settings sit on one page, and it has no COLUMNS tab because the mapping below chooses the fields.

The response is a JSON document.

RESPONSE MAPPING

With nothing connected, the panel says Connect input frames to map them to the response. Once frames are connected it shows, from top to bottom:

  • Frames (N): click to show each connected frame's columns and types. The icons beside it copy or download the list of frames (as tab-separated text, CSV or TSV) or the whole mapping as JSON.
  • Output preview: expand it (or refresh it) to assemble the whole response document from the current mapping, before you save. It shows The assembled document is empty (no enabled rows mapped, or no source rows). when nothing would be returned.
  • One block per frame, named after the frame and showing its field count, its path prefix and an enabled box.

A frame block has:

Control What it does
Path prefix The frame's path in the response, for example $[:]. Double-click it (or click the pencil) to change it; the new prefix is applied across all of this frame's rows.
enabled Includes or leaves out every field of the frame at once.
Add row Adds an empty mapping row.
Infer Adds one row per column of the frame, each with a suggested path and marked Inferred until you edit its column or path. Disabled until the frame's columns are known.
Clear Removes all of this frame's mapping rows.
Table icons Copy the frame's rows as tab-separated text or its mapping as JSON, download them as JSON, CSV or TSV, or paste tab-separated rows in (column, output_path, and optionally enabled).
Input data Expand it to preview the frame's incoming rows as JSON.

Each mapping row has a tick box (include this field in the response), the source column (- column - until you choose one), its output path (placeholder $[:].field) and a × to remove it. An empty path shows An output path is required., and a path that clashes with another field's path in the same frame is flagged.

Renaming an incoming frame updates its mapping rows, including disabled rows. Disabled rows do not block a rename because their paths duplicate another row; enabled mappings must remain distinct.

An output path uses the same path notation as the Quote Input tables: $[:].final_premium is a field of each top-level response object, and $[:].drivers[:].age_factor is a field of each object in a nested drivers array. Every path starts at the root array $[:]. A child frame nests under its parent by the parent-level fields it also maps, for example $[:].quote_id. A deployment whose response nests a quote's own rows, such as its drivers, answers a request of several quotes one quote at a time, so each quote's drivers are its own (see Requests with several quotes).

The panel warns when two connected frames resolve to the same name (give the sources distinct names before mapping them), and when two frames emit at the same array level (join them upstream or map one of them to a different level).

Example

Returning the quote ID, the final premium and the area factor:

  1. Connect your priced frame (here priced) to the Quote Response node.
  2. Expand the priced block and click Add row three times. Map quote_id to $[:].quote_id, final_premium to $[:].final_premium and area_factor to $[:].area_factor. (Or click Infer and untick or remove the rows you don't want.)
  3. Expand Output preview to check the document.

The API response then holds only the quote ID, the final premium, and the area factor. All other columns (raw inputs, intermediate calculations) are still computed but not exposed. Fields whose value is null, and empty arrays or objects, are left out of the response.

One per pipeline

You can only have one Quote Response or Workbench Output node in a pipeline.

Required for live pricing

A Quote Response or Workbench Output node is required for live pricing deployments. If your pipeline is batch-only (using Data Output), you don't need one.

In the pipeline file

A pipeline holds one Quote Response, so the node is always named quote_response, and it has no rename.

The node's settings are stored in a JSON sidecar, config/quote_response/quote_response.json, which the pipeline's .py file names in the node's decorator: @pipeline.output(config="config/quote_response/quote_response.json").

Setting in the editor Stored as
Mapping rows output_mapping: one entry per row
Row's frame output_mapping[].source_port: the incoming frame's name
Row's column output_mapping[].source_column
Row's output path output_mapping[].output_path
Row's tick box, frame's enabled box output_mapping[].enabled (true or false)

The example above is stored as:

{
  "output_mapping": [
    { "source_port": "priced", "source_column": "quote_id", "output_path": "$[:].quote_id", "enabled": true },
    { "source_port": "priced", "source_column": "final_premium", "output_path": "$[:].final_premium", "enabled": true },
    { "source_port": "priced", "source_column": "area_factor", "output_path": "$[:].area_factor", "enabled": true }
  ]
}

Every key the config may hold:

Key Type Description
output_mapping list of object The mapping rows, each a column of an incoming frame and the response path it fills.
output_mapping[].source_port text The incoming frame the column comes from, by its input name.
output_mapping[].source_column text The column whose values fill the path.
output_mapping[].output_path text The JSONPath in the response document the column fills, such as $[:].premium.
output_mapping[].enabled true or false Whether the row is part of the response.
input_mapping map of text to text The input names the node's code uses, each mapped to the connected input it reads.
contract "opaque" or object The node's column contract as its decorator declares it: "opaque", or the columns it reads and produces.
selected_columns list of text The columns the node passes downstream, chosen on its Columns tab; absent passes all.
column_renames map of text to text New names for columns passed downstream, from each column's name to its new one.

See also: