Edit Page

Create work calendars

This guide shows you how to create a work calendar using the Rhize GraphQL API. As a calendar has associations with multiple other entities, the process involves a series of mutations to create associated data.

To learn how work calendars work, read About work calendars.

Prerequisites

To use the work calendar service, ensure you have the following:

Procedure

In short, the procedure works as follows:

  1. Add equipment that follows some hierarchy.
  2. Add hierarchy scopes for the calendar rules. These scopes should map to the equipment hierarchy.
  3. Add work calendar definitions.

You can add these objects in the UI or through the GraphQL API. The following sections provide the requirements for each of these entities and examples of a mutation to create them.

Diagram of relationship between three configurations
The calendar service uses the relationships between equipment, hierarchy scope, and work calendars.

Add equipment

The first step is to add an equipment hierarchy.

Requirements.

  • For an equipment calendar state to be recorded, it must have an active version.

Example

This mutation adds multiple items of equipment in a batch. Note that some items, such as Equipment A, Equipment B, and Equipment C, have links to child equipment, as expressed in the isMadeUpOf property. These relationships express the equipment hierarchy.

Add Hierarchy scope

The hierarchy scope establishes the calendar hierarchy that the Rhize calendar service uses to establish calendar precedence.

Requirements. A calendar hierarchy scope must have the following properties.

  • A time zone.
  • An ID that starts with the prefix WorkCalendar_

To associate equipment with the hierarchy scope, add the equipment items to the equipmentHierarchy. To create levels of calendar scope, add children, each of which can link to equipment.

Example

This example adds a work-calendar hierarchy, WorkCalendar_PSDT, with associated children scopes. The scope and its children link to equipment created in the previous step through equipmentHierarchy.

Create work calendar definition

After you have created equipment and hierarchy scopes, create a workCalendarDefinition. The calendar service reads the entries to create records of machine states.

Requirements: The work calendar definition must have the following:

  • An associated work calendar
  • A label. Note that Rhize uses the to label to configure overrides.
  • At least one entry that has at least these properties:
    • Start date
    • type (one of: PlannedDowntime, PlannedShutdown, and PlannedBusyTime).
    • A recurrence time interval in the representation defined by the ISO 8601 standard

You can optionally add properties to each entry to add additional context and information.

Naming conventions

  • When you name the ID, the recommended convention is {CalendarDefinition.Label}.{HierarchyScope.id}. This convention helps readers quickly understand which scopes and equipment its entries affect.

Example

This addWorkCalendarDefinition mutation adds entries for planned downtime and shutdown time. Note that the calendar definitions link to a hierarchy scope defined in the previous step.