Skip to content
soumen-techPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🌌 Graphilia (GraphLab AI)

The Intelligent Multimodal Lab Notebook Companion 🚀

Bridging the gap between physical lab notebooks and digital scientific visualization with Google Gemini AI and Supabase.


React TypeScript Vite Tailwind CSS Gemini AI Supabase Prisma ORM


💡 The Vision & Project Idea

In school and university science labs, students spend a disproportionate amount of time doing tedious administrative work rather than actual scientific analysis:

  • Transcribing handwritten observation tables from physical notebooks.
  • Manually calculating scales (e.g., 1 small square = 0.05 units) and sketching best-fit curves.
  • Re-memorizing theory formulas or struggling with conceptual viva questions.
  • Formatting lab reports to PDF.

Graphilia is an AI-powered desktop/web lab assistant designed to digitize, plot, and explain lab experiments instantly. Simply upload a picture of a handwritten lab notebook, and Graphilia does the rest.


✨ Features at a Glance

📸 1. Multimodal OCR Table Extraction

  • Powered by Gemini 2.5 Flash: Seamlessly detects and transcribes hand-drawn tables from notebook images.
  • Confidence Heatmap: Identifies smudged or blurry handwritten digits and highlights low-confidence values in the data grid for manual verification.
  • Smart Fallback: In offline mode or in case of API limits, falls back to pre-seeded mock experiments from the database.

📈 2. AI Scale Selection & Curve Fitting

  • Auto-scaling Canvas: Replaces manual graph scale calculations. The app automatically determines the optimal axis intervals (e.g. 1 small square = 0.2 V).
  • Interactive HTML5 Plotter: Zoom, scale, and print high-quality graphs with custom grid line toggles.
  • Curve Fitting Engine: Supports Linear, Exponential ($y = a \cdot e^{bx} + c$), and Polynomial cubic regressions with real-time computation of slope, intercept, and $R^2$.

🧠 3. AI Theory & Viva Prep

  • Explained Simply: Explains complex physics formulas in plain English (conceptual theory).
  • Viva Q&A Simulator: Generates targeted viva questions based on the active experiment, categorized by difficulty (Basic, Conceptual, Formula, Tricky).

📁 4. Hybrid Cloud Storage

  • Supabase Storage: Uploads scanned notebooks directly to Supabase storage.
  • Cloudinary Fallback: Fallback integration to Cloudinary ensures file uploads never fail.
  • Supabase Auth: Email verification gating, profile synchronization, and persistent history of experiment runs.

🛠️ Architecture & Technology Stack

graph TD
    subgraph Client [React Frontend]
        A[React App] --> B[HTML5 Graph Canvas]
        A --> C[Dynamic Data Table]
        A --> D[Theory & Viva Panel]
    end
    subgraph Backend [Express API Server]
        E[Express Server] --> F[Gemini 2.5 Multimodal API]
        E --> G[Prisma ORM Client]
        E --> H[Cloudinary API]
    end
    subgraph CloudServices [Cloud Services]
        I[Supabase Auth & PostgreSQL]
        J[Cloudinary Storage]
    end

    A -- REST Request --x E
    G -- Queries --x I
    E -- Upload Failover --x J
Loading
  • Frontend: React 19, TypeScript, Vite, TailwindCSS, Lucide Icons, Custom HTML5 Canvas.
  • Backend: Express, TypeScript, Multer (in-memory buffers), Prisma Client, Nodemon.
  • Cloud Services: Supabase (PostgreSQL, Auth & Storage), Cloudinary (Image failover), Google Gemini API (Multimodal LLM).

📂 Database Schema Overview (Prisma Models)

  • Profile: Connects user credentials from Supabase Auth (auth.users.id) to their student metadata (year, department).
  • SubjectExperiment: A template recipe for 14 pre-seeded physics/electrical experiments including default columns, formula structures, and best-fit algorithms.
  • ExperimentRun: A single session of a student uploading an image and completing the OCR process.
  • ObservationRow: Individual data points extracted from the handwritten table.
  • GraphResult: Cached calculations including calculated slope, intercept, $R^2$, and auto-scale suggestions.
  • VivaQuestion: Curated list of viva questions connected to each experiment.

🚀 Setup & Local Execution Guide

To get Graphilia running locally, follow these simple setup steps.

Prerequisites

Make sure you have Node.js installed on your machine.


Step 1: Environment Variables Setup

Create a .env file in both the root directory and the server directory.

1. Root Directory .env

Create d:/full-stack/Graphilia/.env and paste:

VITE_SUPABASE_URL=https://<your-project-ref>.supabase.co
VITE_SUPABASE_ANON_KEY=<your-anon-public-key>
VITE_API_URL=http://localhost:5000/api

2. Server Directory .env

Create d:/full-stack/Graphilia/server/.env and paste:

PORT=5000
DATABASE_URL="postgresql://postgres:<your-db-password>@db.<your-project-ref>.supabase.co:5432/postgres?schema=public"
SUPABASE_URL=https://<your-project-ref>.supabase.co
SUPABASE_ANON_KEY=<your-anon-public-key>
SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>

CLOUDINARY_CLOUD_NAME=<your-cloudinary-name>
CLOUDINARY_API_KEY=<your-cloudinary-key>
CLOUDINARY_API_SECRET=<your-cloudinary-secret>

GEMINI_API_KEY=<your-google-gemini-api-key>

Note

If your database password contains special characters (like #, @, [), make sure to URL-encode them in the DATABASE_URL string (e.g., replace a space with %20, @ with %40).


Step 2: Database Initialization

Open your terminal, navigate to the server directory, and initialize the database schema and seed data.

# Navigate to the server folder
cd server

# Push the Prisma schema to your Supabase PostgreSQL instance
npx prisma db push

# Generate the type-safe Prisma client
npx prisma generate

# Seed the database with the 14 lab experiments and viva questions
npm run prisma:seed

Step 3: Run the Servers

Running the Backend

In the server directory, run:

npm run dev

The server will boot up on http://localhost:5000.

Running the Frontend

Open a new terminal window in the root directory and run:

npm run dev

The client app will boot up on http://localhost:5173. Open this URL in your web browser to start using Graphilia!


🎨 Designed with Passion

Graphilia was built to bring modern UX, automation, and intelligence into school and university laboratories. No more manual scale rules, no more squinting at handwritten tables—just snap, plot, and understand.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages