Troubleshooting DHIS2 jobs

22 views
Skip to first unread message

mic...@medicmobile.org

unread,
Sep 7, 2017, 7:48:27 PM9/7/17
to OpenFn Community
Just doing some prototyping to familiarize myself with OpenFn + DHIS2.  I set up a job where I submit a hard coded data value set to the DHIS2 demo server.  I'm able to successfully curl the same payload directly to DHIS2, but when I set up the job in OpenFn, it says the job failed (see screenshot).  Any advice on what may be the issue or how to troubleshoot?

curl -d @datavalueset.json "https://play.dhis2.org/dev/api/dataValueSets" -H "Content-Type:application/json" -u admin:district | json_pp

{
  "dataSet": "pBOMPrpg1QX",
  "completeData": "2014-03-03",
  "period": "201402",
  "orgUnit": "DiszpKrYNg8",
  "dataValues": [
    { "dataElement": "f7n9E0hX8qk", "value": "10" },
    { "dataElement": "Ix2HsbDMLea", "value": "20" },
    { "dataElement": "eY5ehpbEsB7", "value": "30" }
  ]
}


openfn_dhis2_datavalueset_run_1133527.png
datavalueset.json

Taylor Downs

unread,
Sep 8, 2017, 8:02:08 AM9/8/17
to mic...@medicmobile.org, OpenFn Community
Hey Michael, happy to help! Would you be willing to post your job expression on the forum?

Taylor

--
You received this message because you are subscribed to the Google Groups "OpenFn Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openfn+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openfn/8ef69e34-aef7-49cb-9b09-a515dcf0f13b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Taylor Downs | Founder & Core Contributor
OpenFn | Integrated Systems for Development

downs....@gmail.com

unread,
Sep 8, 2017, 8:09:25 AM9/8/17
to OpenFn Community
Try this out. I ran the following just now and it worked:

dataValueSet(
  fields(
    field("dataSet", "pBOMPrpg1QX"),
    field("orgUnit", "DiszpKrYNg8"),
    field("period", "201402"),
    field("completeData", "2014-03-03"),
    field("dataValues", function(state) {
      return [
        dataElement("f7n9E0hX8qk", 10),
        dataElement("Ix2HsbDMLea", 20),
        dataElement("eY5ehpbEsB7", 30)
      ]
    })
  )
)

Hope this helps. Would still love to see your job so I can get a sense of how you were interpreting the README.md and we can make some clarifications. 

Best,
Taylor

On Friday, 8 September 2017 09:02:08 UTC-3, Taylor Downs wrote:
Hey Michael, happy to help! Would you be willing to post your job expression on the forum?

Taylor
On Thu, Sep 7, 2017 at 8:48 PM, <mic...@medicmobile.org> wrote:
Just doing some prototyping to familiarize myself with OpenFn + DHIS2.  I set up a job where I submit a hard coded data value set to the DHIS2 demo server.  I'm able to successfully curl the same payload directly to DHIS2, but when I set up the job in OpenFn, it says the job failed (see screenshot).  Any advice on what may be the issue or how to troubleshoot?

curl -d @datavalueset.json "https://play.dhis2.org/dev/api/dataValueSets" -H "Content-Type:application/json" -u admin:district | json_pp

{
  "dataSet": "pBOMPrpg1QX",
  "completeData": "2014-03-03",
  "period": "201402",
  "orgUnit": "DiszpKrYNg8",
  "dataValues": [
    { "dataElement": "f7n9E0hX8qk", "value": "10" },
    { "dataElement": "Ix2HsbDMLea", "value": "20" },
    { "dataElement": "eY5ehpbEsB7", "value": "30" }
  ]
}


--
You received this message because you are subscribed to the Google Groups "OpenFn Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openfn+un...@googlegroups.com.

mic...@medicmobile.org

unread,
Sep 8, 2017, 12:03:28 PM9/8/17
to OpenFn Community
Thanks Taylor!  That worked.  The issue I had was with the second parameter I provided to dataElement... I sent the string "10" instead of the number 10.  Rookie mistake !
openfnjobdef.png

Taylor Downs

unread,
Sep 8, 2017, 1:21:45 PM9/8/17
to mic...@medicmobile.org, OpenFn Community
Very cool. Also, make sure you're using the latest version of the dhis2 adaptor so you've got access to the helpers. Should look like this:

Inline image 1

--
You received this message because you are subscribed to the Google Groups "OpenFn Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openfn+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openfn/c4f44641-8418-4016-b3bc-bd80660db9b1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

mic...@medicmobile.org

unread,
Sep 8, 2017, 5:59:49 PM9/8/17
to OpenFn Community
Hmm... I don't see those helpers. I have 'Latest (auto-upgrade)' selected for the version of the DHIS2 adapter. 

Two other things I tried... (1) specifically selecting the latest version (v0.1.0); and (2) creating a new job (instead of editing an existing) but alas, still no helpers. 

On Friday, September 8, 2017 at 10:21:45 AM UTC-7, Taylor Downs wrote:
Very cool. Also, make sure you're using the latest version of the dhis2 adaptor so you've got access to the helpers. Should look like this:

Inline image 1
On Fri, Sep 8, 2017 at 1:03 PM, <mic...@medicmobile.org> wrote:
Thanks Taylor!  That worked.  The issue I had was with the second parameter I provided to dataElement... I sent the string "10" instead of the number 10.  Rookie mistake !


On Thursday, September 7, 2017 at 4:48:27 PM UTC-7, mic...@medicmobile.org wrote:
Just doing some prototyping to familiarize myself with OpenFn + DHIS2.  I set up a job where I submit a hard coded data value set to the DHIS2 demo server.  I'm able to successfully curl the same payload directly to DHIS2, but when I set up the job in OpenFn, it says the job failed (see screenshot).  Any advice on what may be the issue or how to troubleshoot?

curl -d @datavalueset.json "https://play.dhis2.org/dev/api/dataValueSets" -H "Content-Type:application/json" -u admin:district | json_pp

{
  "dataSet": "pBOMPrpg1QX",
  "completeData": "2014-03-03",
  "period": "201402",
  "orgUnit": "DiszpKrYNg8",
  "dataValues": [
    { "dataElement": "f7n9E0hX8qk", "value": "10" },
    { "dataElement": "Ix2HsbDMLea", "value": "20" },
    { "dataElement": "eY5ehpbEsB7", "value": "30" }
  ]
}


--
You received this message because you are subscribed to the Google Groups "OpenFn Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openfn+un...@googlegroups.com.
Screen Shot 2017-09-08 at 2.43.58 PM.png

Taylor Downs

unread,
Sep 9, 2017, 11:23:39 AM9/9/17
to mic...@medicmobile.org, OpenFn Community

One more thought... The documentation for dhis2 is pretty new. Can you try a hard-refresh on the page to clear your cache? On Chrome it's cntrl-shift-r, or command-shift-r.

Taylor


You received this message because you are subscribed to a topic in the Google Groups "OpenFn Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openfn/k_rSAjc2Qgo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openfn+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openfn/4301bf49-264c-46d8-b815-8c3147956f39%40googlegroups.com.

mic...@medicmobile.org

unread,
Sep 11, 2017, 1:06:26 PM9/11/17
to OpenFn Community
I can see it now, thanks!
Reply all
Reply to author
Forward
0 new messages