test-demoprep / README.md
mikeboone's picture
chore: README, e2e grader, share-permission fix, sprint + quality results
fcde472
|
Raw
History Blame Contribute Delete
6.99 kB
---
title: ThoughtSpot Demo Builder
emoji: πŸš€
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: "4.44.1"
app_file: app.py
pinned: false
license: mit
python_version: "3.11"
---
# DemoPrep β€” AI-Powered ThoughtSpot Demo Builder
A Gradio application that generates and deploys complete ThoughtSpot demo environments end to end β€” company research, an LLM-authored data blueprint, deterministic data generation, a Snowflake schema + data load, and a ThoughtSpot semantic model and liveboard.
> **Deployed on Hugging Face Spaces.** `app.py` is the entry point. See [DEPLOYMENT.md](DEPLOYMENT.md) for setup.
## πŸ–₯️ The interface
The app is a **tabbed Gradio UI**, and the **App tab is the primary way to build a demo**: fill in a short form and press **GO**, and the full pipeline runs automatically with live progress.
> **Naming note:** the whole application lives in **`chat_interface.py`** β€” that name is *historical*. It is **not** just a chat interface; that single file hosts every tab (App, Chat, Admin, Settings, Run History, …), and the **App tab is the main path**. A **Chat tab** offers an alternative conversational flow that runs the same pipeline. `app.py` simply configures and launches this app.
## πŸš€ Features
- **AI-powered research** β€” researches the company and industry with an LLM
- **Single blueprint pipeline** β€” one path, no keyword routing or fallback: research β†’ LLM-authored `DemoBlueprint` β†’ deterministic engine β†’ validation β†’ derived DDL β†’ load
- **Realistic data** β€” bounded/related measures (a part never exceeds its whole, rates stay ≀ 1, prices are stable per entity) plus planted, discoverable "Demo to Win" insights the validator proves are visible
- **ThoughtSpot integration** β€” deploys the connection, tables, semantic model, and an enhanced liveboard
- **Interactive UI** β€” tabbed Gradio app with real-time progress
## πŸ› οΈ Tech Stack
- **Frontend**: Gradio (Python web UI)
- **Backend**: Python 3.11
- **Database**: Snowflake (keypair auth)
- **Analytics**: ThoughtSpot (per-environment trusted auth)
- **AI**: multiple LLM providers (OpenAI and Anthropic/Claude), routed via `llm_config.py`
- **Settings**: Supabase (admin + per-user settings)
## πŸ“‹ Prerequisites
- Python 3.11
- Snowflake account (keypair configured)
- ThoughtSpot Cloud account
- An LLM API key (OpenAI and/or Anthropic)
- Supabase project (settings storage)
## πŸš€ Quick Start
1. **Clone the repository**
```bash
git clone <repo-url>
cd demoprep
```
2. **Set up a virtual environment**
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
4. **Configure bootstrap environment variables** (see Configuration)
```bash
cp .env.example .env
# edit .env
```
5. **Run the application**
```bash
python app.py
```
`app.py` launches the full Gradio app defined in `chat_interface.py`.
6. **Open your browser**
Navigate to `http://localhost:7860` and use the **App** tab.
## βš™οΈ Configuration
`.env` holds only the **bootstrap** secrets needed to start the app and reach Supabase and the LLM providers. All other credentials β€” the Snowflake keypair and the ThoughtSpot **per-environment trusted-auth keys** β€” live in **Supabase admin settings** and are loaded at runtime.
```env
# Supabase (settings storage)
SUPABASE_URL=...
SUPABASE_ANON_KEY=...
# LLM providers
OPENAI_API_KEY=...
GOOGLE_API_KEY=... # optional (Gemini)
# Slack deployment notifications (optional, outbound-only)
SLACK_BOT_TOKEN=xoxb-...
SLACK_DEPLOYMENT_CHANNEL_ID=C0123456789
```
Slack notifications use the Slack Web API to post deployment status into one approved channel. This path is outbound-only: no Socket Mode, event subscriptions, slash commands, or public request URL. The Slack app needs only the `chat:write` bot scope and must be invited to the target channel.
## 🎯 Usage
The **App tab** is the primary interface β€” fill the form, press **GO**, and the pipeline runs end to end:
1. **Fill the form** β€” vertical / line of business / function (or a custom use case), the company URL, and the target **ThoughtSpot environment**
2. **Press GO** β€” research β†’ blueprint β†’ data generation β†’ validation β†’ Snowflake load β†’ ThoughtSpot model + liveboard
3. **Review** β€” model and liveboard links, a Demo Pack, and a Spotter Viz story appear on completion
## πŸ“ Project Structure
```
demoprep/
β”œβ”€β”€ app.py # Entry point β€” launches the Gradio app on :7860
β”œβ”€β”€ chat_interface.py # The full Gradio app (App/Chat/Admin/Settings/…) β€” historical name
β”œβ”€β”€ thoughtspot_deployer.py # ThoughtSpot deploy: connection, tables, model, liveboard
β”œβ”€β”€ liveboard_creator.py # MCP liveboard creation + TML post-processing (enhance_mcp_liveboard)
β”œβ”€β”€ snowflake_auth.py # Snowflake keypair authentication
β”œβ”€β”€ llm_config.py # LLM provider/model routing (single source of truth)
β”œβ”€β”€ demo_personas.py # Vertical Γ— Function use-case configs
β”œβ”€β”€ demoprep_app/ # The demo-generation pipeline package
β”‚ β”œβ”€β”€ pipeline/build_demo.py # the single build entry point
β”‚ β”œβ”€β”€ scenario/ # blueprint contract + LLM authoring + directives
β”‚ β”œβ”€β”€ dataset/ # deterministic engine + validator
β”‚ β”œβ”€β”€ ddl/ # Snowflake DDL derived from the dataset
β”‚ └── integrations/snowflake/ # Snowflake row loader
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ docs/ # Documentation
β”œβ”€β”€ tests/ # Unit tests + the e2e quality harness (e2e_quality.py)
└── results/ # Generated demo results
```
## πŸ§ͺ Testing
```bash
# Unit tests (pytest collects test_*.py)
python -m pytest tests/
# End-to-end quality harness β€” drives a running app via the browser and grades the output
python tests/e2e_quality.py --env-name test
```
## 🀝 Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## πŸ“„ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## πŸ™ Acknowledgments
- ThoughtSpot for the analytics platform
- Snowflake for the data warehouse
- OpenAI and Anthropic for the AI capabilities
- Gradio for the web interface
## πŸ“š Development Notes
Sprint planning and working notes live in `dev_notes/` (gitignored); architecture and handoff docs are in `docs/`.
## πŸ“ž Support
For support, create an issue in this repository.
---
**Built with ❀️ for the ThoughtSpot community**