# Datasets_RemapDatasetChannels

`POST /v1/accounts/{account}/datasets/{dataset}:remapChannels`

Maps native channel names onto canonical keys where the automatic
grammar got them wrong or found none (a mapping lens), then
derives the robot interface again. Renames add to the upload's earlier
ones; a channel renamed again takes the newest key. A key another channel
of the upload already holds is FAILED_PRECONDITION naming that channel
(rename both to swap them), and nothing is written. FAILED_PRECONDITION
on a mixture and on an upload merged into one (naming the dataset to use).

On a merged dataset the renames are its own channel keys: the
call writes one lens on each upload it holds that does not already key a
channel as asked, in one transaction (DATASET_UPDATED on the merged
dataset and on each upload it wrote), and derives their interfaces again
after it commits, which Dataset.interface_settlement counts. A key that
would give one upload two channels is FAILED_PRECONDITION naming the
upload and the channel, and nothing is written on any upload; a name no
upload has is INVALID_ARGUMENT. Sending the same renames again writes
nothing.

- Base URL: `https://junction-api.qualiastudios.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.RemapDatasetChannelsRequest`

## Responses

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

## Schemas

```yaml
qualia.v1.RemapDatasetChannelsRequest:
  required:
    - name
    - renames
  type: object
  properties:
    name:
      type: string
      description: accounts/{account}/datasets/{dataset}
    renames:
      type: object
      additionalProperties:
        type: string
      description: |-
        Native channel name to canonical key, 1 to 512 entries. Keys are
        [left.|right.]{joint_N|gripper|shoulder_pan|...}.{pos|vel|eff|torque|
        current|temp} or [left.|right.]ee.{x|y|z|roll|pitch|yaw|qx|qy|qz|qw},
        each used once. qx..qw are a unit quaternion's parts (x, y, z, w), unit
        "norm". An empty key resets the channel to the key read from its name. A
        name's mapping also reaches its velocity and effort channels.
  description: Request for Datasets.RemapDatasetChannels.
qualia.v1.RemapDatasetChannelsResponse:
  type: object
  properties:
    interfaceHash:
      type: string
      description: |-
        The robot interface derived under the new renames, "b3:<hex>"; empty
        when it could not be derived yet (the renames are kept either way).
    uploadsChanged:
      readOnly: true
      type: array
      items:
        type: string
      description: |-
        Merged dataset only: the uploads a lens was written on, which are
        re-derived after the call returns (empty: they all keyed the channels as
        asked already). `interface_hash` is empty for a merged dataset.
    interfaceSettlement:
      readOnly: true
      allOf:
        - $ref: "#/components/schemas/qualia.v1.Dataset_InterfaceSettlement"
      description: |-
        Merged dataset only: how far its uploads' interfaces have settled as the
        call commits (the same count as Dataset.interface_settlement).
  description: Response for Datasets.RemapDatasetChannels.
qualia.v1.Dataset_InterfaceSettlement:
  type: object
  properties:
    settledMembers:
      readOnly: true
      type: integer
      description: Number of merged members whose derived interfaces are settled.
      format: int32
    totalMembers:
      readOnly: true
      type: integer
      description: Total number of uploads in the merged dataset.
      format: int32
    outstandingUploads:
      readOnly: true
      type: array
      items:
        type: string
      description: Upload resource names whose interfaces are not settled yet.
  description: |-
    Progress toward one settled robot interface across a merged dataset's
    uploads. A member remains outstanding while its accepted mapping lens is
    still being re-derived, or when its derived interface differs from the
    merged dataset's first member.
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.
```
