You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable or disable extended statistics fields in record indices. When enabled, additional computed fields are indexed for loans, acquisition orders, and document requests to support KPI reporting.
172
+
173
+
```python
174
+
ILS_EXTEND_INDICES_WITH_STATS_ENABLED=True
175
+
```
176
+
177
+
See the statistics reference for available fields: [Loans](../reference/stats/loan_stats.md#stats-fields), [Acquisition Orders](../reference/stats/acquisition_orders.md#stats-fields), [Document Requests](../reference/stats/document_requests.md#stats-fields). See the [v7 upgrade guide](../releases/version7/upgrade.md) for setup instructions.
See [Histogram Endpoints](histogram.md) for general parameter documentation.
4
+
5
+
```
6
+
GET /api/acquisition/stats
7
+
```
8
+
9
+
## Stats Fields
10
+
11
+
The following fields are added to acquisition orders specifically for statistics. They require [`ILS_EXTEND_INDICES_WITH_STATS_ENABLED`](../../customize/configure.md#ils_extend_indices_with_stats_enabled-truefalse) to be enabled.
See [Histogram Endpoints](histogram.md) for general parameter documentation.
4
+
5
+
```
6
+
GET /api/document-requests/stats
7
+
```
8
+
9
+
## Stats Fields
10
+
11
+
The following fields are added to document requests specifically for statistics. They require [`ILS_EXTEND_INDICES_WITH_STATS_ENABLED`](../../customize/configure.md#ils_extend_indices_with_stats_enabled-truefalse) to be enabled.
Several record types in InvenioILS expose a `/stats` endpoint for flexible aggregation queries. These endpoints provide real-time aggregation of records from their respective indices, allowing flexible grouping by any field and computation of statistical metrics on numeric fields.
4
+
5
+
Each response returns the count for the records matching the filter and grouping criteria under the field `doc_count` and the requested aggregated metrics.
|`group_by`| JSON array | query | ✓ | Array of grouping definitions. Each item is an object with `field` (required) and `interval` (required for date fields). See [format details below](#group_by-field-format). |
20
+
|`metrics`| JSON array | query | ✗ | Array of metric definitions. Each item is an object with `field` (required) and `aggregation` (required). See [format details below](#metrics-field-format). |
21
+
|`q`| string | query | ✗ | Search query string for filtering records (uses standard search syntax). |
22
+
23
+
### `group_by` Field Format
24
+
25
+
Each grouping object can be:
26
+
27
+
-**Term field**: `{"field": "field_name"}` - Groups by exact values (e.g., `state`, `patron_pid`)
28
+
-**Date field**: `{"field": "date_field", "interval": "time_interval"}` - Groups by time intervals
29
+
- Available intervals for date fields: `1d` (day), `1w` (week), `1M` (month), `1q` (quarter), `1y` (year)
Copy file name to clipboardExpand all lines: docs/reference/stats/index.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,12 @@
2
2
3
3
InvenioILS exposes statistics through REST API endpoints for analyzing library operations.
4
4
5
+
Several record types (loans, acquisition orders, document requests) share a common [histogram endpoint](histogram.md) pattern for flexible aggregation queries.
6
+
5
7
## Available Statistics
6
8
9
+
-[Histogram Endpoints](histogram.md) - Flexible aggregation queries for loans, orders, and document requests
7
10
-[Loan Statistics](loan_stats.md) - Loan histogram aggregations and transition tracking
11
+
-[Acquisition Order Statistics](acquisition_orders.md) - Purchase order timing and workflow metrics
12
+
-[Document Request Statistics](document_requests.md) - Literature request fulfillment metrics
8
13
-[Record Changes](record_changes.md) - Track insertions, updates, and deletions per record type
Copy file name to clipboardExpand all lines: docs/reference/stats/loan_stats.md
+8-32Lines changed: 8 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,45 +8,21 @@ InvenioILS provides two complementary endpoints for analyzing loan data:
8
8
9
9
## Loan Histogram
10
10
11
-
The Loan Histogram endpoint provides real-time aggregation of loan records from the loans index.
12
-
It allows flexible grouping by any field and computation of statistical metrics on numeric fields.
13
-
Each response returns the count for the loans matching the filter and grouping criteria under the field `doc_count` and the requested aggregated metrics.
14
-
15
-
16
-
### Endpoint
11
+
See [Histogram Endpoints](histogram.md) for general parameter documentation.
17
12
18
13
```
19
14
GET /api/circulation/loans/stats
20
15
```
21
16
22
-
### Parameters
23
-
24
-
| Name | Type | Location | Required | Description |
|`group_by`| JSON array | query | ✓ | Array of grouping definitions. Each item is an object with `field` (required) and `interval` (required for date fields). See [format details below](#group_by-field-format). |
27
-
|`metrics`| JSON array | query | ✗ | Array of metric definitions. Each item is an object with `field` (required) and `aggregation` (required). See [format details below](#metrics-field-format). |
28
-
|`q`| string | query | ✗ | Search query string for filtering loans (uses standard search syntax). |
29
-
30
-
#### `group_by` Field Format
31
-
32
-
Each grouping object can be:
33
-
34
-
-**Term field**: `{"field": "field_name"}` - Groups by exact values (e.g., `state`, `patron_pid`)
35
-
-**Date field**: `{"field": "date_field", "interval": "time_interval"}` - Groups by time intervals
36
-
- Available intervals for date fields: `1d` (day), `1w` (week), `1M` (month), `1q` (quarter), `1y` (year)
The following fields are added to loans specifically for statistics. They require [`ILS_EXTEND_INDICES_WITH_STATS_ENABLED`](../../customize/configure.md#ils_extend_indices_with_stats_enabled-truefalse) to be enabled.
44
20
45
-
!!! tip "Discovering available fields"
46
-
To see all available loan fields for grouping and metrics, query the loans endpoint:
0 commit comments