Thanks to @bjwebb and @siemvaessen I've recently been able to generate version 2.02 IATI data out of the CSV2IATI tool
A word of caution - this isnt a straightforward process -so please only try/test this on non-production data models to begin with. Ideally - create a brand new model in CSV2IATI to test it out for yourself.
The key to this project is this JSON code. What this does is generate the "mapping" model in CSV2IATI according to the 2.02 schema. As people might be aware, CSV2IATI currently outputs to version 1.03 by default. It is actually possible to construct a model in line with any version of the schema - but this requires some careful work, planning and clicking. Hence, this code helps generate the template according to 2.02, giving you the foundation to build on.
To do this, try the following steps:
- Create a new model in CSV2IATI, with the source data CSV file you want to convert
- When in this model, click the link on the right hand side "Show JSON" - this is the current model in JSON format
- In a new tab, open the 2.02 JSON file - and copy the JSON (tip: click on the Raw button to the same code without the surrounding web page)
- Go back to CSV2IATI, select the existing code, and then paste in the 2.02 version - this replaces the underlying code for your model
- Whilst the JSON window is still open, find the "Save Model" button click it. This can be tricky in some browsers/interfaces - but it's essential (I found) to save the model whilst the JSON is still open
- Once saved, you can close the JSON and moved to the model and mapping.
- In the mapping page you should see the whole of the activity standard elements and attributes, to map you source file again.
- If you really dont need a particular element you cna delete it with the small trashcan icon for each element/attribute.
- Tip: As you do so, dont forget to save!
- When you've finished, you can move directly to the convert page, and convert to XML.
The resultant file is structured according to 2.02 , but with two small issues. To fix these, you'll then need to download the XML and edit it:
- The version attribute of
iati-activities will still be 1.03. Manually edit this to 2.02
reporting-org element will not be formatted according to 2.02, if you have provided an Organisation Name in the first page of CSV2IATI - eg:
<reporting-org ref="12345" type="60">Org Name</reporting-org>
Find and replace the existing code with something like:
<reporting-org ref="12345" type="60"><narrative>Org Name</narrative></reporting-org>
As highlighted, this is quite involved, but does work if you make some time for it. Would be great to hear from others who try it