Skip to content

alebels/medianalytics

Repository files navigation

alt text

Medianalytics is an open-source platform that processes articles daily from each registered source (media outlets, organizations, etc) and provides users with tools to view this information from a broader perspective through data visualization and analysis.

📋 Prerequisites

This project uses Docker to run the application. Make sure you have Docker installed on your machine. You can download it from Docker.

🏗️ Architecture Schema

alt text

⚙️ Setup Instructions

  1. Create a .env file

    In the root folder medianalytics, create a .env file based on this example file and set your environment variables accordingly.

    DATABASE_URL=postgresql+asyncpg://dockeruser:**db_password**@db:5432/medianalytics
    DB_PASSWORD=**db_password**
    API_KEY=example # AI API key
    GOOGLE_AI_API_URL="https://generativelanguage.googleapis.com/v1beta/openai/"
    VERIFY_SSL="true"
    CONNECTION_TIMEOUT=10
    READ_TIMEOUT=30
    MAX_CONNECTIONS=10
    MAX_KEEPALIVE_CONNECTIONS=5
    # Only if you plan to use X API
    X_API_KEY=example
    X_API_SECRET=example
    X_ACCESS_TOKEN=example
    X_ACCESS_TOKEN_SECRET=example

Back-ai

  1. Get an AI API key
  • Recommended: Google AI (free tier available with gemma-3-27b-it)

On root folder medianalytics:

  1. Launch Application
    docker compose up

Back-data

In the back-data docker container terminal Exec:

  1. Database Migration Setup

    alembic init alembic
  2. Generate Migration Script

    alembic revision --autogenerate -m "Initial migration"
  3. Apply Migration

    alembic upgrade head
  4. Initialize Database

    python3 init_db.py

📝 Important Notes

  • Keep containers running for scheduled jobs to execute as specified in Back-data/main.py
  • Frontend can also run locally as an Angular project (v19.0.6)
  • To add new sources, follow the example in Back-data/media_test_scrap.py

About

Platform for the analysis of media and other relevant sources that influence public opinion, utilizing web scraping, NLP and AI.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors