📊 User Preference Entity

Stores user-specific preferences and historical interaction data to personalize activity suggestions.

core 🔑 Primary Key: user_id

📈 Entity Statistics

📋 Attributes

5

2 required, 2 unique

🔍 Indexes

2

Database performance indexes

✅ Validations

2

Data integrity rules

⚡ Operations

4

Allowed CRUD operations

📝 Entity Overview

The User Preference entity enables the platform to deliver highly personalized activity suggestions by capturing individual user interests, past activity history, and motivational factors. This personalization increases user engagement and satisfaction, helping to overcome barriers such as decision paralysis. By adapting suggestions to user-specific contexts, the platform fosters sustained physical activity habits, contributing to improved health outcomes and user retention.

Developing the User Preference entity involves managing user data securely and integrating with the user-preferences-service for CRUD operations. The entity requires validation to ensure data quality and must support efficient querying to enable real-time personalization by the activity-suggestion-engine. Coordination with privacy and security teams is essential to comply with GDPR. The entity's design must accommodate evolving user data and support scalable storage within the activity-data-repository.

Technically, the User Preference entity is stored in a relational database within the activity-data-repository, with a schema optimized for quick lookups by user_id and indexed attributes like age_group. Integration with user-preferences-service handles all CRUD operations, while the activity-suggestion-engine consumes this data to tailor activity suggestions. Validation rules enforce enumerated values for fields such as age_group and motivation_level. The entity supports arrays for preferences and history, requiring careful serialization and deserialization in the service layer.

📋 Data Structure

Name Type Description Constraints
id uuid Unique identifier for user preference REQUIRED UNIQUE
user_id PK uuid Unique identifier for the user PRIMARY KEY REQUIRED UNIQUE
preferred_activity_types json List of preferred activity types or categories -
disliked_activity_types json List of activity types the user prefers to avoid -
preferred_time_of_day enum Preferred time of day for activities -

🔍 Database Indexes

idx_age_group

Columns: age_group

idx_location_preference

Columns: location_preference

✅ Validation Rules

valid_preference_type

error

Ensures preference_type is valid and recognized

Applies to: preference_type

preference_value_required

error

Preference value must be provided for each user preference

Applies to: preference_value

📐 Business Rules

user_preferences_must_be_considered_in_suggestions

always

User preferences must be used to tailor activity suggestions

user_preferences_must_be_securely_stored

create

User preferences must be stored and handled in compliance with GDPR

⚡ CRUD Operations

➕ CREATE

Allowed
Required Permissions:
useradmin
Required Fields: user_id, preference_type, preference_value

👁️ READ

Allowed
Required Permissions:
useradmin
Filterable by: user_id, preference_type

✏️ UPDATE

Allowed
Required Permissions:
useradmin
Updatable Fields: preference_value

🗑️ DELETE

Allowed
Required Permissions:
useradmin
Cascade Rules:

💾 Storage Configuration

Storage Type: relational_database
Location: activity-data-repository

🧩 Components Managing This Entity

Data service dedicated to managing user-specific preferences and settings related to activity suggestions, enabling personalized recommendation adjustments and feedback incorporation.

🔌 Interfaces

  • getUserPreferences(userId)
  • saveUserPreferences(userId, preferences)
  • updatePreferencesFromFeedback(userId, feedback)

Core service implementing the algorithm that generates personalized activity suggestions based on user context including location, season, weather, equipment availability, and user preferences. It applies rule-based logic initially with extensibility for machine learning enhancements.

🔌 Interfaces

  • generateSuggestions(userContext)
  • updateUserPreferences(userId, preferences)
  • recordActivityFeedback(userId, activityId, feedback)
  • getHistoricalActivityData(userId)
  • refreshContextualData()