Notebooks
A notebook is analysis written as code beside the model: queries on its measures, C# with OpenBI’s library, and text that says what was found. It is how a data scientist works in OpenBI Studio, and how an AI agent does the same work, step by step, where you can read it.
What a notebook is
A notebook is a list of steps that run in order, each showing what it found under it. There are five kinds of step:
- Text
- Markdown: the question, what each part does, and what it found.
- OAX
- A query on the model, with its measures, relationships and security. Its rows become a variable named after the step, and it can take parameters such as
@asOf. - SQL
- DuckDB SQL over the project’s sources and the model’s tables. Its rows become a variable too.
- C#
- Code with OpenBI’s notebook library: tables, LightGBM, OR-Tools, QuantLib, Open Graph, statistics, charts and saved versions.
- TikZ
- A figure drawn as papers draw them, compiled on this computer.
The steps run in a kernel, a process of its own that starts with the first step and keeps every variable until you restart it. Each notebook is a file in Jupyter’s format in the project, versioned with it, and typeset as a paper whenever you want one.
A first look
On the Example Brewery project (File › Open the example project), an OAX step reads two of the model’s measures by product. Its name, byProduct, is the variable the next steps use:
EVALUATE
SUMMARIZECOLUMNS (
Products[Product],
"Liters", [Liters sold],
"Revenue", [Revenue]
)
| Product | Liters | Revenue |
|---|---|---|
| Cider | 301,074 | 15,655,848 |
| IPA | 331,884 | 21,240,576 |
| Lettøl | 169,179 | 5,075,370 |
| Pils | 1,004,326 | 38,164,388 |
A C# step sorts it. Tables never change: every method gives a new one.
// the products by revenue, highest first: a new table (byProduct is unchanged)
byProduct.OrderBy("Revenue", descending: true)
| Product | Liters | Revenue |
|---|---|---|
| Pils | 1,004,326 | 38,164,388 |
| IPA | 331,884 | 21,240,576 |
| Cider | 301,074 | 15,655,848 |
| Lettøl | 169,179 | 5,075,370 |
And a chart, drawn under the step, in the notebook’s PDF and in Jupyter alike:
var names = byProduct.Rows.Select(r => r.Text("Product")!).ToList();
Chart.HBar("Revenue by product, NOK", names, byProduct["Revenue"].ToNumbers())
The numbers are the model’s own: [Revenue] is the measure the report pages use, so the notebook and the reports agree. Get started builds a whole notebook this way.
What you can do in a notebook
| Work | With |
|---|---|
| Data in and out | OAX and SQL steps into Table; results back into the model as approved versions. |
| Learning | LightGBM, time-based folds, tuning, metrics, a verdict against a simple rule, calibration, drift, backtests, uplift, forecasts. |
| Optimization | OR-Tools: plans under limits, shadow prices, scenarios, vehicle routing. |
| Quantitative finance | QuantLib: curves, bonds, swaps, options, credit, XVA, value at risk, Monte Carlo. |
| Networks | Open Graph: PageRank, betweenness, communities, cut points, paths. |
| Statistics and survival | Experiments and A/B tests, bootstrap intervals, Kaplan-Meier, Cox models. |
| Charts and visuals | Charts under a step, and any of the report visuals on the model’s measures. |
Every type and member is in the library reference.
Languages and libraries
A notebook’s languages are the five step kinds above: text, OAX, SQL, C# and TikZ. C# steps use OpenBI’s notebook library and .NET’s own. LightGBM, OR-Tools, QuantLib and Open Graph are built in, with nothing to install: no package manager and no environment to set up. You reach them through OpenBI’s library, a surface chosen for analysis on a model (training with honest held-out tests, plans that explain their limits, valuations kept with their market), not each library’s whole interface. OR-Tools’ own .NET classes (CP-SAT, flows, assignment) are there as well, by their namespaces.
Notebooks don’t run Python or R, and pip and install.packages don’t apply. Why no Python or R says why. Models made in Python come in as files, read and never run (see Versions and approval).
Where notebooks live
Notebooks are in the studio’s four analytics views: Prediction, Operations Research, Quantitative and Networks. Each kind has its folder in the project (predictions\, operations-research\, quantitative\, networks\) and each notebook a folder of its own, with its notebook.ipynb inside. A name is used once across the four kinds. The studio’s side of a notebook, its buttons, tabs and keys, is on Notebooks in the studio.
Agents work the same way
An AI agent connected to the studio writes and runs notebooks through the same steps you see: it adds a step, runs it, reads what it showed and puts it right, in the notebook open in front of you. It saves drafts; a person approves them. Agents and notebooks walks through a real session.
Where next
- Get started: a first notebook on the example project.
- Steps and the kernel: variables, parameters, errors and their hints, interrupting and restarting.
- Library reference: every type and member.