dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28259
Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 14092: Support for category option group sets in analytics service
On 21 February 2014 16:56, Lars Helge Øverland <larshelge@xxxxxxxxx> wrote:
> Bob,
>
> sorry I don't have time to give a full reply now, will do later. For your
> work on the parser you can just ignore this for now.
>
OK. will try.
>
> There is a good reason for the new option combination, bizarre or not, and
> it has nothing to do with concepts nor data value sets.
>
Alright. I am sceptical. I can see that it probably solves an immediate
problem with partner reporting but am not convinced its the best approach.
Will wait to hear the good reason when you have more time.
> Lars
>
>
>
> On Fri, Feb 21, 2014 at 4:43 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx>wrote:
>
>> Lars, I think this categoryoptiongroupset thing (
>> https://blueprints.launchpad.net/dhis2/+spec/category-option-groups-and-group-sets)
>> is looking like a slightly bizarre twist which will come to no good.
>>
>> Importantly I think it now makes communication with dhis2 closer to
>> impossible from a third party system unless that system also implements the
>> same categoryoptioncombo madness/peculiarity/genius (take your pick!).
>>
>> The categoryoptiongroup/categoryoptiongroupset seem to equate almost
>> directly to the category/categorycombo construct as collections of
>> collections of categoryoptions. The difference being the constraint on
>> groups and groupsets effectively creates the situation we had for a while
>> with categories (where categoryoptions in one category couldn't be in
>> another). So instead of resolving the situation we have now implemented
>> both variants - the one which is too loose and the other which is too
>> strict for general use. And, somewhat arbitrarily, the one type of
>> dimension is applicable to datasets as a whole and the other to datavalues.
>>
>> In my previous mail regarding dxf datavalues I pointed out that, as we
>> stand, the categoryOptionCombo is a just a bunch of categoryOptions where
>> identifying the categories themselves is not even required. So for example
>>
>> <dv value='3' sex='M' age='under1' />
>>
>> would store the value with a categoryoptioncombo corresponding to
>> ('M','under1'). This makes a parser of expanded options possible by simply
>> gathering up *all* the extra attribute values and looking up which
>> catoptcombo matches. The attribute names are not important. Not ideal but
>> we figured it would be better than nothing. I was starting to look at
>> implementing this today when the implications of this other business
>> started dawning.
>>
>> I am worried that by now adding yet another categoryoptioncombo to the
>> datavalue you are making this very difficult to externalize ie. there is
>> not an easy way to describe an interoperable dxf2 datavalue format without
>> also describing (now two variants of!) categoryoptioncombos.
>>
>> Enough ranting. So what do I think should be different? :
>> 1. instead of creating two types of category dimension we should rather
>> really implement the 'concept' properly. So categoryoptions are more than
>> just a uniform collection of labels, but each one is linked to a concept.
>> Like 'under1' is an AGE_GROUP concept. Another way of looking at this is
>> that the collection of categoryoptions now becomes identifiable as distinct
>> separate vocabularies - logically equivalent to having separate tables for
>> age, sex, disease, partner etc. This is a requirement for being able to
>> import and export codelists or controlled vocabs. It would facilitate what
>> you have done with categoryoptiongroupsets without creating a bundle of new
>> classes.
>> 2. if we want to attach attributes or dimensions (they are different) to
>> the datavalueset we should create a datavalueset class to do this. I think
>> this would be a much more logical addition to our datavalue object than
>> this other catoptcombo. A datavalueset could be used for registering
>> completeness, data locking as well as assigning broad attributes like
>> 'implementing partner' to a complete range of datavalues.
>>
>> Sorry for the long mail. But I am really concerned about this
>> proliferation of categoryoptioncombos into new places. And somewhat at a
>> loss as to how to describe this in terms of dxf2 interoperability. Maybe
>> the weekend will shed a better light on it.
>>
>> Bob
>>
>>
>>
>> On 21 February 2014 13:44, <noreply@xxxxxxxxxxxxx> wrote:
>>
>>> ------------------------------------------------------------
>>> revno: 14092
>>> committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
>>> branch nick: dhis2
>>> timestamp: Fri 2014-02-21 14:44:04 +0100
>>> message:
>>> Support for category option group sets in analytics service
>>> modified:
>>>
>>> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
>>>
>>> dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
>>>
>>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
>>>
>>>
>>> --
>>> lp:dhis2
>>> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
>>>
>>> Your team DHIS 2 developers is subscribed to branch lp:dhis2.
>>> To unsubscribe from this branch go to
>>> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
>>>
>>> === modified file
>>> 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
>>> ---
>>> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
>>> 2014-02-13 14:24:59 +0000
>>> +++
>>> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
>>> 2014-02-21 13:44:04 +0000
>>> @@ -32,6 +32,7 @@
>>> import org.hisp.dhis.hierarchy.HierarchyViolationException;
>>>
>>> import java.util.Collection;
>>> +import java.util.List;
>>> import java.util.Map;
>>> import java.util.Set;
>>>
>>> @@ -396,7 +397,6 @@
>>> * DataElementCategoryOptions.
>>> *
>>> * @param categoryOptions
>>> - * @return
>>> */
>>> DataElementCategoryOptionCombo getDataElementCategoryOptionCombo(
>>> Collection<DataElementCategoryOption> categoryOptions );
>>> @@ -410,6 +410,12 @@
>>> */
>>> DataElementCategoryOptionCombo getDataElementCategoryOptionCombo(
>>> DataElementCategoryOptionCombo categoryOptionCombo );
>>>
>>> + /**
>>> + * Retrieves a DataElementCategoryOptionCombo.
>>> + *
>>> + * @param categoryCombo the DataElementCategoryOptionCombo.
>>> + * @param categoryOptions the set of DataElementCategoryOptions.
>>> + */
>>> DataElementCategoryOptionCombo getDataElementCategoryOptionCombo(
>>> DataElementCategoryCombo categoryCombo,
>>> Set<DataElementCategoryOption> categoryOptions );
>>>
>>> @@ -563,6 +569,8 @@
>>> CategoryOptionGroup getCategoryOptionGroup( int id );
>>>
>>> CategoryOptionGroup getCategoryOptionGroup( String uid );
>>> +
>>> + List<CategoryOptionGroup> getCategoryOptionGroupsByUid(
>>> Collection<String> uids );
>>>
>>> void deleteCategoryOptionGroup( CategoryOptionGroup group );
>>>
>>> @@ -593,6 +601,8 @@
>>> CategoryOptionGroupSet getCategoryOptionGroupSet( int id );
>>>
>>> CategoryOptionGroupSet getCategoryOptionGroupSet( String uid );
>>> +
>>> + List<CategoryOptionGroupSet> getCategoryOptionGroupSetsByUid(
>>> Collection<String> uids );
>>>
>>> void deleteCategoryOptionGroupSet( CategoryOptionGroupSet group );
>>>
>>>
>>> === modified file
>>> 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
>>> ---
>>> dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
>>> 2014-02-04 21:38:37 +0000
>>> +++
>>> dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
>>> 2014-02-21 13:44:04 +0000
>>> @@ -99,6 +99,7 @@
>>> import org.hisp.dhis.common.NameableObject;
>>> import org.hisp.dhis.common.NameableObjectUtils;
>>> import org.hisp.dhis.constant.ConstantService;
>>> +import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
>>> import org.hisp.dhis.dataelement.DataElement;
>>> import org.hisp.dhis.dataelement.DataElementCategory;
>>> import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
>>> @@ -964,6 +965,17 @@
>>> return Arrays.asList( object );
>>> }
>>>
>>> + CategoryOptionGroupSet cogs =
>>> categoryService.getCategoryOptionGroupSet( dimension );
>>> +
>>> + if ( cogs != null )
>>> + {
>>> + List<NameableObject> cogz = asList(
>>> categoryService.getCategoryOptionGroupsByUid( items ) );
>>> +
>>> + DimensionalObject object = new BaseDimensionalObject(
>>> dimension, DimensionType.CATEGORYOPTION_GROUPSET, null,
>>> cogs.getDisplayName(), cogz );
>>> +
>>> + return Arrays.asList( object );
>>> + }
>>> +
>>> DataElementCategory dec =
>>> categoryService.getDataElementCategory( dimension );
>>>
>>> if ( dec != null && dec.isDataDimension() )
>>>
>>> === modified file
>>> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
>>> ---
>>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
>>> 2014-02-13 14:24:59 +0000
>>> +++
>>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
>>> 2014-02-21 13:44:04 +0000
>>> @@ -793,6 +793,11 @@
>>> return categoryOptionGroupStore.getByUid( uid );
>>> }
>>>
>>> + public List<CategoryOptionGroup> getCategoryOptionGroupsByUid(
>>> Collection<String> uids )
>>> + {
>>> + return categoryOptionGroupStore.getByUid( uids );
>>> + }
>>> +
>>> public void deleteCategoryOptionGroup( CategoryOptionGroup group )
>>> {
>>> categoryOptionGroupStore.delete( group );
>>> @@ -874,6 +879,11 @@
>>> {
>>> return categoryOptionGroupSetStore.getByUid( uid );
>>> }
>>> +
>>> + public List<CategoryOptionGroupSet>
>>> getCategoryOptionGroupSetsByUid( Collection<String> uids )
>>> + {
>>> + return categoryOptionGroupSetStore.getByUid( uids );
>>> + }
>>>
>>> public void deleteCategoryOptionGroupSet( CategoryOptionGroupSet
>>> group )
>>> {
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>
References