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

Extend submissions REST API to support views and view counts #8887

Closed
NateWr opened this issue Apr 6, 2023 · 7 comments
Closed

Extend submissions REST API to support views and view counts #8887

NateWr opened this issue Apr 6, 2023 · 7 comments
Assignees
Labels
Enhancement:3:Major A new feature or improvement that will take a month or more to complete.
Milestone

Comments

@NateWr
Copy link
Contributor

NateWr commented Apr 6, 2023

Describe the problem you would like to solve
As part of the new submissions list design (#8880), there are several new views. Each view will show submissions in a given state. For example, "No editor assigned" will show all submissions without a deciding editor assigned.

Describe the solution you'd like
Extend the REST API to support all of these views. There are lots of ways that this could be done. Here are some ideas:

  1. This may be possible by adding query params to the existing submissions API for each view. For example, a ?needsEditor=true query param.

  2. However, the number of query params might become very large. We may also encounter query "conflicts", for example consider combining the needsEditor param with the assignedTo param for editor assignments: ?assignedTo=1&needsEditor=true. This would result in an "invalid" query, since both conditions can not be true. For that reason it may be better to consider more generic params, like withCountEditors=1+.

  3. Alternatively, it may be better to think of each view as a standalone thing. For example, maybe each view is a separate API endpoint, like: /submissions/view/needsEditors. This would result in more API code, but each handler method would be much simpler with fewer invalid conditions. It may also be easier to allow plugins to add views with this architecture.

Also, for each view, we need to be able to get a count of submissions in that view. Because of the number of views, it will not be performant to make a separate API request for each view. We probably need a single API endpoint we can hit to get updated view counts. It may be worth considering caching this data in some way.

Who is asking for this feature?
This is required for #8880.

Additional information
When designing the solution, keep in mind that what views we have will change over time. An architecture that allows us to quickly add, edit or remove views will be best in the long-term.

The following views were settled upon after conducting user research.

View Description
Assigned to Me All submissions that the current user is assigned to as MANAGER, SUB_EDITOR or ASSISTANT.
All in initial review All submissions in the submission stage except incomplete submissions.
No editors assigned All submissions that do not have someone assigned in a MANAGER or SUB_EDITOR role except incomplete submissions.
All in internal review (OMP only) All submissions in the internal review stage.
All in peer review All submissions in the external review stage. (Iin OMP, this should be called "All in external review".)
No reviewers assigned All submissions in the review stage with no pending or completed review assignments in the current round.
Awaiting reviews All submissions in the review stage with 1 or more pending reviews in the current round.
Reviews submitted All submissions in the review stage with 1 or more completed reviews in the current round.
Reviews overdue All submissions in the review stage with 1 or more overdue review assignments in the currnet round.
Revisions submitted All submissions in the review stage with a revisions requested decision and 1 or more revision files in the current round.
All in copyediting All submissions in the copyediting stage.
All in production All submissions in the production stage.
Scheduled for publication All submissions with the STATUS_SCHEDULED status.
Published All submissions with the STATUS_PUBLISHED status.
Declined All submissions with the STATUS_DECLINED status.

For a user with the MANAGER role, each view will include all submissions, except the "Assigned to Me" view. For users with the SUB_EDITOR or ASSISTANT role, they will only see submissions they are assigned to in one of those roles.

One thing to note is that it should no longer be possible for editorial staff to see incomplete submissions through this list. In other words, all of these views should exclude incomplete submissions.

@NateWr NateWr added the Enhancement:3:Major A new feature or improvement that will take a month or more to complete. label Apr 6, 2023
@NateWr NateWr added this to the 3.5 milestone Apr 6, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Sep 26, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Sep 26, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 19, 2023
Vitaliy-1 added a commit to Vitaliy-1/ojs that referenced this issue Oct 20, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 23, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 23, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 23, 2023
Vitaliy-1 added a commit to Vitaliy-1/ojs that referenced this issue Oct 23, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 24, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 25, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 29, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/ojs that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/ojs that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/reviewReport that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/reviewReport that referenced this issue Oct 30, 2023
Vitaliy-1 added a commit to Vitaliy-1/orcidProfile that referenced this issue Oct 30, 2023
@Vitaliy-1
Copy link
Collaborator

Vitaliy-1 commented Oct 30, 2023

pkp-lib: #9469
ORCID Profile Plugin: pkp/orcidProfile#296
Review Report Plugin: pkp/reviewReport#50
OJS: pkp/ojs#4088
OMP: pkp/omp#1484
pkp-docs: pkp/pkp-docs#1158

Vitaliy-1 added a commit to Vitaliy-1/pkp-lib that referenced this issue Nov 12, 2023
Vitaliy-1 added a commit to Vitaliy-1/omp that referenced this issue Nov 12, 2023
Vitaliy-1 added a commit to Vitaliy-1/omp that referenced this issue Nov 13, 2023
Vitaliy-1 added a commit that referenced this issue Nov 13, 2023
Vitaliy-1 added a commit to pkp/orcidProfile that referenced this issue Nov 13, 2023
Vitaliy-1 added a commit to pkp/ojs that referenced this issue Nov 13, 2023
Vitaliy-1 added a commit to pkp/omp that referenced this issue Nov 13, 2023
@Vitaliy-1
Copy link
Collaborator

@asmecher, merged except reviewReport and pkp-docs, I don't have wright access to them.

asmecher pushed a commit to pkp/reviewReport that referenced this issue Nov 14, 2023
asmecher pushed a commit to pkp/reviewReport that referenced this issue Nov 14, 2023
asmecher pushed a commit to pkp/reviewReport that referenced this issue Nov 14, 2023
asmecher added a commit to pkp/pkp-docs that referenced this issue Nov 14, 2023
pkp/pkp-lib#8887 Document changes in the REST API and review assignments
@asmecher
Copy link
Member

@Vitaliy-1, both merged, thanks!

@touhidurabir
Copy link
Member

@Vitaliy-1 This cause issue with only OPS submission list view because of https://github.com/pkp/pkp-lib/blob/main/classes/submission/maps/Schema.php#L223 as the Review Assignment repository is not defined in the APP level for OPS . This is understandable as for OPS we do not have any review functionality but need adjustment for OPS . Current OPS main does not point to latest commit of pkp-lib but the checkout of main in OPS does cause issue with following trace

[16-Nov-2023 08:10:17 UTC] Error: Call to undefined method APP\facades\Repo::reviewAssignment() in /Users/abir/Sites/code/ops-main/lib/pkp/classes/submission/maps/Schema.php:223
Stack trace:
#0 /Users/abir/Sites/code/ops-main/classes/submission/maps/Schema.php(26): PKP\submission\maps\Schema->mapByProperties(Array, Object(APP\submission\Submission))
#1 /Users/abir/Sites/code/ops-main/lib/pkp/classes/submission/maps/Schema.php(162): APP\submission\maps\Schema->mapByProperties(Array, Object(APP\submission\Submission))
#2 /Users/abir/Sites/code/ops-main/lib/pkp/classes/submission/maps/Schema.php(179): PKP\submission\maps\Schema->mapToSubmissionsList(Object(APP\submission\Submission), Object(Illuminate\Support\LazyCollection), Array)
#3 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Collections/LazyCollection.php(790): PKP\submission\maps\Schema->PKP\submission\maps\{closure}(Object(APP\submission\Submission), 21)
#4 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Collections/LazyCollection.php(1588): Illuminate\Support\LazyCollection->Illuminate\Support\{closure}()
#5 [internal function]: Illuminate\Support\LazyCollection->Illuminate\Support\{closure}()
#6 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Collections/LazyCollection.php(106): iterator_to_array(Object(Generator))
#7 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(931): Illuminate\Support\LazyCollection->all()
#8 [internal function]: Illuminate\Support\LazyCollection->jsonSerialize()
#9 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php(84): json_encode(Array, 0)
#10 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/symfony/http-foundation/JsonResponse.php(49): Illuminate\Http\JsonResponse->setData(Array)
#11 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php(32): Symfony\Component\HttpFoundation\JsonResponse->__construct(Array, 200, Array, false)
#12 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(101): Illuminate\Http\JsonResponse->__construct(Array, 200, Array, 0)
#13 /Users/abir/Sites/code/ops-main/lib/pkp/api/v1/_submissions/PKPBackendSubmissionsController.php(229): Illuminate\Routing\ResponseFactory->json(Array, 200)
#14 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/CallableDispatcher.php(40): PKP\API\v1\_submissions\PKPBackendSubmissionsController->getMany(Object(Illuminate\Http\Request), 'publicknowledge', 'v1')
#15 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Route.php(237): Illuminate\Routing\CallableDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Closure))
#16 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Route.php(208): Illuminate\Routing\Route->runCallable()
#17 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Router.php(799): Illuminate\Routing\Route->run()
#18 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#19 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/HasRoles.php(69): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\HasRoles->handle(Object(Illuminate\Http\Request), Object(Closure), Object(Illuminate\Support\Collection))
#21 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/HasContext.php(35): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\HasContext->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/HasUser.php(35): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\HasUser->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Router.php(800): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#27 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Router.php(777): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#28 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Router.php(741): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#29 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Routing/Router.php(730): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#30 /Users/abir/Sites/code/ops-main/lib/pkp/classes/handler/APIHandler.php(64): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#31 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): PKP\handler\APIHandler->PKP\handler\{closure}(Object(Illuminate\Http\Request))
#32 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/PolicyAuthorizer.php(71): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\PolicyAuthorizer->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#42 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/ValidateCsrfToken.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\ValidateCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/DecodeApiTokenWithValidation.php(58): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\DecodeApiTokenWithValidation->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/SetupContextBasedOnRequestUrl.php(65): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#47 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\SetupContextBasedOnRequestUrl->handle(Object(Illuminate\Http\Request), Object(Closure))
#48 /Users/abir/Sites/code/ops-main/lib/pkp/classes/middleware/AllowCrossOrigin.php(34): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#49 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): PKP\middleware\AllowCrossOrigin->handle(Object(Illuminate\Http\Request), Object(Closure))
#50 /Users/abir/Sites/code/ops-main/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#51 /Users/abir/Sites/code/ops-main/lib/pkp/classes/handler/APIHandler.php(65): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#52 /Users/abir/Sites/code/ops-main/api/v1/_submissions/index.php(20): PKP\handler\APIHandler->__construct(Object(APP\API\v1\_submissions\BackendSubmissionsController))
#53 /Users/abir/Sites/code/ops-main/lib/pkp/classes/core/APIRouter.php(103): require('/Users/abir/Sit...')
#54 /Users/abir/Sites/code/ops-main/lib/pkp/classes/core/Dispatcher.php(167): PKP\core\APIRouter->route(Object(APP\core\Request))
#55 /Users/abir/Sites/code/ops-main/lib/pkp/classes/core/PKPApplication.php(378): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#56 /Users/abir/Sites/code/ops-main/index.php(21): PKP\core\PKPApplication->execute()
#57 /Users/abir/.composer/vendor/laravel/valet/server.php(235): require('/Users/abir/Sit...')
#58 {main}

@asmecher
Copy link
Member

@Vitaliy-1, can this issue be closed now?

ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in Editorial Workflow Dec 12, 2023
asmecher added a commit that referenced this issue Feb 8, 2024
ipula pushed a commit to ipula/pkp-lib that referenced this issue Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:3:Major A new feature or improvement that will take a month or more to complete.
Projects
Status: Done
Development

No branches or pull requests

5 participants