# DeepBrain AI Metabase project

This project uses the existing local Metabase server and account, with **separate database 3, collection 17, dashboards 7–10 and 24 new saved questions**. It does not share the SORI dataset or collections. This is separation within the same local Metabase installation, not a second server/application database.

The snapshot is `deepbrain-study.sqlite` in this folder; canonical practice data is `../lab/deepbrain_practice.sqlite`. All business/evaluation values are fictional; metric definitions and initiative plans are proposed. No credentials are in this project or the website downloads. Private credentials are read in memory from the existing local infrastructure, never copied.

Dashboard URLs are in `links.json`. Exact queries are `Q01.sql`–`Q24.sql`; executable SQLite versions are in `../lab/sql`. Open a saved question for the query and underlying table. The task evidence table Q15 provides record-level drilldown; the dashboard banner links it. The financial and offline/planning questions do not accept persona/workflow filters because those dimensions would misrepresent their scope.

Filters: persona; workflow (task actual workflow, user primary intended workflow); signup month; From inclusive and To exclusive dates in YYYY-MM-DD. Financial questions use whole calendar months: align both dates to month starts. Default To 2026-10-01 excludes partial October. Q01 filters use date; task cards use creation date; user cards use signup date. Always read the card's population. Static evaluation and planning cards retain their independent populations. Choose filters, select Update filter, then inspect query output.

North Star links are hypotheses, not measured causal weights. Account-level weekly value is distinct from task funnel counts and user activation/return. Confirmation coverage and customer effort remain separate. The charts do not execute paid models or retrieve live company data.

Reproduce: with the local server running, `python3 scripts/build_metabase.py` then `python3 scripts/validate_metabase.py` from the project root. These scripts update only IDs in this project's `objects.json`; do not remove that registry. `build_lab.py` refuses an existing database. Never point it at SORI. An import on another installation needs an authorized Metabase session and creation of a new SQLite connection/collection; keep credential paths local and private. If the server is stopped, use the existing installation's Start Metabase.command; do not run account setup again.

Validation compares every cell of 168 actual filtered Metabase queries against canonical SQLite, checks all parameter mappings, and verifies old card definitions plus source hashes remain unchanged. Browser chart-rendering evidence is reported separately in the QA report.


## Extended SORI-equivalent capabilities

Run only inside this DeepBrain project, using an existing authorized local session:

```bash
python3 scripts/build_metabase_library.py
python3 scripts/build_relationship_explorers.py
python3 scripts/describe_deepbrain_metadata.py
python3 scripts/describe_deepbrain_charts.py
python3 scripts/validate_relationship_explorers.py
/Users/pj/Documents/Sori/.venv-analysis/bin/python scripts/build_metabase_analysis_docs.py
```

The library and explorer builders update only IDs in their own DeepBrain state registries; no database generation occurs. Keep the existing state files on this Mac to avoid duplicates. On a different machine, create a new DeepBrain connection/collection with build_metabase.py first, then run library/explorer builders with fresh state. Never copy current-machine IDs into a different server's state. The portable bundle excludes executable object registries and retains read-only reference IDs in the metric crosswalk/catalog. Set metabase_client.py to that machine's authorized session location; do not publish or paste secrets.

Library: dashboard 11. Strategy/journey/growth explorers: 12,13,14. The four operational dashboards remain 7–10. 27 reusable metric objects, 13 models and a full 32-definition registry are separate from 24 operational questions and 13 relationship views. Rates are 0–1 unless a chart explicitly says percent. Full library snapshot differs from default date-filtered questions. Full financial months and complete weekly value windows are enforced.

`metrics/pm_chart_descriptions.json` holds complete descriptions behind compact tooltips; `metrics/dimensions_catalog.json` and `metric_dimensions.json` hold field definitions. `qa/Metabase_Parity_Report.md` explains equivalent scope, validation and unsupported instrumentation. Raw database metadata already has 27 foreign-key relationships. Open database 3 tables/model sources or Q15 to inspect evidence; preaggregate child rows before joining.
