Skip to content

hungchou8994/int-data-qa-n-sow-generation

Repository files navigation

πŸ€– AI Questionnaire & SOW Generator

Python 3.11+ Streamlit Google Cloud License

Hệ thα»‘ng AI tα»± Δ‘α»™ng sinh BαΊ£ng cΓ’u hỏi khαΊ£o sΓ‘t (Questionnaire) vΓ  PhαΊ‘m vi cΓ΄ng việc (Scope of Work) cho cΓ‘c dα»± Γ‘n tΖ° vαΊ₯n, tΓ­ch hợp Google Gemini, RAG (BigQuery Vector Search), vΓ  xuαΊ₯t kαΊΏt quαΊ£ ra Google Sheets.


πŸ“‹ Table of Contents


✨ Features

🎯 Questionnaire Generator

  • AI-Powered Generation: Sα»­ dα»₯ng Google Gemini vα»›i RAG để sinh cΓ’u hỏi thΓ΄ng minh
  • Multi-Category Support: Tα»• chα»©c cΓ’u hỏi theo cΓ‘c danh mα»₯c logic (Technical, Business, Infrastructure, etc.)
  • Quality Control: AI Judge tα»± Δ‘α»™ng Δ‘Γ‘nh giΓ‘ chαΊ₯t lượng cΓ’u hỏi (coverage, relevance, clarity)
  • Retry Mechanism: Tα»± Δ‘α»™ng regenerate nαΊΏu chαΊ₯t lượng khΓ΄ng Δ‘αΊ‘t (max 3 lαΊ§n)
  • RAG Integration: Vector search trΓͺn BigQuery để lαΊ₯y cΓ’u hỏi tΖ°Ζ‘ng tα»±
  • Google Sheets Export: XuαΊ₯t trα»±c tiαΊΏp vΓ o Google Sheet vα»›i formatting chuyΓͺn nghiệp
  • Custom Worksheet: Người dΓΉng tα»± Δ‘αΊ·t tΓͺn worksheet, tα»± Δ‘α»™ng xΓ³a & tαΊ‘o mα»›i
  • Requirements Display: Hiển thα»‹ yΓͺu cαΊ§u gα»‘c cα»§a người dΓΉng (truncated 200 chars)

πŸ“ SOW Generator

  • Multi-Agent System: 4 agents chuyΓͺn biệt (Generate, Quality, Refine, Export)
  • Intelligent Orchestration: Judge-based quality control vα»›i auto-retry
  • Comprehensive Output: Project Detail + Assumptions + Scope of Work
  • Professional Formatting: 15-column task breakdown vα»›i man-days, owners, dates
  • Dual Worksheet Export:
    • Worksheet 1 "Overview": Project metadata + Detail (left) + Assumptions (right)
    • Worksheet 2 "Scope of Work": Full task table vα»›i Progress dropdown
  • Category Grouping: Tasks grouped by category vα»›i auto-calculated totals
  • Interactive UI: Phase-by-phase generation vα»›i real-time status updates

πŸš€ Common Features

  • Streamlit UI: Modern, responsive web interface
  • Session Management: Persistent state across interactions
  • JSON Export: Download results as structured JSON
  • Error Handling: Comprehensive error reporting vΓ  user guidance
  • Cost Tracking: Token usage monitoring (if implemented)

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         User (Web Browser)                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Streamlit Frontend                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ questionnaire_ui.py   β”‚  β”‚    sow_agent_ui.py             β”‚ β”‚
β”‚  β”‚ - Input form          β”‚  β”‚    - 4-phase workflow          β”‚ β”‚
β”‚  β”‚ - Config sidebar      β”‚  β”‚    - Agent orchestration       β”‚ β”‚
β”‚  β”‚ - Export interface    β”‚  β”‚    - Quality control           β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Business Logic Layer                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Questionnaire Module (app/questionaires/)                 β”‚  β”‚
β”‚  β”‚  - engine.py: Core generation logic                       β”‚  β”‚
β”‚  β”‚  - model.py: Pydantic models (Question, Category, etc.)   β”‚  β”‚
β”‚  β”‚  - prompts.py: LLM prompt templates                       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ SOW Module (app/scope_of_work/)                           β”‚  β”‚
β”‚  β”‚  - engine.py: Multi-agent orchestrator                    β”‚  β”‚
β”‚  β”‚  - model.py: SOW data models                              β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Sheet Connectors (app/sheet/, app/sow_sheet/)             β”‚  β”‚
β”‚  β”‚  - connect.py: Google Sheets API integration              β”‚  β”‚
β”‚  β”‚  - model.py: Sheet operation models                       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    External Services                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ Google       β”‚  β”‚ BigQuery     β”‚  β”‚ Google Sheets      β”‚   β”‚
β”‚  β”‚ Gemini API   β”‚  β”‚ Vector Searchβ”‚  β”‚ API                β”‚   β”‚
β”‚  β”‚ (LLM)        β”‚  β”‚ (RAG)        β”‚  β”‚ (Export)           β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

Questionnaire Generation:

User Input β†’ RAG Retrieval (BigQuery) β†’ LLM Generation (Gemini)
                                              ↓
                                         AI Judge
                                              ↓
                                    Pass? β†’ Export to Sheets
                                    Fail? β†’ Retry (max 3x)

SOW Generation:

Phase 1: Gather Info β†’ Extract requirements
Phase 2: Generate β†’ Multi-agent system (Generate + Quality + Refine)
Phase 3: Quality Control β†’ Judge evaluation + auto-retry
Phase 4: Export β†’ Dual-worksheet formatting β†’ Google Sheets

πŸ› οΈ Tech Stack

Core Technologies

  • Python 3.11+: Primary language
  • Streamlit 1.28+: Web UI framework
  • Pydantic 2.0+: Data validation

AI/ML

  • Google Gemini: LLM for generation (gemini-1.5-flash, gemini-1.5-pro)
  • BigQuery Vector Search: RAG for retrieval
  • Vertex AI: ML platform

Cloud Services

  • Google Cloud Run: Serverless deployment
  • Secret Manager: Credential management
  • Cloud Build: Container builds
  • Artifact Registry: Docker registry

APIs & Integrations

  • Google Sheets API: Export functionality
  • gspread: Python wrapper for Sheets
  • google-auth: Authentication

Development

  • python-dotenv: Environment variables
  • pytest: Testing framework
  • black: Code formatting

πŸ“¦ Prerequisites

1. Software Requirements

  • Python 3.11 or higher
  • pip (Python package manager)
  • Git
  • Google Cloud SDK (for deployment)

2. Google Cloud Platform

  • GCP Project vα»›i cΓ‘c API enabled:
    • Vertex AI API (aiplatform.googleapis.com)
    • BigQuery API (bigquery.googleapis.com)
    • Google Sheets API (sheets.googleapis.com)
    • Google Drive API (drive.googleapis.com)
    • Secret Manager API (secretmanager.googleapis.com)
    • Cloud Run API (run.googleapis.com)

3. Credentials

  • Google API Key: Gemini API access
  • Service Account JSON: BigQuery + Sheets access
    • Required roles:
      • BigQuery Data Viewer
      • BigQuery Job User
      • Vertex AI User

4. Google Sheets

  • Shared Sheet URL (người dΓΉng cung cαΊ₯p)
  • Service account email added as Editor

πŸš€ Installation

Local Development

  1. Clone repository

    git clone https://github.com/hungchou8994/int-data-qa-n-sow-generation.git
    cd int-data-qa-n-sow-generation
  2. Create virtual environment

    # Windows
    python -m venv venv
    .\venv\Scripts\activate
    
    # Linux/Mac
    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies

    cd app
    pip install -r requirements.txt
  4. Setup environment variables

    # Create .env file in project root
    cp .env.example .env
    
    # Edit .env with your credentials
    GOOGLE_API_KEY=your_gemini_api_key_here
    GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account-key.json
  5. Verify installation

    python -c "import streamlit; import google.generativeai; print('OK')"

βš™οΈ Configuration

Environment Variables

Create .env file in project root:

# Required
GOOGLE_API_KEY=AIzaSy...                    # Gemini API key
GOOGLE_APPLICATION_CREDENTIALS=D:\path\to\service-account.json

# Optional
PROJECT_ID=int-data-qa-n-sow-generation     # GCP project ID
BQ_DATASET=your_dataset                     # BigQuery dataset name
BQ_TABLE=your_table                         # BigQuery table name

Service Account Setup

  1. Create service account in GCP Console

  2. Grant IAM roles:

    gcloud projects add-iam-policy-binding int-data-qa-n-sow-generation \
      --member=serviceAccount:SERVICE_ACCOUNT_EMAIL \
      --role=roles/bigquery.dataViewer
    
    gcloud projects add-iam-policy-binding int-data-qa-n-sow-generation \
      --member=serviceAccount:SERVICE_ACCOUNT_EMAIL \
      --role=roles/bigquery.jobUser
    
    gcloud projects add-iam-policy-binding int-data-qa-n-sow-generation \
      --member=serviceAccount:SERVICE_ACCOUNT_EMAIL \
      --role=roles/aiplatform.user
  3. Download JSON key vΓ  set trong .env

BigQuery Setup (RAG)

Prepare your questionnaire embeddings table:

CREATE TABLE `project.dataset.questionnaire_embeddings` (
  id STRING,
  question TEXT,
  embedding ARRAY<FLOAT64>,
  category STRING,
  metadata JSON
);

πŸ’» Usage

Questionnaire Generator

  1. Start app

    cd app
    streamlit run questionnaire_ui.py
  2. Open browser: http://localhost:8501

  3. Configure (Sidebar)

    • Google API Key (if not in .env)
    • Model selection (gemini-1.5-flash recommended)
    • Temperature (0.7 default)
  4. Generate questionnaire

    • Enter customer name
    • Describe business domain
    • Specify requirements
    • Click "Generate Questionnaire"
  5. Export to Google Sheets

    • Paste Google Sheet URL
    • Enter worksheet name (default: "Questionnaire")
    • Click "Export to Google Sheets"

SOW Generator

  1. Start app

    cd app
    streamlit run sow_agent_ui.py
  2. Phase 1: Gather Information

    • Customer name
    • Business context
    • Requirements
    • Click "Start Generation"
  3. Phase 2-3: AI Generation (automatic)

    • Agent system generates SOW
    • Judge evaluates quality
    • Auto-retry if needed
  4. Phase 4: Export

    • Paste Google Sheet URL
    • Enter worksheet names (default: "Overview", "Scope of Work")
    • Click "Export to Google Sheets"
    • Or download JSON

Testing SOW Export

cd app/sow_sheet
python test_export.py

🚒 Deployment

Quick Deploy to Cloud Run

  1. Setup secrets (one-time)

    # Create secrets in Secret Manager
    echo -n "YOUR_API_KEY" | gcloud secrets create google-api-key --data-file=-
    
    gcloud secrets create service-account-key `
      --data-file="D:\path\to\service-account.json"
    
    # Grant access to Cloud Run service account
    .\setup-permissions.ps1
  2. Deploy

    # Windows
    .\deploy.ps1
    
    # Linux/Mac
    chmod +x deploy.sh
    ./deploy.sh
  3. Access deployed app

    • URL will be displayed after deployment
    • Format: https://SERVICE_NAME-HASH-REGION.run.app

Manual Deployment

See detailed guide: DEPLOYMENT.md

Service Account Permissions

See setup guide: SERVICE_ACCOUNT_SETUP.md

Observability (Optional)

See monitoring guide: OBSERVABILITY.md


πŸ“ Project Structure

int-data-qa-n-sow-generation/
β”œβ”€β”€ app/                                # Main application
β”‚   β”œβ”€β”€ questionnaire_ui.py            # Questionnaire Streamlit UI
β”‚   β”œβ”€β”€ sow_agent_ui.py                # SOW Streamlit UI
β”‚   β”œβ”€β”€ requirements.txt               # Python dependencies
β”‚   β”œβ”€β”€ questionaires/                 # Questionnaire module
β”‚   β”‚   β”œβ”€β”€ engine.py                  # Core generation logic
β”‚   β”‚   β”œβ”€β”€ model.py                   # Pydantic data models
β”‚   β”‚   β”œβ”€β”€ prompts.py                 # LLM prompt templates
β”‚   β”‚   └── test.py                    # Unit tests
β”‚   β”œβ”€β”€ scope_of_work/                 # SOW module
β”‚   β”‚   β”œβ”€β”€ engine.py                  # Multi-agent orchestrator
β”‚   β”‚   └── model.py                   # SOW data models
β”‚   β”œβ”€β”€ sheet/                         # Questionnaire sheets connector
β”‚   β”‚   β”œβ”€β”€ connect.py                 # Google Sheets integration
β”‚   β”‚   └── model.py                   # Sheet models
β”‚   └── sow_sheet/                     # SOW sheets connector
β”‚       β”œβ”€β”€ connect.py                 # SOW export logic
β”‚       β”œβ”€β”€ model.py                   # SOW sheet models
β”‚       └── test_export.py             # Export testing script
β”œβ”€β”€ rag/                                # RAG module
β”‚   β”œβ”€β”€ main.py                        # RAG orchestrator
β”‚   β”œβ”€β”€ bq_vector.py                   # BigQuery vector search
β”‚   β”œβ”€β”€ requirements.txt               # RAG dependencies
β”‚   β”œβ”€β”€ embedding/                     # Embedding generation
β”‚   β”‚   └── model.py                   # Embedding models
β”‚   └── sheet/                         # RAG data ingestion
β”‚       β”œβ”€β”€ ingest_questionnaires.py   # Ingest questionnaires
β”‚       β”œβ”€β”€ ingest_sows.py             # Ingest SOWs
β”‚       β”œβ”€β”€ prompt.py                  # Embedding prompts
β”‚       β”œβ”€β”€ questionaires.csv          # Sample data
β”‚       └── sow_hung.csv               # Sample SOW data
β”œβ”€β”€ Dockerfile                          # Container definition
β”œβ”€β”€ .dockerignore                       # Docker build exclusions
β”œβ”€β”€ deploy.ps1                          # PowerShell deployment script
β”œβ”€β”€ deploy.sh                           # Bash deployment script
β”œβ”€β”€ setup-permissions.ps1               # IAM permission setup
β”œβ”€β”€ .env.example                        # Environment template
β”œβ”€β”€ .gitignore                          # Git exclusions
β”œβ”€β”€ README.md                           # This file
β”œβ”€β”€ DEPLOYMENT.md                       # Deployment guide
β”œβ”€β”€ SERVICE_ACCOUNT_SETUP.md            # Permission guide
└── OBSERVABILITY.md                    # Monitoring guide

πŸ“š Documentation

Key Components

Questionnaire Module (app/questionaires/)

  • engine.py: Core generation with retry logic
  • model.py: Data models (Question, Category, Questionnaire)
  • prompts.py: System prompts vΓ  templates

SOW Module (app/scope_of_work/)

  • engine.py: Multi-agent orchestrator (4 agents)
  • model.py: SOW models (ProjectDetail, ProjectAssumption, ScopeOfWork)

Sheet Connectors (app/sheet/, app/sow_sheet/)

  • connect.py: Google Sheets API wrapper
  • Delete + recreate worksheet approach
  • Professional formatting (colors, borders, widths)
  • Frozen headers, data validation (dropdowns)

RAG Module (rag/)

  • bq_vector.py: BigQuery vector similarity search
  • embedding/model.py: Text embedding generation
  • sheet/ingest_*.py: Data ingestion scripts

πŸ§ͺ Testing

Run unit tests

cd app/questionaires
python -m pytest test.py -v

Test SOW export

cd app/sow_sheet
python test_export.py

Manual testing checklist

  • Generate questionnaire (5-10 categories)
  • Judge passes (score >= 75)
  • Export to Google Sheets works
  • Worksheet name customization works
  • Generate SOW (all 4 phases)
  • SOW export creates 2 worksheets
  • Formatting is correct (colors, borders, widths)

🀝 Contributing

Development Workflow

  1. Create feature branch

    git checkout -b feature/your-feature-name
  2. Make changes

    • Follow PEP 8 style guide
    • Add docstrings to functions
    • Update tests if needed
  3. Test locally

    streamlit run questionnaire_ui.py
  4. Commit & push

    git add .
    git commit -m "Add: your feature description"
    git push origin feature/your-feature-name
  5. Create Pull Request

Code Style

  • Use black for formatting: black app/
  • Use flake8 for linting: flake8 app/
  • Follow PEP 8 conventions

πŸ“Š Performance

Latency Benchmarks (local)

  • Questionnaire Generation: 15-30s (depends on RAG retrieval + LLM)
  • SOW Generation: 45-90s (multi-agent with retries)
  • Sheet Export: 3-8s (depends on data size)

Cloud Run Performance

  • Cold start: 10-15s (first request)
  • Warm start: 2-5s (subsequent requests)
  • Memory usage: ~500MB-1GB
  • CPU: 2 vCPU recommended

πŸ”’ Security

Best Practices

  • βœ… Never commit .env or credentials to git
  • βœ… Use Secret Manager for production secrets
  • βœ… Rotate API keys regularly
  • βœ… Use service accounts with least privilege
  • βœ… Enable Cloud Armor (DDoS protection) for production
  • βœ… Implement authentication if needed (Cloud IAP, OAuth)

Secrets Management

  • Local: .env file (gitignored)
  • Cloud Run: Secret Manager
  • CI/CD: GitHub Secrets or Cloud Build substitutions

πŸ› Troubleshooting

Common Issues

1. Module import error after folder rename

# Clear Python cache
find . -type d -name "__pycache__" -exec rm -rf {} +
# Or Windows PowerShell
Get-ChildItem -Recurse -Directory -Filter __pycache__ | Remove-Item -Recurse -Force

2. Google Sheets "Insufficient permissions"

  • Share sheet vα»›i service account email (from JSON)
  • Grant "Editor" permission

3. BigQuery "Access Denied"

  • Verify service account has roles/bigquery.dataViewer
  • Check dataset/table permissions

4. Gemini API quota exceeded

  • Check API quotas in GCP Console
  • Increase quota or use exponential backoff

5. Streamlit connection error

# Disable XSRF protection
streamlit run app.py --server.enableXsrfProtection=false

6. Cloud Run deployment fails

# Check build logs
gcloud builds log BUILD_ID

# Check service logs
gcloud run logs tail SERVICE_NAME --region asia-southeast1

πŸ™ Acknowledgments

  • Google Cloud Platform for Vertex AI & BigQuery
  • Streamlit team for excellent web framework
  • Google Gemini for powerful LLM capabilities

πŸ“ž Support

Issues & Questions:

Documentation:


πŸ—ΊοΈ Roadmap

Version 1.1 (Planned)

  • Migrate to Google ADK (Agent Development Kit)
  • Implement A2A (Agent-to-Agent) communication
  • Add OpenTelemetry observability
  • Custom dashboards in Cloud Monitoring
  • Automated testing pipeline (CI/CD)

Version 1.2 (Future)

  • Multi-language support (English, Vietnamese)
  • PDF export functionality
  • Template management system
  • User authentication & authorization
  • Team collaboration features

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published