CSVs and other Types

Hello DHIS2 Dev Group

We are in a transition period at the moment between an offline Access Database and the online DHIS2 HIS and in the next few months I will need to do some reports that pull from both. Right now I am creating some pivot tables to download. While I was performing some simple awk scripts, I found a potential drawback to the CSV output.

I understand that CSV stands for Comma Separated Values, but several of our organizational units have commas in their names. This is causing awk to go haywire. Is there anyway we can download a pivot table from DHIS2 using a different field separator? Such as a | or some character combination that cannot exist inside the name field for an organizational unit?

I am aware of attempting this with more than one FS e.g. awk -F’","|^"|,$’ but this is even more finicky.

Thanks!

Timothy Harding
PeaceCorps Volunteer

Republic of Vanuatu

hardingt@gmail.com

+678 5955137

Hi Tim,
You can output a number of formats through the WebAPI, including XML and JSON, which may be easier to parse. However, the quotes in the organisation unit output are there for a reason, since even if there is a comma in an orgunit name, it is inside of quotes, which can be handled differently than those outside of quotes.

You can read about the API here and see if other formats might work better for you. For instance, try…http://myserver/api/organisationUnits.json

https://www.dhis2.org/doc/snapshot/en/user/html/ch32.html

Regards,

Jaso

n

···

On Mon, Aug 18, 2014 at 6:09 AM, Timothy Harding hardingt@gmail.com wrote:

Hello DHIS2 Dev Group

We are in a transition period at the moment between an offline Access Database and the online DHIS2 HIS and in the next few months I will need to do some reports that pull from both. Right now I am creating some pivot tables to download. While I was performing some simple awk scripts, I found a potential drawback to the CSV output.

I understand that CSV stands for Comma Separated Values, but several of our organizational units have commas in their names. This is causing awk to go haywire. Is there anyway we can download a pivot table from DHIS2 using a different field separator? Such as a | or some character combination that cannot exist inside the name field for an organizational unit?

I am aware of attempting this with more than one FS e.g. awk -F’","|^"|,$’ but this is even more finicky.

Thanks!

Timothy Harding
PeaceCorps Volunteer

Republic of Vanuatu

hardingt@gmail.com

+678 5955137


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