58 lines
3.9 KiB
Python
58 lines
3.9 KiB
Python
# Generated by Django 5.0.14 on 2026-01-05 10:43
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('organizations', '0001_initial'),
|
|
('px_action_center', '0001_initial'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='SocialMention',
|
|
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)),
|
|
('platform', models.CharField(choices=[('twitter', 'Twitter/X'), ('facebook', 'Facebook'), ('instagram', 'Instagram'), ('linkedin', 'LinkedIn'), ('youtube', 'YouTube'), ('tiktok', 'TikTok'), ('other', 'Other')], db_index=True, max_length=50)),
|
|
('post_url', models.URLField(max_length=1000)),
|
|
('post_id', models.CharField(db_index=True, help_text='Unique post ID from platform', max_length=200, unique=True)),
|
|
('author_username', models.CharField(max_length=200)),
|
|
('author_name', models.CharField(blank=True, max_length=200)),
|
|
('author_followers', models.IntegerField(blank=True, null=True)),
|
|
('content', models.TextField()),
|
|
('content_ar', models.TextField(blank=True, help_text='Arabic translation if applicable')),
|
|
('sentiment', models.CharField(blank=True, choices=[('positive', 'Positive'), ('neutral', 'Neutral'), ('negative', 'Negative')], db_index=True, max_length=20, null=True)),
|
|
('sentiment_score', models.DecimalField(blank=True, decimal_places=2, help_text='Sentiment score (-1 to 1, or 0-100 depending on AI service)', max_digits=5, null=True)),
|
|
('sentiment_analyzed_at', models.DateTimeField(blank=True, null=True)),
|
|
('likes_count', models.IntegerField(default=0)),
|
|
('shares_count', models.IntegerField(default=0)),
|
|
('comments_count', models.IntegerField(default=0)),
|
|
('posted_at', models.DateTimeField(db_index=True)),
|
|
('collected_at', models.DateTimeField(auto_now_add=True)),
|
|
('responded', models.BooleanField(default=False)),
|
|
('response_text', models.TextField(blank=True)),
|
|
('responded_at', models.DateTimeField(blank=True, null=True)),
|
|
('action_created', models.BooleanField(default=False)),
|
|
('metadata', models.JSONField(blank=True, default=dict)),
|
|
('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='social_mentions', to='organizations.department')),
|
|
('hospital', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='social_mentions', to='organizations.hospital')),
|
|
('px_action', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='social_mentions', to='px_action_center.pxaction')),
|
|
('responded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='social_responses', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'ordering': ['-posted_at'],
|
|
'indexes': [models.Index(fields=['platform', '-posted_at'], name='social_soci_platfor_b8e20e_idx'), models.Index(fields=['sentiment', '-posted_at'], name='social_soci_sentime_a4e18d_idx'), models.Index(fields=['hospital', 'sentiment', '-posted_at'], name='social_soci_hospita_8b4bde_idx')],
|
|
},
|
|
),
|
|
]
|