← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] Using DHIS File Store

 

Hi Aamer,

like Abyot indicates, the file resources are currently only used to back
data values and events with data element type "File". In this case, the
actual data value is a weak reference to the file resource. So you need to
create a corresponding data value/event and then access the file through
the "dataValues" / "events" resources to access the files. This is done in
order to follow standard access control and retrieval syntax, however it
might be inconvenient for your use-case.

Supporting "standalone" file resources is a feature we are planning to
implement, but we cannot guarantee which version at this point.

Perhaps you could take it on? I do not think it will be a huge task. One
can extend the "FileResourceDomain" class with a new enum value, and then
add support for retrieving files of "standalone" file resources in
FileResourceController.

regards,

Lars








On Mon, Feb 29, 2016 at 11:23 AM, Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
wrote:

> Hi Aamer,
>
> To get the files you uploaded, you need to use the following end points:
>
> If the file is stored through the aggregate part of dhis2
>
> api/dataValues/files?de=<data_element_uid>&co=<category_option_combo_uid>&ou=<organisation_unit_uid>&pe=<period>
>
>
>
> If the file is stored through the tracker part of dhis2
>
> api/events/files?eventUid=<event_uid>&dataElementUid=<data_element_uid>
>
> ---
> Thank you,
> Abyot.
>
> On Mon, Feb 29, 2016 at 10:40 AM, Aamer Mohammed <aamerm@xxxxxxxxxxxxxxxx>
> wrote:
>
>> Any thoughts from the community please. Can we leverage File Store to
>> store data independent of any other object or should it be referenced from
>> other objects only?
>>
>> Thanks
>> Aamer.
>>
>>
>> On Fri, Feb 26, 2016 at 12:29 PM, Aamer Mohammed <aamerm@xxxxxxxxxxxxxxxx
>> > wrote:
>>
>>> Hi All,
>>>
>>> We need to store specific data related to our application and exploring
>>> DHIS Data Store and File Store in this regard. We have few queries related
>>> to DHIS File Store here.
>>>
>>> *File Store:*
>>> We used api/fileResources endpoint for multipart upload POST request and
>>> the file is saved in the file system as specified in dhis.conf file.
>>>
>>> Can anyone suggest on how to get the content of the file uploaded?
>>> Hitting the endpoint is giving the metadata for the uploaded file and not
>>> the actual content. Also can anyone clarify the below points in the
>>> documentation.
>>> http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s12.html
>>>
>>> ----------------
>>> The contents of a file resources is not directly accessible but is
>>> referenced from other objects (such as data values) to store binary content
>>> of virtually unlimited size.
>>> ----------------
>>> 1.12.1. File resource constraints
>>> File resources must be referenced (assigned) from another object in
>>> order to be persisted in the long term. A file resource which is created
>>> but not referenced by another object such as a data value is considered to
>>> be in staging. Any file resources which are in this state and are older
>>> than two hours will be marked for deletion and will eventually be purged
>>> from the system.
>>> -----------------
>>>
>>> Any thoughts please.
>>>
>>> Thanks
>>> Aamer.
>>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org/>

References