101 lines
No EOL
2.8 KiB
Text
101 lines
No EOL
2.8 KiB
Text
erDiagram
|
|
conversation_flows {
|
|
UUID id PK
|
|
VARCHAR name
|
|
TEXT description
|
|
BOOLEAN is_active
|
|
TIMESTAMP created_at
|
|
TIMESTAMP updated_at
|
|
}
|
|
|
|
slot_definitions {
|
|
UUID id PK
|
|
UUID flow_id FK
|
|
VARCHAR slot_name
|
|
VARCHAR slot_type
|
|
BOOLEAN is_required
|
|
INTEGER priority
|
|
VARCHAR depends_on_slot
|
|
JSONB dependency_value
|
|
TIMESTAMP created_at
|
|
}
|
|
|
|
slot_validations {
|
|
UUID id PK
|
|
UUID slot_id FK
|
|
VARCHAR validation_type
|
|
JSONB validation_rule
|
|
TEXT error_message
|
|
TIMESTAMP created_at
|
|
}
|
|
|
|
slot_questions {
|
|
UUID id PK
|
|
UUID slot_id FK
|
|
VARCHAR question_type
|
|
TEXT question_text
|
|
TEXT follow_up_text
|
|
BOOLEAN is_default
|
|
JSONB context_conditions
|
|
TIMESTAMP created_at
|
|
}
|
|
|
|
conversation_sessions {
|
|
UUID id PK
|
|
VARCHAR user_id
|
|
UUID flow_id FK
|
|
VARCHAR session_status
|
|
VARCHAR current_slot
|
|
JSONB collected_slots
|
|
JSONB context_data
|
|
TIMESTAMP started_at
|
|
TIMESTAMP completed_at
|
|
TIMESTAMP last_interaction
|
|
}
|
|
|
|
slot_collection_attempts {
|
|
UUID id PK
|
|
UUID session_id FK
|
|
VARCHAR slot_name
|
|
TEXT user_input
|
|
JSONB extracted_value
|
|
BOOLEAN is_valid
|
|
JSONB validation_errors
|
|
INTEGER attempt_number
|
|
TIMESTAMP created_at
|
|
}
|
|
|
|
%% Relationships
|
|
conversation_flows ||--o{ slot_definitions : "has many"
|
|
slot_definitions ||--o{ slot_validations : "has many"
|
|
slot_definitions ||--o{ slot_questions : "has many"
|
|
conversation_flows ||--o{ conversation_sessions : "has many"
|
|
conversation_sessions ||--o{ slot_collection_attempts : "has many"
|
|
|
|
%% Additional annotations
|
|
slot_definitions {
|
|
string slot_type "text|number|email|phone|date|boolean|choice"
|
|
string depends_on_slot "Optional reference to another slot"
|
|
json dependency_value "Required values for dependency"
|
|
}
|
|
|
|
slot_validations {
|
|
string validation_type "regex|range|length|choices|custom"
|
|
json validation_rule "Validation parameters"
|
|
}
|
|
|
|
slot_questions {
|
|
string question_type "initial|clarification|validation_error|confirmation"
|
|
json context_conditions "When to use this question variant"
|
|
}
|
|
|
|
conversation_sessions {
|
|
string session_status "active|completed|paused|abandoned"
|
|
json collected_slots "Key-value pairs of collected data"
|
|
json context_data "Additional session context"
|
|
}
|
|
|
|
slot_collection_attempts {
|
|
json extracted_value "Processed user input"
|
|
json validation_errors "List of validation failures"
|
|
} |