48 lines
2.7 KiB
Python
48 lines
2.7 KiB
Python
<<<<<<< HEAD
|
|
# Generated by Django 6.0 on 2026-01-12 09:50
|
|
=======
|
|
# Generated by Django 6.0.1 on 2026-01-12 09:50
|
|
>>>>>>> 1f9d8a7 (update on the complaint sla and staff hierarchy)
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('contenttypes', '0002_remove_content_type_name'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='SentimentResult',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('object_id', models.UUIDField()),
|
|
('text', models.TextField(help_text='Text that was analyzed')),
|
|
('language', models.CharField(choices=[('en', 'English'), ('ar', 'Arabic')], default='en', max_length=5)),
|
|
('sentiment', models.CharField(choices=[('positive', 'Positive'), ('neutral', 'Neutral'), ('negative', 'Negative')], db_index=True, max_length=20)),
|
|
('sentiment_score', models.DecimalField(decimal_places=4, help_text='Sentiment score from -1 (negative) to 1 (positive)', max_digits=5)),
|
|
('confidence', models.DecimalField(decimal_places=4, help_text='Confidence level of the sentiment analysis', max_digits=5)),
|
|
('ai_service', models.CharField(default='stub', help_text="AI service used (e.g., 'openai', 'azure', 'aws', 'stub')", max_length=100)),
|
|
('ai_model', models.CharField(blank=True, help_text='Specific AI model used', max_length=100)),
|
|
('processing_time_ms', models.IntegerField(blank=True, help_text='Time taken to analyze (milliseconds)', null=True)),
|
|
('keywords', models.JSONField(blank=True, default=list, help_text='Extracted keywords')),
|
|
('entities', models.JSONField(blank=True, default=list, help_text='Extracted entities (people, places, etc.)')),
|
|
('emotions', models.JSONField(blank=True, default=dict, help_text='Emotion scores (joy, anger, sadness, etc.)')),
|
|
('metadata', models.JSONField(blank=True, default=dict)),
|
|
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
'indexes': [models.Index(fields=['sentiment', '-created_at'], name='ai_engine_s_sentime_e4f801_idx'), models.Index(fields=['content_type', 'object_id'], name='ai_engine_s_content_eb5a8a_idx')],
|
|
},
|
|
),
|
|
]
|