Koha/api/v1/swagger/paths/erm_counter_files.yaml
Pedro Amorim 2951edc697
Bug 34587: SUSHI COUNTER Harvester
This commit is a squash of the following:

SUSHI harvesting process in the data providers class:
* Builds the URL query and requests the SUSHI service endpoint
* Parses the JSON response and builds the csv COUNTER file and adds it to counter_files table

Usage statistics data processing:
* When a counter_files entry is stored, CounterFile.pm will:
* Parse the csv COUNTER file and
* Add a usage_titles entry for each unique title in the COUNTER file
* Add the title's respective erm_usage_mus (monthly usage) entries, repeating for each metric_type
* Add the title's respective erm_usage_yus (yearly usage) entries, repeating for each metric_type

Harvesting cronjob;

'Run now':
* API endpoint to start the harvesting process of a data provider
* Button in the data providers list to run the harvesting process for each data provider upon clicked

ERM SUSHI: Background job

Job progress is updated to total amount of usage titles after retrieving
the response from SUSHI;
Job warning and success messages are added accordingly
Redundant duplicate titles will not be added
Redundant duplicate monthly and yearly usage statistics will not be added
Data provider harvest background job harvests once per report_type

Enqueue one background job for each report_type in the usage data provider

Update the way we measure progress in the background job.
It now uses the COUNTER report body rows instead of SUSHI response results.
We're now incrementing and showing the number of skipped mus, skipped
yus, added mus and added yus
There's a bug in the way we calculate yus
Updates to background job progress bar - Depends on 34468

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-31 16:45:58 -03:00

238 lines
No EOL
7 KiB
YAML

---
"/erm/counter_files/{erm_counter_files_id}/file/content":
get:
x-mojo-to: ERM::CounterFiles#get
operationId: downloadCounterFile
tags:
- counter_file
summary: Download Counter file
produces:
- application/octet-stream
parameters:
- description: Case insensitive search on erm_counter_files_id
in: path
name: erm_counter_files_id
required: true
type: integer
responses:
200:
description: A counter file
schema:
type: file
401:
description: Authentication required
schema:
$ref: "../swagger.yaml#/definitions/error"
403:
description: Access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
404:
description: Ressource not found
schema:
$ref: "../swagger.yaml#/definitions/error"
500:
description: |-
Internal server error. Possible `error_code` attribute values:
* `internal_server_error`
schema:
$ref: "../swagger.yaml#/definitions/error"
503:
description: Under maintenance
schema:
$ref: "../swagger.yaml#/definitions/error"
x-koha-authorization:
permissions:
erm: 1
/erm/counter_files:
get:
x-mojo-to: ERM::CounterFiles#list
operationId: listErmCounterFiles
tags:
- counter_file
summary: List counter_files
produces:
- application/json
parameters:
- description: Case insensitive search on counter_file erm_counter_files_id
in: query
name: erm_counter_files_id
required: false
type: integer
- description: Case insensitive search on counter_file usage_data_provider_id
in: query
name: usage_data_provider_id
required: false
type: integer
- description: Case insensitive search on counter_file filename
in: query
name: filename
required: false
type: string
- description: Case insensitive search on counter_file type
in: query
name: type
required: false
type: string
- description: Case insensitive search on counter_file file_content
in: query
name: file_content
required: false
type: string
- description: Case insensitive search on counter_file date_uploaded
in: query
name: date_uploaded
required: false
type: string
- name: x-koha-embed
in: header
required: false
description: Embed list sent as a request header
type: array
items:
type: string
enum:
- counter_logs
collectionFormat: csv
- $ref: "../swagger.yaml#/parameters/match"
- $ref: "../swagger.yaml#/parameters/order_by"
- $ref: "../swagger.yaml#/parameters/page"
- $ref: "../swagger.yaml#/parameters/per_page"
- $ref: "../swagger.yaml#/parameters/q_param"
- $ref: "../swagger.yaml#/parameters/q_body"
- $ref: "../swagger.yaml#/parameters/q_header"
responses:
200:
description: A list of counter_files
schema:
items:
$ref: "../swagger.yaml#/definitions/erm_counter_file"
type: array
400:
description: Bad request
schema:
$ref: "../swagger.yaml#/definitions/error"
403:
description: Access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
500:
description: |-
Internal server error. Possible `error_code` attribute values:
* `internal_server_error`
schema:
$ref: "../swagger.yaml#/definitions/error"
503:
description: Under maintenance
schema:
$ref: "../swagger.yaml#/definitions/error"
x-koha-authorization:
permissions:
erm: 1
post:
x-mojo-to: ERM::CounterFiles#add
operationId: addErmCounterFiles
tags:
- counter_file
summary: Add counter_file
consumes:
- application/json
produces:
- application/json
parameters:
- description: A JSON object containing information about the new counter_file
in: body
name: body
required: true
schema:
$ref: "../swagger.yaml#/definitions/erm_counter_file"
responses:
201:
description: A successfully created counter_file
schema:
items:
$ref: "../swagger.yaml#/definitions/erm_counter_file"
400:
description: Bad parameter
schema:
$ref: "../swagger.yaml#/definitions/error"
401:
description: Authentication required
schema:
$ref: "../swagger.yaml#/definitions/error"
403:
description: Access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
404:
description: Ressource not found
schema:
$ref: "../swagger.yaml#/definitions/error"
409:
description: Conflict in creating resource
schema:
$ref: "../swagger.yaml#/definitions/error"
413:
description: Payload too large
schema:
$ref: "../swagger.yaml#/definitions/error"
500:
description: |-
Internal server error. Possible `error_code` attribute values:
* `internal_server_error`
schema:
$ref: "../swagger.yaml#/definitions/error"
503:
description: Under maintenance
schema:
$ref: "../swagger.yaml#/definitions/error"
x-koha-authorization:
permissions:
erm: 1
"/erm/counter_files/{erm_counter_files_id}":
delete:
x-mojo-to: ERM::CounterFiles#delete
operationId: deleteERMCounterFiles
tags:
- counter_file
summary: Delete counter_file
produces:
- application/json
parameters:
- $ref: "../swagger.yaml#/parameters/erm_counter_files_id_pp"
responses:
204:
description: counter_file deleted
400:
description: counter_file deletion failed
schema:
$ref: "../swagger.yaml#/definitions/error"
401:
description: authentication required
schema:
$ref: "../swagger.yaml#/definitions/error"
403:
description: access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
404:
description: ressource not found
schema:
$ref: "../swagger.yaml#/definitions/error"
409:
description: conflict in deleting resource
schema:
$ref: "../swagger.yaml#/definitions/error"
500:
description: |-
internal server error. possible `error_code` attribute values:
* `internal_server_error`
schema:
$ref: "../swagger.yaml#/definitions/error"
503:
description: under maintenance
schema:
$ref: "../swagger.yaml#/definitions/error"
x-koha-authorization:
permissions:
erm: 1