Dataset report downloads not a useful format

When I try to download the data set report, the two options are xls or PDF, but both export the data in a very un-friendly format. As a workaround, the program team manually copies the table from the web UI, pastes it into excel, and then sends it off. Is there any other way to export the data set reports in a human-readable format to avoid this manual process?

thanks,
ali

Sorry, I don’t know much about the dataset report.

How comfortable you are with coding ?
You might have a look at Taskr
It’s possible to combine several api calls to dhis2 and generate csv or more advanced xls files in a small js snippet.

2 Likes

@Ali_Flaming, do you mean that you’d like the export to be human-readable text instead of binary? Hitting the data set report page’s underlying API endpoint from the browser will give you a human-readable JSON representation of the data set report. For example, assuming you’re logged into the demo instance of DHIS2, opening DHIS 2 Demo - Sierra Leone from your browser will give you:

[
   {
      "title":"HIV testing and counseling HIV age",
      "subtitle":"Sierra Leone W9 2020Sat 2020",
      "headers":[
         {
            "name":"Data element",
            "column":"Data element",
            "type":"java.lang.String",
            "hidden":false,
            "meta":true
         },
         {
            "name":"<15y",
            "column":"<15y",
            "type":"java.lang.String",
            "hidden":false,
            "meta":false
         },
         {
            "name":"15-24y",
            "column":"15-24y",
            "type":"java.lang.String",
            "hidden":false,
            "meta":false
         },
         {
            "name":"25-49y",
            "column":"25-49y",
            "type":"java.lang.String",
            "hidden":false,
            "meta":false
         },
         {
            "name":">49y",
            "column":">49y",
            "type":"java.lang.String",
            "hidden":false,
            "meta":false
         },
         {
            "name":"Total",
            "column":"Total",
            "type":"java.lang.String",
            "hidden":false,
            "meta":false
         }
      ],
      "metaData":{
         
      },
      "rows":[
         [
            "HIV: currently on care",
            null,
            null,
            null,
            null,
            null
         ],
         [
            "HIV: new on care",
            null,
            null,
            null,
            null,
            null
         ],
         [
            "HIV: testing",
            null,
            null,
            null,
            null,
            null
         ],
         [
            "HIV: counseling",
            null,
            null,
            null,
            null,
            null
         ]
      ],
      "height":4,
      "headerWidth":6,
      "width":6
   }
]

You can then manually feed the JSON output into a tool which turns JSON into CSV so that the data set report is compatible with Excel (e.g., JSON to CSV Converter | Online Tool).

2 Likes

thanks for the suggestions - this is for the relatively low-tech-literacy supervisors who will be reviewing the reports to monitor the program, so these solutions won’t work. but you’ve both confirmed that this is not a bug, this is expected behavior for the data set report export, correct? i will submit a jira bug as i think this is a pretty important feature for the platform to be able to export human-readable versions of the data set reports

As far as I know, the exported XLS or PDF will appear exactly the same as they were designed. If you used a custom dataset entry form design, make sure that you’re using a valid HTML table. This has been discussed here

Someone previously created a jira bug issue (see post link above). You can vote/watch /add a comment in the Jira issue: https://jira.dhis2.org/browse/DHIS2-11705

Thanks!