Transforming what is sent
The steps
The generic plug-ins (Message queue, Webhook, OAuth API, Azure Blob Storage, Azure Data Lake, Azure Files, Azure Event Grid and Power BI) send each curve, timeseries or options of a group as an item message. Before it is sent it goes through optional steps, all set on the group's Transform tab. The file plug-ins (Azure Blob Storage, Azure Data Lake and Azure Files) first choose the file format: JSON files go through the same steps as the other plug-ins, CSV files have the columns you choose.
| Step | What it does | Where it is set |
|---|---|---|
| 1. The item | The item message: id, code, name, kind, ondate, group, system, correction and values. | |
| 2. File format | File plug-ins only: JSON (the item message, or the group message) or CSV (one row per value). | The Transform tab |
| 3. Tenor rules and tenor map | Which contracts of a curve, and which tenors of options, are sent, and the ids they are sent with. See Tenor rules and maps. | The group's Tenors tab |
| 4. ODSL function | JSON only: a function of one of your ODSL scripts turns the message into whatever the system takes. What it returns is sent instead, as JSON, or given to the template. | The Transform tab |
| 5. Mustache template | JSON only: the text of a Mustache template applied to the message (or what the function returned) is sent instead of the JSON, with its Content type. | The Transform tab |
| 4. CSV columns | CSV only: the columns of the files, in your order. | The Transform tab |
The group's Transform tab shows the steps for the format chosen, and Save the transformation saves them all. What does not apply to the format is removed when you save: choosing CSV removes the function, the template and the content type; choosing JSON removes the columns. The file format, template and content type are no longer on the Settings tab.

A file plug-in's group whose settings have a template is shown as JSON, as its files are the template's text whatever the format. A group made without a format (through the API) sends JSON.
Systems with their own plug-in, such as Molecule, have the tenor rules but not the function and template steps. A custom system can call the group's function itself.
CSV columns
With the file format set to CSV, the Transform tab lists the columns a file can have. Tick the ones the system needs and put them in order with Up and Down; the header they make is shown under the list.

| Column | What it holds |
|---|---|
id | The data id, such as NGE.GAS.TTF:MID. |
code | The code the system knows the item by (its identity), else the data id. |
name, kind, ondate | The item's name, curve, timeseries or options, and the date of the data. |
tenor | The tenor sent: with a tenor map, the mapped id. |
odslTenor | The curve's own tenor, when a tenor map changed it; else empty. |
absolute | The absolute tenor, such as 2027M01. |
start | The start of delivery. |
time | The time of a timeseries value. |
value | The value. |
expiry, strike, callput, column | Options: the expiry, the strike, C or P, and the column of the value, such as SETTLEMENT_PRICE. |
With the standard columns ticked (Standard columns), nothing is saved and the files have id,code,name,kind,ondate,tenor,start,time,value, and for a file with options also expiry,strike,callput,column. A column that does not apply to a row, such as time for a curve, is empty. See CSV files.
The ODSL function
The function is in one of your ODSL scripts whose category is odsl.integration, set in the script's first comment:
/**
* @category odsl.integration
* Transforms for the trading hub
*/
// The prices of a curve as the hub takes them
function toHub(item)
toHub = SimpleObject()
toHub.set_Id(null)
toHub.curve = item.code
toHub.date = item.ondate
toHub.prices = []
for v in item.values
p = SimpleObject()
p.set_Id(null)
p.contract = v.tenor
p.price = v.value
toHub.prices.add(p)
next
end
The Transform tab lists the scripts of that category, and the functions of the chosen script that take one parameter. The function:
- takes the item message after the tenor rules (with a tenor map,
tenoris the mapped id andodslTenorthe curve's own); - returns an object, which is sent instead of the message, as JSON, or given to the Mustache template as its data;
- runs on the platform, once for each item, with the access of the group's process (the person who saved it needs the run action on the script).
A function that fails, or returns something other than an object, fails the item, with the function's message in the daily report.
When the function returns an object that still has the message's kind and values, the Power BI rows and the template's rows are made from it. Otherwise they are made from the message before the function.
Testing the transformation
Test the transformation on the Transform tab runs the steps for one item of the group, as a run would, without sending anything or changing the daily report:

-
Choose the item and, optionally, the ondate (blank is yesterday), then Run the steps.
-
Each step the group has gets a tab with its output, which is exactly what the next step gets, so you can copy it and write your function or template against it:
- Item: the item with every contract and its own tenor id.
- Tenor rules: the message after them. With a function, this is the parameter it gets.
- Function: what the function returned.
- Template data: the JSON the Mustache template is applied to: the message (or what the function returned) with
rows, or, with one message per group, the group message with the item initemsandrows. See Transforming with a Mustache template. - Template: the text of the template, which is sent.
- Sent: with one message per group and no template, the group message that is sent, with the item in
items. - CSV: for CSV files, the file with the group's columns.
The last step is shown when the run ends; a step that failed has its tab marked in red. Copy puts a step's output on the clipboard.
-
Paste what the system should get under Check the result, on the right, and Compare. It is compared with the last step's output: as JSON when both are JSON, whatever the order of the keys, else as text, ignoring line endings and spaces at the ends of lines. The differences are listed by JSON path or by line.

The test uses the transformation as saved: save it before testing a change.
A step that fails shows its error (and the last lines of the function's log), and the steps before it can still be compared.
The screen reads the item and builds the message and the tenor rules the way a run does, runs your function on the platform, and has the platform apply the template, so the test takes seconds. A click outside the dialog does not close it; use the x.