climate_ref.results.diagnostics
#
Typed, detached read surface for diagnostic metadata.
DiagnosticsReader is reached via
Reader.diagnostics.
It executes the select_diagnostics query
(joining Diagnostic -> Provider and counting execution groups per diagnostic)
and maps the rows into detached DTOs that outlive the session.
DiagnosticCollection
#
An immutable page of diagnostics plus collection-level metadata.
total_count is the number of diagnostics matching the filter before pagination, so a
caller can tell there are more rows than the returned page. offset/limit echo back the
pagination applied to produce items (limit is None when the whole result was
returned).
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
items
instance-attribute
#
The diagnostics on this page.
limit
instance-attribute
#
Page size requested, or None when the whole result was returned.
offset
instance-attribute
#
Rows skipped before this page.
total_count
instance-attribute
#
Total diagnostics matching the filter before offset/limit.
to_pandas()
#
DataFrame mirroring the diagnostics list CLI columns.
Columns are emitted explicitly (provider, diagnostic, name, promoted_version,
execution_group_count, successful, inflight, total) even when the collection is empty, so
callers can select columns / build an empty table without special-casing.
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
DiagnosticFilter
#
Declarative filter over diagnostics.
Every field is optional; None means "do not constrain on this axis".
diagnostic_contains/provider_contains are case-insensitive substring matches
(OR-combined within each field), matching the semantics used by
ExecutionGroupFilter.
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
diagnostic_contains = attrs.field(default=None, converter=_as_str_tuple)
class-attribute
instance-attribute
#
Case-insensitive substring matches on diagnostic slug (OR-combined).
provider_contains = attrs.field(default=None, converter=_as_str_tuple)
class-attribute
instance-attribute
#
Case-insensitive substring matches on provider slug (OR-combined).
DiagnosticView
#
A single diagnostic with information about the currently promoted version and execution-group counts.
execution_group_count counts execution groups across every diagnostic version,
while successful/inflight/total are scoped to the currently promoted_version.
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
execution_group_count
instance-attribute
#
Execution groups for the diagnostic across every version.
inflight
instance-attribute
#
Promoted-version execution groups whose latest execution is still running (outcome not yet known).
name
instance-attribute
#
Human-readable diagnostic name.
promoted_version
instance-attribute
#
Diagnostic version currently promoted for production.
provider_slug
instance-attribute
#
Owning provider's slug.
slug
instance-attribute
#
The diagnostic's own slug, unique within its provider.
successful
instance-attribute
#
Promoted-version execution groups whose latest execution succeeded.
total
instance-attribute
#
Execution groups at the promoted version.
DiagnosticsReader
#
Diagnostic read domain.
Constructed from a Database, which owns the session. All read methods return detached DTOs that outlive the session.
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
session
property
#
The underlying database session.
list(filters=None, *, offset=0, limit=None)
#
Query diagnostics, with their provider, execution-group count, and promoted-version stats.
Pagination is applied in SQL (offset/limit), with total_count computed from a
separate unpaged count query over the same filtered statement.
Promoted-version status counts (successful/inflight/total) are merged in from
stats,
and keyed by (provider, diagnostic) so status-count logic stays defined once.
Diagnostics with no execution groups at the promoted version get zeros.
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
stats(*, diagnostic_contains=None, provider_contains=None)
#
Per-(provider, diagnostic) execution status counts.
Reuses select_execution_statistics rather than duplicating the aggregate SQL, so status-count logic stays defined once. This has the same signature and behaviour as ExecutionsReader.statistics, just reachable under the diagnostics domain.
Source code in packages/climate-ref/src/climate_ref/results/diagnostics.py
select_diagnostics(filters=None)
#
Build the Select for diagnostics joined to their provider, with an execution-group count.
execution_group_count counts every ExecutionGroup row for the diagnostic
(all versions, not scoped to promoted_version),
so it reflects the diagnostic's full execution history.
Ordered by (Provider.slug, Diagnostic.slug, Diagnostic.id).
The diagnostic primary key is the final tiebreak so SQL pagination is deterministic across pages.