Counts
Bases: Reporter
Get counts of inclusion and exclusion criteria
Source code in phenex/reporting/counts.py
get_pretty_display()
Return a formatted version of the reporter's results for display.
Default implementation returns a copy of self.df with: - Numeric values rounded to decimal_places - NaN values replaced with empty strings for cleaner display
Subclasses can override this method for custom formatting (e.g., phenotype display names).
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: Formatted copy of the results |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If self.df is not defined |
Source code in phenex/reporting/reporter.py
to_csv(filename)
Export reporter results to CSV format.
Default implementation exports self.df if it exists. Subclasses can override for custom behavior. If pretty_display=True, formats the DataFrame before export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the output file (relative or absolute, with or without .csv extension) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Full path to the created file |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If self.df is not defined (call execute() first) |
Source code in phenex/reporting/reporter.py
to_excel(filename)
Export reporter results to Excel format.
Default implementation exports self.df if it exists. Subclasses can override for custom behavior. If pretty_display=True, formats the DataFrame before export using get_pretty_display().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the output file (relative or absolute, with or without .xlsx extension) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Full path to the created file |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If self.df is not defined (call execute() first) |
ImportError
|
If openpyxl is not installed |
Source code in phenex/reporting/reporter.py
to_html(filename)
Export reporter results to HTML format.
Default implementation exports self.df if it exists. Subclasses can override for custom behavior. If pretty_display=True, formats the DataFrame before export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the output file (relative or absolute, with or without .html extension) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Full path to the created file |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If self.df is not defined (call execute() first) |
Source code in phenex/reporting/reporter.py
to_markdown(filename)
Export reporter results to Markdown format.
Default implementation exports self.df if it exists. Subclasses can override for custom behavior. If pretty_display=True, formats the DataFrame before export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the output file (relative or absolute, with or without .md extension) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Full path to the created file |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If self.df is not defined (call execute() first) |
ImportError
|
If tabulate is not installed (required for df.to_markdown()) |
Source code in phenex/reporting/reporter.py
to_word(filename)
Export reporter results to Microsoft Word format.
Default implementation exports self.df as a simple table if it exists. Subclasses can override for custom formatting (headers, styling, etc). If pretty_display=True, formats the DataFrame before export using get_pretty_display().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the output file (relative or absolute, with or without .docx extension) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Full path to the created file |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If self.df is not defined (call execute() first) |
ImportError
|
If python-docx is not installed |