Shifts

class pytm4srv.models.Shift

Represents a user-defined shift.

color: Mapped[str]

User-specified color (#RRGGBB) of the shift when displayed.

days: Mapped[int]

Days on which this shift occurs.

This is a bitfield (of length 16), so multiple days can be selected by combining their values with bitwise OR.

Value

Binary

Day

0

0000 0000 0000 0000

(None)

1

0000 0000 0000 0001

Monday

2

0000 0000 0000 0010

Tuesday

4

0000 0000 0000 0100

Wednesday

8

0000 0000 0000 1000

Thursday

16

0000 0000 0001 0000

Friday

32

0000 0000 0010 0000

Saturday

64

0000 0000 0100 0000

Sunday

For example, for a shift on Monday through Thursday, the value of this field would be 15 (0000 1111), and for a shift every day, this field would be 127 (0111 1111).

end_time: Mapped[time]

Time this shift ends (always assumed to be in the configured local time zone).

id: MappedColumn object at 0x7b55cc329c60>]]

Unique, numeric ID for the shift.

ignore_preflight: Mapped[bool]

Whether to ignore preflight failures and always report machines as ready during this shift.

lights_out: Mapped[bool]

Whether this shift is automated.

machines

The list of machines that are assigned to this shift.

Clients can link or unlink machines from this shift by setting a new list of machine IDs.

name: Mapped[str]

User-specified name of the shift.

start_time: Mapped[time]

Time this shift starts (always assumed to be in the configured local time zone).

Shift notes

class pytm4srv.models.ShiftNotesSubmission

A record of shift notes being submitted by a user.

date: Mapped[date]

Date of the shift this submission is for (local time zone).

id: MappedColumn object at 0x7b55cc329c60>]]

Unique, numeric ID of this shift notes submission.

machine_id: Mapped[int]

ID of the machine shift notes were submitted for.

shift_id: Mapped[int]

ID of the shift that notes were submitted for.

timestamp: Mapped[datetime]

Timestamp of the submission.

user_id: Mapped[int]

ID of the user who submitted shift notes.

class pytm4srv.models.ShiftNotesField

A custom form field to show during shift notes entry.

archived: Mapped[bool]

Whether this field is archived.

This allows a field to be hidden when entering shift notes, but kept around to access historical data.

hint: Mapped[str]

Optional help text to display near this field.

id: MappedColumn object at 0x7b55cc329c60>]]

Unique, numeric ID of this field.

input_type: Mapped[str]

The type of input control to use for data entry.

Only the following values are supported:

Value

Description

text

A single line of text

textarea

Multiple lines of text

number

Numeric (integer or decimal) value

checkbox

Single checkbox, with the field’s name as the label

checklist

List of checkboxes (multi-selection allowed), one for each entry in options

radio

List of radio buttons (single selection only), one for each entry in options

machines

The list of machines that will display this field in their shift notes.

Clients can link or unlink this field to/from machines by setting a new list of machine IDs.

name: Mapped[str]

User-specified name for this field.

options: Mapped[List[str]]

List of available options. Only used for the checklist and radio input types.

required: Mapped[bool]

Whether this field is required (meaning submission is not allowed if the field is blank).

Input type

Validation logic

text

Any non-whitespace characters are entered

textarea

number

Any numeric value is entered

checkbox

The checkbox is checked

checklist

At least one option is selected

radio

shifts

The list of shifts that will display this field in their shift notes.

Clients can link or unlink this field to/from shifts by setting a new list of shift IDs.

class pytm4srv.models.ShiftNotesValue

A single value that was entered for a custom shift notes field.

field_id: Mapped[int]

The ID of the field this value is for.

id: MappedColumn object at 0x7b55cc329c60>]]

Unique, numeric ID of this value.

submission_id: Mapped[int]

The ID of the submission during which this value was entered.

value: Mapped[Any]

The value entered for this field.

May be any valid JSON, but will usually be: - a string for text, textarea, and radio fields - a number for number fields - a boolean for checkbox fields - an object mapping each option (at the time of submission) to a boolean for checklist fields