diff --git a/docs/user_guidance/entity_relationships.md b/docs/user_guidance/entity_relationships.md index bf0f6c1..68fe76d 100644 --- a/docs/user_guidance/entity_relationships.md +++ b/docs/user_guidance/entity_relationships.md @@ -48,8 +48,8 @@ There is also the functionality to customise errors related to either missing pa - `missing_parent_id_error_message`: the error message to display if a record is rejected as it has no valid parent record - `no_valid_records_error_code`: the error code to display if parent records are removed due to no valid children in a mandatory field - `no_valid_records_error_message`: the error message to display if parent records are removed due to no valid children in a mandatory field -- `empty_entity_error_code`: the error code to display if a __mandatory__ entity has any records post filtering -- `empty_entity_error_message`: the error message to display if a __mandatory__ entity has any records post filtering +- `empty_entity_post_br_error_code`: the error code to display if a __mandatory__ entity has any records post filtering +- `empty_entity_post_br_error_message`: the error message to display if a __mandatory__ entity has any records post filtering !!! note Specifying root entities is __optional__. Root entities will be inferred based on their absence. diff --git a/src/dve/core_engine/configuration/v1/__init__.py b/src/dve/core_engine/configuration/v1/__init__.py index 634cc11..dbccdab 100644 --- a/src/dve/core_engine/configuration/v1/__init__.py +++ b/src/dve/core_engine/configuration/v1/__init__.py @@ -116,9 +116,9 @@ class _LinkageConfig(BaseModel): "Records removed due to no valid parent record" ) """The error code to emit if the entity contains records that are orphaned by parent record rejections""" # pylint: disable=C0301 - empty_entity_error_code: ErrorCode = "EmptyEntity" + empty_entity_post_br_error_code: ErrorCode = "EmptyEntity" """The error code to emit if a mandatory entity has no valid remaining records""" - empty_entity_error_message: ErrorMessage = "no valid records remaining" + empty_entity_post_br_error_message: ErrorMessage = "no valid records remaining" """The error message to emit if a mandatory entity has no valid remaining records""" @model_validator(mode="after") diff --git a/src/dve/core_engine/configuration/v1/hierarchy.py b/src/dve/core_engine/configuration/v1/hierarchy.py index 35997eb..57b6450 100644 --- a/src/dve/core_engine/configuration/v1/hierarchy.py +++ b/src/dve/core_engine/configuration/v1/hierarchy.py @@ -26,8 +26,8 @@ class HierarchyNode(BaseModel): missing_parent_id_error_message: Optional[ErrorMessage] = ( "Records removed due to no valid parent record" ) - empty_entity_error_code: ErrorCode = "EmptyEntity" - empty_entity_error_message: ErrorMessage = "no valid records remaining" + empty_entity_post_br_error_code: ErrorCode = "EmptyEntity" + empty_entity_post_br_error_message: ErrorMessage = "no valid records remaining" @model_validator(mode="after") def validate_empty_error_details(self): @@ -36,8 +36,8 @@ def validate_empty_error_details(self): non mandatory nodes/entities """ if not self.mandatory: - self.empty_entity_error_code = None - self.empty_entity_error_message = None + self.empty_entity_post_br_error_code = None + self.empty_entity_post_br_error_message = None return self def get_descendents(self) -> list["HierarchyNode"]: diff --git a/src/dve/pipeline/pipeline.py b/src/dve/pipeline/pipeline.py index 2cf0055..1d29b1b 100644 --- a/src/dve/pipeline/pipeline.py +++ b/src/dve/pipeline/pipeline.py @@ -581,10 +581,10 @@ def check_mandatory_entities_have_records( entity=entity_name, record=None, error_location=entity_name, - error_message=node.empty_entity_error_message, + error_message=node.empty_entity_post_br_error_message, failure_type="submission", error_type="submission", - error_code=node.empty_entity_error_code, + error_code=node.empty_entity_post_br_error_code, category="Empty entity", ) ) diff --git a/tests/test_core_engine/test_hierarchy.py b/tests/test_core_engine/test_hierarchy.py index bbce74f..43a0a8f 100644 --- a/tests/test_core_engine/test_hierarchy.py +++ b/tests/test_core_engine/test_hierarchy.py @@ -269,8 +269,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "parent record removed as no valid child records", "missing_parent_id_error_code": null, "missing_parent_id_error_message": null, - "empty_entity_error_code": null, - "empty_entity_error_message": null, + "empty_entity_post_br_error_code": null, + "empty_entity_post_br_error_message": null, "children": { "ds_003": { "parent_entity": "ds_001", @@ -282,8 +282,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "parent record removed as no valid child records", "missing_parent_id_error_code": "DS003NoParent", "missing_parent_id_error_message": "record removed as no parent", - "empty_entity_error_code": null, - "empty_entity_error_message": null, + "empty_entity_post_br_error_code": null, + "empty_entity_post_br_error_message": null, "children": {} }, "ds_101": { @@ -296,8 +296,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "{{ ds_001_id }} removed as no valid ds_101 records", "missing_parent_id_error_code": "DS101NoParent", "missing_parent_id_error_message": "record removed as no parent", - "empty_entity_error_code": null, - "empty_entity_error_message": null, + "empty_entity_post_br_error_code": null, + "empty_entity_post_br_error_message": null, "children": { "ds_201": { "parent_entity": "ds_101", @@ -309,8 +309,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "parent record removed as no valid child records", "missing_parent_id_error_code": "DS201NoParent", "missing_parent_id_error_message": "record removed as no parent", - "empty_entity_error_code": null, - "empty_entity_error_message": null, + "empty_entity_post_br_error_code": null, + "empty_entity_post_br_error_message": null, "children": { "ds_202": { "parent_entity": "ds_201", @@ -322,8 +322,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "parent record removed as no valid child records", "missing_parent_id_error_code": "MissingParentRecord", "missing_parent_id_error_message": "Records removed due to no valid parent record", - "empty_entity_error_code": "EmptyEntity", - "empty_entity_error_message": "no valid records remaining", + "empty_entity_post_br_error_code": "EmptyEntity", + "empty_entity_post_br_error_message": "no valid records remaining", "children": {} } } @@ -351,8 +351,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "{{ ds_001_id }} removed as no valid ds_101 records", "missing_parent_id_error_code": "DS101NoParent", "missing_parent_id_error_message": "record removed as no parent", - "empty_entity_error_code": null, - "empty_entity_error_message": null, + "empty_entity_post_br_error_code": null, + "empty_entity_post_br_error_message": null, "children": { "ds_201": { "parent_entity": "ds_101", @@ -364,8 +364,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "parent record removed as no valid child records", "missing_parent_id_error_code": "DS201NoParent", "missing_parent_id_error_message": "record removed as no parent", - "empty_entity_error_code": null, - "empty_entity_error_message": null, + "empty_entity_post_br_error_code": null, + "empty_entity_post_br_error_message": null, "children": { "ds_202": { "parent_entity": "ds_201", @@ -377,8 +377,8 @@ def test_linkage_config_load(): "no_valid_records_error_message": "parent record removed as no valid child records", "missing_parent_id_error_code": "MissingParentRecord", "missing_parent_id_error_message": "Records removed due to no valid parent record", - "empty_entity_error_code": "EmptyEntity", - "empty_entity_error_message": "no valid records remaining", + "empty_entity_post_br_error_code": "EmptyEntity", + "empty_entity_post_br_error_message": "no valid records remaining", "children": {} } } diff --git a/tests/testdata/flights/flights.dischema.json b/tests/testdata/flights/flights.dischema.json index a0342cc..a4ef67e 100644 --- a/tests/testdata/flights/flights.dischema.json +++ b/tests/testdata/flights/flights.dischema.json @@ -161,8 +161,8 @@ "country": { "is_root_entity": true, "mandatory": true, - "empty_entity_error_code": "NoValidCountries", - "empty_entity_error_message": "File Rejected - There are no valid country records" + "empty_entity_post_br_error_code": "NoValidCountries", + "empty_entity_post_br_error_message": "File Rejected - There are no valid country records" }, "airport": { "parent_entity": "country", @@ -174,8 +174,8 @@ "missing_parent_id_error_message": "Record rejected - No valid country id found for airport", "no_valid_records_error_code": "CountryHasNoAirport", "no_valid_records_error_message": "Group rejected - Unable to find any valid airports", - "empty_entity_error_code": "NoValidAirports", - "empty_entity_error_message": "File Rejected - There are no valid airport records" + "empty_entity_post_br_error_code": "NoValidAirports", + "empty_entity_post_br_error_message": "File Rejected - There are no valid airport records" }, "staff": { "parent_entity": "airport", @@ -187,8 +187,8 @@ "missing_parent_id_error_message": "Record rejected - No valid airport id found for staff. Airport ID = {{ airport_id }}, Staff ID = {{ staff_id }}", "no_valid_records_error_code": "AirportHasNoStaff", "no_valid_records_error_message": "Group rejected - Airport has no valid staff. Airport ID = {{ airport_id }}", - "empty_entity_error_code": "NoValidStaff", - "empty_entity_error_message": "File Rejected - There are no valid staff records" + "empty_entity_post_br_error_code": "NoValidStaff", + "empty_entity_post_br_error_message": "File Rejected - There are no valid staff records" }, "flights": { "parent_entity": "airport", diff --git a/tests/testdata/flights/flights_spark.dischema.json b/tests/testdata/flights/flights_spark.dischema.json index b318f82..d94e07d 100644 --- a/tests/testdata/flights/flights_spark.dischema.json +++ b/tests/testdata/flights/flights_spark.dischema.json @@ -174,8 +174,8 @@ "missing_parent_id_error_message": "Record rejected - No valid country id found for airport", "no_valid_records_error_code": "CountryHasNoAirport", "no_valid_records_error_message": "Group rejected - Unable to find any valid airports", - "empty_entity_error_code": "NoValidAirports", - "empty_entity_error_message": "File Rejected - There are no valid airport records" + "empty_entity_post_br_error_code": "NoValidAirports", + "empty_entity_post_br_error_message": "File Rejected - There are no valid airport records" }, "staff": { "parent_entity": "airport", @@ -187,8 +187,8 @@ "missing_parent_id_error_message": "Record rejected - No valid airport id found for staff. Airport ID = {{ airport_id }}, Staff ID = {{ staff_id }}", "no_valid_records_error_code": "AirportHasNoStaff", "no_valid_records_error_message": "Group rejected - Airport has no valid staff. Airport ID = {{ airport_id }}", - "empty_entity_error_code": "NoValidStaff", - "empty_entity_error_message": "File Rejected - There are no valid staff records" + "empty_entity_post_br_error_code": "NoValidStaff", + "empty_entity_post_br_error_message": "File Rejected - There are no valid staff records" }, "flights": { "parent_entity": "airport",