Skip to main content

Introduction to the Work_Instruction_Blocks Table

The work_instruction_blocks table is designed to store individual blocks of work instructions associated with process steps. This table plays a crucial role in the Serial system by providing a flexible and structured way to represent various types of instructional content, such as text, images, videos, and more.

Table Structure

The work_instruction_blocks table is structured to accommodate different types of content while maintaining relationships with processes and companies. Here’s a detailed breakdown of its columns:
Column NameData TypeConstraintsDescription
iduuidprimary keyUnique identifier for each work instruction block
company_iduuidforeign key, not nullReference to the company owning the block
process_step_iduuidforeign key, not nullReference to the associated process step
orderintegernot nullOrder of the block within the process step
typetextnot nullType of the work instruction block
file_iduuidReference to an associated file (if applicable)
contentjsonbJSON content of the block, structure varies by type
created_attimestampnot null, default now()Timestamp of block creation
dataset_ref_1uuidReference to an associated dataset (if applicable)
dataset_ref_2uuidReference to an associated dataset (if applicable)
dataset_ref_3uuidReference to an associated dataset (if applicable)
dataset_ref_4uuidReference to an associated dataset (if applicable)
dataset_ref_5uuidReference to an associated dataset (if applicable)

Usage and Functionality

The work_instruction_blocks table is designed to be flexible and extensible, accommodating various types of instructional content. Here are some key points about its usage:
  1. Block Types: The table supports multiple block types, including Heading, Text, Image, Video, PDF, File, List, Table, Callout, Code, and Delimiter. Each type has its own structure within the content JSONB field.
  2. Content Storage: The content column uses JSONB to store type-specific data. For example, a Heading block might include a ‘text’ field and a ‘level’ field, while an Image block might store ‘file_name’ and ‘height’.
  3. Ordering: The ‘order’ column ensures that blocks can be displayed in the correct sequence within a process step, allowing for a logical flow of instructions.
  4. Dataset References: The table includes five dataset reference columns, allowing blocks to be associated with up to five different datasets. This feature enables dynamic content based on dataset information.

Notes

  • The work_instruction_blocks table is closely related to the process_steps table, with each block belonging to a specific step in a process.
  • Here’s an example of how a work instruction block might be represented in TypeScript:
    interface ImageBlock extends BaseWorkInstructionBlock {
      type: WorkInstructionBlockType.Image;
      file_id: string;
      content: {
        file_name: string;
        height: number;
        caption?: string;
      };
    }
    
By leveraging the work_instruction_blocks table, the Serial application can create rich, interactive work instructions that combine various media types and data sources, enhancing the user experience in both the process builder and production environments.