Data Model:

Anthony alanthonyc at gmail.com
Sun Apr 12 23:08:51 EDT 2009


On Apr 12, 7:46 pm, Aaron Watters <aaron.watt... at gmail.com> wrote:
> On Apr 12, 10:14 pm, Anthony <alantho... at gmail.com> wrote:
>
>
>
> > I'm struggling on whether or not to implement GroupItem (below) with
> > two separate models, or with one model that has a distinguishing key:
>
> > Given:
> > class ParentGroup:
> >     a group of values represented by class GroupItem
>
> > class ChildGroup:
> >     a group of values represented by class GroupItem
> >     foreign-key to ParentGroup (many Children sum to one Parent)
>
> > Option A:
> > class GroupItem:
> >     foreign-key to ParentGroup
> >     foreign-key to ChildGroup
> >     GroupItemType in (ParentItem, ChildItem)
> >     value
> >     value-type
>
> > Option B:
> > class ParentGroupItem
> >     foreign-key to ParentGroup
> >     value
> >     value-type
>
> > class ChildGroupItem
> >     foreign-key to ChildGroup
> >     value
> >     value-type
>
> > What are my considerations when making this decision?
>
> > Thanks!
>
> It looks to me that the two designs
> might be useful for different
> purposes.  What are you trying to do?
>
>   -- Aaron Watters
>
> ====
> whiff.sourceforge.nethttp://aaron.oirt.rutgers.edu/myapp/root/misc/erdTest

The group values represent statistics that I'm tracking, based on
activity groups.  Some samples:

Group: Johnson, Total Units Produced = 10, Total Units Consumed = 5
Chris Johnson, Units Produced = 6, Units Consumed = 3
Jim Johnson, Units Produced = 4, Units Consumed = 2

Group: Smith, Total Units Produced = 15, Total Units Consumed = 8
Mark Smith, Units Produced = 7, Units Consumed = 5
Bob Smith, Units Produced = 8, Units Consumed = 3

The groups will be responsible for entering their own statistics, so I
will have to do some validation at data entry.  The ability to create
new statistic types (e.g. Units Broken) for new groups in the future
is important.

What would be the advantages of using option A versus option B?

Thanks for the quick response.



More information about the Python-list mailing list