Closed qiarie closed 2 years ago
@samkanga What is the server URL for this?
Web Scoping pieces
reports
Reports
on the Administration dropdown. This menu & package should be governed by the following rules
MANAGE_REPORTS
Reports
menu add a submenu named District Report
This menu should be governed by the following rulesDISTRICT_REPORT
District Report
{host}/opensrp/rest/report/generate/{districtId:.+}/{period:.+}
@dubdabasoduba its https://web.wellnesspass-preview.smartregister.org/
@samkanga This is blocked. The endpoint is yet to be deployed to the instance shared above.
@samkanga @dubdabasoduba The branch with the endpoint is deployed
@qiarie please talk more about the endpoint. Is the method POST or GET, are the keywords districtId, and period included in the url? Could you provide an example of a complete endpoint and if possible a link to the swagger documentation?
@machariamuguku Use GET method to access the endpoint. 400 is returned
Please have a look at this example: {host}/opensrp/rest/report/generate/5cf8fa0e-2dc6-47de-9b0d-b14b890adf25/2021-12
YYYY-MM
If there is a report available for the district & period, a file is returned for download. If no report is found, an error is thrown.
@qiarie what are the response headers? specifically the content-type
@machariamuguku
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="XXXXXX"
@machariamuguku The agreement here was if we can build something that downloads the pdf doc (I assume) the web work is done. Making sure the doc has data is the OpenSRP server team's responsibility.
@dubdabasoduba we need to know the nature of the download request(s) in order to build something generic yet usable. Also to test if the functionality works.
I think the download is a PDF but I will let @qiarie comment about that
@dubdabasoduba he says it's an .xlsx
from the first comment above and also from the Content-Type
@dubdabasoduba he says it's an
.xlsx
from the first comment above and also from the Content-Type
Ooh, yah. Seen that. Thanks
@machariamuguku Please hit this endpoint to get a sample of the report to be downloaded https://wellnesspass-stage.smartregister.org/opensrp/rest/report/download/60f07b23-682d-4fdf-8eaf-4db0957ceaea/2022-02
The endpoint is still under construction but I think this will help you get the sample you require
cc: @qiarie @samkanga
@machariamuguku
Instead of calling the download
URL provided earlier, please use
{host}/opensrp/rest/report/download/{districtId:.+}/{period:.+}
The rest of the conditions remain the same.
@machariamuguku The change has been approved and merged
Feature Use Case
WP has a report that aggregates monthly reports per district. The monthly report is generated as an excel sheet at the end of every month based on submissions made from the android client. The excel sheet is routinely scheduled and saved on the server. The Excel sheet is accessible via a link that downloads the raw
.xlsx
file.The download link has the format
GET: {host}/opensrp/rest/report/generate/{districtId:.+}/{period:.+}
where:districtId
is thelocationId
of the districtperiod
is theyear
andmonth
of the report in the formatYYYY-MM
Below is an example of a complete URL:
{host}/opensrp/rest/report/generate/5cf8fa0e-2dc6-47de-9b0d-b14b890adf25/2021-12
A user must have the role
DISTRICT_REPORT
assigned to their assigned user group to download the excel sheet.Acceptance criteria
Download District Report
(or equivalent) menu option when they have the roleDISTRICT_REPORT
assigned to them.Download District Report
button, they should have a download dialog window prompting them to save the report file.Project Contact
Simon Njoroge
Relevant Information