Records
cognite_data_quality._records
DataQualityRecord
Bases: BaseModel
DMS instance upsert payload for a single validated instance.
Attributes:
| Name | Type | Description |
|---|---|---|
space |
str
|
Destination DMS space for this record. |
external_id |
str
|
External ID of the record instance. |
properties |
dict
|
Dict of property values to write to the Records container. |
Source code in cognite_data_quality/_records.py
RecordsConfig
Bases: BaseModel
Records API coordinates and rule set metadata for a validation run.
Attributes:
| Name | Type | Description |
|---|---|---|
stream_id |
str | None
|
External ID of the Records API stream to ingest into.
Set to |
rule_set_id |
str
|
Identifier for the SHACL rule set being applied (written to every record). |
rule_set_version |
str
|
Version string of the rule set (written to every record). |
data_domain_external_id |
str | None
|
Optional data domain tag written to each record for filtering in the validation dashboard. |
records_space |
str
|
CDF DMS space that hosts the validation records
container. Default: |
records_container |
str
|
External ID of the DMS container that stores
records. Default: |
use_instance_space |
bool
|
Write each record into the same space as the
validated instance instead of records_space. Default: |
record_space |
str | None
|
Explicit destination space, overriding records_space
when use_instance_space is |
Source code in cognite_data_quality/_records.py
Violation
Bases: BaseModel
A single constraint violation extracted from a SHACL validation report.
All fields map directly to SHACL result properties and may be None
when the SHACL engine did not produce that property for a given result.
Attributes:
| Name | Type | Description |
|---|---|---|
focusNode |
str | None
|
URI of the node that failed the constraint. |
resultMessage |
str | None
|
Human-readable violation message from |
resultSeverity |
str | None
|
Severity URI (e.g. |
sourceConstraintComponent |
str | None
|
SHACL constraint component that raised the
violation (e.g. |
resultPath |
str | None
|
Property path that caused the violation. |
value |
str | None
|
The offending value, if any. |
sourceShape |
str | None
|
External ID / URI of the shape that contains the violated constraint. |
sourceConstraint |
str | None
|
The specific constraint within the shape. |
dimension |
str | None
|
Data quality dimension label (Completeness, Validity, etc.). |
targetClass |
str | None
|
Local name of the |
Source code in cognite_data_quality/_records.py
build_records(instances, violations, *, job_run_id, records_config, namespace_base)
Build Records API payloads for all instances.
Source code in cognite_data_quality/_records.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 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 | |
build_schema_issue_records(schema_issues, *, job_run_id, records_config, datamodel_space, datamodel_external_id, datamodel_version)
Build Records API payloads for schema inconsistencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_issues
|
list
|
List of SchemaIssue objects from SHACL validation |
required |
job_run_id
|
str
|
Unique identifier for this validation run |
required |
records_config
|
RecordsConfig
|
Records API configuration |
required |
datamodel_space
|
str
|
Data model space being validated |
required |
datamodel_external_id
|
str
|
Data model external ID |
required |
datamodel_version
|
str
|
Data model version |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of record payloads ready for Records API |
Source code in cognite_data_quality/_records.py
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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |
ensure_records_infrastructure(client, records_config)
Ensure Records API stream and container exist.
Source code in cognite_data_quality/_records.py
parse_focus_node_uri(uri, namespace_base='http://purl.org/cognite/')
Parse focusNode URI into (space, external_id), matching NEAT and simple formats.
NEAT: {namespace_base}space/{instance_space}#{urlencoded(external_id)} Simple: {namespace_base}{space}/{external_id}