Skip to main content

Introduction to the Images Table

The images table is designed to store metadata for images uploaded during manufacturing processes. This table plays a crucial role in organizing and linking visual data to specific process entries and unique identifiers within the Serial system.

Table Structure

The images table is structured to efficiently manage image metadata while maintaining relationships with other key entities in the system. Here’s a detailed breakdown of its columns:
Column NameData TypeConstraintsDescription
iduuidprimary keyUnique identifier for each image entry
company_iduuidforeign key, not nullReference to the company associated with the image
process_entry_iduuidforeign key, not nullReference to the process entry associated with the image
unique_identifier_iduuidforeign key, not nullReference to the unique identifier associated with the image
file_nametextnot null, default ‘image’Name of the image file
bucket_nametextnot null, default ‘data-images’Name of the storage bucket containing the image
dataset_iduuidforeign key, not nullReference to the dataset associated with the image
created_attimestamp with time zonenot null, default now()Timestamp of when the image entry was created

Usage and Functionality

The images table is designed to be a central repository for image metadata within the Serial application. Here are some key points about its usage:
  1. Image Metadata Storage: The table stores essential information about images without containing the actual image data. This approach optimizes database performance while maintaining crucial relationships.
  2. Process and Identifier Linkage: Each image is directly linked to a specific process entry and unique identifier, allowing for precise tracking of visual data throughout the manufacturing process.
  3. Company and Dataset Organization: Images are associated with both a company and a dataset, enabling efficient organization and retrieval of visual data within the context of specific organizational units and data collections.

Notes

  • The actual image files are stored in Supabase storage, with the bucket_name column indicating the storage location.
  • Row-level security is enabled on this table, ensuring that access to image metadata is properly controlled based on user permissions and company associations.
  • Example of inserting a new image entry:
    const { data, error } = await supabase
      .from("images")
      .insert({
        company_id: "company-uuid",
        process_entry_id: "process-entry-uuid",
        unique_identifier_id: "unique-identifier-uuid",
        file_name: "example_image.jpg",
        dataset_id: "dataset-uuid",
      })
      .select();
    
  • When retrieving image data, you’ll need to combine the metadata from this table with the actual image retrieval from Supabase storage.
By leveraging the images table, the Serial application efficiently manages and organizes visual data associated with manufacturing processes, enabling seamless integration of images into the broader data collection and analysis workflow.