Defect in metadata import for optionSets?

Hello Lars,

We are trying to create ‘options’ and ‘optionSets’ on empty Database.

Request Payload:

{

"optionSets": [{

    "id": "b73cdddd773",

    "name": "Hours",

    "options": [{

        "code": "b64365ac185",

        "id": "b64365ac185",

        "name": "One"

    }]

}, {

    "id": "b640fd0cc0f",

    "name": "Minutes",

    "options": [{

        "code": "b65ad0e22c5",

        "id": "b65ad0e22c5",

        "name": "One"

    }]

}],

"options": [{

    "code": "b64365ac185",

    "id": "b64365ac185",

    "name": "One"

}, {

    "code": "b65ad0e22c5",

    "id": "b65ad0e22c5",

    "name": "One"

}]

}

Api Call: /api/metadata

After the api call, the Hour option set is empty while the Minute option set has “One”.

Is this a defect in DHIS or we are missing something in our payload ?

···

Regards,

Mansi Singhal

Hi

Please remember that the way we handle options/optionSets have been changed now. You need to have

This now works as any other metadata… you first define the options, then create optionsets with references to these options… this allow for option reuse, and also translation

···

On Fri, Nov 28, 2014 at 4:28 PM, Mansi Singhal msinghal@thoughtworks.com wrote:

Hello Lars,

We are trying to create ‘options’ and ‘optionSets’ on empty Database.

Request Payload:

{

"optionSets": [{
    "id": "b73cdddd773",
    "name": "Hours",
    "options": [{
        "code": "b64365ac185",
        "id": "b64365ac185",
        "name": "One"
    }]
}, {
    "id": "b640fd0cc0f",
    "name": "Minutes",
    "options": [{
        "code": "b65ad0e22c5",
        "id": "b65ad0e22c5",
        "name": "One"
    }]
}],
"options": [{
    "code": "b64365ac185",
    "id": "b64365ac185",
    "name": "One"
}, {
    "code": "b65ad0e22c5",
    "id": "b65ad0e22c5",
    "name": "One"
}]

}

Api Call: /api/metadata

After the api call, the Hour option set is empty while the Minute option set has “One”.

Is this a defect in DHIS or we are missing something in our payload ?

Regards,

Mansi Singhal


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

Hi Morten,

Some more information on this:

On an empty DHIS database, I ran the options payload only.

{

“options”: [{

“code”: “b64365ac185”,

“id”: “b64365ac185”,

“name”: “One”

}, {

“code”: “b65ad0e22c5”,

“id”: “b65ad0e22c5”,

“name”: “One”

}]

}

After that, I loaded /api/options.json and found only one entry, the option with code “b65ad0e22c5”. The first option was missing. It seems to be using the “name” attribute (and not the code) to determine whether to create or update the entry. Is this by design?

Regards,

Simanta

···

On Sat, Nov 29, 2014 at 11:55 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Please remember that the way we handle options/optionSets have been changed now. You need to have

This now works as any other metadata… you first define the options, then create optionsets with references to these options… this allow for option reuse, and also translation


Morten

On Fri, Nov 28, 2014 at 4:28 PM, Mansi Singhal msinghal@thoughtworks.com wrote:

Hello Lars,

We are trying to create ‘options’ and ‘optionSets’ on empty Database.

Request Payload:

{

"optionSets": [{
    "id": "b73cdddd773",
    "name": "Hours",
    "options": [{
        "code": "b64365ac185",
        "id": "b64365ac185",
        "name": "One"
    }]
}, {
    "id": "b640fd0cc0f",
    "name": "Minutes",
    "options": [{
        "code": "b65ad0e22c5",
        "id": "b65ad0e22c5",
        "name": "One"
    }]
}],
"options": [{
    "code": "b64365ac185",
    "id": "b64365ac185",
    "name": "One"
}, {
    "code": "b65ad0e22c5",
    "id": "b65ad0e22c5",
    "name": "One"
}]

}

Api Call: /api/metadata

After the api call, the Hour option set is empty while the Minute option set has “One”.

Is this a defect in DHIS or we are missing something in our payload ?

Regards,

Mansi Singhal


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

This is now fixed in the latest trunk + 2.17

···

On Mon, Dec 1, 2014 at 3:19 PM, Simanta Jyoti Handique shandique@thoughtworks.com wrote:

Hi Morten,

Some more information on this:

On an empty DHIS database, I ran the options payload only.

{

“options”: [{

“code”: “b64365ac185”,

“id”: “b64365ac185”,

“name”: “One”

}, {

“code”: “b65ad0e22c5”,

“id”: “b65ad0e22c5”,

“name”: “One”

}]

}

After that, I loaded /api/options.json and found only one entry, the option with code “b65ad0e22c5”. The first option was missing. It seems to be using the “name” attribute (and not the code) to determine whether to create or update the entry. Is this by design?

Regards,

Simanta


Morten

On Sat, Nov 29, 2014 at 11:55 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Please remember that the way we handle options/optionSets have been changed now. You need to have

This now works as any other metadata… you first define the options, then create optionsets with references to these options… this allow for option reuse, and also translation


Morten

On Fri, Nov 28, 2014 at 4:28 PM, Mansi Singhal msinghal@thoughtworks.com wrote:

Hello Lars,

We are trying to create ‘options’ and ‘optionSets’ on empty Database.

Request Payload:

{

"optionSets": [{
    "id": "b73cdddd773",
    "name": "Hours",
    "options": [{
        "code": "b64365ac185",
        "id": "b64365ac185",
        "name": "One"
    }]
}, {
    "id": "b640fd0cc0f",
    "name": "Minutes",
    "options": [{
        "code": "b65ad0e22c5",
        "id": "b65ad0e22c5",
        "name": "One"
    }]
}],
"options": [{
    "code": "b64365ac185",
    "id": "b64365ac185",
    "name": "One"
}, {
    "code": "b65ad0e22c5",
    "id": "b65ad0e22c5",
    "name": "One"
}]

}

Api Call: /api/metadata

After the api call, the Hour option set is empty while the Minute option set has “One”.

Is this a defect in DHIS or we are missing something in our payload ?

Regards,

Mansi Singhal


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Great, thanks!

···

On Mon, Dec 1, 2014 at 2:06 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

This is now fixed in the latest trunk + 2.17


Morten

On Mon, Dec 1, 2014 at 3:19 PM, Simanta Jyoti Handique shandique@thoughtworks.com wrote:

Hi Morten,

Some more information on this:

On an empty DHIS database, I ran the options payload only.

{

“options”: [{

“code”: “b64365ac185”,

“id”: “b64365ac185”,

“name”: “One”

}, {

“code”: “b65ad0e22c5”,

“id”: “b65ad0e22c5”,

“name”: “One”

}]

}

After that, I loaded /api/options.json and found only one entry, the option with code “b65ad0e22c5”. The first option was missing. It seems to be using the “name” attribute (and not the code) to determine whether to create or update the entry. Is this by design?

Regards,

Simanta

On Sat, Nov 29, 2014 at 11:55 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Please remember that the way we handle options/optionSets have been changed now. You need to have

This now works as any other metadata… you first define the options, then create optionsets with references to these options… this allow for option reuse, and also translation


Morten

On Fri, Nov 28, 2014 at 4:28 PM, Mansi Singhal msinghal@thoughtworks.com wrote:

Hello Lars,

We are trying to create ‘options’ and ‘optionSets’ on empty Database.

Request Payload:

{

"optionSets": [{
    "id": "b73cdddd773",
    "name": "Hours",
    "options": [{
        "code": "b64365ac185",
        "id": "b64365ac185",
        "name": "One"
    }]
}, {
    "id": "b640fd0cc0f",
    "name": "Minutes",
    "options": [{
        "code": "b65ad0e22c5",
        "id": "b65ad0e22c5",
        "name": "One"
    }]
}],
"options": [{
    "code": "b64365ac185",
    "id": "b64365ac185",
    "name": "One"
}, {
    "code": "b65ad0e22c5",
    "id": "b65ad0e22c5",
    "name": "One"
}]

}

Api Call: /api/metadata

After the api call, the Hour option set is empty while the Minute option set has “One”.

Is this a defect in DHIS or we are missing something in our payload ?

Regards,

Mansi Singhal


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp