Implement data integration tasks with Celery, including periodic fetching and manual refresh of chat data; add utility functions for data processing and transcript handling; create views and URLs for manual data refresh; establish Redis and Celery configuration; enhance error handling and logging; introduce scripts for data cleanup and fixing dashboard data; update documentation for Redis and Celery setup and troubleshooting.

This commit is contained in:
2025-05-18 13:33:11 +00:00
parent e8f2d2adc2
commit 8bbbb109bd
63 changed files with 4601 additions and 164 deletions

View File

@ -0,0 +1,110 @@
# Generated by Django 5.2.1 on 2025-05-16 21:25
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("accounts", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="DataSource",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255)),
("description", models.TextField(blank=True)),
("file", models.FileField(upload_to="data_sources/")),
("uploaded_at", models.DateTimeField(auto_now_add=True)),
(
"company",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="data_sources",
to="accounts.company",
),
),
],
),
migrations.CreateModel(
name="Dashboard",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255)),
("description", models.TextField(blank=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"company",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="dashboards",
to="accounts.company",
),
),
(
"data_sources",
models.ManyToManyField(related_name="dashboards", to="dashboard.datasource"),
),
],
),
migrations.CreateModel(
name="ChatSession",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("session_id", models.CharField(max_length=255)),
("start_time", models.DateTimeField(blank=True, null=True)),
("end_time", models.DateTimeField(blank=True, null=True)),
("ip_address", models.GenericIPAddressField(blank=True, null=True)),
("country", models.CharField(blank=True, max_length=100)),
("language", models.CharField(blank=True, max_length=50)),
("messages_sent", models.IntegerField(default=0)),
("sentiment", models.CharField(blank=True, max_length=50)),
("escalated", models.BooleanField(default=False)),
("forwarded_hr", models.BooleanField(default=False)),
("full_transcript", models.TextField(blank=True)),
("avg_response_time", models.FloatField(blank=True, null=True)),
("tokens", models.IntegerField(default=0)),
("tokens_eur", models.FloatField(blank=True, null=True)),
("category", models.CharField(blank=True, max_length=100)),
("initial_msg", models.TextField(blank=True)),
("user_rating", models.CharField(blank=True, max_length=50)),
(
"data_source",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="chat_sessions",
to="dashboard.datasource",
),
),
],
),
]