8.1 KiB
Features → Interfaces Import Analysis
Summary
This document details all imports from features/ modules to interfaces/ modules.
Total Feature Modules: 6
Modules Importing from Interfaces: 2 (only getRootInterface - system-level function)
Total Interface Imports: 2 (both for getRootInterface only)
✅ REFACTORED: All feature modules now use services.getInterface() to access interfaces, following the same pattern as chatPlayground. Only getRootInterface() remains as a direct import (system-level function, not user-specific).
Detailed Import List
1. features/featuresLifecycle.py
Imports:
- Line 2:
from modules.interfaces.interfaceDbAppObjects import getRootInterface- Type: Direct import
- Usage: Gets root interface to retrieve event user for feature initialization
- Context: Used in
start()function to get event user for automation, syncDelta, and chatAlthaus features - Note:
getRootInterface()is a system-level function (no user required), so it remains as direct import
Refactored:
- ✅ Removed:
from modules.interfaces.interfaceDbChatObjects import getInterface as getChatInterface - ✅ Added:
from modules.services import getInterface as getServices - ✅ Changed: Now uses
services.interfaceDbChatinstead of direct interface import - Pattern:
services = getServices(eventUser, None)thenservices.interfaceDbChat
Purpose: Feature lifecycle management - initializes and manages all features on startup/shutdown.
2. features/automation/mainAutomation.py
Imports:
- Line 14:
from modules.interfaces.interfaceDbAppObjects import getRootInterface- Type: Direct import
- Usage: Gets root interface to retrieve event user (system-level function)
- Context: Used in
createAutomationEventHandler()to get event user - Note:
getRootInterface()is a system-level function (no user required), so it remains as direct import
Refactored:
- ✅ Removed:
from modules.interfaces.interfaceDbChatObjects import getInterface as getChatInterface - ✅ Removed:
from modules.interfaces.interfaceDbAppObjects import getInterface as getAppInterface - ✅ Added:
from modules.services import getInterface as getServices - ✅ Changed: All interface access now goes through services:
executeAutomation(): Usesservices.interfaceDbAppandservices.interfaceDbChatcreateAutomationEventHandler(): UseseventServices.interfaceDbChatandeventServices.interfaceDbApp
- Pattern:
services = getServices(user, None)thenservices.interfaceDbChatorservices.interfaceDbApp
Purpose: Automation workflow execution and scheduling - handles automated workflow triggers and event scheduling.
3. features/chatPlayground/mainChatPlayground.py
Imports:
- ❌ No imports from interfaces/
- Uses
modules.services.getInterfaceinstead (indirect access through services layer)
Purpose: Chat playground feature - interactive chat interface.
4. features/chatAlthaus/mainChatAlthaus.py
Imports:
- ❌ No imports from interfaces/
- Uses
modules.services.getInterfaceinstead (indirect access through services layer)
Purpose: Chat Althaus data scheduler - scheduled data updates for Althaus preprocessing.
5. features/syncDelta/mainSyncDelta.py
Imports:
- ❌ No imports from interfaces/
- Uses
modules.services.getInterfaceinstead (indirect access through services layer)
Purpose: Delta Group sync manager - synchronizes tickets to SharePoint.
6. features/neutralizePlayground/mainNeutralizePlayground.py
Imports:
- ❌ No imports from interfaces/
- Uses
modules.services.getInterfaceinstead (indirect access through services layer)
Purpose: Neutralization playground - UI wrapper for data neutralization service.
Import Statistics
By Interface Module
interfaceDbAppObjects:
getRootInterface: 2 imports (system-level function, remains as direct import)features/featuresLifecycle.py(line 2)features/automation/mainAutomation.py(line 14)
interfaceDbChatObjects:
- ✅ Removed: All direct imports refactored to use services layer
- Now accessed via
services.interfaceDbChatafter callinggetServices(user, None)
interfaceDbAppObjects.getInterface:
- ✅ Removed: All direct imports refactored to use services layer
- Now accessed via
services.interfaceDbAppafter callinggetServices(user, None)
By Import Type
-
Direct imports: 2 (only
getRootInterface- system-level function)features/featuresLifecycle.py: 1features/automation/mainAutomation.py: 1
-
Services-based access: All user-specific interface access now goes through services layer
- Pattern:
services = getServices(user, None)thenservices.interfaceDbChatorservices.interfaceDbApp
- Pattern:
Architectural Notes
✅ Correct Dependency Direction
All imports follow the correct architectural direction:
- features/ → interfaces/ ✅
This is compliant with the dependency rules:
- Features can import from interfaces (correct)
- Features can import from services (correct)
- Features do NOT import from other features (except internal feature-to-feature imports)
Import Patterns
-
Direct Interface Access:
features/automation/mainAutomation.py- Directly imports interfaces for automation managementfeatures/featuresLifecycle.py- Directly importsgetRootInterfacefor feature initialization
-
Indirect Access via Services:
features/chatPlayground/mainChatPlayground.pyfeatures/chatAlthaus/mainChatAlthaus.pyfeatures/syncDelta/mainSyncDelta.pyfeatures/neutralizePlayground/mainNeutralizePlayground.py
These features use
modules.services.getInterfacewhich provides a service layer abstraction.
Usage Context
interfaceDbAppObjects:
- Used for user management (
getRootInterface,getAppInterface) - Primarily for getting event user and creator user in automation context
interfaceDbChatObjects:
- Used for chat/automation data access (
getChatInterface) - Used for automation execution, event syncing, and workflow management
Summary Table
| Feature Module | Interface Imports | Import Type | Purpose |
|---|---|---|---|
featuresLifecycle.py |
interfaceDbAppObjects.getRootInterface |
Direct | Feature initialization (system-level) |
featuresLifecycle.py |
✅ Via services.interfaceDbChat |
Services | Automation event sync |
automation/mainAutomation.py |
interfaceDbAppObjects.getRootInterface |
Direct | Event user access (system-level) |
automation/mainAutomation.py |
✅ Via services.interfaceDbChat |
Services | Automation execution |
automation/mainAutomation.py |
✅ Via services.interfaceDbApp |
Services | User management |
chatPlayground/mainChatPlayground.py |
None | - | Uses services layer |
chatAlthaus/mainChatAlthaus.py |
None | - | Uses services layer |
syncDelta/mainSyncDelta.py |
None | - | Uses services layer |
neutralizePlayground/mainNeutralizePlayground.py |
None | - | Uses services layer |
Conclusion
Total Interface Imports: 2 (only getRootInterface - system-level function)
- 2 direct imports (both for
getRootInterface)
Modules Using Direct Interface Imports: 2 out of 6 (only for getRootInterface)
features/featuresLifecycle.pyfeatures/automation/mainAutomation.py
✅ REFACTORED: All user-specific interface access now goes through services layer
- Pattern:
services = getServices(user, None)thenservices.interfaceDbChatorservices.interfaceDbApp - Consistent with other feature modules (
chatPlayground,chatAlthaus,syncDelta,neutralizePlayground)
Architectural Compliance: ✅ PERFECT
- All imports follow correct direction (features → interfaces)
- Only system-level function (
getRootInterface) remains as direct import - All user-specific interface access goes through services layer
- Clean separation maintained
- Consistent pattern across all feature modules