Report
Data models for report production.
ActivityColumnMetric
dataclass
This class provides granular control of the metric applied in each activity's column.
is_valid
Checks if the activity column metric is valid.
Returns:
Type | Description |
---|---|
bool
|
True if the activity column metric is valid else False. |
Source code in src/cplus_plugin/models/report.py
ActivityContextInfo
dataclass
Contains information about an activity for use in an expression context.
BaseReportContext
dataclass
Common context information for generating a scenario report.
MetricColumn
dataclass
MetricColumn(name, header, expression, alignment=QtCore.Qt.AlignHCenter, auto_calculated=False, format_as_number=True, number_formatter=QgsFallbackNumericFormat)
This class contains information required to create custom columns for the activity table in a scenario analysis report.
create_default_column
staticmethod
Creates a default metric column.
:py:attr:~format_as_number
is set to True and
:py:attr:~number_formatter
is set to two decimals
places with a thousands' comma separator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Unique column name. |
required |
header |
str
|
Label that will be used in the activity metrics table. |
required |
expression |
str
|
Column expression. Default is an empty string. |
''
|
Returns:
Type | Description |
---|---|
MetricColumn
|
Metric column object. |
Source code in src/cplus_plugin/models/report.py
default_formatter
staticmethod
Returns a default number formatter with two decimals places and a comma for thousands' separator.
Returns:
Type | Description |
---|---|
QgsNumericFormat
|
Basic number formatter. |
Source code in src/cplus_plugin/models/report.py
to_qgs_column
Convenience function that converts this object to a QgsLayoutTableColumn for use in a QgsLayoutTable.
Returns:
Type | Description |
---|---|
QgsLayoutTableColumn
|
A layout column object containing the heading, horizontal alignment and width specified. |
Source code in src/cplus_plugin/models/report.py
MetricConfiguration
dataclass
Container for metric column and activity column metric data models.
activities
property
Gets the activity models in the configuration.
Returns:
Type | Description |
---|---|
typing.List[Activity]
|
Activity models in the configuration. |
find
Returns a matching activity column metric model for the activity with the given UUID and the corresponding metric column name or header label.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity_id |
str
|
The activity's unique identifier. |
required |
name_header |
str
|
The metric column name or header to match. |
required |
Returns:
Type | Description |
---|---|
typing.Optional[ActivityColumnMetric]
|
Matching column metric or None if not found. |
Source code in src/cplus_plugin/models/report.py
is_valid
Checks the validity of the configuration.
It verifies if the number of metric columns matches the column mappings for activity metrics.
Returns:
Type | Description |
---|---|
bool
|
True if the configuration is valid, else False. |
Source code in src/cplus_plugin/models/report.py
MetricType
Bases: IntEnum
Type of metric or expression.
from_int
staticmethod
Creates the metric type enum from the corresponding int equivalent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
int_enum |
int
|
Integer representing the metric type. |
required |
Returns:
Type | Description |
---|---|
MetricType
|
Metric type enum corresponding to the given int else unknown if not found. |
Source code in src/cplus_plugin/models/report.py
RepeatAreaDimension
dataclass
Contains information for rendering repeat model items such as scenarios or activities in a CPlus repeat item.
ReportContext
dataclass
ReportResult
dataclass
Detailed result information from a report generation run.
ReportSubmitStatus
dataclass
Result of report submission process.
ScenarioAreaInfo
dataclass
Contains information on the result of calculating a scenario's area.
ScenarioComparisonReportContext
dataclass
Bases: BaseReportContext
Contextual information related to the generation of scenario comparison report.