We are working on a DHIS2 web app which has an Excel template file with certain metadata information. We allow uploading of Excel files filled with data - while uploading we use the template file for validating the uploaded file. Now, the template file is part of source code, means, it is part of the compiled app.
Is there any way so that we can have the Excel template out of the compiled app, so that if any update in the template file - we can just replace the file and the app continues working without compilation?
Does the dataStore allow Excel files instead of raw JSON?
Thanks @austin we have already used the file resource.
Although I am curious to know is there any limit on number of files that can be uploaded?
Any DHIS2 settings that we may have to tweak if the number of files/size exceed?
What is the folder where files are uploaded?
There are no limits to number of files uploaded, for size, I think this might be restricted through your webserver like nginx, etc. But in DHIS2 we have no set limits at the moment.
Files are saved in your DHIS2_HOME folder, unless your instance is configured to use a cloud provider. In the latter case, files are saved in the cloud as configured in dhis.conf.
A last note: Files can be uploaded to one of several âdomainsâ. Each domain decide how the file is used. For example, files uploaded as a data or attribute value will only be accessible to some people. However, the domain called DOCUMENT are the one I would assume you want to look at. These are static files available to every logged in user, in theory.
Hi @Stian ,
I see two APIs - api/fileResources & api/documents. Are they same? Somewhere I read that file resources uploaded must be âlinkedâ to any entity inside DHIS2 otherwise they may get deleted in 2 hours.
I am giving my scenario - an external application will upload some data as a âdocumentâ (say CSV) via API. Later at some point (maybe 2-3 days later) a custom DHIS2 web app will look for this file and extract and import data into tracker.
So in my scenario when files are uploaded - we cannot link it with any resource immediatelyâŠany idea?
Yes, any file you upload will need to be related to a resource inside dhis2. On the backend, document and fileResources are the same. A FileResource is a reference to a file, while DataValue, Document, etc are using that reference/fileResource to âhaveâ a file.
If you upload something as a document, that is sufficient. We do have a cleanup job that would look for FileResources without any attachments, and remove them.