invenio-app-ils 7.0.0__py2.py3-none-any.whl → 7.1.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- invenio_app_ils/__init__.py +1 -1
- invenio_app_ils/acquisition/indexer.py +72 -0
- invenio_app_ils/acquisition/mappings/os-v2/acq_orders/order-v1.0.0.json +5 -0
- invenio_app_ils/acquisition/stats/__init__.py +8 -0
- invenio_app_ils/acquisition/stats/views.py +82 -0
- invenio_app_ils/circulation/indexer.py +2 -0
- invenio_app_ils/circulation/stats/api.py +0 -100
- invenio_app_ils/circulation/stats/views.py +14 -29
- invenio_app_ils/document_requests/indexer.py +76 -2
- invenio_app_ils/document_requests/mappings/os-v2/document_requests/document_request-v1.0.0.json +5 -0
- invenio_app_ils/document_requests/stats/__init__.py +8 -0
- invenio_app_ils/document_requests/stats/views.py +85 -0
- invenio_app_ils/ext.py +49 -0
- invenio_app_ils/permissions.py +2 -0
- invenio_app_ils/stats/histogram/__init__.py +18 -0
- invenio_app_ils/stats/histogram/api.py +109 -0
- invenio_app_ils/{circulation/stats → stats/histogram}/schemas.py +10 -28
- invenio_app_ils/stats/histogram/serializers/__init__.py +18 -0
- invenio_app_ils/{circulation/stats → stats/histogram}/serializers/response.py +3 -4
- invenio_app_ils/{circulation/stats → stats/histogram}/serializers/schema.py +1 -1
- invenio_app_ils/stats/histogram/views.py +34 -0
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/METADATA +8 -1
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/RECORD +28 -20
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/WHEEL +1 -1
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/entry_points.txt +2 -0
- invenio_app_ils/circulation/stats/serializers/__init__.py +0 -13
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/licenses/AUTHORS.rst +0 -0
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/licenses/LICENSE +0 -0
- {invenio_app_ils-7.0.0.dist-info → invenio_app_ils-7.1.0.dist-info}/top_level.txt +0 -0
invenio_app_ils/__init__.py
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Order indexer APIs."""
|
|
9
|
+
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
|
|
12
|
+
from invenio_search import current_search_client
|
|
13
|
+
|
|
14
|
+
from invenio_app_ils.acquisition.api import ORDER_PID_TYPE
|
|
15
|
+
from invenio_app_ils.proxies import current_app_ils
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def index_stats_fields_for_order(order_dict):
|
|
19
|
+
"""Indexer hook to modify the order record dict before indexing."""
|
|
20
|
+
|
|
21
|
+
# This is done through the hook and not through an indexer class,
|
|
22
|
+
# as we need access to the `_created` field
|
|
23
|
+
|
|
24
|
+
# Only calculate stats if order is received
|
|
25
|
+
if not order_dict.get("received_date"):
|
|
26
|
+
return
|
|
27
|
+
|
|
28
|
+
stats = {}
|
|
29
|
+
|
|
30
|
+
received_date = datetime.fromisoformat(order_dict["received_date"]).date()
|
|
31
|
+
creation_date = datetime.fromisoformat(order_dict["_created"]).date()
|
|
32
|
+
|
|
33
|
+
# Calculate order_processing_time
|
|
34
|
+
order_processing_time = (received_date - creation_date).days
|
|
35
|
+
stats["order_processing_time"] = order_processing_time if order_processing_time >= 0 else None
|
|
36
|
+
|
|
37
|
+
# Find related document request if any
|
|
38
|
+
order_pid = order_dict.get("pid")
|
|
39
|
+
if order_pid:
|
|
40
|
+
doc_req_search_cls = current_app_ils.document_request_search_cls
|
|
41
|
+
search_body = {
|
|
42
|
+
"query": {
|
|
43
|
+
"bool": {
|
|
44
|
+
"must": [
|
|
45
|
+
{"term": {"physical_item_provider.pid": order_pid}},
|
|
46
|
+
{"term": {"physical_item_provider.pid_type": ORDER_PID_TYPE}},
|
|
47
|
+
],
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"size": 1,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
search_result = current_search_client.search(
|
|
54
|
+
index=doc_req_search_cls.Meta.index, body=search_body
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
hits = search_result["hits"]["hits"]
|
|
58
|
+
if len(hits) > 0:
|
|
59
|
+
doc_request = hits[0]["_source"]
|
|
60
|
+
doc_req_creation_date = datetime.fromisoformat(
|
|
61
|
+
doc_request["_created"]
|
|
62
|
+
).date()
|
|
63
|
+
|
|
64
|
+
order_dict["doc_request"] = {}
|
|
65
|
+
|
|
66
|
+
# Calculate document_request_waiting_time
|
|
67
|
+
waiting_time = (received_date - doc_req_creation_date).days
|
|
68
|
+
stats["document_request_waiting_time"] = (
|
|
69
|
+
waiting_time if waiting_time >= 0 else None
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
order_dict["stats"] = stats
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Invenio App ILS acquisition stats module."""
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Invenio App ILS acquisition stats views."""
|
|
9
|
+
|
|
10
|
+
from flask import Blueprint, request
|
|
11
|
+
from invenio_records_rest.query import default_search_factory
|
|
12
|
+
from invenio_rest import ContentNegotiatedMethodView
|
|
13
|
+
from marshmallow.exceptions import ValidationError
|
|
14
|
+
|
|
15
|
+
from invenio_app_ils.acquisition.api import ORDER_PID_TYPE
|
|
16
|
+
from invenio_app_ils.acquisition.proxies import current_ils_acq
|
|
17
|
+
from invenio_app_ils.errors import InvalidParameterError
|
|
18
|
+
from invenio_app_ils.permissions import need_permissions
|
|
19
|
+
from invenio_app_ils.stats.histogram import (
|
|
20
|
+
HistogramParamsSchema,
|
|
21
|
+
create_histogram_view,
|
|
22
|
+
get_record_statistics,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def create_acquisition_stats_blueprint(app):
|
|
27
|
+
"""Add statistics views to the blueprint."""
|
|
28
|
+
blueprint = Blueprint("invenio_app_ils_acquisition_stats", __name__, url_prefix="")
|
|
29
|
+
|
|
30
|
+
create_histogram_view(
|
|
31
|
+
blueprint, app, ORDER_PID_TYPE, OrderHistogramResource, "/acquisition"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return blueprint
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class OrderHistogramResource(ContentNegotiatedMethodView):
|
|
38
|
+
"""Order stats resource."""
|
|
39
|
+
|
|
40
|
+
view_name = "order_histogram"
|
|
41
|
+
|
|
42
|
+
def __init__(self, serializers, ctx, *args, **kwargs):
|
|
43
|
+
"""Constructor."""
|
|
44
|
+
super().__init__(serializers, *args, **kwargs)
|
|
45
|
+
for key, value in ctx.items():
|
|
46
|
+
setattr(self, key, value)
|
|
47
|
+
|
|
48
|
+
@need_permissions("stats-orders")
|
|
49
|
+
def get(self, **kwargs):
|
|
50
|
+
"""Get order statistics."""
|
|
51
|
+
|
|
52
|
+
order_date_fields = [
|
|
53
|
+
"order_date",
|
|
54
|
+
"expected_delivery_date",
|
|
55
|
+
"received_date",
|
|
56
|
+
"_created",
|
|
57
|
+
"_updated",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
schema = HistogramParamsSchema(order_date_fields)
|
|
61
|
+
try:
|
|
62
|
+
parsed_args = schema.load(request.args.to_dict())
|
|
63
|
+
except ValidationError as e:
|
|
64
|
+
raise InvalidParameterError(description=e.messages) from e
|
|
65
|
+
|
|
66
|
+
# Construct search to allow for filtering with the q parameter
|
|
67
|
+
search_cls = current_ils_acq.order_search_cls
|
|
68
|
+
search = search_cls()
|
|
69
|
+
search, _ = default_search_factory(self, search)
|
|
70
|
+
|
|
71
|
+
aggregation_buckets = get_record_statistics(
|
|
72
|
+
order_date_fields,
|
|
73
|
+
search,
|
|
74
|
+
parsed_args["group_by"],
|
|
75
|
+
parsed_args["metrics"],
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
response = {
|
|
79
|
+
"buckets": aggregation_buckets,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return self.make_response(response, 200)
|
|
@@ -164,6 +164,8 @@ def index_stats_fields_for_loan(loan_dict):
|
|
|
164
164
|
)
|
|
165
165
|
|
|
166
166
|
|
|
167
|
+
# Make use of the `extra_data` property as loans are part of `invenio-circulation`,
|
|
168
|
+
# which do not expose the `stats` property directly
|
|
167
169
|
if not "extra_data" in loan_dict:
|
|
168
170
|
loan_dict["extra_data"] = {}
|
|
169
171
|
loan_dict["extra_data"]["stats"] = stats
|
|
@@ -7,12 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
"""APIs for ILS circulation statistics."""
|
|
9
9
|
|
|
10
|
-
from invenio_search.engine import dsl
|
|
11
|
-
|
|
12
10
|
from invenio_app_ils.circulation.search import get_most_loaned_documents
|
|
13
|
-
from invenio_app_ils.circulation.stats.schemas import (
|
|
14
|
-
_OS_NATIVE_AGGREGATE_FUNCTION_TYPES,
|
|
15
|
-
)
|
|
16
11
|
from invenio_app_ils.proxies import current_app_ils
|
|
17
12
|
|
|
18
13
|
|
|
@@ -54,98 +49,3 @@ def fetch_most_loaned_documents(from_date, to_date, bucket_size):
|
|
|
54
49
|
)
|
|
55
50
|
|
|
56
51
|
return res
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def _generate_metric_agg_field_name(metric):
|
|
60
|
-
"""Return the aggregation name used for a metric.
|
|
61
|
-
|
|
62
|
-
:param metric: Must include 'field' and 'aggregation' keys.
|
|
63
|
-
:returns: The aggregation field name in the form '<aggregation>_<field>'.
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
return f"{metric['aggregation']}__{metric['field']}"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def get_loan_statistics(date_fields, search, requested_group_by, requested_metrics):
|
|
70
|
-
"""Aggregate loan statistics for requested metrics.
|
|
71
|
-
|
|
72
|
-
:param date_fields: List of date fields for the record type.
|
|
73
|
-
Date fields require different handling when using them to group by.
|
|
74
|
-
:param search: The base search object to apply aggregations on
|
|
75
|
-
:param requested_group_by: List of group dictionaries with 'field' and optional 'interval' keys.
|
|
76
|
-
Example: [{"field": "start_date", "interval": "monthly"}, {"field": "state"}]
|
|
77
|
-
:param requested_metrics: List of metric dictionaries with 'field' and 'aggregation' keys.
|
|
78
|
-
Example: [{"field": "loan_duration", "aggregation": "avg"}]
|
|
79
|
-
:returns: OpenSearch aggregation results with multi-terms histogram and optional metrics
|
|
80
|
-
"""
|
|
81
|
-
|
|
82
|
-
# Build composite aggregation
|
|
83
|
-
sources = []
|
|
84
|
-
for grouping in requested_group_by:
|
|
85
|
-
grouping_field = grouping["field"]
|
|
86
|
-
|
|
87
|
-
if grouping_field in date_fields:
|
|
88
|
-
sources.append(
|
|
89
|
-
{
|
|
90
|
-
grouping_field: {
|
|
91
|
-
"date_histogram": {
|
|
92
|
-
"field": grouping_field,
|
|
93
|
-
"calendar_interval": grouping["interval"],
|
|
94
|
-
"format": "yyyy-MM-dd",
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
else:
|
|
100
|
-
sources.append({grouping_field: {"terms": {"field": grouping_field}}})
|
|
101
|
-
|
|
102
|
-
composite_agg = dsl.A("composite", sources=sources, size=1000)
|
|
103
|
-
|
|
104
|
-
for metric in requested_metrics:
|
|
105
|
-
agg_name = _generate_metric_agg_field_name(metric)
|
|
106
|
-
|
|
107
|
-
grouping_field = metric["field"]
|
|
108
|
-
agg_type = metric["aggregation"]
|
|
109
|
-
field_config = {"field": grouping_field}
|
|
110
|
-
if agg_type in _OS_NATIVE_AGGREGATE_FUNCTION_TYPES:
|
|
111
|
-
composite_agg = composite_agg.metric(
|
|
112
|
-
agg_name, dsl.A(agg_type, **field_config)
|
|
113
|
-
)
|
|
114
|
-
elif agg_type == "median":
|
|
115
|
-
composite_agg = composite_agg.metric(
|
|
116
|
-
agg_name, dsl.A("percentiles", percents=[50], **field_config)
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
search.aggs.bucket("loan_aggregations", composite_agg)
|
|
120
|
-
|
|
121
|
-
# Only retrieve aggregation results
|
|
122
|
-
search = search[:0]
|
|
123
|
-
result = search.execute()
|
|
124
|
-
|
|
125
|
-
# Parse aggregation results
|
|
126
|
-
buckets = []
|
|
127
|
-
if hasattr(result.aggregations, "loan_aggregations"):
|
|
128
|
-
for bucket in result.aggregations.loan_aggregations.buckets:
|
|
129
|
-
metrics_data = {}
|
|
130
|
-
for metric in requested_metrics:
|
|
131
|
-
agg_name = _generate_metric_agg_field_name(metric)
|
|
132
|
-
|
|
133
|
-
if hasattr(bucket, agg_name):
|
|
134
|
-
agg_result = getattr(bucket, agg_name)
|
|
135
|
-
agg_type = metric["aggregation"]
|
|
136
|
-
|
|
137
|
-
if agg_type in _OS_NATIVE_AGGREGATE_FUNCTION_TYPES:
|
|
138
|
-
metrics_data[agg_name] = agg_result.value
|
|
139
|
-
elif agg_type == "median":
|
|
140
|
-
median_value = agg_result.values.get("50.0")
|
|
141
|
-
metrics_data[agg_name] = median_value
|
|
142
|
-
|
|
143
|
-
bucket_data = {
|
|
144
|
-
"key": bucket.key.to_dict(),
|
|
145
|
-
"doc_count": bucket.doc_count,
|
|
146
|
-
"metrics": metrics_data,
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
buckets.append(bucket_data)
|
|
150
|
-
|
|
151
|
-
return buckets
|
|
@@ -18,17 +18,17 @@ from invenio_records_rest.utils import obj_or_import_string
|
|
|
18
18
|
from invenio_rest import ContentNegotiatedMethodView
|
|
19
19
|
from marshmallow.exceptions import ValidationError
|
|
20
20
|
|
|
21
|
-
from invenio_app_ils.circulation.stats.api import
|
|
22
|
-
fetch_most_loaned_documents,
|
|
23
|
-
get_loan_statistics,
|
|
24
|
-
)
|
|
25
|
-
from invenio_app_ils.circulation.stats.schemas import HistogramParamsSchema
|
|
26
|
-
from invenio_app_ils.circulation.stats.serializers import loan_stats_response
|
|
21
|
+
from invenio_app_ils.circulation.stats.api import fetch_most_loaned_documents
|
|
27
22
|
from invenio_app_ils.circulation.views import IlsCirculationResource
|
|
28
23
|
from invenio_app_ils.config import RECORDS_REST_MAX_RESULT_WINDOW
|
|
29
24
|
from invenio_app_ils.documents.api import DOCUMENT_PID_FETCHER, DOCUMENT_PID_TYPE
|
|
30
25
|
from invenio_app_ils.errors import InvalidParameterError
|
|
31
26
|
from invenio_app_ils.permissions import need_permissions
|
|
27
|
+
from invenio_app_ils.stats.histogram import (
|
|
28
|
+
HistogramParamsSchema,
|
|
29
|
+
create_histogram_view,
|
|
30
|
+
get_record_statistics,
|
|
31
|
+
)
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def create_most_loaned_documents_view(blueprint, app):
|
|
@@ -56,33 +56,18 @@ def create_most_loaned_documents_view(blueprint, app):
|
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
def create_loan_histogram_view(blueprint, app):
|
|
60
|
-
"""Add url rule for loan histogram view."""
|
|
61
|
-
|
|
62
|
-
endpoints = app.config.get("RECORDS_REST_ENDPOINTS")
|
|
63
|
-
document_endpoint = endpoints.get(CIRCULATION_LOAN_PID_TYPE)
|
|
64
|
-
default_media_type = document_endpoint.get("default_media_type")
|
|
65
|
-
loan_stats_serializers = {"application/json": loan_stats_response}
|
|
66
|
-
|
|
67
|
-
loan_stats_view_func = LoanHistogramResource.as_view(
|
|
68
|
-
LoanHistogramResource.view_name,
|
|
69
|
-
serializers=loan_stats_serializers,
|
|
70
|
-
default_media_type=default_media_type,
|
|
71
|
-
ctx={},
|
|
72
|
-
)
|
|
73
|
-
blueprint.add_url_rule(
|
|
74
|
-
"/circulation/loans/stats",
|
|
75
|
-
view_func=loan_stats_view_func,
|
|
76
|
-
methods=["GET"],
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
|
|
80
59
|
def create_circulation_stats_blueprint(app):
|
|
81
60
|
"""Add statistics views to the blueprint."""
|
|
82
61
|
blueprint = Blueprint("invenio_app_ils_circulation_stats", __name__, url_prefix="")
|
|
83
62
|
|
|
84
63
|
create_most_loaned_documents_view(blueprint, app)
|
|
85
|
-
|
|
64
|
+
create_histogram_view(
|
|
65
|
+
blueprint,
|
|
66
|
+
app,
|
|
67
|
+
CIRCULATION_LOAN_PID_TYPE,
|
|
68
|
+
LoanHistogramResource,
|
|
69
|
+
"/circulation/loans",
|
|
70
|
+
)
|
|
86
71
|
|
|
87
72
|
return blueprint
|
|
88
73
|
|
|
@@ -190,7 +175,7 @@ class LoanHistogramResource(IlsCirculationResource):
|
|
|
190
175
|
search = search_cls()
|
|
191
176
|
search, _ = default_search_factory(self, search)
|
|
192
177
|
|
|
193
|
-
aggregation_buckets =
|
|
178
|
+
aggregation_buckets = get_record_statistics(
|
|
194
179
|
loan_date_fields,
|
|
195
180
|
search,
|
|
196
181
|
parsed_args["group_by"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2019 CERN.
|
|
3
|
+
# Copyright (C) 2019-2025 CERN.
|
|
4
4
|
#
|
|
5
5
|
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
6
|
# under the terms of the MIT License; see LICENSE file for more details.
|
|
@@ -12,28 +12,102 @@ from datetime import datetime
|
|
|
12
12
|
from celery import shared_task
|
|
13
13
|
from flask import current_app
|
|
14
14
|
from invenio_indexer.api import RecordIndexer
|
|
15
|
+
from invenio_search import current_search_client
|
|
15
16
|
|
|
17
|
+
from invenio_app_ils.acquisition.api import ORDER_PID_TYPE
|
|
18
|
+
from invenio_app_ils.acquisition.proxies import current_ils_acq
|
|
16
19
|
from invenio_app_ils.documents.api import DOCUMENT_PID_TYPE
|
|
20
|
+
from invenio_app_ils.ill.api import BORROWING_REQUEST_PID_TYPE
|
|
21
|
+
from invenio_app_ils.ill.proxies import current_ils_ill
|
|
17
22
|
from invenio_app_ils.indexer import ReferencedRecordsIndexer
|
|
18
23
|
from invenio_app_ils.proxies import current_app_ils
|
|
19
24
|
|
|
20
25
|
from .api import DOCUMENT_REQUEST_PID_TYPE
|
|
21
26
|
|
|
22
27
|
|
|
28
|
+
def index_stats_fields_for_document_request(doc_request_dict):
|
|
29
|
+
"""Indexer hook to modify the document request record dict before indexing."""
|
|
30
|
+
|
|
31
|
+
# This is done through the hook and not through an indexer class,
|
|
32
|
+
# as we need access to the `_created` field.
|
|
33
|
+
|
|
34
|
+
physical_item_provider = doc_request_dict.get("physical_item_provider")
|
|
35
|
+
if not physical_item_provider:
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
provider_pid = physical_item_provider["pid"]
|
|
39
|
+
provider_pid_type = physical_item_provider["pid_type"]
|
|
40
|
+
|
|
41
|
+
doc_request_created = doc_request_dict["_created"]
|
|
42
|
+
doc_request_creation_date = datetime.fromisoformat(doc_request_created).date()
|
|
43
|
+
|
|
44
|
+
provider_creation_date = None
|
|
45
|
+
|
|
46
|
+
if provider_pid_type == ORDER_PID_TYPE:
|
|
47
|
+
order_search_cls = current_ils_acq.order_search_cls
|
|
48
|
+
search_body = {
|
|
49
|
+
"query": {"term": {"pid": provider_pid}},
|
|
50
|
+
"size": 1,
|
|
51
|
+
}
|
|
52
|
+
search_result = current_search_client.search(
|
|
53
|
+
index=order_search_cls.Meta.index, body=search_body
|
|
54
|
+
)
|
|
55
|
+
hits = search_result["hits"]["hits"]
|
|
56
|
+
if len(hits) > 0:
|
|
57
|
+
order = hits[0]["_source"]
|
|
58
|
+
provider_creation_date = datetime.fromisoformat(order["_created"]).date()
|
|
59
|
+
|
|
60
|
+
elif provider_pid_type == BORROWING_REQUEST_PID_TYPE:
|
|
61
|
+
brw_req_search_cls = current_ils_ill.borrowing_request_search_cls
|
|
62
|
+
search_body = {
|
|
63
|
+
"query": {"term": {"pid": provider_pid}},
|
|
64
|
+
"size": 1,
|
|
65
|
+
}
|
|
66
|
+
search_result = current_search_client.search(
|
|
67
|
+
index=brw_req_search_cls.Meta.index, body=search_body
|
|
68
|
+
)
|
|
69
|
+
hits = search_result["hits"]["hits"]
|
|
70
|
+
if len(hits) > 0:
|
|
71
|
+
brw_req = hits[0]["_source"]
|
|
72
|
+
provider_creation_date = datetime.fromisoformat(brw_req["_created"]).date()
|
|
73
|
+
stats = {}
|
|
74
|
+
if provider_creation_date:
|
|
75
|
+
provider_creation_delay = (
|
|
76
|
+
provider_creation_date - doc_request_creation_date
|
|
77
|
+
).days
|
|
78
|
+
stats["provider_creation_delay"] = (
|
|
79
|
+
provider_creation_delay if provider_creation_delay >= 0 else None
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
if stats:
|
|
83
|
+
doc_request_dict["stats"] = stats
|
|
84
|
+
|
|
85
|
+
|
|
23
86
|
@shared_task(ignore_result=True)
|
|
24
87
|
def index_referenced_records(docreq):
|
|
25
88
|
"""Index referenced records."""
|
|
26
89
|
indexer = ReferencedRecordsIndexer()
|
|
27
90
|
indexed = dict(pid_type=DOCUMENT_REQUEST_PID_TYPE, record=docreq)
|
|
28
91
|
|
|
92
|
+
referenced = []
|
|
93
|
+
|
|
29
94
|
# fetch and index the document
|
|
30
95
|
document_pid = docreq.get("document_pid")
|
|
31
|
-
referenced = []
|
|
32
96
|
if document_pid:
|
|
33
97
|
document_cls = current_app_ils.document_record_cls
|
|
34
98
|
document = document_cls.get_record_by_pid(document_pid)
|
|
35
99
|
referenced.append(dict(pid_type=DOCUMENT_PID_TYPE, record=document))
|
|
36
100
|
|
|
101
|
+
# fetch and index the related order (physical_item_provider)
|
|
102
|
+
physical_item_provider = docreq.get("physical_item_provider")
|
|
103
|
+
if physical_item_provider:
|
|
104
|
+
provider_pid = physical_item_provider.get("pid")
|
|
105
|
+
provider_pid_type = physical_item_provider.get("pid_type")
|
|
106
|
+
if provider_pid and provider_pid_type == ORDER_PID_TYPE:
|
|
107
|
+
order_cls = current_ils_acq.order_record_cls
|
|
108
|
+
order = order_cls.get_record_by_pid(provider_pid)
|
|
109
|
+
referenced.append(dict(pid_type=ORDER_PID_TYPE, record=order))
|
|
110
|
+
|
|
37
111
|
indexer.index(indexed, referenced)
|
|
38
112
|
|
|
39
113
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Invenio App ILS document requests stats module."""
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Invenio App ILS document requests stats views."""
|
|
9
|
+
|
|
10
|
+
from flask import Blueprint, request
|
|
11
|
+
from invenio_records_rest.query import default_search_factory
|
|
12
|
+
from invenio_rest import ContentNegotiatedMethodView
|
|
13
|
+
from marshmallow.exceptions import ValidationError
|
|
14
|
+
|
|
15
|
+
from invenio_app_ils.document_requests.api import DOCUMENT_REQUEST_PID_TYPE
|
|
16
|
+
from invenio_app_ils.errors import InvalidParameterError
|
|
17
|
+
from invenio_app_ils.permissions import need_permissions
|
|
18
|
+
from invenio_app_ils.proxies import current_app_ils
|
|
19
|
+
from invenio_app_ils.stats.histogram import (
|
|
20
|
+
HistogramParamsSchema,
|
|
21
|
+
create_histogram_view,
|
|
22
|
+
get_record_statistics,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def create_document_request_stats_blueprint(app):
|
|
27
|
+
"""Add statistics views to the blueprint."""
|
|
28
|
+
blueprint = Blueprint(
|
|
29
|
+
"invenio_app_ils_document_request_stats", __name__, url_prefix=""
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
create_histogram_view(
|
|
33
|
+
blueprint,
|
|
34
|
+
app,
|
|
35
|
+
DOCUMENT_REQUEST_PID_TYPE,
|
|
36
|
+
DocumentRequestHistogramResource,
|
|
37
|
+
"/document-requests",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return blueprint
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class DocumentRequestHistogramResource(ContentNegotiatedMethodView):
|
|
44
|
+
"""Document request stats resource."""
|
|
45
|
+
|
|
46
|
+
view_name = "document_request_histogram"
|
|
47
|
+
|
|
48
|
+
def __init__(self, serializers, ctx, *args, **kwargs):
|
|
49
|
+
"""Constructor."""
|
|
50
|
+
super().__init__(serializers, *args, **kwargs)
|
|
51
|
+
for key, value in ctx.items():
|
|
52
|
+
setattr(self, key, value)
|
|
53
|
+
|
|
54
|
+
@need_permissions("stats-document-requests")
|
|
55
|
+
def get(self, **kwargs):
|
|
56
|
+
"""Get document request statistics."""
|
|
57
|
+
|
|
58
|
+
document_request_date_fields = [
|
|
59
|
+
"_created",
|
|
60
|
+
"_updated",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
schema = HistogramParamsSchema(document_request_date_fields)
|
|
64
|
+
try:
|
|
65
|
+
parsed_args = schema.load(request.args.to_dict())
|
|
66
|
+
except ValidationError as e:
|
|
67
|
+
raise InvalidParameterError(description=e.messages) from e
|
|
68
|
+
|
|
69
|
+
# Construct search to allow for filtering with the q parameter
|
|
70
|
+
search_cls = current_app_ils.document_request_search_cls
|
|
71
|
+
search = search_cls()
|
|
72
|
+
search, _ = default_search_factory(self, search)
|
|
73
|
+
|
|
74
|
+
aggregation_buckets = get_record_statistics(
|
|
75
|
+
document_request_date_fields,
|
|
76
|
+
search,
|
|
77
|
+
parsed_args["group_by"],
|
|
78
|
+
parsed_args["metrics"],
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
response = {
|
|
82
|
+
"buckets": aggregation_buckets,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return self.make_response(response, 200)
|
invenio_app_ils/ext.py
CHANGED
|
@@ -20,12 +20,14 @@ from invenio_app_ils.records.metadata_extensions import (
|
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
from .circulation import config as circulation_config
|
|
23
|
+
from .acquisition.indexer import index_stats_fields_for_order
|
|
23
24
|
from .circulation.indexer import (
|
|
24
25
|
index_extra_fields_for_loan,
|
|
25
26
|
index_stats_fields_for_loan,
|
|
26
27
|
)
|
|
27
28
|
from .circulation.receivers import register_circulation_signals
|
|
28
29
|
from .document_requests.api import DOCUMENT_REQUEST_PID_TYPE
|
|
30
|
+
from .document_requests.indexer import index_stats_fields_for_document_request
|
|
29
31
|
from .documents.api import DOCUMENT_PID_TYPE
|
|
30
32
|
from .eitems.api import EITEM_PID_TYPE
|
|
31
33
|
from .files.receivers import register_files_signals
|
|
@@ -224,6 +226,8 @@ class InvenioAppIls(object):
|
|
|
224
226
|
self.init_app(app)
|
|
225
227
|
self.init_metadata_extensions(app)
|
|
226
228
|
self.init_loan_indexer_hook(app)
|
|
229
|
+
self.init_order_indexer_hook(app)
|
|
230
|
+
self.init_document_request_indexer_hook(app)
|
|
227
231
|
|
|
228
232
|
def init_app(self, app):
|
|
229
233
|
"""Flask application initialization."""
|
|
@@ -278,6 +282,24 @@ class InvenioAppIls(object):
|
|
|
278
282
|
index="{0}s-{0}-v1.0.0".format("loan"),
|
|
279
283
|
)
|
|
280
284
|
|
|
285
|
+
def init_order_indexer_hook(self, app):
|
|
286
|
+
"""Custom order indexer hook init."""
|
|
287
|
+
before_record_index.dynamic_connect(
|
|
288
|
+
before_order_index_hook,
|
|
289
|
+
sender=app,
|
|
290
|
+
weak=False,
|
|
291
|
+
index="acq_orders-order-v1.0.0",
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
def init_document_request_indexer_hook(self, app):
|
|
295
|
+
"""Custom document request indexer hook init."""
|
|
296
|
+
before_record_index.dynamic_connect(
|
|
297
|
+
before_document_request_index_hook,
|
|
298
|
+
sender=app,
|
|
299
|
+
weak=False,
|
|
300
|
+
index="document_requests-document_request-v1.0.0",
|
|
301
|
+
)
|
|
302
|
+
|
|
281
303
|
def update_config_records_rest(self, app):
|
|
282
304
|
"""Merge overridden circ records rest into global records rest."""
|
|
283
305
|
for k in dir(circulation_config):
|
|
@@ -332,3 +354,30 @@ def before_loan_index_hook(sender, json=None, record=None, index=None, **kwargs)
|
|
|
332
354
|
index_extra_fields_for_loan(json)
|
|
333
355
|
if current_app.config["ILS_EXTEND_INDICES_WITH_STATS_ENABLED"]:
|
|
334
356
|
index_stats_fields_for_loan(json)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def before_order_index_hook(sender, json=None, record=None, index=None, **kwargs):
|
|
360
|
+
"""Hook to transform order record before ES indexing.
|
|
361
|
+
|
|
362
|
+
:param sender: The entity sending the signal.
|
|
363
|
+
:param json: The dumped Record dict which will be indexed.
|
|
364
|
+
:param record: The corresponding Record object.
|
|
365
|
+
:param index: The index in which the json will be indexed.
|
|
366
|
+
:param kwargs: Any other parameters.
|
|
367
|
+
"""
|
|
368
|
+
if current_app.config["ILS_EXTEND_INDICES_WITH_STATS_ENABLED"]:
|
|
369
|
+
index_stats_fields_for_order(json)
|
|
370
|
+
|
|
371
|
+
def before_document_request_index_hook(
|
|
372
|
+
sender, json=None, record=None, index=None, **kwargs
|
|
373
|
+
):
|
|
374
|
+
"""Hook to transform document request record before ES indexing.
|
|
375
|
+
|
|
376
|
+
:param sender: The entity sending the signal.
|
|
377
|
+
:param json: The dumped Record dict which will be indexed.
|
|
378
|
+
:param record: The corresponding Record object.
|
|
379
|
+
:param index: The index in which the json will be indexed.
|
|
380
|
+
:param kwargs: Any other parameters.
|
|
381
|
+
"""
|
|
382
|
+
if current_app.config["ILS_EXTEND_INDICES_WITH_STATS_ENABLED"]:
|
|
383
|
+
index_stats_fields_for_document_request(json)
|
invenio_app_ils/permissions.py
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Invenio App ILS histogram statistics."""
|
|
9
|
+
|
|
10
|
+
from invenio_app_ils.stats.histogram.api import get_record_statistics
|
|
11
|
+
from invenio_app_ils.stats.histogram.schemas import HistogramParamsSchema
|
|
12
|
+
from invenio_app_ils.stats.histogram.views import create_histogram_view
|
|
13
|
+
|
|
14
|
+
__all__ = (
|
|
15
|
+
"get_record_statistics",
|
|
16
|
+
"HistogramParamsSchema",
|
|
17
|
+
"create_histogram_view",
|
|
18
|
+
)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2019-2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""APIs for ILS histogram statistics."""
|
|
9
|
+
|
|
10
|
+
from invenio_search.engine import dsl
|
|
11
|
+
|
|
12
|
+
from invenio_app_ils.stats.histogram.schemas import (
|
|
13
|
+
_OS_NATIVE_AGGREGATE_FUNCTION_TYPES,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _generate_metric_agg_field_name(metric):
|
|
18
|
+
"""Return the aggregation name used for a metric.
|
|
19
|
+
|
|
20
|
+
:param metric: Must include 'field' and 'aggregation' keys.
|
|
21
|
+
:returns: The aggregation field name in the form '<aggregation>_<field>'.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
return f"{metric['aggregation']}__{metric['field']}"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_record_statistics(date_fields, search, requested_group_by, requested_metrics):
|
|
28
|
+
"""Aggregate record statistics for requested metrics.
|
|
29
|
+
|
|
30
|
+
:param date_fields: List of date fields for the record type.
|
|
31
|
+
Date fields require different handling when using them to group by.
|
|
32
|
+
:param search: The base search object to apply aggregations on.
|
|
33
|
+
:param requested_group_by: List of group dictionaries with 'field' and optional 'interval' keys.
|
|
34
|
+
Example: [{"field": "start_date", "interval": "monthly"}, {"field": "state"}]
|
|
35
|
+
:param requested_metrics: List of metric dictionaries with 'field' and 'aggregation' keys.
|
|
36
|
+
Example: [{"field": "loan_duration", "aggregation": "avg"}]
|
|
37
|
+
:returns: OpenSearch aggregation results with multi-terms histogram and optional metrics
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
# Build composite aggregation
|
|
41
|
+
sources = []
|
|
42
|
+
for grouping in requested_group_by:
|
|
43
|
+
grouping_field = grouping["field"]
|
|
44
|
+
|
|
45
|
+
if grouping_field in date_fields:
|
|
46
|
+
sources.append(
|
|
47
|
+
{
|
|
48
|
+
grouping_field: {
|
|
49
|
+
"date_histogram": {
|
|
50
|
+
"field": grouping_field,
|
|
51
|
+
"calendar_interval": grouping["interval"],
|
|
52
|
+
"format": "yyyy-MM-dd",
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
sources.append({grouping_field: {"terms": {"field": grouping_field}}})
|
|
59
|
+
|
|
60
|
+
composite_agg = dsl.A("composite", sources=sources, size=1000)
|
|
61
|
+
|
|
62
|
+
for metric in requested_metrics:
|
|
63
|
+
agg_name = _generate_metric_agg_field_name(metric)
|
|
64
|
+
|
|
65
|
+
grouping_field = metric["field"]
|
|
66
|
+
agg_type = metric["aggregation"]
|
|
67
|
+
field_config = {"field": grouping_field}
|
|
68
|
+
if agg_type in _OS_NATIVE_AGGREGATE_FUNCTION_TYPES:
|
|
69
|
+
composite_agg = composite_agg.metric(
|
|
70
|
+
agg_name, dsl.A(agg_type, **field_config)
|
|
71
|
+
)
|
|
72
|
+
elif agg_type == "median":
|
|
73
|
+
composite_agg = composite_agg.metric(
|
|
74
|
+
agg_name, dsl.A("percentiles", percents=[50], **field_config)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
search.aggs.bucket("aggregations", composite_agg)
|
|
78
|
+
|
|
79
|
+
# Only retrieve aggregation results
|
|
80
|
+
search = search[:0]
|
|
81
|
+
result = search.execute()
|
|
82
|
+
|
|
83
|
+
# Parse aggregation results
|
|
84
|
+
buckets = []
|
|
85
|
+
if hasattr(result.aggregations, "aggregations"):
|
|
86
|
+
for bucket in getattr(result.aggregations, "aggregations").buckets:
|
|
87
|
+
metrics_data = {}
|
|
88
|
+
for metric in requested_metrics:
|
|
89
|
+
agg_name = _generate_metric_agg_field_name(metric)
|
|
90
|
+
|
|
91
|
+
if hasattr(bucket, agg_name):
|
|
92
|
+
agg_result = getattr(bucket, agg_name)
|
|
93
|
+
agg_type = metric["aggregation"]
|
|
94
|
+
|
|
95
|
+
if agg_type in _OS_NATIVE_AGGREGATE_FUNCTION_TYPES:
|
|
96
|
+
metrics_data[agg_name] = agg_result.value
|
|
97
|
+
elif agg_type == "median":
|
|
98
|
+
median_value = agg_result.values.get("50.0")
|
|
99
|
+
metrics_data[agg_name] = median_value
|
|
100
|
+
|
|
101
|
+
bucket_data = {
|
|
102
|
+
"key": bucket.key.to_dict(),
|
|
103
|
+
"doc_count": bucket.doc_count,
|
|
104
|
+
"metrics": metrics_data,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
buckets.append(bucket_data)
|
|
108
|
+
|
|
109
|
+
return buckets
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
6
|
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
7
|
|
|
8
|
-
"""Marshmallow schemas for
|
|
8
|
+
"""Marshmallow schemas for histogram statistics validation."""
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
11
|
import re
|
|
@@ -19,7 +19,6 @@ from marshmallow import (
|
|
|
19
19
|
validates_schema,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
from invenio_app_ils.errors import InvalidParameterError
|
|
23
22
|
|
|
24
23
|
_OS_VALID_FIELD_NAME_PATTERN = re.compile(r"^[A-Za-z0-9_.]+$")
|
|
25
24
|
_OS_NATIVE_AGGREGATE_FUNCTION_TYPES = {"avg", "sum", "min", "max"}
|
|
@@ -27,35 +26,18 @@ _VALID_AGGREGATE_FUNCTION_TYPES = _OS_NATIVE_AGGREGATE_FUNCTION_TYPES.union({"me
|
|
|
27
26
|
_VALID_DATE_INTERVALS = {"1d", "1w", "1M", "1q", "1y"}
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
"""
|
|
29
|
+
class SecureSearchFieldNameField(fields.String):
|
|
30
|
+
"""Field that validates field names for search to prevent injection attacks."""
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if not _OS_VALID_FIELD_NAME_PATTERN.match(field_name):
|
|
37
|
-
raise InvalidParameterError(
|
|
38
|
-
description=(
|
|
39
|
-
f"Invalid field name '{field_name}'. "
|
|
40
|
-
"Field names may contain only alphanumeric characters, underscores, "
|
|
41
|
-
"and dots."
|
|
42
|
-
)
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class SecureFieldNameField(fields.String):
|
|
47
|
-
"""Marshmallow field that validates field names to prevent injection attacks."""
|
|
48
|
-
|
|
49
|
-
def _deserialize(self, value, attr, data, **kwargs):
|
|
50
|
-
"""Deserialize and validate field name."""
|
|
51
|
-
|
|
52
|
-
field_name = super()._deserialize(value, attr, data, **kwargs)
|
|
53
|
-
validate_field_name(field_name)
|
|
54
|
-
return field_name
|
|
32
|
+
def __init__(self, *args, **kwargs):
|
|
33
|
+
kwargs["validate"] = validate.Regexp(_OS_VALID_FIELD_NAME_PATTERN)
|
|
34
|
+
super().__init__(*args, **kwargs)
|
|
55
35
|
|
|
56
36
|
|
|
57
37
|
class GroupByItemSchema(Schema):
|
|
58
|
-
|
|
38
|
+
"""Schema for validating a single group_by item."""
|
|
39
|
+
|
|
40
|
+
field = SecureSearchFieldNameField(required=True)
|
|
59
41
|
interval = fields.String(validate=validate.OneOf(_VALID_DATE_INTERVALS))
|
|
60
42
|
|
|
61
43
|
@validates_schema
|
|
@@ -78,7 +60,7 @@ class GroupByItemSchema(Schema):
|
|
|
78
60
|
class MetricItemSchema(Schema):
|
|
79
61
|
"""Schema for validating a single metric item."""
|
|
80
62
|
|
|
81
|
-
field =
|
|
63
|
+
field = SecureSearchFieldNameField(required=True)
|
|
82
64
|
aggregation = fields.String(
|
|
83
65
|
required=True, validate=validate.OneOf(_VALID_AGGREGATE_FUNCTION_TYPES)
|
|
84
66
|
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Invenio.
|
|
4
|
+
# Copyright (C) 2025-2025 CERN.
|
|
5
|
+
#
|
|
6
|
+
# Invenio is free software; you can redistribute it and/or modify it
|
|
7
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
8
|
+
|
|
9
|
+
"""Invenio App ILS histogram stats serializers."""
|
|
10
|
+
|
|
11
|
+
from invenio_app_ils.stats.histogram.serializers.response import (
|
|
12
|
+
histogram_stats_responsify,
|
|
13
|
+
)
|
|
14
|
+
from invenio_app_ils.stats.histogram.serializers.schema import HistogramStatsV1
|
|
15
|
+
|
|
16
|
+
histogram_stats_response = histogram_stats_responsify(
|
|
17
|
+
HistogramStatsV1, "application/json"
|
|
18
|
+
)
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
# Invenio is free software; you can redistribute it and/or modify it
|
|
7
7
|
# under the terms of the MIT License; see LICENSE file for more details.
|
|
8
8
|
|
|
9
|
-
"""Invenio App ILS
|
|
9
|
+
"""Invenio App ILS histogram stats response serializers."""
|
|
10
10
|
|
|
11
11
|
import json
|
|
12
12
|
|
|
13
13
|
from flask import current_app
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
"""
|
|
16
|
+
def histogram_stats_responsify(schema_class, mimetype):
|
|
17
|
+
"""Histogram stats response serializer.
|
|
18
18
|
|
|
19
19
|
:param schema_class: Schema instance.
|
|
20
20
|
:param mimetype: MIME type of response.
|
|
@@ -22,7 +22,6 @@ def loan_stats_responsify(schema_class, mimetype):
|
|
|
22
22
|
|
|
23
23
|
def view(data, code=200, headers=None):
|
|
24
24
|
"""Generate the response object."""
|
|
25
|
-
# return jsonify(data), code
|
|
26
25
|
response_data = schema_class().dump(data)
|
|
27
26
|
|
|
28
27
|
response = current_app.response_class(
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# Invenio is free software; you can redistribute it and/or modify it
|
|
7
7
|
# under the terms of the MIT License; see LICENSE file for more details.
|
|
8
8
|
|
|
9
|
-
"""Invenio App ILS
|
|
9
|
+
"""Invenio App ILS histogram stats serializers schema."""
|
|
10
10
|
|
|
11
11
|
from marshmallow import Schema, fields
|
|
12
12
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2025 CERN.
|
|
4
|
+
#
|
|
5
|
+
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Invenio App ILS histogram stats views."""
|
|
9
|
+
|
|
10
|
+
from invenio_app_ils.stats.histogram.serializers import histogram_stats_response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def create_histogram_view(blueprint, app, pid_type, resource_cls, url_prefix):
|
|
14
|
+
"""Add url rule for histogram view."""
|
|
15
|
+
|
|
16
|
+
assert url_prefix.startswith("/"), "url_prefix must start with /"
|
|
17
|
+
assert not url_prefix.endswith("/"), "url_prefix must not end with /"
|
|
18
|
+
|
|
19
|
+
endpoints = app.config.get("RECORDS_REST_ENDPOINTS")
|
|
20
|
+
record_endpoint = endpoints.get(pid_type)
|
|
21
|
+
default_media_type = record_endpoint.get("default_media_type")
|
|
22
|
+
histogram_serializers = {"application/json": histogram_stats_response}
|
|
23
|
+
|
|
24
|
+
histogram_stats_view_func = resource_cls.as_view(
|
|
25
|
+
resource_cls.view_name,
|
|
26
|
+
serializers=histogram_serializers,
|
|
27
|
+
default_media_type=default_media_type,
|
|
28
|
+
ctx={},
|
|
29
|
+
)
|
|
30
|
+
blueprint.add_url_rule(
|
|
31
|
+
f"{url_prefix}/stats",
|
|
32
|
+
view_func=histogram_stats_view_func,
|
|
33
|
+
methods=["GET"],
|
|
34
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: invenio-app-ils
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.1.0
|
|
4
4
|
Summary: Invenio Integrated Library System.
|
|
5
5
|
Home-page: https://github.com/inveniosoftware/invenio-app-ils
|
|
6
6
|
Author: CERN
|
|
@@ -103,6 +103,13 @@ https://invenioils.docs.cern.ch
|
|
|
103
103
|
Changes
|
|
104
104
|
=======
|
|
105
105
|
|
|
106
|
+
Version 7.1.0 (released 2026-01-22)
|
|
107
|
+
|
|
108
|
+
- stats: add document request stats endpoint and extend document request index
|
|
109
|
+
- stats: fix Schema using deserialize to validate
|
|
110
|
+
- stats: add order stats endpoint and extend orders index
|
|
111
|
+
- stats: turn loan histogram endpoint into reusable component
|
|
112
|
+
|
|
106
113
|
Version 7.0.0 (released 2026-01-06)
|
|
107
114
|
|
|
108
115
|
- stats: generalize stat tracking loan extensions to track all transitions
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
invenio_app_ils/__init__.py,sha256=
|
|
1
|
+
invenio_app_ils/__init__.py,sha256=HsFoetzDRkXOmOwWa_1sSlb7gE8ZQ-eRwu3tLvLHt9w,285
|
|
2
2
|
invenio_app_ils/cli.py,sha256=GGXMuXUlO9i8S9fpBXwj5wfPcK8aYe0leSDB3V--7Bs,58609
|
|
3
3
|
invenio_app_ils/config.py,sha256=R70-ZkUXwWWKcQkt2KiIgZtP2cVt0zMPsIfULEhxZ94,47229
|
|
4
4
|
invenio_app_ils/errors.py,sha256=HB_iWj-aYxzTzzO6hWb66mUPZdqpWYHgmr2H2t3j3wU,13293
|
|
5
|
-
invenio_app_ils/ext.py,sha256=
|
|
5
|
+
invenio_app_ils/ext.py,sha256=nBKUkbkZ9VDOhwhXKjNq4gKSpixsaaCJqQmTJiHspiY,13613
|
|
6
6
|
invenio_app_ils/facets.py,sha256=x-ID7vL34zqbxJi7VC3EJSee13l_Jk0CfPZN3RHZrM8,4207
|
|
7
7
|
invenio_app_ils/fetchers.py,sha256=GY5A6BXaqMB9HKvJuTcio3JYoF15t6eqMo3yzQKTqac,520
|
|
8
8
|
invenio_app_ils/indexer.py,sha256=ngXRx2liufDzgsSIoCeusk6q0Y1uskQ3QiVLeAi3KRg,2212
|
|
9
9
|
invenio_app_ils/minters.py,sha256=8JW-45fL9Oy_13eZjlk8kL_12jJGZK59qbKlCeseQgA,537
|
|
10
|
-
invenio_app_ils/permissions.py,sha256=
|
|
10
|
+
invenio_app_ils/permissions.py,sha256=tzxW2oU4Xb8rqL4rZLKLqUaYHHT78YD9NoxIRJE5UL0,7814
|
|
11
11
|
invenio_app_ils/proxies.py,sha256=IGBwXQSOxpXHjD8PWFG1nqUm70xGAgzWT8Y0AKdCGiI,453
|
|
12
12
|
invenio_app_ils/search_permissions.py,sha256=cJWDgShgzXwxAtCtb7qXCIUfNSrQy_oe0zMuT0TzXgA,5073
|
|
13
13
|
invenio_app_ils/signals.py,sha256=KaN8yQUVq-2O2IKQQvPLtMjqp1S3AU1LYPlRyw9U8Pg,395
|
|
@@ -18,6 +18,7 @@ invenio_app_ils/acquisition/api.py,sha256=4WYKSw5aKg9KgMYIBuxlT9C7THybl6CfUnlTFz
|
|
|
18
18
|
invenio_app_ils/acquisition/config.py,sha256=GxroZ9_A9c0j5yfGqdQar2mMhlqQiM679E_R4-rpoBA,3602
|
|
19
19
|
invenio_app_ils/acquisition/errors.py,sha256=cUmGj3jYPhnBZFgeORTeKa554R93qDnrNUY9VEfBgFg,507
|
|
20
20
|
invenio_app_ils/acquisition/ext.py,sha256=AcMXLvowZkNSRdx-qw6JVqoO--XUI4Vcq609-heoGsI,3095
|
|
21
|
+
invenio_app_ils/acquisition/indexer.py,sha256=nVbiAH2z5DHxGSncS5Tb8du8yZXW0vlhf4oouEieBVY,2376
|
|
21
22
|
invenio_app_ils/acquisition/proxies.py,sha256=VUTcGAcyVPWQGuaGrdXA7Uz0GLyyWlzsgAtry14iuCA,461
|
|
22
23
|
invenio_app_ils/acquisition/search.py,sha256=upPzjLLUD9PwhmVS41K6vPhQNw_QizOY0g78x4uJPUg,2031
|
|
23
24
|
invenio_app_ils/acquisition/jsonresolvers/__init__.py,sha256=8Qvg1pp5IahIJu_gnvbhgCGBGpWNFTZbXbiJq4JObEw,246
|
|
@@ -30,18 +31,20 @@ invenio_app_ils/acquisition/mappings/__init__.py,sha256=4v-oXYmqpAAPcrIkHhpC1myK
|
|
|
30
31
|
invenio_app_ils/acquisition/mappings/os-v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
32
|
invenio_app_ils/acquisition/mappings/os-v1/acq_orders/order-v1.0.0.json,sha256=KMaSi0O-YsiTnA_dj4fkWiDvlNSAkm3dR5HfFnAJvUU,8155
|
|
32
33
|
invenio_app_ils/acquisition/mappings/os-v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
|
-
invenio_app_ils/acquisition/mappings/os-v2/acq_orders/order-v1.0.0.json,sha256=
|
|
34
|
+
invenio_app_ils/acquisition/mappings/os-v2/acq_orders/order-v1.0.0.json,sha256=aOsgHS3diHWBaf87-6W9oO93eefqK9YUyawDfFMbfqE,8256
|
|
34
35
|
invenio_app_ils/acquisition/mappings/v7/__init__.py,sha256=JvBjTv45pDy60DvPsjWoSR-4fxVlj_gGRVBOT7441RY,248
|
|
35
36
|
invenio_app_ils/acquisition/mappings/v7/acq_orders/order-v1.0.0.json,sha256=KMaSi0O-YsiTnA_dj4fkWiDvlNSAkm3dR5HfFnAJvUU,8155
|
|
36
37
|
invenio_app_ils/acquisition/schemas/__init__.py,sha256=HulLvvDz0W5owDGxVLIaastuZ4o6T5-MYGw0RPuY90g,233
|
|
37
38
|
invenio_app_ils/acquisition/schemas/acq_orders/order-v1.0.0.json,sha256=_Kd3oX_7gJJQSqSc2TxQulXletYu0wEeTdQKkXr7kLs,5688
|
|
39
|
+
invenio_app_ils/acquisition/stats/__init__.py,sha256=4046ZDfFZ5jhKJb7pxkogKB5HvkJnmlWe5Z-vqbSYHA,254
|
|
40
|
+
invenio_app_ils/acquisition/stats/views.py,sha256=ky8FbAYWi1GZ1jbHu_scvmFJkaPp01E3I6bm4cLPakk,2545
|
|
38
41
|
invenio_app_ils/assets/semantic-ui/less/theme.config,sha256=j2GQ2ulbymT0K-AEzHNOV1r_Fb9QAptMvK4vN04a1Ug,3017
|
|
39
42
|
invenio_app_ils/assets/semantic-ui/templates/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
43
|
invenio_app_ils/circulation/__init__.py,sha256=Gd0KAsGdhPdz0ACEQ9k8xSeOIxZr3xRK_FiE8U3RQWs,248
|
|
41
44
|
invenio_app_ils/circulation/api.py,sha256=jKty3IqTOK0XJdeXLlDqnZH2uhdVzd4xWuVphQe4YKw,14643
|
|
42
45
|
invenio_app_ils/circulation/config.py,sha256=pcB5JEjxXrieRRO-8RBUbxgf5dkhRGXXI2BvWfQUUCs,11433
|
|
43
46
|
invenio_app_ils/circulation/errors.py,sha256=R0VwfKbYyq02PPKxpKg5LCW86x5l6s9n8MV1m5c85gk,367
|
|
44
|
-
invenio_app_ils/circulation/indexer.py,sha256=
|
|
47
|
+
invenio_app_ils/circulation/indexer.py,sha256=CEAumqSq7ZYaOE0AIgIFijgfOinVd6yz6B5jFaMbF9M,6340
|
|
45
48
|
invenio_app_ils/circulation/receivers.py,sha256=Ux6KTNbII3DHBvCUS0gxqbi6tNbm76_kbcaHtK0BsB4,2488
|
|
46
49
|
invenio_app_ils/circulation/search.py,sha256=l9DAr9uoaF_JbfiiXVpAFKW3NLv9bgs7D-uDwtU-fv0,6105
|
|
47
50
|
invenio_app_ils/circulation/tasks.py,sha256=w4lpbQo78aDg_vgdzQoRVe1y1NjCKrz1xNlLl5RDgs0,1515
|
|
@@ -68,12 +71,8 @@ invenio_app_ils/circulation/serializers/custom_fields.py,sha256=EQnWMCLNgModn4Br
|
|
|
68
71
|
invenio_app_ils/circulation/serializers/json.py,sha256=x625dleVLyfZU1bAWuTfk1UvEGUlWuAYUAvec4qAFHo,1553
|
|
69
72
|
invenio_app_ils/circulation/serializers/response.py,sha256=xPmwnO-bHoaaL6KgCz6ayo2FBGBlJKmb4cH9JeOb9ls,1289
|
|
70
73
|
invenio_app_ils/circulation/stats/__init__.py,sha256=X_oDxvlDZRHxfjM1J-sBisDmn_45F0MptRbvyTTI3WA,247
|
|
71
|
-
invenio_app_ils/circulation/stats/api.py,sha256=
|
|
72
|
-
invenio_app_ils/circulation/stats/
|
|
73
|
-
invenio_app_ils/circulation/stats/views.py,sha256=o9w3MxgHaLPwT6FCaeQdtRV2L8KRPDGwNge63cs8ysQ,7356
|
|
74
|
-
invenio_app_ils/circulation/stats/serializers/__init__.py,sha256=gUOm8aLiRFTfdZH3DRPLAkygzh0WcWX6ZPod1lalEv0,490
|
|
75
|
-
invenio_app_ils/circulation/stats/serializers/response.py,sha256=Zj3BPq13Ot0RaVwdzlncqTVyLzOpuXNB8plSeopg9SQ,967
|
|
76
|
-
invenio_app_ils/circulation/stats/serializers/schema.py,sha256=FS9_C3QycWuuTmxXtGIpjXsWVSDVr01pEW-VcyQiqew,832
|
|
74
|
+
invenio_app_ils/circulation/stats/api.py,sha256=90mZL28b7LxlPRpfW7oyiLvvPrPiTiTO8EES3eIWCz0,1812
|
|
75
|
+
invenio_app_ils/circulation/stats/views.py,sha256=1RwpoGrlGp93aeWij7NA4Py3fgsNiRr6OfwOx1NvfHA,6704
|
|
77
76
|
invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/bulk_extend.html,sha256=rSYqCysrRnlKJTE1VjnigmPCCj5vHT0jsKzqgajHNRM,1616
|
|
78
77
|
invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/cancel.html,sha256=Rm51UHpxuQo5syVf2_KBEdpHvxVEdyIvFMo0e8vsZxw,725
|
|
79
78
|
invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/checkin.html,sha256=Bwud7JhRsBBb9gArBOtbw4CGJWIRHJVw4KMxOuyxlM0,545
|
|
@@ -98,7 +97,7 @@ invenio_app_ils/demo_data/documents.json,sha256=n0urrP68azieRMjgwGvKWoJSNXyTwpVx
|
|
|
98
97
|
invenio_app_ils/demo_data/items.json,sha256=J0IGbnIsFefgvGbgMWVCcvDIW5RJa48WoDPNBImUWKQ,1799
|
|
99
98
|
invenio_app_ils/document_requests/__init__.py,sha256=yPDfvJcGPy0dJ0f_hsJ5OQ5EcQ-WJODFPLjuWmSXSdU,237
|
|
100
99
|
invenio_app_ils/document_requests/api.py,sha256=OzBzMlhxt69wl7JTb0Pvj98UZSbv75dNpULst7IryDA,6707
|
|
101
|
-
invenio_app_ils/document_requests/indexer.py,sha256=
|
|
100
|
+
invenio_app_ils/document_requests/indexer.py,sha256=wpw3lTqTuwm2mu7-aCMRA_SqkdAYcZHVOxRNHbblfxA,4535
|
|
102
101
|
invenio_app_ils/document_requests/search.py,sha256=bi1ssTfhBcXmIN5U5TjHkzkMQR6YElXl3YfWNmP8u9g,1495
|
|
103
102
|
invenio_app_ils/document_requests/views.py,sha256=hT1A01mlnUaWIafGoyUReoikUf3pYm6H2GC5RG4wj9c,9544
|
|
104
103
|
invenio_app_ils/document_requests/jsonresolvers/__init__.py,sha256=isc0o6XFuTxHDndda1c-kCR-hep3xAYTI8KyZsjY9ts,255
|
|
@@ -114,7 +113,7 @@ invenio_app_ils/document_requests/mappings/__init__.py,sha256=zhVrec2bOyFtzNem8z
|
|
|
114
113
|
invenio_app_ils/document_requests/mappings/os-v1/__init__.py,sha256=h4RXf0yVWsRrOz_6no2OJRx4dy3_ppW7OxrNpVtufwo,262
|
|
115
114
|
invenio_app_ils/document_requests/mappings/os-v1/document_requests/document_request-v1.0.0.json,sha256=RyZX6X2vj30ncF5wYwKQAZihK7xD-TaK8wdsejX3rLw,4297
|
|
116
115
|
invenio_app_ils/document_requests/mappings/os-v2/__init__.py,sha256=h4RXf0yVWsRrOz_6no2OJRx4dy3_ppW7OxrNpVtufwo,262
|
|
117
|
-
invenio_app_ils/document_requests/mappings/os-v2/document_requests/document_request-v1.0.0.json,sha256=
|
|
116
|
+
invenio_app_ils/document_requests/mappings/os-v2/document_requests/document_request-v1.0.0.json,sha256=ebM_I4SBaflfnZ8tfJPk2HQaZDI0zDrVl2oGIscehAk,4398
|
|
118
117
|
invenio_app_ils/document_requests/mappings/v7/__init__.py,sha256=h4RXf0yVWsRrOz_6no2OJRx4dy3_ppW7OxrNpVtufwo,262
|
|
119
118
|
invenio_app_ils/document_requests/mappings/v7/document_requests/document_request-v1.0.0.json,sha256=RyZX6X2vj30ncF5wYwKQAZihK7xD-TaK8wdsejX3rLw,4297
|
|
120
119
|
invenio_app_ils/document_requests/notifications/__init__.py,sha256=K97db_cvtGJxWBuPXIaj3i19bsZkAcAdLoZ-e5Z7M80,256
|
|
@@ -122,6 +121,8 @@ invenio_app_ils/document_requests/notifications/api.py,sha256=ghwB0Vs_fMtsa203ZL
|
|
|
122
121
|
invenio_app_ils/document_requests/notifications/messages.py,sha256=DLMWlH9NAfo3JOvxfvXCbN59Pb0zkJUldYCp6l8AjIg,2574
|
|
123
122
|
invenio_app_ils/document_requests/schemas/__init__.py,sha256=wrBwDSD85k60icw_ML_oC7liOwLPK5x6beASsicMQZc,242
|
|
124
123
|
invenio_app_ils/document_requests/schemas/document_requests/document_request-v1.0.0.json,sha256=weq2-AeHOLwpWWl3G9GrJJWUSag0idxi3bTLonGic6g,3208
|
|
124
|
+
invenio_app_ils/document_requests/stats/__init__.py,sha256=wifhVGB7Cqdxnz30Tw0zX-DMv2TExfkvz7FSbUqoumU,260
|
|
125
|
+
invenio_app_ils/document_requests/stats/views.py,sha256=f6DzxTTJ9BUaRT11D9WL0mGmnklMwCuQgQNw-28VHG4,2645
|
|
125
126
|
invenio_app_ils/document_requests/templates/invenio_app_ils_document_requests/notifications/document_request_accept.html,sha256=vv3mSqvE755X7dhe69_hF5VprN83I0kWQt6BlDtn8uc,392
|
|
126
127
|
invenio_app_ils/document_requests/templates/invenio_app_ils_document_requests/notifications/document_request_decline_in_catalog.html,sha256=NBJPJxAzf7tUzCm-s5O0QzHTmxJGeZYGHkklRTGLMvs,523
|
|
127
128
|
invenio_app_ils/document_requests/templates/invenio_app_ils_document_requests/notifications/document_request_decline_not_found.html,sha256=cqHXkkyjOnFZRwcEv3jn9-nQAS12k4s8lTdmJpaj2wg,509
|
|
@@ -399,6 +400,13 @@ invenio_app_ils/stats/file_download/os-v2/__init__.py,sha256=T0kcRAoEecatActm6Mv
|
|
|
399
400
|
invenio_app_ils/stats/file_download/os-v2/file-download-v1.json,sha256=TAz_srZZ7BhBHiQTuac-3NhbD1OraAnUYW9ZsneYWj4,1444
|
|
400
401
|
invenio_app_ils/stats/file_download/v7/__init__.py,sha256=T0kcRAoEecatActm6MvVlAWbHIQ7xq8D2vCE59ShWTI,287
|
|
401
402
|
invenio_app_ils/stats/file_download/v7/file-download-v1.json,sha256=JOfqa0HYysRL1-OcnrG4Ohhv39eML5qKVXswN7OYfE4,1383
|
|
403
|
+
invenio_app_ils/stats/histogram/__init__.py,sha256=ZLKckMrKkV9rM_NPi_2xXiCR957rV1GxxEgyz9GkdtI,569
|
|
404
|
+
invenio_app_ils/stats/histogram/api.py,sha256=RG3WR0fZwLFgjuKOZGtSYuefoGWZoWKmFTbmoephApM,4006
|
|
405
|
+
invenio_app_ils/stats/histogram/schemas.py,sha256=LyA0u-EjO6xUnf_eCRqYkZal5l_tIBRk9UwJYZATXWg,3050
|
|
406
|
+
invenio_app_ils/stats/histogram/views.py,sha256=zr6DGO0allRF3tB1HwEcQRUvNqX5WdpOoiBFbbA_vLQ,1182
|
|
407
|
+
invenio_app_ils/stats/histogram/serializers/__init__.py,sha256=WPyi9aRve9QgCy-dZbhBbhJPGEZRZL5BmA9AHXEYluk,567
|
|
408
|
+
invenio_app_ils/stats/histogram/serializers/response.py,sha256=TmSMQnYrf9ETEfaYNppJbwE158G8oye5heEt5txgiqk,945
|
|
409
|
+
invenio_app_ils/stats/histogram/serializers/schema.py,sha256=EvDyeEvuik1da2ZMVxD_B1zTvPyu1iWFm1jLZ_zjL_M,837
|
|
402
410
|
invenio_app_ils/stats/templates/aggregations/__init__.py,sha256=u5NGrHHOqWBgFs2-igJenjaj33UGluHgkKYV2etwJ1E,242
|
|
403
411
|
invenio_app_ils/stats/templates/aggregations/ils_record_changes/__init__.py,sha256=Fae3O56C56coEeyOZqcW4Pr9p3anlR6C1MZidpF4ots,254
|
|
404
412
|
invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/__init__.py,sha256=Fae3O56C56coEeyOZqcW4Pr9p3anlR6C1MZidpF4ots,254
|
|
@@ -466,10 +474,10 @@ invenio_app_ils/vocabularies/sources/__init__.py,sha256=EMLoLQGiq9_qoZ4lKqO_J0u2
|
|
|
466
474
|
invenio_app_ils/vocabularies/sources/base.py,sha256=kmNg85cjrxqc8VErFP2SUtlyo1PnmzOBQgfoSpfTPh4,1418
|
|
467
475
|
invenio_app_ils/vocabularies/sources/json.py,sha256=KGLTJ4AX8zEDdkpi3v92oHGs-h2dUzHbNPSg99-j8o0,1021
|
|
468
476
|
invenio_app_ils/vocabularies/sources/opendefinition.py,sha256=9zbRXuTr0i5lVLt596oUhsLQPiJVf9jiM9-C7T6zbXA,2151
|
|
469
|
-
invenio_app_ils-7.
|
|
470
|
-
invenio_app_ils-7.
|
|
471
|
-
invenio_app_ils-7.
|
|
472
|
-
invenio_app_ils-7.
|
|
473
|
-
invenio_app_ils-7.
|
|
474
|
-
invenio_app_ils-7.
|
|
475
|
-
invenio_app_ils-7.
|
|
477
|
+
invenio_app_ils-7.1.0.dist-info/licenses/AUTHORS.rst,sha256=BaXCGzdHCmiMOl4qtVlh1qrfy2ROMVOQp6ylzy1m0ww,212
|
|
478
|
+
invenio_app_ils-7.1.0.dist-info/licenses/LICENSE,sha256=9OdaPOAO1ZOJcRQ8BrGj7QAdaJc8SRSUgBtdom49MrI,1062
|
|
479
|
+
invenio_app_ils-7.1.0.dist-info/METADATA,sha256=sK9iE9rvghCwwdBZxRFIeGj8Caye8VIuiwyOk3ObJyQ,19087
|
|
480
|
+
invenio_app_ils-7.1.0.dist-info/WHEEL,sha256=Q6xS052dXadQWXcEVKSI037R6NoyqhUlJ5BcYz2iMP4,110
|
|
481
|
+
invenio_app_ils-7.1.0.dist-info/entry_points.txt,sha256=XJzPenKn4NOWqckmUFaXh9idhxTMQQbtssxeVW7qH3E,7962
|
|
482
|
+
invenio_app_ils-7.1.0.dist-info/top_level.txt,sha256=p-lnzfSHaDER0BHbQvDV6dvUW7_Q0prMDFaqPhBSK50,16
|
|
483
|
+
invenio_app_ils-7.1.0.dist-info/RECORD,,
|
|
@@ -23,10 +23,12 @@ ils_providers = invenio_app_ils.providers.ext:InvenioIlsProviders
|
|
|
23
23
|
ils_rest = invenio_app_ils.ext:InvenioAppIlsREST
|
|
24
24
|
|
|
25
25
|
[invenio_base.api_blueprints]
|
|
26
|
+
ils_acquisition_stats = invenio_app_ils.acquisition.stats.views:create_acquisition_stats_blueprint
|
|
26
27
|
ils_circulation = invenio_app_ils.circulation.views:create_circulation_blueprint
|
|
27
28
|
ils_circulation_stats = invenio_app_ils.circulation.stats.views:create_circulation_stats_blueprint
|
|
28
29
|
ils_closures = invenio_app_ils.closures.views:create_closures_blueprint
|
|
29
30
|
ils_document_request = invenio_app_ils.document_requests.views:create_document_request_action_blueprint
|
|
31
|
+
ils_document_request_stats = invenio_app_ils.document_requests.stats.views:create_document_request_stats_blueprint
|
|
30
32
|
ils_document_stats = invenio_app_ils.records.views:create_document_stats_blueprint
|
|
31
33
|
ils_files = invenio_app_ils.files.views:create_files_blueprint
|
|
32
34
|
ils_ill = invenio_app_ils.ill.views:create_ill_blueprint
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# This file is part of Invenio.
|
|
4
|
-
# Copyright (C) 2025-2025 CERN.
|
|
5
|
-
#
|
|
6
|
-
# Invenio is free software; you can redistribute it and/or modify it
|
|
7
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
from invenio_app_ils.circulation.stats.serializers.response import loan_stats_responsify
|
|
11
|
-
from invenio_app_ils.circulation.stats.serializers.schema import HistogramStatsV1
|
|
12
|
-
|
|
13
|
-
loan_stats_response = loan_stats_responsify(HistogramStatsV1, "application/json")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|