Skip to content

Move events

Martin Ballhatchet edited this page Apr 19, 2021 · 36 revisions

Move events

This page documents move events in the Book A Secure Move API

Normal Move Events

Normally a move will have at least the following Move events (as well as some Journey Events):-

  • MoveRequested (mostly generated by the Authority)
  • MoveAccept
  • MoveStart
  • MoveComplete

MoveAccept

Description

Accepting a move will change the move status from requested to booked.

Attributes

Common attributes, only

Request Example

POST /api/events

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:28+00:00",
      "recorded_at": "2020-12-03T10:51:28+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveAccept"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "18cf2777-a0e4-4cac-947b-44316580b33d"
        }
      }
    }
  }
}

Validations

Common validations, only

Triggers

Accepting a move will change the move status from requested to booked.

MoveApprove

Description

Approving a move will change the move status to requested and update with the provided move date.

Attributes

  • date - Date on which the move is scheduled
  • create_in_nomis - Indicates if the move should be automatically created in NOMIS

Request Example

POST /api/events

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:30+00:00",
      "recorded_at": "2020-12-03T10:51:30+00:00",
      "notes": "Additional information about this event",
      "details": {
        "date": "2020-06-16",
        "create_in_nomis": true
      },
      "event_type": "MoveApprove"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "34dadfc0-1f24-45c5-ba40-fc95e1097119"
        }
      }
    }
  }
}

Validations

  • date - presence, iso8601 date

Triggers

Approving a move will change the move status to requested and update with the provided move date.

MoveReject

Description

Rejecting a move will change the move status to cancelled, the move cancellation reason to rejected and update with the provided rejection reason.

Attributes

  • rebook - Indicates if the move should be automatically rebooked in 7 days time (boolean)
  • cancellation_reason_comment - Optional comment explaining why the move was cancelled
  • rejection_reason - The reason the move has been rejected

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
        "rejection_reason": "no_space_at_receiving_prison",
        "cancellation_reason_comment": "It was a mistake",
        "rebook": false
      },
      "event_type": "MoveReject"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "db6a65c8-4385-4d17-afcd-767d06529a61"
        }
      }
    }
  }
}

Validations

  • rejection_reason - presence, one of no_space_at_receiving_prison, no_transport_available

Triggers

Rejecting a move will change the move status to cancelled, the move cancellation reason to rejected and update with the provided rejection reason.

MoveCancel

Description

Cancelling a move will change the move status to be cancelled.

Move events do not alter the child journeys associated with the move: additional API calls may be necessary to complete or cancel existing journeys.

Attributes

  • cancellation_reason - The reason the move has been cancelled
  • cancellation_reason_comment - Optional comment explaining why the move was cancelled

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
        "cancellation_reason": "made_in_error",
        "cancellation_reason_comment": "It was a mistake"
      },
      "event_type": "MoveCancel"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "a3d77087-6ede-4805-9488-8ebdaa58cbd7"
        }
      }
    }
  }
}

Validations

  • cancellation_reason - presence, one of made_in_error, supplier_declined_to_move, cancelled_by_pmu, rejected, other

Triggers

Cancelling a move will change the move status to be cancelled.

Move events do not alter the child journeys associated with the move: additional API calls may be necessary to complete or cancel existing journeys.

MoveStart

Description

Starting a move will change the move status from booked to in_transit.

The event indicates the vehicle has begun to move. NB: This event occurs after the vehicle has been loaded and is ready to exit but before the vehicle has exited through the outer gate. A Move / Journey should not be started in the case where a vehicle moves to reposition itself at the pick up location.

Attributes

Common attributes, only

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:28+00:00",
      "recorded_at": "2020-12-03T10:51:28+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveStart"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "ce0f04c6-5b10-4978-b7e3-49e616ea20e2"
        }
      }
    }
  }
}

Validations

Common validations, only

Triggers

Starting a move will change the move status from booked to in_transit.

A move should only be started when the Escorting Escort Vehicle is loaded and ready for exit from the Designated Location.

MoveRedirect

Description

Redirecting a move changes the move's to_location.

Move events do not alter the child journeys associated with the move: additional API calls may be necessary to complete or cancel existing journeys.

Attributes

  • to_location - The location that the move is being redirected to.
  • move_type - Indicates the type of move, e.g. prison transfer or court appearance (optional)
  • reason - Indicates the reason for the redirect (optional)

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:28+00:00",
      "recorded_at": "2020-12-03T10:51:28+00:00",
      "notes": "Additional information about this event",
      "details": {
        "reason": "no_space",
        "move_type": "court_appearance"
      },
      "event_type": "MoveRedirect"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "ca3e5f7c-1592-4256-8953-218cea2e98df"
        }
      },
      "to_location": {
        "data": {
          "id": "0459732f-0794-4807-b345-36a490224efe",
          "type": "locations"
        }
      }
    }
  }
}

Validations

  • to_location - presence, is an existing location identifier
  • reason - optional, one of no_space, serious_incident, covid, receiving_prison_request, force_majeure or other
  • move_type - optional, one of court_appearance, court_other, hospital, police_transfer, prison_recall, prison_remand, prison_transfer or video_remand

Triggers

Sets the move_type on the move

Sets the to_location on the move

MoveComplete

Description

Completing a move will change the move status to completed. NB: Suppliers must complete Moves when the person has been handed over to staff at the final move destination (drop-off) designated location

Move events do not alter the child journeys associated with the move: additional API calls may be necessary to complete or cancel existing journeys.

Attributes

Common attributes, only

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:30+00:00",
      "recorded_at": "2020-12-03T10:51:30+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveComplete"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "95e6d8c0-9339-4ca9-b721-d8abc57d8b46"
        }
      }
    }
  }
}

Validations

Common validations, only

Triggers

Updates the move status to completed

MoveLockout

Description

Recording a lockout event does not change the moves status. After recording the lockout, if (with the agreement of the Authority) the move has a new final destination, then the move should be redirected to the new destination. If the final destination is unaltered, then the move should not be redirected.

Move events do not alter the child journeys associated with the move: additional API calls may be necessary to complete or cancel existing journeys.

Attributes

  • from_location - The location that the vehicle was locked out from.
  • reason - The reason for the lockout.
  • authorised_by - The authoriser of the creation of this lockout event.
  • authorised_at - The date time of the the authoriser authorised the lockout event.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:30+00:00",
      "recorded_at": "2020-12-03T10:51:30+00:00",
      "notes": "Additional information about this event",
      "details": {
        "reason": "no_space",
        "authorised_at": "2020-12-03T10:51:30+00:00",
        "authorised_by": "PMU"
      },
      "event_type": "MoveLockout"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "1e33a1a7-cb08-454d-9f53-df900842f7ed"
        }
      },
      "from_location": {
        "data": {
          "id": "deb9ae4c-39f4-40ab-a1a7-2a88bd7fbad4",
          "type": "locations"
        }
      }
    }
  }
}

Validations

  • from_location - presence, is an existing location identifier
  • reason - optional, one of no_space, unachievable_redirection, late_sitting_court, unavailable_resource_vehicle_or_staff, traffic_issues, mechanical_or_other_vehicle_failure, ineffective_route_planning, unachievable_ptr_request, other
  • authorised_at - optional, iso8601 date time
  • authorised_by - presence, one of PMU, CDM, Other

Triggers

None

MoveLodgingStart

Description

Indicates when a lodging was started and at which location.

Recording a lodging event does not change the move's state and is purely an auditing event.

The common occurred_at field is used to indicate the start of the lodging.

Attributes

  • location - The location of the lodging
  • reason - The reason for the lodging

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:30+00:00",
      "recorded_at": "2020-12-03T10:51:30+00:00",
      "notes": "Additional information about this event",
      "details": {
        "reason": "overnight_lodging"
      },
      "event_type": "MoveLodgingStart"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "7712fe99-dd51-4a7f-897d-b13dde4016de"
        }
      },
      "location": {
        "data": {
          "id": "6f807f8e-be9e-4b19-96cb-5f52d9f96230",
          "type": "locations"
        }
      }
    }
  }
}

Validations

  • location - presence, is an existing location identifier
  • reason - presence, one of overnight_lodging, lockout, operation_hmcts, court_cells, operation_tornado, operation_safeguard, other

Triggers

None

MoveLodgingEnd

Indicates when a lodging ended at a given location.

Recording a lodging event does not change the move's state and is purely an auditing event.

The common occurred_at field is used to indicate the end of the lodging.

Description

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveLodgingEnd"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "189753a8-3539-4184-bc56-ed36d983d43c"
        }
      },
      "location": {
        "data": {
          "id": "752b83ce-1da7-4fff-9a8b-6696250b2736",
          "type": "locations"
        }
      }
    }
  }
}

Attributes

  • location - The location of the lodging

Validations

  • location - presence, is an existing location identifier

Triggers

MoveNotifySupplierOfMoveRequest

Description

Attributes

Request Example

Validations

Triggers

MoveOperationSafeguard

Description

The procedure the Authority has in place to manage the detention of Prisoners when prison operational capacity is reached. The Supplier may be required to provide Escort Vehicles and Supplier Personnel for the movement of Prisoners between Courts and Police Premises, and between Police Premises and Prisons when so notified by PMU.

Attributes

  • authorised_by - The authoriser of the creation of this safeguard event.
  • authorised_at - The date time of the the authoriser authorised the safeguard event.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
        "authorised_at": "2020-12-03T10:51:29+00:00",
        "authorised_by": "PMU"
      },
      "event_type": "MoveOperationSafeguard"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "d08055f2-cfef-422a-91e5-822a59704866"
        }
      }
    }
  }
}

Validations

  • authorised_at - optional, iso8601 date time
  • authorised_by - presence, one of PMU, CDM, Other

Triggers

None

MoveOperationTornado

Description

The procedure the Authority has in place to decant detained Prisoners where prisons suddenly need to be vacated as a result of fire, breakdown of infrastructure, loss of accommodation or transfer Prisoners to maintain order and control.

Attributes

  • authorised_by - The authoriser of the creation of this safeguard event.
  • authorised_at - The date time of the the authoriser authorised the safeguard event.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:30+00:00",
      "recorded_at": "2020-12-03T10:51:30+00:00",
      "notes": "Additional information about this event",
      "details": {
        "authorised_at": "2020-12-03T10:51:30+00:00",
        "authorised_by": "PMU"
      },
      "event_type": "MoveOperationTornado"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "69b3da08-cb09-42a1-8f0a-ac9ee4a4a6d2"
        }
      }
    }
  }
}

Validations

  • authorised_at - optional, iso8601 date time
  • authorised_by - presence, one of PMU, CDM, Other

Triggers

None

MoveOperationHmcts

Description

Formal arrangement for the utilisation of HMCTS Courthouse cells ("HMCTS Court Cells") to accommodate Prisoners overnight Monday to Friday, and Saturday afternoon through to Monday morning, when Operation Safeguard has reached its operational capacity.

Attributes

  • authorised_by - The authoriser of the creation of this HMCTS event.
  • authorised_at - The date time of the the authoriser authorised the HMCTS event.
  • court_cell_number - The unique cell number that indicates where the person is staying during HMCTS.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
        "authorised_at": "2020-12-03T10:51:29+00:00",
        "authorised_by": "PMU",
        "court_cell_number": "6b"
      },
      "event_type": "MoveOperationHmcts"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "83f4379b-f77f-428c-ba81-fe94bc27e5bc"
        }
      }
    }
  }
}

Validations

  • authorised_at - optional, iso8601 date time
  • authorised_by - presence, one of PMU, CDM, Other

Triggers

None

MoveNotifyPremisesOfExpectedCollectionTime

Description

Supplier provides estimated collection time to the designated pick up location.

The common occurred_at field should be used to indicate when the notification was sent to the supplier.

Use expected_at to indicate when the vehicle is expected to arrive at the collection premises

Attributes

  • expected_at - A date time indicating when the vehicle is expected to arrive at the collection premises.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:30+00:00",
      "recorded_at": "2020-12-03T10:51:30+00:00",
      "notes": "Additional information about this event",
      "details": {
        "expected_at": "2020-06-16T10:20:30+01:00"
      },
      "event_type": "MoveNotifyPremisesOfExpectedCollectionTime"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "46edd570-ade0-4686-9506-0e0e394a735e"
        }
      }
    }
  }
}

Validations

  • expected_at - presence, iso8601 datetime

Triggers

None

MoveNotifyPremisesOfEta

Description

An Estimated Time of Arrival (ETA) MoveNotifyPremisesOfEta event will be provided by the supplier at the start of a journey.

A new MoveNotifyPremisesOfEta event will be sent by the supplier if the ETA changes by more than (+/-) 5 minutes.

The common occurred_at field should be used to indicate when the notification was sent to the supplier.

Use expected_at to indicate when the vehicle is expected to arrive at the arrival premises

Attributes

  • expected_at - A date time indicating when the vehicle is expected to arrive at the premises.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:28+00:00",
      "recorded_at": "2020-12-03T10:51:28+00:00",
      "notes": "Expecting some traffic on M6",
      "details": {
        "expected_at": "2020-12-03T12:20:30+00:00"
      },
      "event_type": "MoveNotifyPremisesOfEta"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "e2b37d20-0c80-44d3-beeb-91337deda52d"
        }
      }
    }
  }
}

Validations

  • expected_at - presence, iso8601 datetime

Triggers

None

MoveNotifyPremisesOfArrivalIn30Mins

Description

If a journey is expected to take 30 minutes or more at any point whilst still in transit, at the 30 minutes to arrival mark a "30 minutes to arrival" MoveNotifyPremisesOfArrivalIn30Mins event will need to be sent by the supplier to the Book a Secure Move API.

Where there are delays en route the supplier will send a new 30 minutes to arrival event when they reach the latest 30 minutes to arrival mark.

The common occurred_at field should be used to indicate when the notification was sent to the supplier.

Attributes

Common attributes, only

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveNotifyPremisesOfArrivalIn30Mins"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "088f40bc-16f4-4beb-932b-483010e01cc0"
        }
      }
    }
  }
}

Validations

Common validations, only

Triggers

None

MoveCollectionByEscort

Description

Indicates the time that the person is handed over to the custody of the supplier as signed for on the PER.

The common occurred_at field is used to indicate when the custody handover occurred.

Attributes

  • vehicle_type - Indicates the type of the vehicle used for the escort

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
        "vehicle_type": "pro_cab"
      },
      "event_type": "MoveCollectionByEscort"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "1f94d5bc-d8d7-4e6a-807f-212ed64bb975"
        }
      }
    }
  }
}

Validations

  • vehicle_type - presence, one of c4, pro_cab, mpv, 2_cell, 3_cell, 6_cell, 12_cell

Triggers

None

MoveCrossSupplierDropOff

Description

As a sending supplier handing over custody of a person during a move to another supplier, this event captures the moment when the person was dropped off to the new supplier.

Attributes

Common attributes, only.

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:28+00:00",
      "recorded_at": "2020-12-03T10:51:28+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveCrossSupplierDropOff"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "f0223880-f53d-4cab-84fb-94d964bd758c"
        }
      }
    }
  }
}

Validations

Common validations, only.

Triggers

None

MoveCrossSupplierPickUp

Description

As a receiving supplier receiving a handover of custody of a person during a move from another supplier, this event captures the moment the receiving supplier received custody of the person being handed over.

Use the previous_move relationship to tie this event and its move to the move record attached to the previous supplier.

Attributes

  • previous_move

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
      },
      "event_type": "MoveCrossSupplierPickUp"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "30256e9a-b81d-4c78-b939-f0f0437ebff7"
        }
      },
      "previous_move": {
        "data": {
          "id": "f8b042a9-96ed-4e08-8cf4-25c089fd095e",
          "type": "locations"
        }
      }
    }
  }
}

Validations

  • previous_move - presence, must exist in PECs database

Triggers

None

PersonMoveBookedIntoReceivingEstablishment

Description

NB: this event is for Court to Prison moves only

Indicates the time a person was booked into the receiving prison from a court: i.e. when the supplier informs the receiving prison of an incoming person (person booked into receiving establishment) - this is sent prior to the person being moved.

(Adults) Where unavailable CDI to fall back on the latest time the person was returned to the court custody area from the court dock.

Attributes

  • supplier_personnel_number - Supplier personnel indicator that indicates the representative from the supplier
  • location - The receiving establishment location

Request Example

POST /api/events

{
  "data": {
    "type": "events",
    "attributes": {
      "occurred_at": "2020-12-03T10:51:29+00:00",
      "recorded_at": "2020-12-03T10:51:29+00:00",
      "notes": "Additional information about this event",
      "details": {
        "supplier_personnel_number": "dd8b1f8a-45dd-4bdc-8a5c-2a124b676b8c"
      },
      "event_type": "PersonMoveBookedIntoReceivingEstablishment"
    },
    "relationships": {
      "eventable": {
        "data": {
          "type": "moves",
          "id": "2dcbca4e-702f-47a8-bbe5-2ca50edb32c8"
        }
      },
      "location": {
        "data": {
          "id": "3f7d60e0-c2a2-4547-a79f-3d1e16bd8cfa",
          "type": "locations"
        }
      }
    }
  }
}

Validations

  • supplier_personnel_number - presence
  • location - presence, is an existing location identifier

Triggers

None

Clone this wiki locally