← Back to all products

Energy Customer Data Model

$2490

Reusable star-schema template for energy retailers/DSOs connecting customers, contracts, metering points, and products with deterministic surrogate keys and referential-integrity checks. Ships a dependency-free modeling library + offline tests. The foundation gold layer for CLV, settlement, and trading.

📁 19 files🏷 v1.0.0
Production-readyUnit-testedDatabricks Asset Bundle
✓ Instant download✓ Lifetime updates✓ MIT licensed✓ Secure checkout (Stripe)

⚙ Try the Live Demo interactive

Edit a fact table and see grain-violation and referential-orphan checks run live — the model's integrity logic in your browser.

⚡ Open Schema Validator

📋 What's Inside 19 files

  • README.md
  • LICENSE
  • manifest.json
  • databricks.yml
  • resources/jobs.yml
  • src/dimensions/d_customer.sql
  • src/dimensions/d_contract.sql
  • src/dimensions/d_metering_point.sql
  • src/dimensions/d_product.sql
  • src/facts/f_contract_mp_customer_product.sql
  • src/quality/quality_monitoring_summary.sql
  • lib/star_schema.py
  • tests/test_star_schema.py
  • conftest.py
  • guide/01_what-you-get.md
  • guide/02_getting-started.md
  • guide/03_architecture.md
  • guide/04_support.md
  • guides/data-modeling-methodology.md

📁 File Structure 19 files

energy-customer-data-model/
├── README.md
├── LICENSE
├── manifest.json
├── databricks.yml
├── resources/
│   ├── jobs.yml
├── src/
│   ├── dimensions/
│   │   ├── d_customer.sql
│   │   ├── d_contract.sql
│   │   ├── d_metering_point.sql
│   │   ├── d_product.sql
│   ├── facts/
│   │   ├── f_contract_mp_customer_product.sql
│   ├── quality/
│   │   ├── quality_monitoring_summary.sql
├── lib/
│   ├── star_schema.py
├── tests/
│   ├── test_star_schema.py
├── conftest.py
├── guide/
│   ├── 01_what-you-get.md
│   ├── 02_getting-started.md
│   ├── 03_architecture.md
│   ├── 04_support.md
├── guides/
│   ├── data-modeling-methodology.md

📖 Documentation Preview README excerpt

Energy Customer Data Model

A reusable **star-schema template** for energy retailers and DSOs that connects

customers, contracts, metering points, and products — the foundation gold layer

that CLV, balance settlement, and trading analytics plug into.

Fully generic and environment-agnostic: adapt the source references to your

CIS/billing system, pick a business domain (electricity_sales / heat_and_cooling

/ distribution), and deploy.

What's inside

- **Databricks Asset Bundle** — a daily refresh (4 dimensions → central fact →

quality summary).

- **Four conformed dimensions** — customer, contract, metering point, product,

each with a deterministic surrogate key.

- **A central fact** at (contract × metering point) grain with referential

integrity to every dimension.

- **A quality summary** — grain-uniqueness and orphan-key checks.

- **A dependency-free modeling library** (`lib/star_schema.py`): surrogate keys,

grain-violation detection, referential-orphan detection, completeness, and

conformed-dimension checks — with an offline test suite (5 tests).

Quickstart

```bash

pip install pytest && pytest tests/ -v

databricks bundle deploy -t dev -p <profile>

```

Map your CIS source tables (`cis.customers`, `cis.contracts`,

`cis.metering_points`, `cis.products`, and the bridge tables).

License

MIT — see `LICENSE`.

... preview truncated, see full README in product download.

📄 Code Sample .sql preview

src/dimensions/d_customer.sql-- Customer Dimension — one row per customer with a deterministic surrogate key. -- Mirrors lib/star_schema.surrogate_key(). Adapt source refs to your CIS. CREATE OR REPLACE TABLE IDENTIFIER(:target_catalog || '.' || :target_schema || '.d_customer') AS SELECT MD5(CONCAT_WS('||', customer_code, :business_domain)) AS customer_key, customer_code, customer_name, customer_type, -- residential / business postal_code, city, country, :business_domain AS business_domain, CURRENT_TIMESTAMP() AS _load_timestamp FROM IDENTIFIER(:source_catalog || '.cis.customers');