Data Models 🚧
🚧 Roadmap Item - Data models provide reusable, hierarchical data structures for industrial assets and processes.
Data models define the structure and schema of your industrial data. They act as reusable templates that can be instantiated across multiple assets, ensuring consistency and enabling powerful sub-model composition.
Overview
Data models are stored in the datamodels:
configuration section and define the logical structure of your data without specifying where it comes from or where it goes. They focus purely on the "what" - what fields exist, their types, and how they're organized.
Structure Elements
Data models support three types of structural elements:
Fields
Fields represent actual data points and always contain a type:
specification:
Field Properties:
constraints
: Optional validation rules (unit, min, max, allowed values)
Folders
Folders organize related fields without containing data themselves. They have no type:
or _model:
properties:
Folders create hierarchical organization in your UNS topics:
Sub-Models
Sub-models enable composition by referencing other data models. They contain a _model:
property:
This includes all fields from the referenced model:
Payload Shapes
Payload shapes define the JSON schema for field values. UMH Core includes built-in shapes:
Timeseries (Default)
The default payload shape for sensor data:
Example payload:
Binary Blob
For file data or binary content:
Custom Payload Shapes
You can define custom shapes for complex data:
Complete Examples
Simple Model
Complex Model with Sub-Models
Validation Rules
Data models support various constraint types:
Numeric Constraints
Enumerated Values
Boolean Constraints
Units and Metadata
Best Practices
Model Organization
Keep models focused: Each model should represent a single logical entity
Use sub-models for reusability: Common components like motors, sensors
Version models explicitly: Always specify version numbers
Use descriptive naming: Clear, self-documenting field names
Field Naming
Use snake_case:
total_power
, nottotalPower
orTotal-Power
Be specific:
temperature_inlet
vs. justtemperature
Include units in names when helpful:
temperature_c
,pressure_kpa
Folder Structure
Group related fields: All diagnostics under
diagnostics/
Avoid deep nesting: Keep hierarchy manageable (2-3 levels max)
Use logical grouping: By function, not by data source
Sub-Model Usage
Create reusable components: Common equipment types
Version sub-models independently: Allow evolution of components
Document dependencies: Clear which models depend on others
Schema Registry Integration
All data models are automatically registered in the Redpanda Schema Registry at boot time, enabling:
Runtime validation: Messages are validated against schemas
Schema evolution: Controlled versioning and compatibility
Cross-system consistency: Shared schema definitions
Related Documentation
Last updated