Absences

An absence from the care home for a service user.

The absence object

Attributes

  • _id
    string

    A unique Id for the absence.

  • created
    string

    The date/time the absense was created.

  • ends
    string

    The date/time the service user is returning.

  • location
    string

    The Id of the location the service user is absent from.

  • modified
    string

    The date/time the absense was modified.

  • notes
    string

    Any additional information about the absence.

  • reason_for_absence
    string
  • service_user
    string

    The service user the absence relates to.

  • starts
    string

    The date/time the service user is leaving.

  • with_family_or_friend
    boolean

    Flag indicating if the service user is being accompanied by a family member of friend.

  • with_other
    string

    Any other persons the service user is accompanied by.

  • with_staff
    boolean

    Flag indicating if the service user is being accompanied by a staff member.

The absence object
{
    "_id": "66bfb4d09ab4e3d6eb735eea",
    "created": "2024-08-16 20:21:36",
    "ends": "2024-08-23 18:00:00",
    "location": "66bfb4bb9ab4e3d6eb734900",
    "modified": "2024-08-16 20:21:36",
    "notes": "Daughter is taking Anna to a dentist appointment.",
    "reason_for_absence": "66bfb4bb9ab4e3d6eb73481e",
    "service_user": "66bfb4c09ab4e3d6eb735790",
    "starts": "2024-08-23 15:00:00",
    "with_family_or_friend": true,
    "with_other": "",
    "with_staff": false
}

List all absences

Return a list of absences for service users.

Parameters

  • attributes
    optional
    default ['_id']

    A list of attributes to include for fetched objects.

  • filters-end_date
    optional

    A filter that accepts a date and filters absences to those before or on the end date.

  • filters-ids
    optional

    A filter that accepts a list of Ids and filters the items returned to those with an Id in the list.

  • filters-location
    optional

    A filter that accepts a list of location Ids and filters absences by the location the service user is absent from.

  • filters-modified_after
    optional

    A filter that accepts a date/time and filters the items returned to those modified after the date/time.

  • filters-modified_before
    optional

    A filter that accepts a date/time and filters the items returned to those modified before the date/time.

  • filters-q
    optional

    A case insensitive keyword filter applied to the following fields; notes.

  • filters-reason_for_absence
    optional

    A filter that accepts a list of group Ids and filters absences by the reason for the absence.

  • filters-service_user
    optional

    A filter that accepts a list of service user Ids and filters absences by the service user who is absent.

  • filters-start_date
    optional

    A filter that accepts a date and filters absences to those after or on the start date.

  • page
    optional
    default 1

    The page number to fetch.

  • per_page
    optional
    default 10

    The number of items to return per page.

  • sort_by
    optional
    default _id

    A list of fields the returned items can be sorted by. Fields prefixed with minus (-) sign are sorted in descending order.

    • _id
    • created
    • modified

Response

Returns a page of absences.

GET
/v1/absences
var absences = apiClient.Request(
    HttpMethod.Get,
    "absences",
    new MultiValueDict()
        .Add("attributes", "ends", "notes", "reason_for_absence", "starts"),
        .Add("filters-service_user", serviceUserId)
);
<?php

$absences = $api_client->request(
    'GET',
    'absences',
    [
        'attributes'=>['ends', 'notes', 'reason_for_absence', 'starts'],
        'filters-service_user'=>[$service_user_id]
    ]
);
absences = api_client(
    'GET',
    'absences',
    params={
        'attributes': ['ends', 'notes', 'reason_for_absence', 'starts'],
        'filters-service_user': [service_user_id]
    }
)
absences = api_client.request(
    'GET',
    'absences',
    params: {
        'attributes'=>['ends', 'notes', 'reason_for_absence', 'starts'],
        'filters-service_user' => [$service_user_id]
    }
)
Response
{
    "item_count": 1,
    "items": [
        {
            "_id": "66bfb4d09ab4e3d6eb735eea",
            "ends": "2024-08-23 18:00:00",
            "notes": "Daughter is taking Anna to a dentist appointment.",
            "reason_for_absence": "66bfb4bb9ab4e3d6eb73481e",
            "starts": "2024-08-23 15:00:00"
        }
    ],
    "page": 1,
    "page_count": 1,
    "per_page": 10
}

Retrieve an absence

Retrieve an absence object.

Response

Returns an absence object.

GET
/v1/absences/<absence_id>
var absence = apiClient.Request(HttpMethod.Get, $"absences/{absenceId}");
<?php

$absence = $api_client->request('GET', 'absences/' . $absence_id);
absence = api_client('GET', f'absences/{absence_id}')
absence = api_client.request('GET', "absences/#{absence_id}")
Response
{
    "_id": "66bfb4d09ab4e3d6eb735eea",
    "created": "2024-08-16 20:21:36",
    "ends": "2024-08-23 18:00:00",
    "location": "66bfb4bb9ab4e3d6eb734900",
    "modified": "2024-08-16 20:21:36",
    "notes": "Daughter is taking Anna to a dentist appointment.",
    "reason_for_absence": "66bfb4bb9ab4e3d6eb73481e",
    "service_user": "66bfb4c09ab4e3d6eb735790",
    "starts": "2024-08-23 15:00:00",
    "with_family_or_friend": true,
    "with_other": "",
    "with_staff": false
}