mardi 5 juillet 2016

Data Warehouse Hierarchical Events

I need to model an event tracking system, items tracked are hierarchical (it's a relatively complex hierarchy, but I'll simplify it for this post). Progress is tracked at the lowest level, and then when all of the children reach a given state the parent is marked as completed.

It's not education, but this is a good way to illustrate the point, let's assume we have two levels:

  • Class
  • Module

A student takes a class that is constructed of many modules, so when all modules are completed the class is completed (following a test), and the student receives a certificate. Easy.

So we know the following:

  1. 'things' need to be tracked at a module, and a class level, so we know we need a fact table for each gain.
  2. these levels are hierarchical, so we know they need a relationship between them.
  3. events kind of roll-up, but not in the way numeric measures can roll up

So at present, I kind of have this arrangement in my mind...

Fig1

The thought process here is that modules and classes are separate entities and need to be different dimensions in order to correctly describe the contents of the fact tables that reside at differing grains. I've not 100% thought through the relationship between the two, but it does exist in some capacity because the classes roll up into one another... so this is basically descendant tables similar to AdventureWorks Product > ProductSubCategory > ProductCategory, i don't think it can be maintained as a single table due to the need for fact tables of a different grain??

The other mechanism I have thought about, which now I type this out is potentially more flexible (i will think, and qualify this with an edit later) is maybe this...

Fig2

I suppose it would also be possible to pop-out the parent-child to more of an "adjacency list" style design, but I'm not sure at this point if that would be more, or less work to maintain...?

Something I have just thought about while writing this up though, is what happens if a module needs to be part of multiple classes... perhaps an adjacency list would be more suitable at that point? It's starting to turn into more of a "network" than hierarchy at this point though...

Aucun commentaire:

Enregistrer un commentaire