📁 プロジェクトフォルダ構成とファイルの説明
🔷 /odoo/
postgres-deployment.yaml- Odoo/Metabase 共用の Postgres デプロイメント(DB用)
create-metabase-db.sqlを初期化スクリプトとして使用
create-metabase-db.sql- Postgres起動時に
metabaseというDBを作成するSQLスクリプト
- Postgres起動時に
pvc-postgres.yaml- Postgresデータ保存用の永続ボリューム(PVC)
🔷 /metabase/
metabase-deployment.yaml- Metabase本体のPod定義(内部DBはPostgresの
metabaseDBを使用)
- Metabase本体のPod定義(内部DBはPostgresの
metabase-service.yaml- MetabaseのService(ポート3000)
metabase-secret.yaml- Metabase初期ログイン用ユーザー名・パスワード等を定義したSecret
metabase-pvc.yaml- Metabaseの永続データ(設定・ダッシュボード)の保存用PVC
🔷 /openai/
main.py- FastAPIアプリ。以下のエンドポイントを提供:
/generate-sql:自然言語からSQL生成/ask-odoo:OdooマニュアルのQA対応/run-sql:SQLをMetabaseに実行し、グラフURLと解説を返す
- FastAPIアプリ。以下のエンドポイントを提供:
metabase_query.py- MetabaseのAPIを使ってSQLを実行・カード(グラフ)を作成
openai-deployment.yaml- OpenAI APIとの接続用Pod
- ChromaDBとMetabase APIに対応
save_metadata.py- OdooのDB構造をjson化して
/chroma/db_metadata.jsonに保存
- OdooのDB構造をjson化して
chroma/- ChromaDBの永続保存先(Odooマニュアルのベクトル検索用)
✅ このシステムで実現できること(総合まとめ)
このプロジェクトは以下のような自然言語ベースの業務支援AIシステムを構築するものです:
🎯 自然言語 → SQL → グラフ → 解説
- 自然言語で質問
- OpenAIでSQLを自動生成(対象テーブルに沿った安全な構文)
- MetabaseにSQLを実行、グラフを作成
- 作成されたグラフURLと、OpenAIによるグラフの意味・解説を自動出力
- フロントエンドでは iframe によるグラフ表示も可能
💡 導入メリット・訴求点
- リリース時にマニュアルを読むことなく使えるUI/UX
- データ検索~グラフ化~解釈~次のアクション提案まで一貫自動化
- カスタマイズさえすれば「ERPのデータ可視化+AIレコメンド基盤」をすぐ提供可能
- 運用コストはKubernetes上のPod運用のみ。継続課金型ビジネスにも転用可能
英語
Here’s the folder and file explanation in English, along with a summary of what the system does, suitable for sharing with offshore teams or in a next project thread.
📁 Project Folder Structure & File Descriptions
🔷 /odoo/
postgres-deployment.yaml- Deployment file for shared Postgres (used by both Odoo and Metabase)
- Executes
create-metabase-db.sqlto createmetabaseDB on startup
create-metabase-db.sql- SQL script to create the
metabasedatabase
- SQL script to create the
pvc-postgres.yaml- Persistent Volume Claim (PVC) for storing Postgres data
🔷 /metabase/
metabase-deployment.yaml- Pod definition for Metabase, using
metabaseDB on shared Postgres
- Pod definition for Metabase, using
metabase-service.yaml- Service exposing Metabase on port 3000
metabase-secret.yaml- Secret containing Metabase initial login credentials
metabase-pvc.yaml- PVC for saving Metabase dashboards and settings
🔷 /openai/
main.py- FastAPI app with the following endpoints:
/generate-sql: Generates SQL from natural language questions/ask-odoo: Answers Odoo-related questions using ChromaDB/run-sql: Executes SQL on Metabase and returns chart URL with OpenAI explanation
- FastAPI app with the following endpoints:
metabase_query.py- Script that sends SQL to Metabase via API and generates chart cards
openai-deployment.yaml- Pod to run the OpenAI integration service
- Connects to ChromaDB and Metabase API
save_metadata.py- Extracts database schema from Odoo and saves it as
db_metadata.json
- Extracts database schema from Odoo and saves it as
chroma/- Persistent storage directory for ChromaDB (used for Odoo documentation embeddings)
✅ What This System Does (Summary)
This project builds a natural language-driven analytics assistant using OpenAI, Metabase, and FastAPI:
🎯 Flow: Natural Language → SQL → Chart → Explanation
- User asks a question in natural language
- OpenAI generates appropriate SQL based on schema metadata
- SQL is executed on Metabase, and a chart is created
- The chart URL is returned along with an automatic explanation by OpenAI
- In the frontend, the chart can be embedded using
iframe
💡 Business Value & Use Case
- No need to manually write SQL or design charts
- Fully automated pipeline from data query to interpretation
- Ideal for building a “smart ERP analytics frontend”
- Can be converted into a SaaS offering by charging for:
- Usage per query
- AI interpretation
- Custom dashboard templates
Let me know if you’d like this turned into a slide deck or a Markdown README for your GitHub repo.
コメントを残す