Skip to content

About

Core data platform and transformation pipeline for Oppia product analytics. Contains dbt models, schemas, and SQL logic translating raw web and Android event data into production-ready analytical datasets.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Oppia Product Analytics Data Platform

This repository houses the central dbt (Data Build Tool) transformation pipeline for Oppia. It ingests raw logging inputs from both the Web server and Android client applications and converts them into structured, performance-optimized analytical datasets inside Google Cloud BigQuery.


Repository Topology

The project uses three dbt model layers. Folder names are part of the dbt configuration in dbt_project.yml, so new models should be added to the corresponding layer.

  ├── models/
  │   ├── staging/
  │   │   ├── web/             # Raw web sources and web event cleaning
  │   │   ├── android/         # Raw Android sources and Android event cleaning
  │   │   └── cuj_reference/   # CUJ workbook inventory and step definitions
  │   ├── intermediate/        # Reusable transformations shared by marts
  │   │   └── cuj_health/      # CUJ mappings, readiness, progression, metrics
  │   └── marts/               # Business-facing models by product domain
  │       ├── users/
  │       ├── curriculum/
  │       ├── growth_outreach/
  │       └── cuj_health/      # Semantic Layer CUJ-health outputs
  ├── seeds/cuj_health/         # Governed CUJ mappings, thresholds, and step pairs
  ├── tests/cuj_health/         # Custom CUJ-health assertions
  ├── macros/                  # Reusable dbt macros across all domains
  │   ├── ga4/                 # Reusable GA4 event-parameter extraction
  │   ├── cuj_health/          # Shared CUJ-health calculations
  │   └── generate_surrogate_key.sql
  ├── utils/
  │   └── udf/                 # Warehouse user-defined functions
  ├── dbt_project.yml           # Model routing and project scope
  └── profiles.yml.example      # Credential configuration blueprint

Model Naming

Use a double underscore between the entity and the business subject, for example stg_web_analytics__events or int_web_cuj__event_matches. Keep source definitions in src_<platform>.yml files and keep model descriptions and tests beside the models they document.


⚙️ Local Sandbox Environment Setup

Before compiling data structures locally, developers must establish active credentials to access the development sandboxes inside oppia-analytics-test.

1. Initialize Local Environment and Dependencies

Ensure you have Python 3.11+ installed, create a virtual environment, and install the project dependencies:

python3 -m venv .venv
source .venv/bin/activate

# Install dbt-bigquery and local dev tools (ruff, coverage, sqlfluff, yamllint)
pip install -r requirements-dev.txt

# Pull down open-source external packages (if any)
dbt deps

2. Configure Your Connection Profile

Local credentials are kept strictly out of git version control.

  1. Copy the tracking template: cp profiles.yml.example profiles.yml

  2. Open your newly created profiles.yml file and replace "dev_yourname" with your specific developer schema signature (e.g., dev_johndoe).

  3. Authenticate with Google Cloud using your local user credentials: gcloud auth application-default login

3. Verify System Path Execution

Run a diagnostic framework check to ensure dbt can establish a secure handshake with BigQuery:

dbt debug

🚀 Daily Execution Commands

  • Compile the structural SQL lineage tree: dbt compile

  • Build and test models inside your personal schema sandbox: dbt build --target dev

  • Run offline linting, tests, and coverage checks (same checks run in PR CI): yamllint --strict . ruff check . ruff format --check . coverage run -m unittest discover -s scripts -v && coverage report sqlfluff lint models/ tests/ dbt parse python3 scripts/check_dbt_coverage.py

For modeling conventions and architecture details, see models/README.md. For making and reviewing Pull Requests, see CONTRIBUTING.md.

About

Core data platform and transformation pipeline for Oppia product analytics. Contains dbt models, schemas, and SQL logic translating raw web and Android event data into production-ready analytical datasets.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages