Skip to content

Rest contracts for qaevents, qatopics and qasources endpoints #181

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

Merged
merged 10 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
* [/api/workflow/pooltasks](pooltasks.md)
* [/api/workflow/claimedtasks](claimedtasks.md)
* [/api/tools/feedbacks](feedbacks.md)
* [/api/integration/qasources](qasources.md)
* [/api/integration/qatopics](qatopics.md)
* [/api/integration/qaevents](qaevents.md)

## Endpoints Under Development/Discussion
* [/api/authz/resourcepolicies](resourcepolicies.md)
Expand Down
116 changes: 116 additions & 0 deletions qaevents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
## Main Endpoint
**GET /api/integration/qaevents**
Copy link
Member

Choose a reason for hiding this comment

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

Somewhere we should describe at a high level what a "QA Event" is and where it comes from. So, I'd expect there to be a summary section at the top which describes the concept...similar to how we have a summary section for the ORCID endpoints (see orcidequeues.md for example)


_Unsupported._ The suggestions can be retrieved only by source and target or via direct link, see the single entry and search method below.
Copy link
Member

Choose a reason for hiding this comment

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

This description should be updated, because these are "quality assurance events" not "suggestions". I think the term "suggestions" would be confusing to use here as it's also used heavily in #192


## GET Single suggestion
** GET /api/integration/qaevents/<:qaevent-id>

Return a single suggestion:
Copy link
Member

Choose a reason for hiding this comment

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

Again, this should be "quality assurance event" not "suggestion"


```json
{
"id":"123e4567-e89b-12d3-a456-426614174000",
"originalId": "oai:www.openstarts.units.it:10077/21486",
"title":"Index nominum et rerum",
"trust":"0.375",
"eventDate": "2020/10/09 10:11 UTC",
"status": "PENDING",
"message" : {
"type":"doi",
"value":"10.18848/1447-9494/cgp/v15i09/45934",
"abstracts":"Abstract Complex functionality of the ...",
"acronym":"EPSILON",
"code":"277749",
"funder":"EC",
"fundingProgram":"FP7",
"jurisdiction":"EU",
"title":"Elliptic Pdes and Symmetry of Interfaces and Layers for Odd Nonlinearities"
},
type: "qaevent"
}
```

Attributes
* the *id* attribute is the event primary key
* the *originalId* attribute is the oai identifier of the target publication
Copy link
Member

Choose a reason for hiding this comment

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

Silly question perhaps. But, what is this called "originalId" instead of "oaiId"? What does the term "original" reference here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Original indicates that it is the id used by the event source to reference the publication that is the subject of the event itself. I will make the description of this attribute more general.

* the *title* attribute is the title of the publication as provided by the correction's source
* the *trust* attribute is the level of accuracy of the suggestion
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the value that comes back here is a fraction/percentage? Can we describe the value better? E.g. is it a percentage of trust? Does 1.0 mean 100% certain? I think we should provide more info to people who use this endpoint

* the *status* attribute is one of (ACCEPTED, REJECTED, DISCARDED, PENDING)
* the *eventDate* attribute is the timestamp of the event reception
* the *message* attribute is a json object which structure depends on the source and on the topic of the event. When the "topic" type is
* ENRICH/MISSING/PID and ENRICH/MORE/PID: fills `message.type` with the type of persistent identifier (doi, pmid, etc.) and `message.value` with the corresponding value
* ENRICH/MISSING/ABSTRACT: fills `message.abstract`
* ENRICH/MISSING/SUBJECT/ACM: fills the `message.value` with the actual keywords, the subject classification is defined by the last part of the topic (ACM, JEL, DDC, etc.)
* ENRICH/MISSING/PROJECT: fills `acronym`, `code`, `funder`, `fundingProgram`, `jurisdiction` and `title`

Exposed links:
* topic: link to the topic to which the event belong to
Copy link
Member

Choose a reason for hiding this comment

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

This description should probably reference the "qatopics" endpoint directly, to make it clear what the "topic" is here. Even saying "See qatopics endpoint" (with a link to those docs) is fine.

* target: link to the item that represent the targe to whom the suggestion apply
Copy link
Member

Choose a reason for hiding this comment

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

Again, we should not use the term "suggestion" here..probably "quality assurance event" or just "event".

* related: link to a second item that is involved in the qa events (i.e. the project item)
Copy link
Member

Choose a reason for hiding this comment

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

This is the first time a "project item" is mentioned in these docs. Could we better describe what this second item is? Do all "qaevents" only act on Publications which have related Projects? Or is this related link optional?

Or should this link down to the POST section below about "associating a related item"? If so, maybe we can provide more details on that endpoint about when a related item is used.


Status codes:
* 200 Ok - if the operation succeed
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged as an administrator
* 404 Not found - if no qa event exists with such id

## Search methods
### Get qaevents by a given topic
**/api/integration/qaevents/search/findByTopic?topic=:target-key[&size=10&page=0]**

It returns the list of qa events from a specific topic

The supported parameters are:
* page, size [see pagination](README.md#Pagination)
* topic: mandatory, the key associated with the requested topic

Return codes:
* 200 OK - if the operation succeed
* 400 Bad Request - if the topic parameter is missing or invalid

Provide paginated list of the qa events available.

## PATCH
### To record a decision
PATCH /api/integration/qaevents/<:qaevent-id>

This method allow users to Accept, Reject or Discard a qa event. The PATCH body must follow the JSON PATCH specification

```json
[
{
"op": "replace",
"path": "/status",
"value": "ACCEPTED|REJECTED|DISCARDED|PENDING"
}
]
```

As response, the modified qa event will be returned.

## POST
### To associated a related item to the qa event
Copy link
Member

Choose a reason for hiding this comment

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

As implied above, I think we need more details about "related items". Are they always Project Items? Are they required? When or why would you need to "associate a related item"?

POST /api/integration/qaevents/<:qaevent-id>/related?item=<:item-uri>

Return codes:
* 201 Created - if the operation succeed
* 400 Bad Request - if the qa event doesn't allow a related item (i.e. it is not related to a */PROJECT topic)
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged as an administrator
* 404 Not found - if no qa event exists with such id

### To remove a related item to the qa event
DELETE /api/integration/qaevents/<:qaevent-id>/related

Only the association between the qa event and the related item id deleted. The related item stays untouched

Return codes:
* 204 No content - if the delete succeeded (including the case of no-op if the qa event didn't contain a related item)
* 400 Bad Request - if the qa event doesn't allow a related item (i.e. it is not related to a */PROJECT topic)
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged as an administrator
* 404 Not found - if no qa event exists with such id

### To replace a related item
Replacing a related item will require deleting the related association and creating a new association hereafter
50 changes: 50 additions & 0 deletions qasources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Main Endpoint
**GET /api/integration/qasources**

Provide access to the Quality Assurance sources. It returns the list of the Quality Assurance sources.

```json
[

{
id: "openaire",
type: "qasource",
totalEvents: "33"
},
{
id: "another-source",
type: "qasource",
lastEvent: "2020/10/09 10:11 UTC",
totalEvents: "21"
},
...
]
```
Attributes:
* lastEvent: the date of the last update from the specific Quality Assurance source
* totalEvents: the total number of suggestions provided by the Quality Assurance source
Copy link
Member

Choose a reason for hiding this comment

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

Please replace "suggestions" with "Quality Assurance Events" or just Events. We may also want to mention here that events can be found using the "qaevents" endpoint, as that'll help people find the related endpoints.

* id: is the identifier to use in GET Single Source

Return codes:
* 200 OK - if the operation succeed
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged in with sufficient permissions, only system administrators can access

## GET Single Source
**GET /api/integration/qasources/<:qasource-id>**
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @LucaGiamminonni,

One thing I recall from our meeting was that we would create a generic mechanism for quality assurance.
Does it makes sense to have something like we have in authority or external sources for dealing with multiple sources?
https://github.com/DSpace/RestContract/blob/main/external-authority-sources.md#single-entry

GET /api/integration/qasources/<:source-name>/entryValues/<:entry-id>

in this specific case, the notification broker (nb) source-name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @paulo-graca, currently it is possible to search all topics given a source and all events related to a topic using the endpoints /api/integration/qatopics/search/bySource and /api/integration/qaevents/search/findByTopic. This also reflects the pages that are shown on the angular side: first all the sources, then all the topics of the selected source (or directly the topics of the only source if there is only one) and then all the events of the selected topic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you @LucaGiamminonni for your comment. Perhaps we are in different mindset regarding this. I look at this as new generic feature that we will be available in DSpace that handles sources, events, topics for quality assurance, being source agnostic. Apart from the implementation your team already have, I see it to be very similar to external sources and authority and how it should be specified. Perhaps external entities and authority should be differently and could be based also on search/bySource. But for the matter of the scope of this PR, for coherency and consistency, to me, this specification should be very close to what we already have regarding handling different sources.

Provide detailed information about a specific Quality Assurance source. The JSON response document is as follow
```json
{
id: "openaire",
type: "qasource",
totalEvents: "33"
}
```
Return codes:
* 200 OK - if the operation succeed
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged in with sufficient permissions, only system administrators can access
* 404 Not found - if the source doesn't exist
74 changes: 74 additions & 0 deletions qatopics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
## Main Endpoint
**GET /api/integration/qatopics**

Provide access to the Quality Assurance Broker topics. It returns the list of the Quality Assurance Broker topics.
Copy link
Member

Choose a reason for hiding this comment

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

Could we describe where these topics come from? Do these topics get assigned/set by the qasource? If so, we might say "It returns the list of Quality Assurance topics available from existing Quality Assurance Sources (see qasources endpoint)" or something similar.

I think it's very important in these docs to link up related endpoints so we describe how they are related.


```json
[

{
id: "ENRICH!MORE!PID",
type: "qatopic",
name: "ENRICH/MORE/PID",
lastEvent: "2020/10/09 10:11 UTC",
totalSuggestions: "33"
},
{
id: "ENRICH!MISSING!ABSTRACT",
type: "qatopic",
name: "ENRICH/MISSING/ABSTRACT",
lastEvent: "2020/10/09 10:11 UTC",
totalSuggestions: "21"
},
...
]
```
Attributes:
* name: the name of the topic to display on the frontend user interface
* lastEvent: the date of the last update from Quality Assurance Broker
* totalEvents: the total number of suggestions provided by Quality Assurance Broker for this topic
Copy link
Member

Choose a reason for hiding this comment

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

Again, don't use "suggestions", use "events". And again, we may want to note that the list of events can be found via "qaevents"

* id: is the identifier to use in GET Single Topic

Return codes:
* 200 OK - if the operation succeed
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged in with sufficient permissions, only system administrators can access

## GET Single Topic
**GET /api/integration/qatopics/<:qatopic-id>**
Provide detailed information about a specific Quality Assurance Broker topic. The JSON response document is as follow
```json
{
id: "ENRICH!MORE!PID",
type: "qatopic",
name: "ENRICH/MORE/PID",
lastEvent: "2020/10/09 10:11 UTC",
totalEvents: 33
}
```
Return codes:
* 200 OK - if the operation succeed
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged in with sufficient permissions, only system administrators can access
* 404 Not found - if the topic doesn't exist

## Search methods
### Get qatopics by a given source
**/api/core/entitytypes/search/bySource**

It returns the list of qa topics from a specific source

The supported parameters are:
* page, size [see pagination](README.md#Pagination)
* source: mandatory, the name associated with a specific source

Return codes:
* 200 OK - if the operation succeed
* 400 Bad Request - if the topic parameter is missing or invalid
* 401 Unauthorized - if you are not authenticated
* 403 Forbidden - if you are not logged in with sufficient permissions, only system administrators can access

Provide paginated list of the qa topics available.