db: update cardinality of model
This commit is contained in:
parent
ee1d2acf01
commit
f18838ee13
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- The values [positive,negative,neutral] on the enum `Sentiment` will be removed. If these variants are still used in the database, this will fail.
|
||||||
|
- You are about to drop the column `reviewId` on the `Analysis` table. All the data in the column will be lost.
|
||||||
|
- You are about to drop the column `updatedAt` on the `Analysis` table. All the data in the column will be lost.
|
||||||
|
- You are about to drop the column `productReference` on the `User` table. All the data in the column will be lost.
|
||||||
|
- A unique constraint covering the columns `[url]` on the table `Product` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
- Added the required column `compatibilityScore` to the `Analysis` table without a default value. This is not possible if the table is not empty.
|
||||||
|
- Added the required column `generalScore` to the `Analysis` table without a default value. This is not possible if the table is not empty.
|
||||||
|
- Added the required column `targetProfession` to the `Analysis` table without a default value. This is not possible if the table is not empty.
|
||||||
|
- Added the required column `verdict` to the `Analysis` table without a default value. This is not possible if the table is not empty.
|
||||||
|
- Added the required column `url` to the `Product` table without a default value. This is not possible if the table is not empty.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN');
|
||||||
|
|
||||||
|
-- AlterEnum
|
||||||
|
BEGIN;
|
||||||
|
CREATE TYPE "Sentiment_new" AS ENUM ('POSITIVE', 'NEGATIVE', 'NEUTRAL');
|
||||||
|
ALTER TABLE "Review" ALTER COLUMN "sentiment" TYPE "Sentiment_new" USING ("sentiment"::text::"Sentiment_new");
|
||||||
|
ALTER TYPE "Sentiment" RENAME TO "Sentiment_old";
|
||||||
|
ALTER TYPE "Sentiment_new" RENAME TO "Sentiment";
|
||||||
|
DROP TYPE "public"."Sentiment_old";
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE "Analysis" DROP CONSTRAINT "Analysis_reviewId_fkey";
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE "Analysis" DROP CONSTRAINT "Analysis_userId_fkey";
|
||||||
|
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE "Review" DROP CONSTRAINT "Review_productId_fkey";
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Analysis" DROP COLUMN "reviewId",
|
||||||
|
DROP COLUMN "updatedAt",
|
||||||
|
ADD COLUMN "compatibilityScore" DOUBLE PRECISION NOT NULL,
|
||||||
|
ADD COLUMN "generalScore" DOUBLE PRECISION NOT NULL,
|
||||||
|
ADD COLUMN "targetProfession" TEXT NOT NULL,
|
||||||
|
ADD COLUMN "verdict" TEXT NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Model" ADD COLUMN "version" TEXT,
|
||||||
|
ALTER COLUMN "description" DROP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Product" ADD COLUMN "image" TEXT,
|
||||||
|
ADD COLUMN "url" TEXT NOT NULL,
|
||||||
|
ALTER COLUMN "brand" DROP NOT NULL;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Review" ADD COLUMN "modelId" INTEGER;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "User" DROP COLUMN "productReference",
|
||||||
|
ADD COLUMN "role" "Role" NOT NULL DEFAULT 'USER';
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Product_url_key" ON "Product"("url");
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Review" ADD CONSTRAINT "Review_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Review" ADD CONSTRAINT "Review_modelId_fkey" FOREIGN KEY ("modelId") REFERENCES "Model"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Analysis" ADD CONSTRAINT "Analysis_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `generalScore` on the `Analysis` table. All the data in the column will be lost.
|
||||||
|
- Added the required column `generalSentiment` to the `Analysis` table without a default value. This is not possible if the table is not empty.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE "Analysis" DROP CONSTRAINT "Analysis_productId_fkey";
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Analysis" DROP COLUMN "generalScore",
|
||||||
|
ADD COLUMN "generalSentiment" DOUBLE PRECISION NOT NULL,
|
||||||
|
ADD COLUMN "topKeywords" TEXT[];
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Analysis" ADD CONSTRAINT "Analysis_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
@ -6,16 +6,22 @@ datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- ENUMS ---
|
||||||
enum UserGender {
|
enum UserGender {
|
||||||
male
|
male
|
||||||
female
|
female
|
||||||
other
|
other
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Role {
|
||||||
|
USER
|
||||||
|
ADMIN
|
||||||
|
}
|
||||||
|
|
||||||
enum Sentiment {
|
enum Sentiment {
|
||||||
positive
|
POSITIVE
|
||||||
negative
|
NEGATIVE
|
||||||
neutral
|
NEUTRAL
|
||||||
}
|
}
|
||||||
|
|
||||||
model Account {
|
model Account {
|
||||||
|
|
@ -31,7 +37,6 @@ model Account {
|
||||||
scope String?
|
scope String?
|
||||||
id_token String?
|
id_token String?
|
||||||
session_state String?
|
session_state String?
|
||||||
|
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@unique([provider, providerAccountId])
|
@@unique([provider, providerAccountId])
|
||||||
|
|
@ -42,7 +47,6 @@ model Session {
|
||||||
sessionToken String @unique
|
sessionToken String @unique
|
||||||
userId Int
|
userId Int
|
||||||
expires DateTime
|
expires DateTime
|
||||||
|
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +58,6 @@ model VerificationToken {
|
||||||
@@unique([identifier, token])
|
@@unique([identifier, token])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String?
|
name String?
|
||||||
|
|
@ -62,68 +65,86 @@ model User {
|
||||||
emailVerified DateTime?
|
emailVerified DateTime?
|
||||||
image String?
|
image String?
|
||||||
gender UserGender?
|
gender UserGender?
|
||||||
productReference String?
|
|
||||||
password String?
|
password String?
|
||||||
|
role Role @default(USER)
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
accounts Account[]
|
accounts Account[]
|
||||||
sessions Session[]
|
sessions Session[]
|
||||||
analysis Analysis[]
|
|
||||||
}
|
|
||||||
|
|
||||||
model Analysis {
|
analyses Analysis[]
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
userId Int
|
|
||||||
reviewId Int
|
|
||||||
productId Int
|
|
||||||
modelId Int
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
|
|
||||||
user User @relation(fields: [userId], references: [id])
|
|
||||||
review Review @relation(fields: [reviewId], references: [id])
|
|
||||||
product Product @relation(fields: [productId], references: [id])
|
|
||||||
model Model @relation(fields: [modelId], references: [id])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model Product {
|
model Product {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String
|
||||||
brand String
|
brand String?
|
||||||
|
url String @unique
|
||||||
|
image String?
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
reviews Review[]
|
reviews Review[]
|
||||||
analysis Analysis[]
|
analyses Analysis[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model Review {
|
model Review {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
productId Int
|
|
||||||
modelId Int
|
|
||||||
content String
|
content String
|
||||||
keywords String[]
|
|
||||||
sentiment Sentiment
|
sentiment Sentiment
|
||||||
confidenceScore Float
|
confidenceScore Float
|
||||||
|
keywords String[]
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
product Product @relation(fields: [productId], references: [id])
|
productId Int
|
||||||
|
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
modelId Int?
|
||||||
|
model Model? @relation(fields: [modelId], references: [id])
|
||||||
|
}
|
||||||
|
|
||||||
|
model Analysis {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
|
||||||
|
targetProfession String
|
||||||
|
|
||||||
|
generalSentiment Float
|
||||||
|
compatibilityScore Float
|
||||||
|
verdict String
|
||||||
|
|
||||||
|
topKeywords String[]
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
|
userId Int
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
productId Int
|
||||||
|
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
modelId Int
|
||||||
model Model @relation(fields: [modelId], references: [id])
|
model Model @relation(fields: [modelId], references: [id])
|
||||||
analysis Analysis[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model Model {
|
model Model {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
modelName String
|
modelName String
|
||||||
description String
|
description String?
|
||||||
|
version String?
|
||||||
|
|
||||||
accuracy Float
|
accuracy Float
|
||||||
macroF1 Float
|
macroF1 Float
|
||||||
f1Negative Float
|
f1Negative Float
|
||||||
f1Neutral Float
|
f1Neutral Float
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
analysis Analysis[]
|
analyses Analysis[]
|
||||||
review Review[]
|
reviews Review[]
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ import { Badge } from "../ui/badge";
|
||||||
import { getSentimentDisplay } from "@/src/utils/datas";
|
import { getSentimentDisplay } from "@/src/utils/datas";
|
||||||
import { useSentimentForm } from "@/src/hooks/useSentimentForm";
|
import { useSentimentForm } from "@/src/hooks/useSentimentForm";
|
||||||
|
|
||||||
export default function SentimentForm() {
|
export default function SentimentAnalyzer() {
|
||||||
const {
|
const {
|
||||||
selectedModel,
|
selectedModel,
|
||||||
searchQuery,
|
searchQuery,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Frown, Meh, Smile } from "lucide-react";
|
import { Frown, Meh, Smile } from "lucide-react";
|
||||||
import { WordCloudConfig, WordItem } from "../types";
|
import { ScrapeResult, WordCloudConfig, WordItem } from "../types";
|
||||||
|
|
||||||
export const MODEL_OPTIONS = [
|
export const MODEL_OPTIONS = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue