Import patient list in CSV file

Hi, i have a list of patient that i would to import with basic information like firstname , lastname. Do you have any idea simple way on how to do it ?

Thank you, Regards

sadly the default import/export wizard are “more technical”

created,orgUnit,createdAtClient,trackedEntityInstance,lastUpdated,trackedEntityType,lastUpdatedAtClient,storedBy,coordinates,potentialDuplicate,lastUpdatedByUserInfo,deleted,inactive,featureType,geometry,createdByUserInfo,lastUpdated,code,storedBy,displayName,created,valueType,attribute,value
2014-07-23T12:45:49.669,DiszpKrYNg8,2014-07-23T12:45:49.669,oi3PMIGYJH8,2014-07-23T12:45:49.787,nEenWmSyUEp,,,,false,,false,false,NONE,,,2016-01-12T09:10:35.884,MMD_PER_NAM,,"First name",2016-01-12T09:10:26.986,TEXT,w75KJ2mc4zz,Evelyn
2014-07-23T12:45:49.669,DiszpKrYNg8,2014-07-23T12:45:49.669,oi3PMIGYJH8,2014-07-23T12:45:49.787,nEenWmSyUEp,,,,false,,false,false,NONE,,,2016-01-12T09:10:35.884,,,"Last name",2016-01-12T09:10:26.986,TEXT,zDhUuAYrxNC,Jackson
2014-07-23T12:45:49.669,DiszpKrYNg8,2014-07-23T12:45:49.669,oi3PMIGYJH8,2014-07-23T12:45:49.787,nEenWmSyUEp,,,,false,,false,false,NONE,,,2016-01-12T09:10:35.884,,,Gender,2016-01-12T09:10:26.986,TEXT,cejWyOfXge6,Female

the produced csv has 1 line per attribute.

you might have more luck with some external app in the application store.
but you will need to map the “columns” to the associated “attribute”

1 Like

@Stephan_Mestach thank you for your help, can you tell me which external app i may use in order to import. Please @Gassim can you help

I think there used to be other apps.
I found this one : DHIS2 App Hub

1 Like

Hi @Ornella

Firstly I’ll discourage doing this directly into the database. Why not send the csv data over API? I believe this would be way easier and safer.

If you want to do this via sql query, you may have to interact with more than just a single table. And if care is not taken, it could lead to data integrity issue/errors. Here are the key tables you may have to interact with:

  1. trackedentityinstance: Contains information about the tracked entity instances.
  2. program: Stores information about programs.
  3. programinstance: Links tracked entity instances to programs, representing enrollments in a program.
  4. trackedentityattributevalue: Stores values for the attributes associated with tracked entity instances.

Here’s the order in which you should insert data into the respective tables:

  1. Insert into trackedentityinstance:
  • This step creates the tracked entity instance with its basic information.
  1. Insert into trackedentityattributevalue (if there are attributes associated with the tracked entity):
  • Insert attribute values for the tracked entity instance.
  1. Insert into programinstance:
  • This step enrolls the tracked entity instance into a program.
  1. Insert into programstageinstance (if there are events associated with the program stages):
  • Create events for the tracked entity instance in the different stages of the program.

I hope you find this helpful!

Hi @Stephan_Mestach

Thanks for mentioning Bulk Load. @Ornella you have documentation and video tutorials on how to use this app here If you use and have any problems, please let us know!