RIDING BYTES
← All insights

November 14, 2026 · 8 min read

SENAITE Databox: recurring extracts without a developer

A Databox is a saved catalog query with columns you choose and a CSV or Excel export. How to build one step by step, which values the filters expect, and where the tool reaches its limits.

SENAITE Databox: recurring extracts without a developer

Sooner or later someone asks for a list. All nitrate results of the year with sample, client and date. All samples of one client last quarter with their sample point. Every one of these is a question SENAITE can answer, and senaite.databox is the tool that answers it without a developer and without exporting half the database.

A Databox is a folder with a stored catalog query. Opening it runs the query against live data and shows the matching records in a table with the columns you chose. Every Databox exports to CSV or Excel.

Databox is an add-on. It is not part of a default installation; it is added to the buildout and installed once. After that, Databoxes appear in the side menu.

Who can do what

Creating and editing a Databox is reserved to Lab Manager and Manager by default. Lab Clerks can open and export them. That split works well in practice: the lab manager designs the extract once, and the office pulls the file whenever it is needed.

There is a good reason the editing right is narrow. Columns can contain Python expressions that run on the server (more on that below), so editing a Databox is closer to configuring the system than to filling in a form.

A worked example: nitrate results of the year

The goal is a table of all verified nitrate results since 1 January, with sample ID, client, result, unit and date received.

1. Create the Databox and choose the query type. The query type is the content type the query runs against. It decides which catalog is searched and which fields are available as columns. The rule of thumb: query the type that has one row per line you want in the result. One line per result means Analysis. One line per sample means AnalysisRequest, which is the internal name of the sample.

2. Narrow the time range on the Query tab. Pick a date index, here the date the sample was received, and set “from” to 1 January. Leave “to” empty, which means “up to now”. On the same tab you set the sort index and direction.

3. Filter on the Advanced Query tab. Each row is one catalog index and the value it must match, and several rows apply together:

  • getKeyword = NO3 keeps only nitrate analyses. The value is the keyword of the analysis service, not its title.
  • review_state = verified keeps only verified results. The value is the internal state id, not the label shown on screen. A list such as ["to_be_verified", "verified"] matches either state.

This is where most first attempts fail. The values must match what the catalog stores: keywords, state ids, UIDs for references. A label typed as it appears on screen (“Verified”) matches nothing, and the table stays empty without an error message.

4. Choose the columns on the Columns tab. A new Databox shows only the title. Add a row per column: the label becomes the column heading, the value is a field of the queried type. Result and Unit are fields of the analysis itself. For sample and client, follow references: an analysis has a virtual Parent field that points to its sample, and from the sample you reach Client and then the client’s name. Drag the rows into the order you want in the export.

5. Export. The two icons at the top right produce CSV or Excel (.xlsx). The export contains every record the query returns, in the column order of the Columns tab, not only the page currently on screen.

"Sample","Client","Result","Unit","Date received"
"W-26-00412","Riverside Water","12.40","mg/L","2026-03-04"
"W-26-00413","Riverside Water","62.00","mg/L","2026-03-04"

Computed columns

A column does not have to be a field. Its Code is a short Python expression evaluated once per row, and a Converter turns the value into a formatted date or a link before it reaches the table and the export.

The expression sees the row’s object and catalog record, the referenced object when the column follows a reference, and SENAITE’s API. A column Above 50 mg/L with the code

float(obj.getResult() or 0) > 50

marks every result above the limit. If an expression fails, the cell shows the error text instead of a value, so a broken column is visible rather than silently empty.

The next release of the add-on, 1.6, adds a Parameters tab. It holds named values, from plain numbers to Python expressions, that are worked out once before the main query runs and can be used in every column. The limit of 50 above would then live in one parameter instead of being repeated in several columns, and an expression parameter can look something up once instead of once per row. At the time of writing 1.6 is not yet released.

Databox Nitrate results on its Query tab: sorted and filtered on getDateReceived from 01/01/2026, limit 5. Two rows with columns Analysis, Result, Unit, Uncertainty and a computed column Above threshold showing No and Yes.
A nitrate Databox with a computed column that flags results above 50 mg/L. The export icons sit at the top right.

Limits worth knowing

One type per Databox. There are no joins in the SQL sense. Following references covers most “joined” questions labs ask, such as the client of a sample or the method of an analysis. Questions that need two unrelated types side by side need two Databoxes.

The date range is absolute. “From” and “to” are fixed dates. A Databox for “last month” has to be edited each month. A range that only has a “from” date grows with time, which suits “year to date” extracts.

Only indexed fields can be filtered. The Advanced Query offers the indexes of the catalog behind the query type. A field that is not indexed can be shown as a column but not filtered on. New indexes can be added to a catalog, but that is a change to the system and should go through whoever maintains it.

Large result sets are slow. For each row the Databox loads the full object, follows the references and runs the column code. A few thousand rows are fine. A Databox over every analysis of the last five years will make the page and the export wait. Narrow the date range first, then widen it if needed.

It only reads. Databox does not change data and is not an import tool.

It is not a charting tool. It delivers rows. Pivot tables and charts belong in the spreadsheet or reporting tool that opens the export.

Where it earns its place

The Databoxes we see in daily use fall into a few shapes:

  • Monthly extracts for accounting: published samples of a period with client and analysis services.
  • Input for the QA meeting: verified results of selected services over a quarter, exported and charted in a spreadsheet.
  • Answers to client questions: all samples of one client in a period with their sample points and dates.
  • Checks before an audit: all samples of a sample type with their state, to find the ones left open.

A sensible habit: when the same “can you send me a list of…” request arrives a second time, build a Databox for it, give it a title that says what it answers, and let the person who asked export it themselves from then on. For a quick look at live work the listings with saved filters are faster; the Databox is for extracts that leave SENAITE.

Two people reviewing notes on paper next to a laptop

Bring this to your lab

Whether you are evaluating SENAITE, scaling it across sites, or wiring up instruments and monitoring, the team that wrote the platform is the team you talk to.