This directory contains the complete synthetic demo for the question:
Analyze the average GAAP value of valid users for product X during March 2026, show the trend, and explain the largest spike.
The dataset is fictional and reproducible. It contains 475 rows in
dws_gaap_di, uses a fixed random seed, and has a deliberate spike on
2026-03-10. A valid user is one whose fiscal year-to-date GAAP value is at
least 10 USD.
| Asset | Purpose |
|---|---|
demo_semantic_config.xlsx |
DataBridge semantic configuration for the datasource, domain, dataset, columns, dimensions, metric, and metric formula |
demo_kg_doc.docx |
Knowledge Graph document containing the valid-user definition and business events associated with the spike |
init_demo.sh / init_demo.ps1 / init_demo.py |
Repeatable SQLite and PostgreSQL initialization, verification, and DataBridge registration |
smoke_test.py |
Deterministic real-CLI/DataBridge/SQL test using a local model stub |
semantic_smoke_test.py |
Deterministic datasource + semantic CLI test (CRUD, import, weave); no model key |
Complete the root initialization first. Start the local services in terminal A; the frontend is not needed for this test:
# macOS / Linux
scripts/start_local.sh --skip-frontend# Windows PowerShell
.\scripts\start_local.ps1 --skip-frontendIn terminal B, start and seed the bundled PostgreSQL database, then run the smoke test using the commands for your platform:
# macOS / Linux
examples/init_demo.sh
uv run python examples/smoke_test.py# Windows PowerShell
.\examples\init_demo.ps1
uv run python .\examples\smoke_test.pyThe smoke test starts an isolated DataBridge API and an OpenAI-compatible local
stub, registers the real PostgreSQL datasource, runs a real qwenpaw-data run, and
checks that the SQL result contains the expected 2026-03-10 average of 45.89.
It makes no external model request and does not need a real API key.
After configuring the root .env and running the platform initializer, start
the full local stack in terminal A:
# macOS / Linux
scripts/start_local.sh# Windows PowerShell
.\scripts\start_local.ps1The UI is available at http://localhost:3000 and the API at
http://localhost:8765.
In terminal B, run:
# macOS / Linux
examples/init_demo.sh --register# Windows PowerShell
.\examples\init_demo.ps1 -RegisterThis one command:
- creates and verifies
examples/demo/data/qwenpaw-data-demo.sqlite; - starts PostgreSQL with Docker Compose and loads all 475
dws_gaap_dirows; - imports
demo_semantic_config.xlsxinto DataBridge; and - attaches the local PostgreSQL credentials to datasource
postgresql-demo-gaap.
The PostgreSQL service listens on 127.0.0.1:55432 by default:
database: qwenpaw_data_demo
user: qwenpaw_data
password: qwenpaw-data-demo
These are loopback-only demo credentials, not production credentials. Override
the host port with QWENPAW_DATA_DEMO_POSTGRES_PORT.
Open the DataBridge UI:
- In Semantic Weaving, select
Demo PG - GAAP use caseand submit aFULLweave. - In KG Docs Management, upload
examples/demo_kg_doc.docx. - Wait until the document status is
ready.
The Excel configuration is already imported by --register; do not import it
again manually. KG extraction and semantic embeddings use the model settings in
the root .env. For a SQL-only test, you can skip this graph-building step and
run the deterministic smoke test instead.
Verify that the fixed demo datasource is visible:
qwenpaw-data datasource listThen run:
# macOS / Linux
qwenpaw-data run \
--no-stream \
--datasource-id postgresql-demo-gaap \
"Analyze the average GAAP value of valid users for product X during March 2026; show the trend over time and explain any spikes with relevant KG events"# Windows PowerShell
qwenpaw-data run --no-stream --datasource-id postgresql-demo-gaap "Analyze the average GAAP value of valid users for product X during March 2026; show the trend over time and explain any spikes with relevant KG events"The expected peak is 2026-03-10, with an average GAAP value of approximately
45.89 for valid product-X users. The Knowledge Graph document includes the
student renewal campaign and North enterprise renewal batch that explain the
spike.
SQLite is available without Docker:
# macOS / Linux
examples/init_demo.sh --sqlite-only
sqlite3 examples/demo/data/qwenpaw-data-demo.sqlite \
"SELECT ds, ROUND(AVG(gaap_val), 2) FROM dws_gaap_di WHERE product = 'X' AND ytd_gaap >= 10 GROUP BY ds ORDER BY ds;"# Windows PowerShell (creates and verifies the same SQLite file)
.\examples\init_demo.ps1 -SqliteOnlyPostgreSQL can be queried after running either platform initializer:
docker compose -f examples/docker-compose.yml exec -T postgres \
psql -U qwenpaw_data -d qwenpaw_data_demo -c \
"SELECT ds, ROUND(AVG(gaap_val), 2) FROM dws_gaap_di WHERE product = 'X' AND ytd_gaap >= 10 GROUP BY ds ORDER BY ds;"The same docker compose ... psql command can be entered as one line in
PowerShell.
Stop the demo PostgreSQL service without deleting its volume:
docker compose -f examples/docker-compose.yml downDelete the demo database volume as well:
docker compose -f examples/docker-compose.yml down --volumesThe initializer is idempotent: rerunning it drops and recreates the demo table with the same rows and expected aggregates.
Conceptually, the Knowledge Graph defines what a valid user means, while the
semantic metric defines how the value is calculated. The current execution
path cannot yet translate a KG entity rule into an SQL predicate, so the metric
formula also contains ytd_gaap >= 10. The KG remains the business-definition
and event-evidence source; the metric formula remains the executable SQL
contract.
- Docker is unavailable: use
examples/init_demo.sh --sqlite-onlyon macOS/Linux or.\examples\init_demo.ps1 -SqliteOnlyon Windows. - Registration cannot reach DataBridge: start the platform lifecycle script
and confirm
http://127.0.0.1:8765/api/healthresponds. - KG ingestion fails: verify
OPENAI_API_KEY,OPENAI_BASE_URL,LLM_MODEL, and the embedding configuration in.env. - PostgreSQL reports that
dws_gaap_diis missing: rerun the platform demo initializer and checkdocker compose -f examples/docker-compose.yml ps. - The analysis returns no March data: include the explicit March 2026 date range in the prompt; the demo is intentionally historical.