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
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
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
data_catalog(source_type)
#
Load the ingested catalog as the solver sees it.
The adapter and database are carried through where there are any, so an unfinalised dataset can still be finalised during a solve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
SourceDatasetType
|
The source type to load. |
required |
Returns:
| Type | Description |
|---|---|
DataCatalog
|
A catalog the solver can be run against. |
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. |