diff --git a/nacc_form_validator/errors.py b/nacc_form_validator/errors.py index 870828b..8589840 100644 --- a/nacc_form_validator/errors.py +++ b/nacc_form_validator/errors.py @@ -89,7 +89,7 @@ def __set_custom_error_codes(self): 0x1009: "{1} for if {2} else {3} - compatibility rule no: {0}", 0x2000: - "{1} in current visit for if {2} in previous visit then {3} " + + "{1} for if {2} in previous visit then {3} " + "in current visit - temporal rule no: {0}", 0x2001: "primary key variable {0} not set in current visit data", @@ -122,7 +122,7 @@ def __set_custom_error_codes(self): 0x3003: "Error in comparing {0} to age at {1} ({2}): {3}", 0x3004: - "{1} in previous visit for if {3} in current visit then {2} " + + "{1} for if {3} in current visit then {2} " + "in previous visit - temporal rule no: {0}", } diff --git a/tests/test_nacc_validator_datastore.py b/tests/test_nacc_validator_datastore.py index 2ebf08c..a0a4c99 100644 --- a/tests/test_nacc_validator_datastore.py +++ b/tests/test_nacc_validator_datastore.py @@ -126,7 +126,7 @@ def test_temporal_check(schema): assert not nv.validate({'patient_id': 'PatientID1', 'visit_num': 4, 'taxes': 8}) assert nv.errors == {'taxes': [ - "('taxes', ['unallowed value 8']) in current visit for if {'taxes': {'allowed': [0]}} in previous visit then {'taxes': {'forbidden': [8]}} in current visit - temporal rule no: 0"]} + "('taxes', ['unallowed value 8']) for if {'taxes': {'allowed': [0]}} in previous visit then {'taxes': {'forbidden': [8]}} in current visit - temporal rule no: 0"]} def test_temporal_check_swap_order(schema): """ Test temporal check when the order of evaluation is swapped """ @@ -139,7 +139,7 @@ def test_temporal_check_swap_order(schema): nv.reset_record_cache() assert not nv.validate({'patient_id': 'PatientID1', 'visit_num': 2, 'taxes': 1}) assert nv.errors == {'taxes': [ - "('taxes', ['unallowed value 8']) in previous visit for if {'taxes': {'forbidden': [8]}} in current visit then {'taxes': {'allowed': [0]}} in previous visit - temporal rule no: 0"]} + "('taxes', ['unallowed value 8']) for if {'taxes': {'forbidden': [8]}} in current visit then {'taxes': {'allowed': [0]}} in previous visit - temporal rule no: 0"]} def test_temporal_check_no_prev_visit(schema): """ Temporal test check when there are no previous visits (e.g. before visit 0) """ @@ -305,7 +305,7 @@ def test_temporal_check_with_nested_compare_with_previous_record(): assert not nv.validate({'patient_id': 'PatientID1', 'visit_num': 4, 'birthyr': 1951}) assert nv.errors == {'birthyr': [ - '(\'birthyr\', ["input value doesn\'t satisfy the condition birthyr == birthyr (previous record)"]) in current visit for ' + + '(\'birthyr\', ["input value doesn\'t satisfy the condition birthyr == birthyr (previous record)"]) for ' + 'if {\'birthyr\': {\'forbidden\': [-1]}} in previous visit ' + 'then {\'birthyr\': {\'compare_with\': {\'comparator\': \'==\', \'base\': \'birthyr\', \'previous_record\': True}}} in current visit ' + '- temporal rule no: 0']}