Skip to main content

Overview

The reports module provides utilities for generating formatted reports from Markdown templates with variable substitution. It supports both Markdown output and PDF generation via wkhtmltopdf.

MarkdownReport

from openavmkit.reports import MarkdownReport
A report generator that uses Markdown templates with variable substitution.

Constructor

name
str
required
Name of the report template (without file extension). Templates are loaded from openavmkit.resources.reports/.

Attributes

name
str
Name of the report template
template
str
The raw Markdown template text
rendered
str
The rendered Markdown text after variable substitution
variables
dict
Dictionary of variables for substitution in the template

Methods

get_var()

report.get_var(key: str)
Get a variable value from the report’s variable dictionary.
key
str
required
Variable name to retrieve

set_var()

report.set_var(key: str, value: any)
Set a variable value in the report’s variable dictionary.
key
str
required
Variable name to set
value
any
required
Value to assign to the variable

render()

report.render() -> str
Render the template by substituting all variables.
return
str
The rendered Markdown text

to_markdown()

report.to_markdown(output_path: str)
Write the rendered Markdown to a file.
output_path
str
required
File path where the Markdown should be written

to_pdf()

report.to_pdf(output_path: str, css_path: str = None)
Generate a PDF from the rendered Markdown.
output_path
str
required
File path where the PDF should be written
css_path
str
Optional path to CSS file for styling the PDF
PDF generation requires wkhtmltopdf to be installed. See the PDF Reports configuration guide for setup instructions.

Example Usage

from openavmkit.reports import MarkdownReport

# Create a report from template
report = MarkdownReport("ratio_study")

# Set variables
report.set_var("locality_name", "us-nc-guilford")
report.set_var("valuation_date", "2024-01-01")
report.set_var("median_ratio", 0.98)
report.set_var("cod", 12.5)
report.set_var("prd", 1.01)

# Render the report
report.render()

# Write to Markdown
report.to_markdown("out/ratio_study.md")

# Generate PDF
report.to_pdf("out/ratio_study.pdf")

Available Templates

OpenAVM Kit includes several built-in report templates:
  • ratio_study - IAAO-standard ratio study report
  • sales_scrutiny - Sales validation and outlier detection report
  • variables - Variable importance and correlation analysis
  • report - General assessment quality report
Templates are stored in openavmkit/resources/reports/ and use Markdown with variable substitution syntax.

PDF Configuration

Set up wkhtmltopdf for PDF generation

Ratio Studies

Calculate ratio study metrics

Build docs developers (and LLMs) love