Skip to content

Move events

William Fish edited this page Oct 1, 2020 · 36 revisions

Move events

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

MoveAccept

Description

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

Attributes

None

Request Example

POST /api/events

 {
   "data": {
     "type": "events",
     "attributes": {
       "event_type": "MoveAccept",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": ""
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
     }
   }
 }

Validations

None

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": {
       "event_type": "MoveApprove",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "date": "2020-05-17",
       "create_in_nomis": "true",
       "notes": ""
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
     }
   }
 }

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

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

Request Example

 {
   "data": {
     "type": "events",
     "attributes": {
       "event_type": "MoveReject",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "There was no space at the prison",
       "details": {
         "rejection_reason": "no_space_at_receiving_prison",
         "rebook": true,
         "cancellation_reason_comment": "There was no space at the prison"
       }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
     }
   }
 }

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": {
      "event_type": "MoveCancel",
      "occurred_at": "2020-06-16T10:20:30+01:00",
      "recorded_at": "2020-06-16T10:20:30+01:00",
      "notes": "",
      "details": {
        "cancellation_reason": "made_in_error",
        "cancellation_reason_comment": "Administrative error"
      }
    },
    "relationships": {
      "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
    }
  }
 }

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.

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

Attributes

None

Request Example

 {
  "data": {
    "type": "events",
    "attributes": {
      "event_type": "MoveStart",
      "occurred_at": "2020-06-16T10:20:30+01:00",
      "recorded_at": "2020-06-16T10:20:30+01:00",
      "notes": ""
    },
    "relationships": {
      "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
    }
  }
 }

Validations

None

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)

Request Example

 {
   "data": {
     "type": "events",
     "attributes": {
       "event_type": "MoveRedirect",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "",
       "details": { "move_type": "court_appearance" }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
       "to_location": { "type": "location", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
     }
   }
 }

Validations

to_location - presence, is an existing location identifier

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.

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

None

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "event_type": "MoveComplete",
      "occurred_at": "2020-06-16T10:20:30+01:00",
      "recorded_at": "2020-06-16T10:20:30+01:00",
      "notes": ""
    },
    "relationships": {
      "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
    }
  }
}

Validations

None

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": {
       "event_type": "MoveLockout",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "There was no space at the designated location so we locked out.",
       "details": {
         "reason": "no_space",
         "authorised_at": "2020-06-16T10:20:30+01:00",
         "authorised_by": "PMU",
       }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
       "from_location": { "type": "location", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
     }
   }
 }

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": {
       "event_type": "MoveLodgingStart",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "",
       "details": {
         "reason": "lockout"
       }
     },
     "relationships": {
       "eventable": { "type": "journey", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
       "location": { "type": "locations", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
     }
   }
 }

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": {
       "event_type": "MoveLodgingEnd",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": ""
     },
     "relationships": {
       "eventable": { "type": "journey", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
       "location": { "type": "locations", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
     }
   }
 }

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": {
       "event_type": "MoveOperationSafeguard",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "",
       "details": {
         "reason": "no_space",
         "authorised_at": "2020-06-16T10:20:30+01:00",
         "authorised_by": "PMU",
       }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
     }
   }
 }

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": {
       "event_type": "MoveOperationTornado",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "",
       "details": {
         "authorised_at": "2020-06-16T10:20:30+01:00",
         "authorised_by": "PMU"
       }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
     }
   }
 }

Validations

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

Triggers

None

MoveOperationHMCTS

Description

Attributes

Request Example

Validations

Triggers

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": {
       "event_type": "MoveNotifyPremisesOfEta",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "No traffic.",
       "details": {
         "expected_at": "2020-06-16T10:20:30+01:00"
       }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
     }
   }
 }

Validations

expected_at - presence, iso8601 datetime

Triggers

None

MoveNotifyPremisesOfEta

Description

Supplier notifies the relevant premises of the expected time of arrival

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": {
       "event_type": "MoveNotifyPremisesOfEta",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "Arriving in 30 minutes",
       "details": {
         "expected_at": "2020-06-16T10:20:30+01:00"
       }
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
     }
   }
 }

Validations

expected_at - presence, iso8601 datetime

Triggers

None

MoveNotifyPremisesOfArrivalIn30Mins

Description

Supplier notified the relevant premises 30 mins before arrival time

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

Attributes

None

Request Example

 {
   "data": {
     "type": "events",
     "attributes": {
       "event_type": "MoveNotifyPremisesOfArrivalIn30Mins",
       "occurred_at": "2020-06-16T10:20:30+01:00",
       "recorded_at": "2020-06-16T10:20:30+01:00",
       "notes": "Arriving in 30 minutes"
     },
     "relationships": {
       "eventable": { "type": "moves", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" },
     }
   }
 }

Validations

None

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 being escort

Request Example

{
  "data": {
    "type": "events",
    "attributes": {
      "event_type": "MoveCollectionByEscort",
      "occurred_at": "2020-06-16T10:20:30+01:00",
      "recorded_at": "2020-06-16T10:20:30+01:00",
      "notes": "",
      "details": {
        "vehicle_type": "mpv"
      }
    },
    "relationships": {
      "eventable": { "type": "move", "id": "0003a13f-a6e4-4b33-aa57-60c172f993e7" }
    }
  }
}

Validations

vehicle_type - presence, one of cellular, mpv, other

Triggers

None

Clone this wiki locally