Report Generation¶
The cfa.dataops.reporting
module provides tools for generating parameterized reports from Jupyter notebooks. Reports can be exported as HTML files or uploaded directly to Azure Blob Storage.
Getting Started¶
To use the reporting system:
Available Reports¶
Reports are organized in a namespace structure. You can explore available reports by inspecting the reportcat
object attributes:
Using Report Templates¶
Each report is represented by a NotebookEndpoint
object that provides methods for:
- Getting report parameters (
get_params()
) - Generating HTML output (
nb_to_html_str()
,nb_to_html_file()
,nb_to_html_blob()
)
Example: Dataset Report¶
The dataset_report.ipynb template demonstrates a basic report that:
- Takes a dataset namespace as a parameter
- Shows dataset configuration
- Displays available versions
- Provides data summaries and samples
- Creates visualizations
Example usage:
# Get the report endpoint
report = reportcat.examples.dataset_report_ipynb
# View available parameters
report.print_params()
# Generate HTML report
report.nb_to_html_file(
html_out_path="my_report.html",
dataset_namespace="scenarios.covid19vax_trends"
)
# Or save directly to blob storage
report.nb_to_html_blob(
blob_account="myaccount",
blob_container="mycontainer",
blob_path="reports/dataset_report.html",
dataset_namespace="scenarios.covid19vax_trends"
)
Creating Custom Reports¶
To create a new report:
- Create a Jupyter notebook in the
cfa/dataops/reporting/reports
directory - Use cell tags
parameters
andremove_input
for parameter cells - Add help text as comments for parameters
- Use markdown cells for documentation
- The report will automatically be available in the
reportcat
namespace
Report Parameters¶
Parameters are defined in cells tagged with "parameters":
Template Best Practices¶
- Use cell tags to control input/output visibility
- Add clear markdown documentation
- Handle errors gracefully
- Include data validation
- Use consistent styling
- Test with different parameter
Screenshot Example of a Report¶
Below is a screenshot for the basics report highlighting just a few of the things you can do with this reporting functionality. In addition to the myriad of jupyter compatible libraries that embed JavaScript (like ITables), authoring new functionality is also pretty simple, using IPython.display
submodule, to author all sorts of add-ons that can be included in reports (e.g., a floating table of contents, or a temporary annotation layer).