Error when downloading line list of event reports

Hi, I have a line list of over 1000 events that I am trying to download via the events reports app. However, when I try to download in xls, csv or html formats, I get this error This site can’t be reached. When I try plain data source formats, I get only 100 records (page in view) of about 1300. How can I download all the data?

I’ve personally had this experience when the list of DataElements that I’ve selected is too great, and the result is when I request to download the information, the API request that’s formulated is too long for it to be accepted.

This would be relevant if:

  1. You are pulling a lot of data elements
  2. when reducing the number of data elements, the pulling of events does succeed.

Can stay tuned if this has an effect, if not we can talk more @Akoth_Ondiek

1 Like

Thanks Mathew for this. However, even after cutting down the number of data elements to 3 still gives the same error when downloading.

1 Like

@Akoth_Ondiek ok interesting. The next thing I’d check is if the data elements you are including have optionSets. In our past, when options were manually re-arranged, the sort order was compromised on the backend and the export isn’t possible. The check here would be to simply remove any DE with an optionSet associated, eventually whittling down to any/all DEs which cause the export to fail.

Apologies if I’m sending you down wrong paths! Welcome other thoughts here from CoP if my notes aren’t working for you!

2 Likes

Most probably this is the issue. Majority of my DEs have associated OptionSets, and unfortunately dropping any of them isn’t an option for me. Your thoughts are very helpful.

Not sure if extracting the data using python is a safe option?

1 Like

I’ll defer to @Gassim on safety concerns; can’t think of anything there but not my strength.

OptionSets that have this issue can be easily remedied; going into the front end of the option sets and allowing the options to be ordered by name/code (the available option within the optionSets once you’ve navigated to the options) does solve this problem. Personally if its not a bad thing from the User Experience, I would just re-order these and then the event reports should be able to suit your needs.

1 Like

Hi @Akoth_Ondiek ,

I suspect what is going on here is that the URL which is being formed when you want to try to get all of the data is simply too large for the server to handle. There is no exact figure on how long the URL can be, but you can read more about it here. I suspect that the event report app simply does not inform you that the URL is too long, and you may then get a 414 error from the server. It would be good to check this in your browsers developer mode to see if this is actually the problem.

Unfortunately, at least at the moment I think, there is no easy work around to this problem with the event reports app, other than making a small request.

If using a scripting language such as Python is an option for you, that will certainly work, as you can then break the URL up into smaller pieces, make multiple requests to the server, and then assemble everything back together again.

Let us know if you find out more.

Best regards,
Jason

1 Like

@jason I thought that also but even with a few amount of dimensions selected he’s having the same problem, so I’d bet this is optionSet related.

1 Like

@Matthew_Boddie @Akoth_Ondiek …yeah, it could also be the excessive number of options. What is the exact error you get when you try and make the request? You may need to dig this out your browser with the “developer mode” to see which request is causing the error. You should also see a corresponding error on your web server, if you have access to those logs (if indeed this is the problem…)

Regards,
Jason

1 Like

possibly; I’ll say though that I’ve had fine success with downloading csvs with more than 500 Options. Its all about the sortOrder of the Options in my experience, as I posted above.

It may work…but as explained in the link I sent, its best to keep URLs under 2048 characters. It might work on one browser but not another, against one server but not another for the same request. So, 500 options which are explicitly specified in the URL already add up to at least 5000 characters, which MAY work…but it might not.

Unfortunately, this is a limitation I have seen in a number of DHIS2 apps, that there is no warning to the user that “The request you are about to make probably will not work…”.

Again, it would be good if @Akoth_Ondiek could confirm that they see some error in the browser, or if it is something else.

2 Likes

Thanks @Jason Pickering. Changed URLs to 10000 and it worked.

1 Like

Nice! Well played @jason , I was absolutely convinced it was about option order. Learned something today!

1 Like