GSoC 2018 Attachments Module Enhancements

Thank you very much for clarification.

@mksd So one of the proect tasks is to modify controllers (such as the one you mentioned )to behave RESTfully?

This is ATT-4 but this ticket is already being worked on, and will be completed soon.

Looking at the pending issues, quite a few of them are rather UI-related.

However in term of REST support there would be two things to do that have not been framed by actual tickets:

  1. Enable the ā€˜generic file uploadā€™ feature. See my response on this thread here.
  2. Enable AttachmentResource to return lists of attachments based on a query parameter.

I would rather have you start with the latter for now. Is that something youā€™d be interested to spike at?

1 Like

@mksd ofcourse I would love to work in that area, I was trying to design the extension of HTML Form Entry to behave RESTfully. So I suppose this task is not a lot different.

@madushan there is an easier task and more complex one (that I just created), look at those two:

  • ATT-22 - AttachmentResource to check upload file size based on global property
  • ATT-24 - REST end point to query for lists of attachments
1 Like

@mksd Thanks I will try them and get started.

I would suggest to start with ATT-22 as itā€™s easier.

1 Like

@mksd I made a PR on ATT-22. I will soon begin work on ATT-24. Thank you very much for the guidance.

@mksd I am working on drafting a proposal, and found out the following rest end points needed to be implemented.

  1. add attachent (POST)
  2. update attachment (PUT)
  3. Search for attachments ( GET)

What could be the other REST endpoints needed ?

  1. add attachent (POST) - Thatā€™s ATT-4, so this covers the bytes content part of the GET too.
  2. update attachment (PUT) - Thatā€™s also possibly part of ATT-4. I think the bottom line here was that if the user wanted to bring in a different file, then she would just create a new attachment, this is what this has been overlooked.
  3. Search for attachments (GET) - Thatā€™s ATT-24.

Is that something that is required by GSoC? Iā€™m asking because all the above is pretty much already framed by JIRA tickets (except the specifics about 2).

Since @zouchine and I were IM-ing about 2 yesterday, Iā€™m pinging him here so that he knows as well.

1 Like

thanks @mksd for pinging me , Yes as you said, ATT-4 already covers add attachment and get attachment

@madushan FYI something else that should be streamlined while making Attachments RESTful is the definition and use of appropriate privileges.

There is already a ticket covering the topic to a certain extent, see ATT-9.

Hi @mksd and mentors ,

I would like to work on this project in GSOC 2108. I read the all information included in this talk thread. So I am still understanding code base of the attachment module. And I am willing to contribute some issues related this module.

Thanks , Ridmal.

While I tried to debug the attachment module using remote debugging , new attachment upload is going through the non-rest controller. not through the AttachmentResource1_10.upload method.Any idea about the reason ? (I am run the module with openmrs-sdk 2.1.2 )

@mksd Yes GSoC needs a proposal to be submitted relevant to the project. These days I have been working on that too. So I will include the descriptions of the tickets and way to tackle them. Thank you very much for all these valuable information.

@mksd @zouchine I am starting to work on ATT-24. The ticket describes about implementing search of attachments. How should I start the work, should I create a new controller or use an existing one ? It would be great if you could me with some tips.

@mksd I would like to know more details about the packaging of OWA. Are we hoping to use Angular1 or Angular 2 ?

Hi @ridmal, AttachmentsController is being deprecated as part of ATT-4. The global constant UPLOAD_ATTACHMENT_URL was updated as part of this commit. To experience going through the REST resource when debugging you would have to run the latest snapshot of Attachments using version 2.0.0-SNAPSHOT when fetching with Maven.

@zouchine that makes me think that the last commit for your work on ATT-4 will need to actually mark this controller as deprecated using @Deprecated (see here).

If you look on the ticketā€™s description, I pointed to an example from another resource (ProviderResource), the short answer is that everything will happen in AttachmentResource1_10 with unit tests in AttachmentController1_10Test.

Btw making Attachments RESTful will also require to document its REST API via Swagger. See here for more about this topic: ā€˜Documenting REST Resourcesā€™.

Yes, i am using the latest snapshot of attachment module.And I saw that it use rest URL to upload the image but still, debugger go through that previous controller? Thatā€™s why I got confused.