Skip to content

Anika9203/Content-Monitoring-Flagging-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Content Monitoring & Flagging System

A streamlined Django backend to ingest external content, match it against user-defined keywords, and manage a human review workflow with smart suppression.

Technical Approach & Architecture

  • Separation of Concerns: Business logic (scoring and suppression) is strictly isolated in services.py. Django Views only manage the HTTP layer, and Models only manage data representation.
  • Database Choice: SQLite is used as requested for simplicity, but the ORM queries and transaction.atomic() blocks are production-ready for PostgreSQL.
  • Content Ingestion: A ContentFetcher strategy pattern is used. I opted for the local mock JSON dataset to ensure the assignment remains self-contained, runnable, and verifiable without relying on external API uptimes or rate limits.

Business Logic Assumptions

  1. Scoring Logic:
    • Score 100: Implemented via regex \bkeyword\b to guarantee exact whole-word matching in the title (e.g., "Python" matches "Python Framework" but not "Pythonista").
    • Score 70: Substring matching in the title.
    • Score 40: Keyword appears in the body (and not the title).
  2. Suppression Logic:
    • Flags are unique to a (Keyword, ContentItem) pair to naturally de-duplicate flags.
    • If a user patches a flag's status to irrelevant, it will remain irrelevant across subsequent scans.
    • However, if the last_updated timestamp of the ContentItem from the fetcher is newer than the database timestamp, the DB is updated, and any irrelevant flags tied to it are reverted back to pending.

Setup Instructions

  1. Clone & Virtual Environment:
    python -m venv venv
    source venv/bin/activate
    pip install django djangorestframework python-dateutil

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages