← Back to team overview

dhis2-devs team mailing list archive

Re: Inconsistent name while retrieving category option combos

 

I think this has been discussed before, and I would be in favor of being
able to get reproducible names. However ideally, I think it should be up to
the implementer to determine this. So, lets say you have a category (B,A)
and age groups (Y,X,Z). So, the user would then get the following category
combo options

B,Y
B,X
B,Z
A,Y
A,X
A,Z

So, the ordering of the category options should be the same as when the
category is created and sorted by the user, not necessarily by alphabetical
order.

Best regards,
Jason






On Fri, Jul 18, 2014 at 8:02 AM, Mansi Singhal <msinghal@xxxxxxxxxxxxxxxx>
wrote:

> Hi Lars/Morten,
>
> Can you please let us know your suggestions on the same?
>
>
> On Wed, Jul 16, 2014 at 2:57 PM, Mansi Singhal <msinghal@xxxxxxxxxxxxxxxx>
> wrote:
>
>> Hi Morten,
>>
>> Thanks for the quick reply.
>>
>> We saw the code. It is getting the names of category options in a HashSet
>> and generating the names iterating over it. We get different names since
>> HashSet is not ordered.
>>
>> Would it be a good idea to return the exact same response each time for
>> the same query parameter? We can do this by converting the Set to a List
>> and sorting it alphabetically. Let us know what you think. If you are ok
>> with this approach, we would like to submit a patch for it.
>>
>>
>> Thanks,
>> Mansi
>>
>>
>>
>>
>> On Wed, Jul 16, 2014 at 2:22 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>> wrote:
>>
>>> Hi Mansi,
>>>
>>> Names for DataElementCategoryOptionCombo are not persisted, but rather
>>> generated on the fly. Please have a look
>>> at DataElementCategoryOptionCombo.getName.
>>>
>>> I don't know exactly why this is, I will let Lars add to it.
>>>
>>> --
>>> Morten
>>>
>>>
>>> On Wed, Jul 16, 2014 at 3:41 PM, Mansi Singhal <
>>> msinghal@xxxxxxxxxxxxxxxx> wrote:
>>>
>>>> Hi,
>>>>
>>>> We are creating category option combos by posting the following JSON to
>>>> /api/metadata.
>>>>
>>>> {
>>>>     "categoryOptionCombos": [{
>>>>         "id": "cdf922cc47b",
>>>>         "categoryCombo": {
>>>>             "name": "A and B",
>>>>             "id": "abe84f2cf8e"
>>>>         },
>>>>         "name": "(abc, def)",
>>>>         "categoryOptions": [{
>>>>             "id": "z2ab39bcfd7",
>>>>             "name": "abc"
>>>>         }, {
>>>>             "id": "c78bd47f6af",
>>>>             "name": "def"
>>>>         }]
>>>>     }]
>>>> }
>>>>
>>>> When we are trying to GET the category option combos using
>>>> /api/categoryOptionCombos, the name we get is inconsistent with every call.
>>>> We are getting (abc, def) for some times and (def, abc) some other times.
>>>>
>>>> Is this the intended behavior? Shouldn't the name retrieved be the same
>>>> as the name POSTed as is the case for every other metadata?
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Mansi Singhal
>>>>
>>>>
>>>>
>>>
>>
>>
>
>
> --
> Regards,
> Mansi Singhal
>
> _______________________________________________
> 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
>
>

Follow ups

References