Intelligent Dimension Value Suggestions
Overview
The ResolveAndSuggestSegments endpoint provides intelligent suggestions to help users complete financial dimension combinations efficiently. This document explains the improved suggestion strategy that provides meaningful assistance rather than redundant echoing of already-entered values.
Business Context
When users create journal entries or other financial transactions, they need to specify a complete dimensional combination (e.g., MainAccount + Department + CostCenter). The system should guide them through this process intelligently, providing helpful suggestions at the right moments.
Suggestion Strategies
1. Partial Match Assistance
When: User enters incomplete or invalid values
Purpose: Help complete what they're currently typing
// User types: "SA"
{
"dimension_attribute_id": "department-id",
"value": "SA",
"is_valid": false,
"suggested_values": ["SALES", "SUPPORT", "SAFETY"]
}
// User types: "110"
{
"dimension_attribute_id": "main-account-id",
"value": "110",
"is_valid": false,
"suggested_values": ["1100", "1101", "1102"]
}
2. Alternative Options for Valid Values
When: User enters valid value for commonly-changed dimensions
Purpose: Show related alternatives they might want instead
// User enters valid "SALES" but might want alternatives
{
"dimension_attribute_id": "department-id",
"value": "SALES",
"is_valid": true,
"suggested_values": ["SALES", "MARKETING", "SUPPORT", "IT"]
}
3. No Suggestions for Complete Valid Values
When: User enters complete, valid value for definitive dimensions
Purpose: Avoid UI clutter and redundancy
// User enters complete MainAccount - no suggestions needed
{
"dimension_attribute_id": "main-account-id",
"value": "1100",
"is_valid": true,
"suggested_values": [] // Empty - no need to echo back "1100"
}
Implementation Logic
Decision Tree
Key Methods
GetIntelligentSuggestionsAsync
Central orchestrator that determines which suggestion strategy to use based on:
- Validation result (valid/invalid)
- Value completeness (partial typing detection)
- Dimension type (MainAccount vs Department vs CostCenter)
IsIncompleteValue
Heuristic to detect partial entries:
private static bool IsIncompleteValue(string value)
{
// Consider values ≤2 characters as likely incomplete
return value.Length <= 2;
}
ShouldShowAlternativesForValidValue
Determines if alternatives should be shown for valid values:
private static bool ShouldShowAlternativesForValidValue(...)
{
// Show alternatives for non-MainAccount dimensions
// MainAccount is usually definitive, others might have common alternatives
return level != null && level.DimensionAttributeName != "MainAccount";
}
UX Benefits
Before (Problematic Behavior)
// User enters complete valid value
{
"value": "1100",
"is_valid": true,
"suggested_values": ["1100"] // Redundant and unhelpful
}
After (Intelligent Behavior)
// Complete valid MainAccount
{
"value": "1100",
"is_valid": true,
"suggested_values": [] // Clean UI, no clutter
}
// Partial Department entry
{
"value": "SA",
"is_valid": false,
"suggested_values": ["SALES", "SUPPORT"] // Helpful completion
}
// Valid Department with alternatives
{
"value": "SALES",
"is_valid": true,
"suggested_values": ["SALES", "MARKETING", "SUPPORT"] // Shows options
}
Future Enhancements
Contextual Suggestions
Could enhance with business logic like:
- If MainAccount is "1100" (Assets), suggest Asset-related departments
- If Department is "SALES", suggest Sales-related cost centers
Next-Step Guidance
Could add suggestions for unfilled mandatory dimensions:
{
"next_required_dimension": {
"dimension_attribute_id": "department-id",
"suggested_values": ["SALES", "MARKETING", "IT"]
}
}
Machine Learning
Could learn from user patterns:
- Most commonly used combinations
- User-specific preferences
- Contextual business rules
Testing Scenarios
Scenario 1: Partial MainAccount Entry
Input: "110"
Expected: Suggest ["1100", "1101", "1102"]
Scenario 2: Valid Complete MainAccount
Input: "1100"
Expected: No suggestions (empty array)
Scenario 3: Valid Department with Alternatives
Input: "SALES"
Expected: Suggest ["SALES", "MARKETING", "SUPPORT", "IT"]
Scenario 4: Invalid Department
Input: "INVALID"
Expected: Suggest common departments or partial matches
Architectural Alignment
This approach aligns with our Domain-Driven Design principles:
- User-Centric: Focuses on actual user needs and workflow
- Context-Aware: Uses domain knowledge about dimension types
- Performance-Optimized: Avoids unnecessary suggestions that don't add value
- Extensible: Can be enhanced with business rules and machine learning
Conclusion
The improved suggestion strategy transforms the endpoint from a simple echo mechanism into an intelligent assistant that helps users complete dimensional combinations efficiently. This addresses the core UX issue identified: don't suggest what users already know, suggest what helps them move forward.