Appointments Daily Counts

I’m storing appointments records in my database. I want to expose a report of the daily appointments to the client grouped by date. Here is a screenshot of a sample report I want to obtain

Could someone kindly suggest to me how I can achieve this.

Is using reporting and reportingRest module the way to go? If so where can I get some developers guiding documents on this, I would appreciate any useful links @dkayiwa @rickysilas @mseaton

Did you get a chance to look at these classes:

And these?

@dkayiwa I had used that approach and it was working but it seems that wasen’t the approach I was supposed to use

kindly check the reviews on this or

Did any one tell you that you should not create resources that look like the existing ones?

The approach is i was creating a POJO to help me group appointments by date. I them processing the appointments to group them by date and mapping them to this POJO class. The idea is to obtain response like

  count: 5  // total number of appointments in that day
 appointments:[ ] //list of appoitnment in that day

I then exposed this data using a resource.

As per the reviews resources should only used with entities that have CRUD operations. That leads to the question, can someone suggest for me how i can group this data by date and expose them to a client?

If we already have a resource which returns appointments, wouldn’t this be simply adding optional parameters for grouping?

would you kindly elaborate, how can that be used to to provide a resource representation that would give me the above data

@dkayiwa and @jecihjoy I have made similar comments to Daniel’s on the pull request.

@mseaton @dkayiwa these parameters will be added to the request but in my case the representation also needs to change to this.

The class I introduced is like a DTO, I need to write a raw sql query that groups appointments by date.

Does openmrs have read only resources that can be used with DTOs to expose data?

@mogoodrich @darius any ideas?