Skip to content

Repository files navigation

Instagram Analytics Dashboard for Astana Hub

This is my summer internship project/task

https://instastatsapp.streamlit.app/

This project is an Instagram Analytics Dashboard built for the Department of Regional Management of Astana Hub. It allows tracking, analyzing, and visualizing the Instagram performance of 20 regional IT hubs across Kazakhstan (e.g., astana.hub, almaty_hub, terriconvalley).

🌟 Features

  • Live Data Fetching: Retrieves real-time profile metrics (followers, total posts) and post-level metrics (likes, comments, views) using the instagram-looter2 RapidAPI.
  • Interactive Streamlit Dashboard: A user-friendly web interface providing:
    • KPI Metrics: Total followers, total posts, and average engagement rate (ER).
    • Data View: A tabular view of recent posts with color-coded engagement metrics.
    • Interactive Visualizations: Time-series charts for follower growth and ER trends, along with content format breakdowns.
    • Content Intelligence: Highlights the top 3 best-performing posts based on total engagement.
  • Historical Tracking: Integrates with Google Sheets to store weekly snapshots of account metrics, enabling week-over-week, month-over-month, and year-over-year growth analysis.
  • Automated Weekly Sync: Includes a scheduled background job to automatically scrape and sync metrics for all 20 hubs to Google Sheets every Monday morning.

🏗️ Project Architecture

  • app.py: The main Streamlit application providing the UI, data visualizations, and manual sync controls.
  • scraper.py: Handles the interaction with the RapidAPI endpoint, processing the raw JSON response into structured metrics (calculating engagement rates, classifying content formats).
  • google_sheets_writer.py: Manages the connection to Google Sheets using gspread and Google Service Account credentials. It reads historical data for the dashboard and writes new sync payloads.
  • weekly_sync_job.py: A standalone script using the schedule library to automate the data sync for all hubs.

🚀 Getting Started

Prerequisites

  • Python 3.8+
  • A RapidAPI account with a subscription to the instagram-looter2 API.
  • Google Cloud Service Account credentials with access to Google Sheets.

Installation

  1. Install the required dependencies:

    pip install -r requirements.txt
  2. Configure Environment Variables: Create a .env file in the root directory and add the following variables:

    RAPIDAPI_KEY=your_rapidapi_key_here
    SPREADSHEET_ID=your_google_spreadsheet_id_or_name
    GOOGLE_CREDENTIALS_JSON='{"type": "service_account", ...}' 

    Note: Alternatively, you can place a credentials.json file in the root directory for Google Sheets authentication.

Running the App

To launch the Streamlit dashboard locally:

streamlit run app.py

Running the Automated Sync

To start the background scheduler that syncs data weekly:

python weekly_sync_job.py

🛠️ Technologies Used

  • Frontend: Streamlit
  • Data Manipulation: Pandas
  • Visualizations: Plotly Express
  • Data Sourcing: RapidAPI (instagram-looter2)
  • Storage: Google Sheets API (gspread)
  • Automation: Schedule

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages