# Episodes_ReviewSplitProposals

`POST /v1/accounts/{account}/datasets/{dataset}/episodes:reviewSplitProposals`

Accepts or rejects the splits preparation proposed for an upload's
takes (SplitProposal). Accept draws each proposal on its take's draft,
as a person's split is drawn: the pieces exist only in a version
published from it. Reject closes the proposal and leaves the take as it
is; a rejected proposal can be accepted later. A take that cannot be
decided is left, with its reason, and the others go on. A person or an
API key decides; no model does.

- Base URL: `https://api.qualia.dev`
- Authentication: an API key in the `X-API-Key` header

## Parameters

- `account` (path, string, required): The account id.
- `dataset` (path, string, required): The dataset id.

## Request body

Required: `application/json` `qualia.v1.ReviewSplitProposalsRequest`

## Responses

- `200` OK: `application/json` `qualia.v1.ReviewSplitProposalsResponse`
- `default` Default error response: `application/json` `google.rpc.Status`

## Schemas

```yaml
qualia.v1.ReviewSplitProposalsRequest:
  required:
    - parent
    - decision
  type: object
  properties:
    parent:
      type: string
      description: "accounts/{account}/datasets/{dataset}: must be the upload."
    episodes:
      type: array
      items:
        type: string
      description: |-
        The takes whose proposals to decide. Empty: every open proposal of
        `run`.
    run:
      type: string
      description: |-
        The run whose proposals to decide: a preparation run (Preparation.run_id)
        or a check run. On each take it names one row: of the proposals it wrote
        and those that carry its windows, in any state, the open one, else the
        newest. Empty: the upload's newest preparation run.
    decision:
      enum:
        - DECISION_UNSPECIFIED
        - ACCEPT
        - REJECT
      type: string
      description: Accept or reject.
      format: enum
    validateOnly:
      type: boolean
      description: Report what would be decided and left, without writing it.
    requestId:
      type: string
      description: |-
        Optional UUID identifying this logical edit. Reusing it with the same
        caller and request returns the original result; different input conflicts.
        When absent, each call starts a new logical edit.
  description: Request for Episodes.ReviewSplitProposals.
qualia.v1.ReviewSplitProposalsResponse:
  type: object
  properties:
    reviewed:
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.SplitProposal"
      description: The proposals decided, as they stand now.
    left:
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.LeftEpisode"
      description: The takes left as they were, each with why.
  description: Response for Episodes.ReviewSplitProposals.
qualia.v1.SplitProposal:
  type: object
  properties:
    episode:
      readOnly: true
      type: string
      description: "accounts/{account}/datasets/{dataset}/episodes/{episode}: the take."
    run:
      readOnly: true
      type: string
      description: |-
        The run that proposed it: a preparation run (Preparation.run_id) or a
        check run.
    windows:
      readOnly: true
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.Episode_Trim"
      description: |-
        The windows kept, one or more, in time order, in seconds from the take's
        start. Two or more are pieces; one is a trim. What lies between them,
        before the first and after the last is dropped.
    state:
      readOnly: true
      enum:
        - STATE_UNSPECIFIED
        - PROPOSED
        - ACCEPTED
        - REJECTED
        - SUPERSEDED
        - APPLIED
      type: string
      description: Where it stands.
      format: enum
    decidedBy:
      readOnly: true
      allOf:
        - $ref: "#/components/schemas/qualia.v1.Actor"
      description: |-
        Who made the last decision: a person, or an API key acting for none. A
        person's own API key decides as that person, with the key in `api_key`.
        Unset while PROPOSED, and for APPLIED.
    decideTime:
      readOnly: true
      type: string
      description: When.
      format: date-time
    undoRefusal:
      readOnly: true
      type: string
      description: |-
        For APPLIED: empty when UnsplitEpisodes can restore the take, else why
        it cannot ("piece 18.2: relabelled by Fabian"). Empty in every other
        state.
    cuts:
      readOnly: true
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.SplitProposal_Cut"
      description: |-
        Each cut between two windows, in time order: one fewer than `windows`,
        so none for a trim.
    startReason:
      readOnly: true
      type: string
      description: |-
        Why the first window starts after the take does (a trimmed start), in
        its proposer's words ("Tracking lost 0.00-0.50 s (0.50 s)"). Empty when
        nothing before it is dropped, or the proposer said nothing.
    endReason:
      readOnly: true
      type: string
      description: |-
        Why the last window ends before the take does (a trimmed end), in its
        proposer's words. Empty when nothing after it is dropped, or the
        proposer said nothing.
    checks:
      readOnly: true
      type: array
      items:
        type: string
      description: |-
        The checks whose part the proposal carries, by check id
        ("heuristic.nan"), whichever run wrote it; none for preparation's own
        cut. An issue of the free NaN check opens a proposal that carries
        "heuristic.nan".
  description: |-
    Where preparation or a check would cut or trim one take: the windows it
    would keep, and what became of that. Nothing is published: the take stays
    one episode until a person or an API key accepts the proposal
    (ReviewSplitProposals). A take has one open proposal, whoever proposed it:
    its windows are where every source's windows overlap. When they overlap
    nowhere, nothing is proposed: the take has no proposal, and GetPreparation
    lists it as a take the run did not cut. A split preparation
    published before proposals existed reads as APPLIED.
qualia.v1.Episode_Trim:
  type: object
  properties:
    startSeconds:
      type: number
      description: First second kept.
      format: double
    endSeconds:
      type: number
      description: Last second kept.
      format: double
  description: The trim window, in seconds from the start of the recording.
qualia.v1.Actor:
  type: object
  properties:
    kind:
      readOnly: true
      enum:
        - KIND_UNSPECIFIED
        - PERSON
        - VALIDATION
        - RULE
        - MODEL
        - OPERATOR
        - SYSTEM
      type: string
      description: What kind of actor it is.
      format: enum
    user:
      readOnly: true
      type: string
      description: The person's user id when `kind` is PERSON; empty otherwise.
    displayName:
      readOnly: true
      type: string
      description: The person's display name at the time, for rendering without a lookup.
    agent:
      readOnly: true
      type: string
      description: |-
        The rule code, or for a MODEL the Qualia model tier (e.g. "qualia-vlm";
        "qualia" for any other model), when not a person.
    run:
      readOnly: true
      type: string
      description: The run a model or rule finding came from, when it has one.
    apiKey:
      readOnly: true
      type: string
      description: |-
        The API key's id when a person acted through one; empty for a session.
        Never the key itself.
    attribution:
      readOnly: true
      allOf:
        - $ref: "#/components/schemas/qualia.v1.Attribution"
      description: |-
        Signed identity evidence recorded with the change, kept apart from the
        principal above. Unset on older records and wherever none was signed.
  description: Who did something. Every decision, issue and reply names one.
qualia.v1.Attribution:
  type: object
  properties:
    authentication:
      readOnly: true
      enum:
        - AUTHENTICATION_UNSPECIFIED
        - SESSION
        - API_KEY
        - SERVICE
      type: string
      description: How the principal authenticated.
      format: enum
    initiator:
      readOnly: true
      type: string
      description: |-
        The user id of a person verified as starting the work: the person of a
        session, or the person a trusted service's signed job record names.
        Empty when nobody was verified.
    initiatorDisplayName:
      readOnly: true
      type: string
      description: The initiator's display name at the time, never their email.
    credentialCreator:
      readOnly: true
      type: string
      description: The user id of the key's creator at the time. Not who used the key.
    credentialOwner:
      readOnly: true
      enum:
        - CREDENTIAL_OWNER_UNSPECIFIED
        - PERSON
        - SPACE
      type: string
      description: Who owned the key at the time.
      format: enum
    credentialOwnerSpace:
      readOnly: true
      type: string
      description: |-
        The owning space's id (a workspace or the organization) when
        `credential_owner` is SPACE.
  description: |-
    How a change was authenticated and who verifiably started it.
    Only the trusted mesh signs it. It never authorizes anything, and a key's
    creator or owner is never the person who used the key.
qualia.v1.SplitProposal_Cut:
  type: object
  properties:
    startSeconds:
      readOnly: true
      type: number
      description: |-
        Where the window after the cut starts, in seconds from the take's
        start.
      format: double
    confidence:
      readOnly: true
      enum:
        - CONFIDENCE_UNSPECIFIED
        - LOW
        - MEDIUM
        - HIGH
      type: string
      description: How sure the model was.
      format: enum
    reason:
      readOnly: true
      type: string
      description: |-
        The model's reason, in its own words ("the person resets the cloth
        and starts folding again"). Empty when not recorded.
  description: |-
    Why preparation would cut the take at one place: the model's answer
    when it checked the frames there.
qualia.v1.LeftEpisode:
  type: object
  properties:
    episode:
      type: string
      description: accounts/{account}/datasets/{dataset}/episodes/{episode}
    reason:
      type: string
      description: |-
        Why, in one sentence ("the take has a saved drawing; open it in the
        studio").
  description: A take a call left as it was, and why. The call goes on with the others.
google.rpc.Status:
  oneOf:
    - $ref: "#/components/schemas/ApiError"
    - $ref: "#/components/schemas/GatewayError"
  description: "The body of a failed call: one of the two shapes below."
ApiError:
  title: API error
  type: object
  required:
    - code
    - message
    - retryable
    - details
  properties:
    code:
      type: string
      description: The gRPC code name in upper case, e.g. `NOT_FOUND`.
    message:
      type: string
    retryable:
      type: boolean
      description: Whether the same call may succeed if retried.
    details:
      type: array
      items:
        type: object
      description: "Empty, except when a dataset copy or move is refused: then one `google.rpc.ErrorInfo` with the refusal's `reason` code, its `domain` and, in `metadata`, the datasets it names."
  description: A refusal from the API itself.
GatewayError:
  title: Gateway error
  type: object
  required:
    - detail
  properties:
    detail:
      type: string
      description: What went wrong.
  description: A refusal from the gateway before the call reaches the API, for example `401` bad or missing API key, `403` key lacks the scope or environment closed, `413` body too large.
```
