Asset Attributes
Concept overview
The asset attribute system provides a flexible way to define and store custom properties for different types of assets. It consists of four main components:
- AttributeType: Defines a reusable attribute template (e.g., "Power (kW)", "Manufacturer", "Installation Date")
- AssetTypeAttribute: Links an AttributeType to an AssetType, defining whether it's required and providing default values
- AssetAttributeValue: Stores the actual attribute values for a specific Asset instance
- AttributeOption: For dropdown/select attributes, defines the available options
This system allows different asset types to have different sets of attributes while maintaining consistency across assets of the same type.
Why it matters
- Flexibility: Different asset types can have completely different attribute sets without modifying the database schema
- Type safety: Each attribute has a defined data type (Text, Integer, Decimal, DateTime, Boolean, Option) with optional validation rules
- Consistency: All assets of the same type share the same attribute definitions, ensuring uniform data collection
- Defaults: Asset types can specify default values, streamlining asset creation
- Validation: Min/max ranges for numeric and datetime attributes ensure data quality
Data types
AttributeType supports six data types:
- Text: Free-form text strings (stored in
TextValue) - Integer: Whole numbers with optional min/max validation (stored in
IntValue) - Decimal: Numbers with decimal places and optional min/max validation (stored in
DecimalValue) - DateTime: Date and time values with optional min/max validation (stored in
DateTimeValue) - Boolean: True/false values (stored in
BoolValue) - Option: Single or multi-select from predefined options (stored as
OptionIdreference)
How it works
1. Define an AttributeType
First, create an AttributeType that can be reused across multiple asset types:
var powerAttribute = new AttributeType
{
Code = "POWER_KW",
Name = "Power (kW)",
Description = "Rated power consumption in kilowatts",
DataType = AttributeDataType.Decimal,
Unit = "kW",
MinDecimal = 0,
MaxDecimal = 10000,
IsMultiValued = false
};
For dropdown/select attributes:
var manufacturerAttribute = new AttributeType
{
Code = "MANUFACTURER",
Name = "Manufacturer",
DataType = AttributeDataType.Option,
IsMultiValued = false,
Options = new List<AttributeOption>
{
new() { Value = "ABB", DisplayName = "ABB", SortOrder = 1 },
new() { Value = "SIEMENS", DisplayName = "Siemens", SortOrder = 2 },
new() { Value = "GE", DisplayName = "General Electric", SortOrder = 3 }
}
};
2. Link to AssetType (AssetTypeAttribute)
When defining an AssetType, specify which attributes apply and whether they're required:
var pumpType = new AssetType { Title = "Centrifugal Pump" };
var pumpPowerAttribute = new AssetTypeAttribute
{
AssetType = pumpType,
AttributeType = powerAttribute,
IsRequired = true,
SortOrder = 1,
DefaultDecimalValue = 5.5m // Default 5.5 kW
};
var pumpManufacturerAttribute = new AssetTypeAttribute
{
AssetType = pumpType,
AttributeType = manufacturerAttribute,
IsRequired = true,
SortOrder = 2
// No default - user must select
};
3. Store values for Assets (AssetAttributeValue)
When creating or editing an Asset, store the actual attribute values:
var myPump = new Asset { Title = "Pump P-101", AssetType = pumpType };
// Store power rating
var powerValue = new AssetAttributeValue
{
Asset = myPump,
AttributeType = powerAttribute,
DecimalValue = 7.5m // This pump is rated 7.5 kW
};
// Store manufacturer selection
var manufacturerValue = new AssetAttributeValue
{
Asset = myPump,
AttributeType = manufacturerAttribute,
OptionId = abbOption.Uuid // Selected ABB
};
Key features
Multi-valued attributes
Set IsMultiValued = true on an AttributeType to allow multiple values for a single attribute. This is useful for attributes like "Certifications" or "Supported Fluids" where an asset might have multiple applicable values.
Validation rules
- Numeric ranges: Set
MinInt/MaxIntorMinDecimal/MaxDecimalto enforce valid ranges - DateTime ranges: Set
MinDateTime/MaxDateTimefor date validation (e.g., installation date must be in the past) - Required vs Optional: Use
IsRequiredon AssetTypeAttribute to make attributes mandatory
Units of measurement
The Unit field on AttributeType provides context for numeric attributes (e.g., "kW", "°C", "bar", "rpm"). This is informational and helps users understand what values to enter.
Default values
AssetTypeAttribute can specify default values for each data type:
DefaultTextValueDefaultIntValueDefaultDecimalValueDefaultBoolValueDefaultDateTimeValueDefaultOptionId
These defaults can streamline asset creation when most assets of a type share common values.
Relationships
AttributeType
├─→ AttributeOptions (many)
└─→ AssetTypeAttributes (many)
AssetType
└─→ AssetTypeAttributes (many)
└─→ AttributeType (one)
Asset
└─→ AssetAttributeValues (many)
├─→ AttributeType (one)
└─→ AttributeOption (optional, for Option type only)
First implementation
The initial implementation focuses on:
- CRUD for AttributeTypes: Admin interface to define reusable attribute templates
- AssetType configuration: When creating/editing an AssetType, specify which attributes apply and whether they're required
- Asset forms: When creating/editing an Asset, display a dynamic form with all attributes defined by its AssetType
- Type-appropriate inputs:
- Text → text input
- Integer/Decimal → numeric input with validation
- Boolean → checkbox
- DateTime → date/time picker
- Option → dropdown or radio buttons
Usage in Blueprint
Backend (API)
- AttributeType management endpoints for defining attribute templates
- AssetType configuration includes attribute assignment
- Asset create/update validates attribute values against their types and requirements
- Query assets by attribute values (e.g., "find all pumps with power > 10 kW")
Frontend (Web/Mobile)
- Admin screens for managing AttributeTypes and their options
- AssetType editor shows attribute assignment with required/optional toggles
- Asset form dynamically renders appropriate input controls based on AssetType's attributes
- Display attribute values on asset detail views
Offline support
- AttributeType and AssetTypeAttribute data synced to mobile devices
- Asset attribute values can be edited offline
- Validation rules enforced locally before sync
Example scenarios
Scenario 1: Electric Motors
AttributeType: "MOTOR_POWER"
- DataType: Decimal
- Unit: "kW"
- MinDecimal: 0.1
- MaxDecimal: 500
AttributeType: "MOTOR_SPEED"
- DataType: Integer
- Unit: "rpm"
- MinInt: 100
- MaxInt: 10000
AttributeType: "MOTOR_EFFICIENCY_CLASS"
- DataType: Option
- Options: IE1, IE2, IE3, IE4, IE5
AssetType: "Electric Motor"
- Requires: MOTOR_POWER (default: 5.5 kW)
- Requires: MOTOR_SPEED (default: 1500 rpm)
- Optional: MOTOR_EFFICIENCY_CLASS
Scenario 2: Temperature Sensors
AttributeType: "TEMP_RANGE_MIN"
- DataType: Decimal
- Unit: "°C"
AttributeType: "TEMP_RANGE_MAX"
- DataType: Decimal
- Unit: "°C"
AttributeType: "CALIBRATION_DATE"
- DataType: DateTime
AttributeType: "SENSOR_TYPE"
- DataType: Option
- Options: RTD, Thermocouple, Thermistor
AssetType: "Temperature Sensor"
- Requires: SENSOR_TYPE
- Requires: TEMP_RANGE_MIN (default: -50)
- Requires: TEMP_RANGE_MAX (default: 150)
- Optional: CALIBRATION_DATE
See also
- Asset Types - How asset types categorize assets
- Assets - The assets that these attributes describe