I am sitting here behind the computer doing such a task right now, so thought I would with you my approach.
There are two major ways to do this, either with the DXF importer, or by direct injection with SQL into the database. I personally prefer the second approach, but this is really a personal preference.
For the first approach, you will need to transform your data into an appropriate XML structure. If you look at the WepAPI and look into the organisation units (for instance on the demo database) you will get a good idea of how the XML needs to be structured. You could choose numerous different ways to do this, but likely a scripting language would be appropriate. I prefer R personally for this, while others may use which every language they may know (Python, TCL, etc) . Once you create the XML, you can upload it to your DHIS following this procedure from the docs.
The SQL route is basically the same. Just transform the CSV into INSERT statements to mimic the “organisationunit” table. There are some required fields (name, shortname and organisationunitid). If you are using Postgresql, you can use the “nextval(‘hibernate_sequence’::regclass)” structure to get an ID for your organisation unit. Some other fields like “active” and “openingdate” are not required on the database schema, but cause problems when they do not exist, so it would be best to put them in. Again, the choice of how you create the SQL is really up to you, but again, a scripting language would probably be a good alternative. Once you have the INSERT statements, you just execute them on your database, and then restart DHIS2. This route is a bit riskier, because you are working directly with the database, so the XML route (even though it is a bit more difficult to work up I think) is safer. Obviously, you will need access to the backend system.
I have heard of others using Access somehow to work up the data, and then transfer this over somehow, but I have never seen this in action, but maybe others can describe this process.
Lastly, if you have data in DHIS 1.4, you can just simply import the metadata as described here.
Those are the ways I know of anyway. Hope this helps.
On Wed, Aug 7, 2013 at 3:28 PM, Judge Muzinda email@example.com wrote:
Please assist, I have a list of organisation units in csv format which number about 5000 and I want to import them into DHIS2 how do I go about it, I have been trying the native import export and also the Web API, unfortunately I cannot get a head start, is the a native DHIS2 way to achieve this automatically or some other way using the Web API. Please find attached my csv file.
Mailing list: https://launchpad.net/~dhis2-devs
Post to : firstname.lastname@example.org
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp