Skip to content

Data Model

calServer uses a MySQL database with a multi-tenant structure. Database separation is implemented per tenant at the database level -- each tenant works with its own database instance. This section describes the central entities and their relationships.

Inventory

The inventory table is the central entity. It stores all test and measurement equipment.

Aspect Description
Model FrontendInventory
Primary Key Inventory ID
Fields Dynamically configurable via field management (I-series: I4201 to I4262)
Relationships 1:n to calibrations, maintenance, bookings, DMS documents
Categories Assignment via FrontendCategory / FrontendCategoryItem
Types Device types via FrontendTypes
Hierarchy Parent-child relationships via a path field

Fields I4201 to I4262 are assigned labels, types, and validation rules at runtime via the field configuration (field_configuration). See Field Constants for their use as placeholders.

Calibrations

Calibration processes are linked to inventory and contain measurement results.

Aspect Description
Model FrontendCalibration
Fields Dynamically configurable (C-series: C2301 to C2396)
Relationships n:1 to inventory, 1:n to results (FrontendResults), n:m to standards (FrontendStandards)
Results FrontendResults / FrontendResultsRaw -- measurement values and raw data
Procedures FrontendProcedure -- calibration procedures with steps (FrontendTestStep)
Procedure Templates FrontendProcedureTemplate -- reusable templates

Customers

Aspect Description
Model FrontendCustomer / FrontendContact
Description Customer master data with contact persons
Relationships 1:n to inventories (customer devices), 1:n to orders

Orders/Bookings

Aspect Description
Model FrontendBooking
Description Calibration orders with status tracking
Articles FrontendArticle / FrontendStandardArticle -- order line items and article master data
Prices FrontendPrices / FrontendPriceCategory -- price lists and price groups

Maintenance and Repairs

Aspect Description
Model FrontendRepair
Description Maintenance and repair processes for inventory items
Categories Separate category assignment

Rental Equipment

Aspect Description
Model FrontendBooking (type: rental)
Locations FrontendLocation -- location management for rental equipment

Document Management (DMS)

Aspect Description
Model FrontendDms / FrontendInbox
Description Versioned document management with inbox folder
Storage Local file system, FTP, SFTP, or DigitalOcean Spaces
Linking Documents are linked to inventories, calibrations, or orders

Users and Permissions

Aspect Description
Model FrontendUser / FrontendProfile
API Keys FrontendUserKey -- authentication keys for the REST API
RBAC Database-based access control via KCDbAuthManager with roles and operations
Groups User groups and release groups for data access control
Audit FrontendAudit / FrontendPasswordAudit -- logging of changes and password history

Status

Aspect Description
Model FrontendStatus / FrontendMapStatus
Description Configurable status system for inventories, calibrations, bookings, repairs, locations, and support tickets
Status Types Defined in constants.php: inventory, calibration, booking, notepad, repair, location, support_tickets
Automation Rule-based status changes via the status CLI command

Field Configuration

Aspect Description
Table field_configuration
Description Dynamic field definition for inventory and calibration fields
Field Types Text (various lengths), TextArea, YesNo, Tags, Parameter, Date, Time, DateTime, Decimal, Integer, Link, HtmlEditor, CounterField, AverageValue
Categories RequiredDatabase, RequiredList, PickDatabase, PickList, StatusDatabase

The field configuration allows administrators to adapt the data structure to their laboratory's requirements without code changes.

Reports and Certificates

Aspect Description
Templates JasperReports templates (.jrxml) under httpdocs/reports/
Directories calibrations, inventories, orders, locations, email_sender, individual_delivery, information
DCC Digital Calibration Certificates are generated from calibration data as XML (see DCC Export)

Email System

Aspect Description
Configuration Mailer actions with intervals (day, week, month, year)
Templates Configurable email templates with placeholders ([EMAIL], [NAME], [DOMAIN], etc.)
Queue Two-stage: mailer creates entries, sendemailqueue sends them

Additional Entities

Entity Model Description
Tasks FrontendNotepad / FrontendNotepadResource Task management with resource assignment
Physical Quantities FrontendPhysicalQuantity Physical quantities and SI prefixes (FrontendSiPrefix)
Specifications FrontendSpecification / FrontendSpecificationDetail Specifications for device types
Quality Checks FrontendQualityProvision / FrontendQualityProvisionDetail Quality assurance procedures
Signatures FrontendSignature Digital signatures
Statistics FrontendFilterStatistic Saved filter statistics
Synchronization FrontendInventorySync / FrontendMssqlSyncLog Data synchronization with external systems
Cookies FrontendCookieCategory / FrontendCookieItem Cookie consent management
Login Security FrontendLoginSecurity Failed login attempts and lockouts

Migrations

Database schema changes are managed via Yii migrations (httpdocs/protected/migrations/). The migration command is:

./yiic migrate

Migration files follow the naming pattern mYYMMDD_HHMMSS_description.php.