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

statistics: enable file download statistics #842

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

jma
Copy link
Contributor

@jma jma commented May 4, 2022

Due to invenio isssues, the file download statistics are not enabled.

See: inveniosoftware/invenio-stats#116 for
more details.

Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch

Why are you opening this PR?

  • Which task/US does it implement?
  • Which issue does it fix?

How to test?

  • What command should I have to run to test your PR?
  • What should I test through the UI?

To test the API try a POST on /api/stats with:

{
  "view": {
    "stat": "record-view",
    "params": {
    	"pid_value": "81",
      	"pid_type": "doc"
    }
  },
  "download": {
  	"stat": "file-download",
    "params": {
    "bucket_id": "f9075edd-fbe7-44ad-bb73-b1b88bd5c70c"
    }
  }
}

You should have a response like:

{
  "download": {
    "bucket_id": "f9075edd-fbe7-44ad-bb73-b1b88bd5c70c",
    "buckets": [
      {
        "count": 1,
        "key": "2022INF001-pdf.jpg",
        "unique_count": 1
      },
      {
        "count": 1,
        "key": "2022INF001.pdf",
        "unique_count": 1
      }
    ],
    "count": 2,
    "end_date": null,
    "field": "file_key",
    "key_type": "terms",
    "start_date": null,
    "type": "bucket",
    "unique_count": 2
  },
  "view": {
    "count": 1,
    "end_date": null,
    "pid_type": "doc",
    "pid_value": "81",
    "start_date": null,
    "unique_count": 1
  }
}

Note: to find the bucket id you can see in the /api/documents json response.

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Extracted translations?

@jma jma marked this pull request as ready for review May 23, 2022 08:08
@jma jma requested review from BadrAly, rerowep and vgranata May 23, 2022 08:08
@PascalRepond
Copy link
Contributor

Add "Closes #829" ?

@jma jma force-pushed the maj-fix-files-stats branch 2 times, most recently from 8527315 to b43051e Compare June 2, 2022 14:20
Due to invenio isssues, the file download statistics are not enabled.

See: inveniosoftware/invenio-stats#116 for
more details.

* Closes rero#829.
* Fixes github action tests.
* Updates dependencies.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
@PascalRepond PascalRepond merged commit a9d5dc2 into rero:staging Jun 2, 2022
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.

None yet

3 participants