Skip to content

Computed fields

In addition to plain metadata field names, the fields parameter of /sample/aggregated accepts computed fields using the syntax <field>.<function>, e.g. date.isoWeek. A computed field applies a scalar function to a metadata field and groups by the result, instead of grouping by the raw field value.

Example: to count sequences per ISO week instead of per exact date:

[URL to LAPIS instance]/sample/aggregated?fields=date.isoWeek
{
"fields": ["date.isoWeek"]
}

The response uses the full <field>.<function> string as the column/property key, e.g. date.isoWeek.

| Function | Applicable field types | Description | |-----------|-------------------------|---------------------------------------| | isoWeek | date | The ISO 8601 week of the date field. |