Metadata-Version: 2.4
Name: splent_feature_curation
Version: 0.2.0
Summary: The review queue of a hub: the datasets its policy sends to review before they are published, and the withdrawals their owners ask for
License-Expression: LGPL-3.0-or-later
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: COPYING
License-File: COPYING.LESSER
Requires-Dist: splent_framework>=1.30.0
Dynamic: license-file

# splent_feature_curation

The review queue of an OpenHubs hub (GV-2): what a curator looks at before
the hub acts on it.

- **Publications.** Where dataset's `DATASET_PUBLISH_POLICY` is `curated`,
  an account curation does not trust sends its dataset to review instead of
  publishing it. It waits, submitted, and nothing reaches the provider until
  a curator approves it; it is then published in the background, through
  the provider its owner chose. A rejection takes it back to a draft its
  owner changes and sends again, and its owner can take it back from review
  too. A dataset waiting for review cannot be changed: what is approved is
  what is published.
- **Withdrawals.** The owner of a published dataset asks for it to be
  withdrawn from its page (the button fills dataset's `dataset.view.actions`
  slot), saying why. A curator withdraws it (its DOI then
  answers with a tombstone that says why, 451 for a legal reason) or rejects
  the request, and the dataset stays published.
- **The queue**, under Administration in the panel, for the accounts whose
  role is in `CURATION_REVIEWER_ROLES`, with the count of what waits on its
  menu entry. Every decision carries a note; the owner is mailed it, and the
  reviewers are mailed when something new waits (with the mail feature).

curation is the reviewer of dataset's policy: it implements dataset's
`PublicationReviewer` and registers itself from `init_feature` with
`register_publication_reviewer`, so a product whose policy is `curated`
installs it, or it does not start. It changes datasets only through
dataset's services, and keeps the requests and who decided them in its own
table, `curation_request`. It requires auth and dataset 0.8.0 or later, and
mails with the mail feature when the product has it.

| Route | |
|-------|-|
| `GET /admin/curation` | The queue |
| `GET /admin/curation/<request_id>` | One request, with the dataset it is about |
| `POST /admin/curation/<request_id>/approve`, `.../reject` | The curator's decision, with its note |
| `POST /datasets/<dataset_id>/withdrawal-request` | The owner asks for a withdrawal |
| `POST /datasets/<dataset_id>/withdrawal-request/cancel` | The owner takes the request back |

## Who is trusted

`CURATION_TRUSTED_ACCOUNTS` says which accounts publish without review on a
curated hub:

| Value | Trusted |
|-------|---------|
| `none` | no account: every publication is reviewed |
| `published` (default) | an account with a dataset published on the hub |
| `carried_over` | an account carried over from an older site (auth's `account_origin`) with a dataset published, the history uvlhub 2.12 gave it (D4) |

Whatever the value, a curator is trusted, and an account one of whose
datasets was withdrawn as spam or malware is not. A trusted account still
confirms its address first, as dataset's `verified` asks.

## Parameters

All three are typed in `[tool.splent.config_schema]` and of `derivation`
bind: the product decides them, and an environment that changes them is
drift.

| Key | Type | Default | |
|-----|------|---------|-|
| `CURATION_TRUSTED_ACCOUNTS` | enum: `none`, `published`, `carried_over` | `published` | who publishes without review |
| `CURATION_REVIEWER_ROLES` | list of `admin`, `staff` | `["admin"]` | the roles of the curators |
| `CURATION_NOTIFY_REVIEWERS` | bool | `true` | whether the curators are mailed what is new. The owner is mailed every decision either way, with mail |

## In the model

An optional `curation` node of `repositorio` in openhubs_spl, which
`publish_curated` (the `curated` value of `DATASET_PUBLISH_POLICY`)
requires: `publish_curated => curation`, so a curated hub without its
reviewer does not validate. `docs/openhubs_spl.uvl.patch` was the change of
`splent_spl_openhubs/openhubs_spl.uvl` that added it.

## Develop

```bash
splent feature:test curation --with dataset
splent feature:contract splent_feature_curation --write
```

It needs dataset 0.8.0, the release with the policy: until it is out, its
tests take dataset's working copy (`--with dataset`).
