Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.7.1 (2026-03-12)

### Fix

- enable passing of original_entity_override to fix instance where id cannot be sourced from current entity

## v0.7.0 (2026-03-12)

### Feat
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "data-validation-engine"
version = "0.7.0"
version = "0.7.1"
description = "`nhs data validation engine` is a framework used to validate data"
authors = ["NHS England <england.contactus@nhs.net>"]
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def notify(self, entities: DuckDBEntities, *, config: Notification) -> Messages:
messages.append(
FeedbackMessage(
entity=config.reporting.reporting_entity_override or config.entity_name,
original_entity=config.entity_name,
original_entity=config.reporting.original_entity_override or config.entity_name,
record=record, # type: ignore
error_location=config.reporting.legacy_location,
error_message=template_object(config.reporting.message, record), # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def notify(self, entities: SparkEntities, *, config: Notification) -> Messages:
# more complex extraction done in reporting module
FeedbackMessage(
entity=config.reporting.reporting_entity_override or config.entity_name,
original_entity=config.entity_name,
original_entity=config.reporting.original_entity_override or config.entity_name,
record=record.asDict(recursive=True),
error_location=config.reporting.legacy_location,
error_message=template_object(
Expand Down
7 changes: 7 additions & 0 deletions src/dve/core_engine/backends/metadata/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from dve.core_engine.templating import template_object
from dve.core_engine.type_hints import (
EntityName,
ErrorCategory,
ErrorCode,
ErrorEmitValue,
Expand Down Expand Up @@ -102,6 +103,12 @@ class BaseReportingConfig(BaseModel):
If this is not provided, the top level names from the `location` field
will be used in the report.

"""
original_entity_override: Optional[EntityName] = None
"""
This should only be populated where you need to refer back to an originally defined entity that
contains the key field(s) of interest. This might be required in cases where you've created
lots of new entities during a complex rule.
"""

def template(
Expand Down
2 changes: 2 additions & 0 deletions src/dve/core_engine/configuration/v1/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ConcreteFilterConfig(BaseModel):
reporting_field: Optional[Union[str, list[str]]] = None
reporting_field_name: Optional[str] = None
category: ErrorCategory = "Bad value"
original_entity_override: Optional[str] = None

def to_step(self) -> AbstractStep:
"""Create a deferred filter from the concrete filter config."""
Expand All @@ -37,6 +38,7 @@ def to_step(self) -> AbstractStep:
legacy_is_informational=self.is_informational,
legacy_location=self.error_location,
legacy_reporting_field=self.reporting_field,
original_entity_override=self.original_entity_override,
)

return DeferredFilter(
Expand Down
Loading