I have an Access database with individual students that I want to load into DHIS2. One option could be to go directly to Postgres (via ODBC) - is there an SQL script available for the necessary inserts which I could start from if I were to choose this route?
Alternatively, since there are thousands rather than millions, I can probably use the TEI import functionality in the Import/Export module. I did not see the format spelled out in documentation, but something like the attached format seems to work fine.
tei_enrolled2.json (436 Bytes)
However, I also have pictures of the students - how do I go about importing those?
@Knut_Staring thank for posting directly into the CoP!
I think a similar scenario would be if we had photocopies of birth certificates that we want to upload to the Child Program, right? So I’d say that maybe using API to upload to a Data Element of type ‘file resource’ similar to the Birth Certificate data element,
I hope I’m correct and this actually helps! Please let me know what you think.
Thanks, Gassim. So basically I need to write a script, in order to get the ID that DHIS2 creates for the file resource (or rather image), and then provide that in a subsequent API call to create the data value?
However, I keep getting this message:
The content is being processed and is not available yet. Try again later.
The content requested is in transit to the file store and will be available at a later time.
You’re welcome! It does seem like the best approach and if it doesn’t work, we could still ask for support, but I hope it does. All the info is detailed specifically for this task here: Working with file data values
If the request response is ‘202 accepted’ then the file “storageStatus” will be “PENDING”, so if this is what you are getting then I think that the message you are receiving is because the file must be referenced by the data value otherwise it will be purged by the system within two hours of the upload (as described in the api docs).
If the request response is different would it be possible to share the full request & response please?
Thanks! Hope it will work out…
Hey @Knut_Staring . Someone from @tracker-backend can probably explain better but it is important to understand that the fileResources endpoint works async if I am not mistaken. This means that you would be importing fileResources (via a script or something) and then you would be including the references obtained in the TEI metadata.
There are a couple of issues that I see with this approach: the TEI endpoint doesn’t complain in case of a missing resources (Log in - DHIS 2 JIRA). On the same JIRA issue you can find a tested but poor solution I developed to see if you have TEI linking to missing file resources (that can happen when importing images).
Hope it helps.