Skip to content

Conversation

@JakobMiesner
Copy link
Contributor

@JakobMiesner JakobMiesner force-pushed the feature/stats/ils-record-changes branch from 03afa7b to 6f301b0 Compare October 13, 2025 09:20
@JakobMiesner JakobMiesner marked this pull request as ready for review October 13, 2025 09:36
@JakobMiesner JakobMiesner force-pushed the feature/stats/ils-record-changes branch 4 times, most recently from 1d276c2 to c6d53fa Compare October 15, 2025 11:48
pid_type = record._pid_type

event_data = {
"timestamp": datetime.datetime.now().isoformat(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we normally store dates in UTC timezone, without timezone info. The client can then transform it.
I don't exactly recall, is now() using the server timezone?

Copy link
Contributor Author

@JakobMiesner JakobMiesner Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, thanks for the catch

and now is using the server timezone, yes. See here

@JakobMiesner JakobMiesner force-pushed the feature/stats/ils-record-changes branch from c6d53fa to 484ad86 Compare October 24, 2025 19:40
"""Add unique_id and aggregation_id to the doc."""

# We use this field to group by during aggregation.
# e.g. the count of created eitems by a user with id 7 is tracked under eitmid__insert__None.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one minor thing....
eitmid__insert__None the None part I find it a bit strange. Is this avoidable?

Copy link
Contributor Author

@JakobMiesner JakobMiesner Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For changes not performed by users or by users that have no backoffice access the user id will be None. (please look here for a more detailed description)
I could do a check in the aggregation_id creation and replace the None with something like no_user_id so it would be eitmid__insert__no_user_id, but I dont really find it much clearer. And in the end the aggreagtion_id is only used for aggregation and will not really be interacted with.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it be just etmid_insert instead? also... it should never happen that a non-librarian user creates any record except a document request. It seems like an overkill to have the <>_None pattern in the first place

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpsherva sounds good. I changed it :) I think the non-librarian record change can happen when e.g. a celery job changes any record. I don't think that the global current_user would evaluate to anything in that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also importer comes to mind, could happen in the importer. if it is none, maybe we should have value "script/importer"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was moved into new ticket here

Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still a comment from Karolina, otherwise LGTM ☺️

@kpsherva kpsherva merged commit 3eb0e2b into inveniosoftware:master Oct 30, 2025
5 checks passed
@JakobMiesner JakobMiesner deleted the feature/stats/ils-record-changes branch October 31, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Library Statistics - 4. Number of changes to the Library collections

3 participants