Currently if the display controls are configured to show data for the last n visits, the list will show strictly the last ‘n’ visit’s details. Say if the configuration is to show last 4 visits details and the data is actually available for only 2 visit, then these two records only is displayed.
New requirement is to see the records for last 4 visits in which data specific to this display control is collected. Which means at any point if the Display control is configured for 4 visits, it will display 4 records which need not necessarily be for the last 4 visits.
Say if there are total 7 visits, and data for a Display control is collected for visits 1,3,4 & 7, then all these 4 records need to be displayed. Currently in this case, records for 4th and 7th visit alone is displayed
Currently, to fetch observations of a concept to use them in dashboard display controls, we are using /rest/v1/bahmnicore/observations endpoint
Above call is bounded to specific visit ids, that we are going to find and pass. It’s fetching observations only for those specific visits.
Our approach is to have a new api call, which can find out latest non-empty visit ids for provided concept observations
We have to write a new endpoint
As part of this endpoint, we will write a new api call in visitDao, which can find out latest N number of visit ids for the non-empty concept observations
We will pass these visit ids to existing call. We will reuse all the existing code(obsDao, bahmniObsService)
We will use this endpoint in frontend. We will make this configurable, so that existing implementations intact.
We will use the existing endpoint, and will fetch all visits observations
Based on the configuration, we will filter these visits of information, to get latest N non-empty visits of information. Again here configuration will ensure existing implementations intact.
Please provide comments/suggestions.