appspace / appspace/kwwhat

bridges for attempts and visits

Open
#150 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
14
Forks
3
PR merge metrics
No merged PRs in 30d

Description

`fact_attempts` and `fact_visits` have arrays in their output. Looks like the better way is to use bridge tables.

---
Bridge Tables
A helper table that resolves many-to-many relationships between a fact table and a dimension.
Why it exists:

Dimensions should be one-to-many with facts (one product per sale)
But sometimes facts have many dimensions of the same type (e.g., one order has many products, or one product has multiple colors)
Bridge tables enable many-to-many relationships while maintaining the star schema

Example - Orders with Multiple Products:
Without bridge table (denormalized fact):
OrderKey | ProductKey | Quantity | Amount
1 | 100 | 2 | 49.98
1 | 101 | 1 | 29.99 ← Same order, multiple rows (violates grain)
With bridge table:
Order_Product Bridge
├── OrderKey | ProductKey | Quantity | Amount | Weight
│ 1 | 100 | 2 | 49.98 | 0.5
│ 1 | 101 | 1 | 29.99 | 0.5

Orders Fact (grain: one row per order)
├── OrderKey | CustomerKey | DateKey | TotalAmount
│ 1 | 5 | 120 | 79.97
Common use cases:

Multiple products per order
Multiple colors/sizes per product variant
Multiple physicians per patient visit
Multiple technicians per service call

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the fact_attempts and fact_visits model definitions and inspecting how their arrays are produced. Review the existing fact-table grain and determine the bridge-table structure needed for each relationship; done means the arrays are replaced by appropriate bridges without breaking the fact outputs or their relationships.

Written by the indexing model from the issue text.

Assessment

Domain
data-engineering, databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.