climate_ref.doctor.context
#
The deployment a check runs against.
EMPTY_CATALOG = pd.DataFrame()
module-attribute
#
Stands in for a source type with nothing ingested.
DoctorContext
#
The deployment being checked.
Providers and catalogs are loaded lazily so a check that does not need them does not pay for them, and so a failure to load one provider does not stop the other checks.
Source code in packages/climate-ref/src/climate_ref/doctor/context.py
providers
property
#
The diagnostic providers this deployment has enabled.
catalog(source_type)
#
Load the ingested catalog for a source type, one row per file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
SourceDatasetType
|
The source type to load. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The catalog, or an empty frame when nothing of that type has been ingested. |
Source code in packages/climate-ref/src/climate_ref/doctor/context.py
from_catalogs(catalogs, providers)
classmethod
#
Build a context from catalogs already in hand, with no database behind it.
Source types absent from catalogs are treated as having nothing ingested,
so every check can run without reaching for a database that is not there.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalogs
|
dict[SourceDatasetType, DataFrame]
|
The catalogs to check, keyed by source type. |
required |
providers
|
Iterable[DiagnosticProvider]
|
The providers to treat as enabled. |
required |
Returns:
| Type | Description |
|---|---|
DoctorContext
|
A context backed by nothing but the supplied catalogs and providers. |