mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-02-13 17:55:44 +01:00
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:
110
dashboard_project/dashboard/migrations/0001_initial.py
Normal file
110
dashboard_project/dashboard/migrations/0001_initial.py
Normal 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",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,35 @@
|
||||
# Generated by Django 5.2.1 on 2025-05-17 23:10
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("dashboard", "0001_initial"),
|
||||
("data_integration", "0002_externaldatasource_error_count_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="datasource",
|
||||
name="external_source",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
help_text="Link to an external data source",
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
to="data_integration.externaldatasource",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="datasource",
|
||||
name="file",
|
||||
field=models.FileField(
|
||||
blank=True,
|
||||
help_text="Upload a CSV file or leave empty if using an external data source",
|
||||
null=True,
|
||||
upload_to="data_sources/",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
# Generated by Django 5.2.1 on 2025-05-18 00:09
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("dashboard", "0002_datasource_external_source_alter_datasource_file"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name="chatsession",
|
||||
unique_together={("session_id", "data_source")},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user