← Back to team overview

dhis2-devs team mailing list archive

Re: Error POSTing programs metadata

 

Hi Shilpa

So the rules can be a bit cryptic when using the metadata importer directly
and not the UI (we are hoping to have more intelligent validation in
2.20/2.21), bur the rules are:

1) All ProgramStageDataElements (PSDE) must be present in ProgramStage.PSDE
(regardless of which section they belong to)

2) I have made a fix in rev 18795 that should connect your
programStageSection.PSDE properly

So, it is possible to mess this up.. you can do just pt 2, but that means
the reports etc will be wrong, so please make sure to add to both
collections.

--
Morten

On Wed, Apr 1, 2015 at 4:43 PM, Shilpa Goley <goleys@xxxxxxxxxxxxxxxx>
wrote:

> Hi Morten,
>
> Thanks for the tip. We are able to bind programStage to the
> programStageDataElement  successfully now.
>
> But we are still facing problems while binding programStageSection with
> programStageDataElement. We tried two ways to post.
>
> 1. The payload we've tried posting is as follows:
> {
>     "programStageSections": [
>         {
>             "name": "ProgramSectionForStage1",
>             "programStage": {
>                 "id": "a775ea998743",
>                 "name": "Stage1"
>             },
>             "programStageDataElements": [
>                 {
>                     "id": "udEOZq12345"
>                 }
>             ]
>         }
>     }
>
> Where "udEOZq12345" is a programStageDataElement defined for the
> ProgramSectionForStage1.
>
> 2. We also tried the strategy similar to that of programStage. The
> payloads we tried is as follows:
>
> First Created the programStageSection: (This returns success and creates
> the Section)
> {
>     "programStageSections": [
>         {
>             "name": "ProgramSectionForStage1",
>             "programStage": {
>                 "id": "a775ea97123",
>                 "name": "Stage1"
>             },
>             "sortOrder": 1
>         }
>     ]
> }
>
> And then the programStageDataElements: (This returns success, but does not
> create the bindings.)
>
> {
>     "programStageDataElements": [
>         {
>             "id": "skCkh4ifu34",
>              "dataElement": {
>                 "id": "a365abcddba",
>                 "name": "Arrival Date - Burn Unit"
>             },
>
>             "programStage": {
>                 "id": "a775ea97123",
>                 "name": "Stage1"
>             },
>             "programStageSection": {
>                 "id": "bAu6mYQF12T",
>                 "name": "ProgramSectionForStage1"
>             }
>         }
>     ]
> }
>
> Can you hep us out?
>
>
>
>
>
> On Tue, Mar 31, 2015 at 5:05 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
> wrote:
>
>>
>> On Tue, Mar 31, 2015 at 3:53 PM, Shilpa Goley <goleys@xxxxxxxxxxxxxxxx>
>> wrote:
>>
>>>             "programStageDataElements": [
>>>                 {
>>>                     "id": "a36531ccdvv",
>>>                     "name": "Arrival Date - Burn Unit"
>>>                 }
>>>             ],
>>>
>>
>> Just to confirm, this is pointing to an already created
>> programStageDataElement instance? you probably don't even need this in the
>> payload.. just create the programStage as normal (without
>> programStageDataElement) then create an instance of programStageDataElement
>> where you bind connect programStage and dataElement together
>>
>> --
>> Morten
>>
>
>
>
> --
> Thanks and Regards
> Shilpa
>

References