From 3ea438777a39a7e6f8cc644e7eb04e4d8a564ad7 Mon Sep 17 00:00:00 2001 From: SparshM8 <188700067+SparshM8@users.noreply.github.com> Date: Fri, 21 Aug 2026 19:33:11 +0000 Subject: [PATCH] Phase 1: Metadata support and Intent-Based Taxonomy classification --- backend/app/models/database.py | 4 ++++ backend/app/models/schemas.py | 3 +++ backend/app/services/plagiarism.py | 1 + 3 files changed, 8 insertions(+) diff --git a/backend/app/models/database.py b/backend/app/models/database.py index 1e06b9c0..86897afd 100644 --- a/backend/app/models/database.py +++ b/backend/app/models/database.py @@ -21,6 +21,8 @@ class AnalysisResult(Base): file_size = Column(Integer, nullable=False) # bytes file_hash = Column(String(64), unique=True, index=True) # SHA256 word_count = Column(Integer, nullable=False, default=0) + author_name = Column(String(255), nullable=True) + institution = Column(String(255), nullable=True) # Module scores plagiarism_score = Column(Integer, nullable=False) # 0-100 @@ -74,6 +76,8 @@ def to_dict(self): "writing_quality_score": self.writing_quality_score, "overall_research_credibility": self.overall_research_credibility, "verdict": self.verdict, + "author_name": self.author_name, + "institution": self.institution, "report_path": self.report_path, "analyzed_at": self.analyzed_at.isoformat() if self.analyzed_at else None, "provenance_score": self.provenance_score, diff --git a/backend/app/models/schemas.py b/backend/app/models/schemas.py index a61db0c0..485df9da 100644 --- a/backend/app/models/schemas.py +++ b/backend/app/models/schemas.py @@ -7,6 +7,7 @@ class PlagiarismMatchSchema(BaseModel): similarity: float = Field(..., ge=0, le=100) source: str matched_text: str + match_type: str = "uncited" # uncited, cited, internal, web class PlagiarismModuleResult(BaseModel): @@ -95,6 +96,8 @@ class ScoreContributions(BaseModel): class AnalysisResult(BaseModel): filename: str + author_name: Optional[str] = None + institution: Optional[str] = None analyzed_at: str word_count: int section_count: int diff --git a/backend/app/services/plagiarism.py b/backend/app/services/plagiarism.py index f5603476..50f864d7 100644 --- a/backend/app/services/plagiarism.py +++ b/backend/app/services/plagiarism.py @@ -33,6 +33,7 @@ class SimilarityMatch: source_corpus: str similarity: float matched_text: str + match_type: str = "uncited" # uncited, cited, internal, web @dataclass