Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable date-based usage statistics from the DSpace Statistics API #56

Open
alanorth opened this issue Nov 18, 2020 · 1 comment
Open
Labels
enhancement New feature or request P-medium Medium priority

Comments

@alanorth
Copy link
Member

alanorth commented Nov 18, 2020

View and download statistics are currently "all time" due to limitations of the DSpace Statistics API. We should explore the possibility of enabling a "reporting period". The current version of the API supports date ranges so we can now limit statistics to a date range by POSTing community, collection, or item IDs and date parameters.

For example, if you send this request:

{
    "limit": 100,
    "page": 0,
    "dateFrom": "2020-01-01T00:00:00Z",
    "dateTo": "2020-11-18T00:00:00Z",
    "items": [
        "926ffacd-1916-4366-a420-a966c195295f",
        "e8c64069-78ba-4472-b5b2-72d705f04ca7",
        "e9ac05b8-3270-4e2f-83fb-45e3c65e0c9c",
        "326c00a4-977e-4d32-968a-c372b18bf8c0"
    ]
}

The API will respond:

{
   "currentPage" : 0,
   "limit" : 100,
   "statistics" : [
      {
         "downloads" : 0,
         "id" : "e9ac05b8-3270-4e2f-83fb-45e3c65e0c9c",
         "views" : 420
      },
      {
         "downloads" : 0,
         "id" : "e8c64069-78ba-4472-b5b2-72d705f04ca7",
         "views" : 37
      },
      {
         "downloads" : 0,
         "id" : "326c00a4-977e-4d32-968a-c372b18bf8c0",
         "views" : 10
      },
      {
         "downloads" : 9,
         "id" : "926ffacd-1916-4366-a420-a966c195295f",
         "views" : 4
      }
   ],
   "totalPages" : 0
}

The problem is that this is only feasible for hundreds or thousands of items, but not the entire repository. We could enable it as an option when generating a report perhaps, rather than for the entire AReS Explorer UI. See the Swagger API docs.

@alanorth alanorth changed the title Enable date-based statistics for DSpace Statistics API Enable date-based usage statistics for DSpace Statistics API Nov 18, 2020
@alanorth alanorth changed the title Enable date-based usage statistics for DSpace Statistics API Enable date-based usage statistics from the DSpace Statistics API Nov 18, 2020
@alanorth alanorth added P-medium Medium priority enhancement New feature or request labels Nov 22, 2020
@alanorth
Copy link
Member Author

alanorth commented Feb 4, 2021

A better way to think about this would be as a "reporting period" actually, for example to see how many views/downloads took place during a certain date range.

See the DSpace Statistics API documentation for the new endpoints that allow POSTing a date range with a list of IDs:

https://dspacetest.cgiar.org/rest/statistics/swagger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

1 participant