---
title: "Group"
canonical: "https://wiki.patientsknowbest.com/space/api/3365077600/Group"
format: markdown
---
[http://fhir.patientsknowbest.com/operation/group](http://fhir.patientsknowbest.com/operation/group)

[[Prod Resource](https://my.patientsknowbest.com/fhir/OperationDefinition/Observation-t-group?_format=json)]

[https://www.hl7.org/fhir/STU3/operationdefinition.html](https://www.hl7.org/fhir/STU3/operationdefinition.html)

[https://www.hl7.org/fhir/STU3/operations.html](https://www.hl7.org/fhir/STU3/operations.html)

## name

"group"

## status

"active"

## kind

"operation"

## description

There are some use cases for which it is a helpful optimisation to group the search results based on some criteria, and then return only a limited number of those results.

An existing example of this is the [$lastn operation](https://www.hl7.org/fhir/STU3/observation-operations.html#lastn).

More general grouping behaviour can be achieved by using the custom $group operation (for supported endpoints).

The supported search parameters match those for Observation search.

By default, this query will group results by day, and return only one result per day.

## idempotent

true

## code

"group"

## resource

- "Observation"

## system

false

## type

true

## instance

false