Skip to content
blahaibrahimPublic

About

An end-to-end industrial project intelligence platform that turns a machine/material technical datasheet into a complete virtual factory package: structured technical extraction, 2D/3D plant layout, HD visualization video, global supplier sourcing, AI-assisted supplier negotiation (text + voice), TCO modeling, 5-year business plan + pitch deck.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

96 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

RIBIF - Intelligent Industrial Investment Platform

RIBIF is an end-to-end industrial project intelligence platform that turns a machine/material technical datasheet into a complete virtual factory package:

  • structured technical extraction,
  • 2D/3D plant layout,
  • HD visualization video,
  • global supplier sourcing,
  • AI-assisted supplier negotiation (text + voice),
  • TCO modeling,
  • 5-year business plan + pitch deck,
  • digital twin dashboard with operational KPIs,
  • and a final technical catalog.

The system is implemented as one integrated web application with a Next.js frontend and Flask backend orchestrating the multi-module pipeline.

1) Global Objective

RIBIF is designed to support industrial companies from pre-engineering to investment decision by chaining 9 mandatory modules into one coherent workflow.

Input:

  • Technical files (PDF, DOCX, and structured payloads)

Output:

  • A virtualized factory solution with technical, procurement, financial, and operational decision support artifacts.

2) The 9 Modules (Functional + Implementation Mapping)

Module 1 - Tech Sheets & Needs Extraction

Business purpose:

  • Ingest unstructured technical documentation.
  • Extract key machine/material specs, constraints, capacities, utility requirements, safety factors.
  • Build normalized stage-based JSON for downstream modules.

Backend implementation:

  • Endpoint: POST /api/module1/process
  • Status/result polling: GET /api/module1/status, GET /api/module1/result
  • Route: backend/routes/module1.py
  • Core logic: backend/utils/module_1/

Primary output:

  • Structured extraction payload (stages 1..6) including stage_4_machines_equipements.

Module 2 - 2D/3D Factory Layout

Business purpose:

  • Convert module 1 data into plant/workshop layout.
  • Generate 2D and 3D artifacts representing zones, flows, and placement.

Backend implementation:

  • Endpoint: POST /api/module2/layout
  • Route: backend/routes/module2.py
  • Pipeline engine: backend/utils/module_2/

Primary output:

  • 2D layout artifact (DXF/PNG variants depending on flow)
  • 3D model artifact (GLB/IFC-like workflow representation)

Notes:

  • Layout route normalizes machine dimensions and can run with template fallback when skip flags are enabled.

Module 3 - HD Video Rendering

Business purpose:

  • Transform 3D/layout visual context into investor-ready short video (site walkthrough style).

Backend implementation:

  • Endpoint: POST /api/module3/video
  • Route: backend/routes/module3.py
  • Uses generated layout images or uploaded images + prompt-driven video generation.

Primary output:

  • HD video file (.mp4) and downloadable URL.

Module 4 - Automated Supplier Sourcing

Business purpose:

  • Identify supplier candidates globally.
  • Aggregate price/lead-time/contact/evidence.
  • Rank suppliers per machine family.

Backend implementation:

  • Endpoint: POST /api/module4/enrich
  • Route: backend/routes/module4.py
  • Core agentic/bounded sourcing logic: backend/utils/module_4/
  • Search providers and aggregation: backend/utils/web_search/

Primary output:

  • machines_enriched[] list with supplier options and relevance scoring.

Module 5 - AI Negotiation (Text + Voice)

Business purpose:

  • Support negotiation with suppliers through email-style text rounds and voice-interaction workflows.
  • Produce negotiation history and best-offer summary.

Backend implementation:

  • Core endpoints (subset):
    • POST /api/module5/text/negotiation
    • POST /api/module5/voice/negotiation
    • POST /api/module5/voice/summary
    • POST /api/module5/negotiations/start
    • POST /api/module5/v2/negotiations/create
  • Route: backend/routes/module_5.py
  • Negotiation logic: backend/utils/module_5/
  • Email integration route: backend/routes/email_service.py

Frontend voice UI:

  • frontend/src/app/voice-call/page.tsx
  • Requires VAPI public key.

Primary output:

  • Negotiation rounds, acceptance/rejection states, call transcript data, negotiated pricing traces.

Module 6 - TCO (Total Cost of Ownership)

Business purpose:

  • Compute realistic industrial ownership cost over a horizon.
  • Include purchase, installation, operations, maintenance, materials, and yearly projections.

Backend implementation:

  • Endpoints:
    • POST /api/module6/tco-from-sourcing
    • POST /api/module6/tco
  • Route: backend/routes/module6.py
  • Core model: backend/utils/module_6/core.py

Primary output:

  • Machine/product/raw-material TCO breakdowns
  • Annual multi-year TCO projection.

Module 7 - Automatic Business Plan

Business purpose:

  • Convert technical + TCO data into a 5-year financial model and investor narrative.
  • Generate business-plan deliverables and pitch support.

Backend implementation:

  • Endpoints:
    • POST /api/module7/business-plan
    • POST /api/module7/pitch-deck
  • Route: backend/routes/module7.py
  • Generators:
    • backend/utils/module_7/business_plan.py
    • backend/utils/module_7/pitch_deck.py

Primary output:

  • Business plan file(s) and downloadable URLs
  • Pitch deck output (including PDF export path when available).

Module 8 - Digital Twin & Digital Brain

Business purpose:

  • Represent the factory as a live operational twin.
  • Provide KPI dashboarding (OEE/TRS, throughput, availability, quality) with optimization-oriented visibility.

Current implementation in this repository:

  • Primary UI route: frontend/src/app/twin/page.tsx
  • Workflow twin view component: frontend/src/sections/DigitalTwinView.tsx
  • 3D scene and KPI widgets are available from frontend modules.

Module 9 - Automatic Technical Catalog

Business purpose:

  • Produce reusable technical documentation of machine families, product families, process chains, and logistics context.
  • Deliver both document and web-consumable catalog outputs.

Backend implementation:

  • Endpoint: POST /api/module9/catalog
  • Route: backend/routes/module9.py
  • Core generator: backend/utils/module_9/core.py

Primary output:

  • Catalog payload + PDF artifact upload/URL.

3) Workflow Orchestration in Current App

The primary workflow engine is in frontend/src/app/workflow/[id]/page.tsx.

Actual execution order in the implemented pipeline:

  1. Module 1 (spec extraction)
  2. Module 4 (supplier sourcing)
  3. Module 6 (TCO)
  4. Module 7 (business plan + pitch deck)
  5. Module 9 (technical catalog)
  6. Module 2 (layout 2D/3D)
  7. Module 3 (video)
  8. Digital Twin view (Module 8) is available in UI, not as a blocking backend step.

Why this order:

  • Financial and catalog decisions can proceed once sourcing and TCO are available.
  • Layout/video are generated after core business/procurement intelligence has stabilized.

4) Repository Structure

ribif/
|- backend/
|  |- app.py                      # Flask entrypoint and blueprint registration
|  |- config.py                   # Paths, flags, env configuration
|  |- requirements.txt
|  |- routes/
|  |  |- module1.py
|  |  |- module2.py
|  |  |- module3.py
|  |  |- module4.py
|  |  |- module_5.py
|  |  |- module6.py
|  |  |- module7.py
|  |  |- module9.py
|  |  |- health.py
|  |  |- validation.py
|  |  |- email_service.py
|  |- utils/
|  |  |- module_1/
|  |  |- module_2/
|  |  |- module_4/
|  |  |- module_5/
|  |  |- module_6/
|  |  |- module_7/
|  |  |- module_9/
|  |  |- web_search/
|  |- template/                   # Template payloads for SKIP mode
|- frontend/
|  |- src/app/                    # Next.js App Router pages
|  |- src/sections/               # Workflow module views
|  |- src/lib/                    # API and Supabase helpers
|  |- supabase/                   # SQL schema/migrations

5) Technology Stack

Backend:

  • Python + Flask
  • LLM/tooling: OpenAI SDK, Google GenAI, LangChain/LangGraph
  • Data processing: Pandas, NumPy, Pydantic
  • Document extraction: PyMuPDF, python-docx
  • CAD/render support: ezdxf, matplotlib, moviepy
  • Persistence and file storage: Supabase

Frontend:

  • Next.js (App Router) + React + TypeScript
  • Tailwind CSS
  • Three.js + React Three Fiber/Drei
  • Recharts for KPI/dashboard charts
  • Supabase JS client

6) Setup and Run

Prerequisites

  • Python 3.10+
  • Node.js 20+
  • pnpm (recommended, lockfile included)
  • Supabase project (recommended for full persistence)

Backend setup

cd backend
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python app.py

Backend default URL:

  • http://localhost:5000

Frontend setup

cd frontend
pnpm install
pnpm dev

Frontend default URL:

  • http://localhost:3000

7) Environment Variables

Backend (backend/.env)

Core:

  • GOOGLE_API_KEY (Gemini/Vertex-dependent steps)
  • GEMINI_MODEL (optional override)
  • IMAGE_MODEL (optional)
  • VIDEO_MODEL (optional)

Supabase:

  • SUPABASE_URL
  • SUPABASE_SERVICE_ROLE_KEY
  • SUPABASE_BUCKET_FILES (optional, default project-files)
  • SUPABASE_BUCKET_PUBLIC (optional)

Search and sourcing:

  • SERPER_API_KEY
  • BING_API_KEY
  • WEB_SEARCH_ENABLED
  • PREFER_WEB_DATA

CORS and backend:

  • BACKEND_BASE_URL
  • CORS_ORIGINS

Optional module toggles:

  • SKIP_MODULE_1 ... SKIP_MODULE_9
  • CREATE_MACHINE_IMAGES
  • CREATE_REALISTIC_RENDER
  • CREATE_3D_MODEL

Module 5 negotiation/email:

  • NEGOTIATION_SMTP_HOST, NEGOTIATION_SMTP_PORT, NEGOTIATION_SMTP_USERNAME, NEGOTIATION_SMTP_PASSWORD
  • NEGOTIATION_IMAP_HOST, NEGOTIATION_IMAP_PORT
  • TEST_RECIPIENT_EMAIL

Frontend (frontend/.env.local)

  • NEXT_PUBLIC_BACKEND_URL
  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY
  • NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY (present in code; use with caution)
  • NEXT_PUBLIC_VAPI_PUBLIC_KEY (voice call frontend)

8) API Surface (Core Module Endpoints)

Module endpoints:

  • POST /api/module1/process
  • GET /api/module1/status
  • GET /api/module1/result
  • POST /api/module2/layout
  • POST /api/module3/video
  • POST /api/module4/enrich
  • POST /api/module5/text/negotiation
  • POST /api/module5/voice/negotiation
  • POST /api/module5/voice/summary
  • POST /api/module6/tco-from-sourcing
  • POST /api/module7/business-plan
  • POST /api/module7/pitch-deck
  • POST /api/module9/catalog

Supporting endpoints:

  • GET /health
  • GET /health/ready
  • GET /health/live
  • GET /health/metrics
  • POST /api/validate-pdf
  • POST /api/extract-text
  • POST /api/email/send
  • POST /api/email/poll

9) Data Model (Current Simplified Persistence)

The active schema migration (frontend/supabase/migrations/20260130_simplified.sql) uses a unified projects table as the central workflow state.

Key project columns:

  • module1_data
  • module4_data
  • module5_data (added in 20260201_negotiations.sql)
  • module6_data
  • module7_business
  • module7_pitch
  • module9_data
  • module2_data
  • module3_data
  • completed_modules (text array)
  • settings, metadata

Negotiation tracking is stored in:

  • negotiations table (frontend/supabase/migrations/20260201_negotiations.sql)

10) Artifacts and Deliverables

Typical generated outputs include:

  • Module 1 extraction JSON
  • Supplier shortlist/comparison JSON (Module 4)
  • TCO report JSON (Module 6)
  • Business plan + pitch assets (Module 7)
  • Technical catalog PDF (Module 9)
  • 2D layout and 3D model artifacts (Module 2)
  • HD video .mp4 (Module 3)
  • Digital twin dashboards/KPI views (Module 8 UI)

Sample deliverables are available under frontend/public/deliverables/.


11) Development and Verification

Frontend checks:

cd frontend
pnpm lint
pnpm test

Backend scripts/tests (examples in repo):

cd backend
python test_imports.py
python test_module4_budget_enforcement.py
python test_module1_refactor.py

About

An end-to-end industrial project intelligence platform that turns a machine/material technical datasheet into a complete virtual factory package: structured technical extraction, 2D/3D plant layout, HD visualization video, global supplier sourcing, AI-assisted supplier negotiation (text + voice), TCO modeling, 5-year business plan + pitch deck.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages