dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00251
Re: [Dhis-dev] DataElement -> PeriodType association
Hi Lars
OK, after much poking around the schema, I realize that I have
misinterpreted something. You have to impose one of two constraints.
Either:
1. A DataElement can only (must) be a member of one DataSet; or
2. A DataElement can only (must) have one PeriodType.
And also a DataValue already has a period associated, so there is no
need to also associate the PeriodType explicitly - ie. my suggestion
above is nonsense.
If you could impose (1) it would be cleaner as this would implicitly
enforce (2) but I can see it might be more disruptive to the existing
corpus of data.
Though I am still nagged by doubt that there seems to be some
redundancy in your proposal and also that it will be hard to enforce
constraints at the database level ie. you require a well behaved
application. And in the end it is the datavalues which are to be
aggregated, reported on etc.
If we cannot impose (1), or we shouldn't or we don't want to, then is
it instead possible to think of a "fully qualified" DataElement as
DataSet::DataElement? Practically this means having DataSet,
DataElement and Period association with the DataValue. The advantage
would be that we still only need to associate the PeriodType with the
DataSet.
Of course this probably does not work if DataElements are meant to be
aggregated across different DataSets as it assumes a DataElement in
one DataSet is not the same apple or orange as the same DataElement in
another DataSet. If this is the case, then I do agree, the only
solution is to make the schema change you suggest.
Regards
Bob
PS. I am still looking for sample datasets. I tried the link at
http://208.76.222.114/confluence/display/DHIS2/Downloads but it is
broken. Can anyone please point me to some.
2009/3/17 Lars Helge Øverland <larshelge@xxxxxxxxx>:
>
>>
>>
>> If I read you correctly, you are effectively moving the association
>> down from the dataset to the dataelement.
>
> Actually this implies keeping the DataSet-PeriodType association as you need
> it to enforce that only DataElements with corresponding PeriodTypes are
> members.
>
> Lars
>
>
>
Follow ups
References