-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5308 from akvo/report-generation-doc
Document report generation
- Loading branch information
Showing
4 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ results_framework/index.md | |
reports/index.md | ||
projects.md | ||
tasks.md | ||
::: | ||
report_generation.md | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Report Generation | ||
|
||
## Report definition | ||
|
||
[Report] model is used to store report definitions. Some attributes of the Report model that need to be considered | ||
- [`url`], parameterized path for downloading the report. | ||
- [`formats`], available document format that can be downloaded. | ||
- [`organisations`], restrict access to only employees of related organisations. | ||
|
||
## Formats | ||
|
||
The following are libraries used to produce document formats | ||
- [WeasyPrint] is used to generate PDF documents | ||
- [python-docx] is used to generate DOCX documents | ||
- [PyExcelerate] is used to generate XLSX documents | ||
|
||
## Levels | ||
|
||
Reports can exist at several levels and are defined using the [`url`] attribute in the [Report] model. | ||
- project level, url attribute contains `{project}` parameter | ||
- program level, url attribute contains `{program}` parameter | ||
- organisation level, url attribute contains `{organisation}` parameter | ||
|
||
## Creating new report | ||
|
||
The following are the steps that must be taken to create a new report (not necessarily in order) | ||
- Create a view handler that is used to generate the report. Usually placed in the [`py_reports`](#akvo.rsr.views.py_reports) package. | ||
- Define the [url routing](#akvo.urls) for the view handler. | ||
- Create a new [Report] object and set the [`url`] attribute using the same pattern as the url routing for the view handler. | ||
|
||
|
||
[Report]: #Report | ||
[`url`]: #Report.url | ||
[`formats`]: #Report.formats | ||
[`organisations`]: #Report.organisations | ||
[WeasyPrint]: https://weasyprint.org/ | ||
[python-docx]: https://python-docx.readthedocs.io/ | ||
[PyExcelerate]: https://github.com/kz26/PyExcelerate |
This file was deleted.
Oops, something went wrong.