You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is preferred, because disaggregated checks would make the automated reports even longer. It also means more checks for analysts to click through to read.
Backend patch:
diff --git a/contracting_process/resource_level/consistent/parties_role.py b/contracting_process/resource_level/consistent/parties_role.py
index a7f067e..90fb8c2 100644
--- a/contracting_process/resource_level/consistent/parties_role.py+++ b/contracting_process/resource_level/consistent/parties_role.py@@ -1,29 +1,26 @@
from tools.checks import get_empty_result_resource
from tools.getter import get_values
-version = "1.0"+version = "1.1"
"""
-author: Iaroslav Kolodka+author: Iaroslav Kolodka, Lucie Procházková
"""
-testing_roles = {- "supplier": "awards.suppliers",- "tenderer": "tender.tenderers",- "procuringEntity": "tender.procuringEntity",- "payer": "contracts.implementation.transactions.payer",- "payee": "contracts.implementation.transactions.payee",-}--def calculate(item) -> dict:+def calculate(item, role, path) -> dict:
"""Method is designed to test items from parties on existing refereced items.
- Paramtertes+ Parameters
------------
item: dict
testing JSON
+ role: string+ testing role+ path:+ path to the tested role+
Returns
-----------
@@ -36,6 +33,7 @@ def calculate(item) -> dict:
"party_path": identification of a resource,
"examined_role": party role that was examined
"resource_identification" - identification of a resource
+ "result" - result for this particular role
}
"""
@@ -46,23 +44,21 @@ def calculate(item) -> dict:
if "value" in party and party["value"]:
party_value = party["value"]
if "roles" in party_value and party_value["roles"] and "id" in party_value and party_value["id"]:
- for role in party_value["roles"]:- if role in testing_roles.keys():- party_item = {"role": role, "id": party_value["id"], "path": party["path"]}- parties_roles.append(party_item)+ if role in party_value["roles"]:+ party_item = {"role": role, "id": party_value["id"], "path": party["path"]}+ parties_roles.append(party_item)
if not parties_roles:
result["reason"] = "There are no parties with set role and id"
return result
items_from_paths = []
- for role_name, role_path in testing_roles.items():- found_items = []- found_items += get_values(item, role_path)- for elem in found_items:- if "value" in elem and "id" in elem["value"]:- elem_box = {"id": elem["value"]["id"], "role": role_name}- items_from_paths.append(elem_box)+ found_items = []+ found_items += get_values(item, path)+ for elem in found_items:+ if "value" in elem and "id" in elem["value"]:+ elem_box = {"id": elem["value"]["id"], "role": role}+ items_from_paths.append(elem_box)
passed = None
pass_count = 0
@@ -72,7 +68,6 @@ def calculate(item) -> dict:
if not result["meta"] or "references" not in result["meta"]:
result["meta"] = {"references": []}
passed = False
- role = None
for referenced_item in items_from_paths:
if str(referenced_item["id"]) == str(party["id"]) and referenced_item["role"] == party["role"]:
passed = True
@@ -80,7 +75,12 @@ def calculate(item) -> dict:
application_count += 1
pass_count = pass_count + 1 if passed else pass_count
result["meta"]["references"].append(
- {"party_path": party["path"], "examined_role": party["role"], "resource_identification": party["id"]}+ {+ "party_path": party["path"],+ "examined_role": party["role"],+ "resource_identification": party["id"],+ "result": passed,+ }
)
result["application_count"] = application_count
diff --git a/contracting_process/resource_level/consistent/period_duration_in_days.py b/contracting_process/resource_level/consistent/period_duration_in_days.py
index acabe85..8190025 100644
--- a/contracting_process/resource_level/consistent/period_duration_in_days.py+++ b/contracting_process/resource_level/consistent/period_duration_in_days.py@@ -7,19 +7,35 @@
version = 1.0
-def calculate(item):- result = get_empty_result_resource(version)+def calculate(item, path):+ """Method is designed to test items for correct periods - if period duration is consistent with start and enddate.++ Parameters+ ------------+ item: dict+ testing JSON+ path:+ path to the tested period+++ Returns+ -----------+ result: dict+ {+ "result" - if successed+ "application_count" - application count+ "pass_count" - pass count+ "meta" -+ "periods" -+ "path" - path to the tested role+ "result" - if successed+ }++ """- period_paths = [- "tender.tenderPeriod",- "tender.enquiryPeriod",- "tender.awardPeriod",- "tender.contractPeriod",- "awards.contractPeriod",- "contracts.period",- ]+ result = get_empty_result_resource(version)- periods = [period for path in period_paths for period in get_values(item, path)]+ periods = [period for period in get_values(item, path)]
result["application_count"] = 0
result["pass_count"] = 0
diff --git a/contracting_process/resource_level/consistent/tests/parties_payee_role_test.py b/contracting_process/resource_level/consistent/tests/parties_payee_role_test.py
deleted file mode 100644
index 3e9f301..0000000
--- a/contracting_process/resource_level/consistent/tests/parties_payee_role_test.py+++ /dev/null@@ -1,113 +0,0 @@-from contracting_process.resource_level.consistent.parties_role import calculate-from tools.checks import get_empty_result_resource--"""-author: Iaroslav Kolodka--The file contain tests for a 'function contracting_process.resource_level.consistent.parties_role.calculate' .--'test_on_inaction' - an input item has no valid parties -> "There are no parties with set role and id"-'test_with_correct_input' - an input item has two valid parties with corresponding valid objects-'test_with_incorrect_input' - an inputs has no corresponding valid objects--"""--version = "1.0"--item_with_no_correct_parties = {- "parties": [- {- "id": "adsjk-fhjdkf", # no roles- "name": "abcd",- "address": {"streetAddress": "dcba "},- "identifier": {"scheme": "12-12-12"},- "contactPoint": {},- },- {- "id": "0rw29R-dsfad", # empty list of roles- "name": "Unidad Central",- "roles": [],- "memberOf": [{"id": "adsjk-fhjdkf", "name": "abcd"}],- },- ]-}--correct_item_with_payee = {- "parties": [- {- "id": "010101-a01010", # empty list of roles- "name": "Uni",- "roles": ["payee"],- "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],- }- ],- "contracts": [{"implementation": {"transactions": [{"payee": {"id": "010101-a01010"}}]}}],-}-incorrect_item_with_payee = {- "parties": [- {- "id": "010101-a01010", # empty list of roles- "name": "Uni",- "roles": ["payee"],- "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],- }- ],- "contracts": [{"implementation": {"transactions": [{"payee": {"id": "00000000000"}}]}}],-}--incorrect_item_with_no_payee = {- "parties": [- {- "id": "010101-a01010", # empty list of roles- "name": "Uni",- "roles": ["payee"],- "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],- }- ]-}---def test_on_inaction():- expecting_result = get_empty_result_resource(version)- expecting_result["reason"] = "There are no parties with set role and id"- result = calculate(item_with_no_correct_parties)- assert expecting_result == result---def test_with_correct_input():- expecting_result = get_empty_result_resource(version)- expecting_result["result"] = True- # expecting_result["value"] = None # already None- expecting_result["application_count"] = 1- expecting_result["pass_count"] = 1- expecting_result["meta"] = {"references": []}- expecting_result["meta"]["references"] = [- {"party_path": "parties[0]", "examined_role": "payee", "resource_identification": "010101-a01010"}- ]- result = calculate(correct_item_with_payee)- assert expecting_result == result---def test_with_incorrect_input():- expecting_result1 = get_empty_result_resource(version)- expecting_result1["result"] = False- # expecting_result["value"] = None # already None- expecting_result1["application_count"] = 1- expecting_result1["pass_count"] = 0- expecting_result1["meta"] = {"references": []}- expecting_result1["meta"]["references"] = [- {"party_path": "parties[0]", "examined_role": "payee", "resource_identification": "010101-a01010"}- ]- result1 = calculate(incorrect_item_with_payee)- assert expecting_result1 == result1- expecting_result2 = get_empty_result_resource(version)- expecting_result2["result"] = False- # expecting_result["value"] = None # already None- expecting_result2["application_count"] = 1- expecting_result2["pass_count"] = 0- expecting_result2["meta"] = {"references": []}- expecting_result2["meta"]["references"] = [- {"party_path": "parties[0]", "examined_role": "payee", "resource_identification": "010101-a01010"}- ]- result2 = calculate(incorrect_item_with_no_payee)- assert expecting_result2 == result2diff --git a/contracting_process/resource_level/consistent/tests/parties_referenced_test.py b/contracting_process/resource_level/consistent/tests/parties_referenced_test.py
new file mode 100644
index 0000000..4629225
--- /dev/null+++ b/contracting_process/resource_level/consistent/tests/parties_referenced_test.py@@ -0,0 +1,434 @@+from contracting_process.resource_level.consistent.parties_role import calculate+from tools.checks import get_empty_result_resource++"""+author: Iaroslav Kolodka++The file contain tests for a 'function contracting_process.resource_level.consistent.parties_role.calculate' .++'test_on_inaction' - an input item has no valid parties -> "There are no parties with set role and id"+'test_with_correct_input' - an input item has two valid parties with corresponding valid objects+'test_with_incorrect_input' - an inputs has no corresponding valid objects++"""++version = "1.1"++testing_roles = {+ "supplier": "awards.suppliers",+ "tenderer": "tender.tenderers",+ "procuringEntity": "tender.procuringEntity",+ "payer": "contracts.implementation.transactions.payer",+ "payee": "contracts.implementation.transactions.payee",+}++item_with_no_correct_parties = {+ "parties": [+ {+ "id": "adsjk-fhjdkf", # no roles+ "name": "abcd",+ "address": {"streetAddress": "dcba "},+ "identifier": {"scheme": "12-12-12"},+ "contactPoint": {},+ },+ {+ "id": "0rw29R-dsfad", # empty list of roles+ "name": "Unidad Central",+ "roles": [],+ "memberOf": [{"id": "adsjk-fhjdkf", "name": "abcd"}],+ },+ ]+}++correct_item_with_payee = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["payee"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "contracts": [{"implementation": {"transactions": [{"payee": {"id": "010101-a01010"}}]}}],+}+++correct_item_with_payer = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["payer"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "contracts": [{"implementation": {"transactions": [{"payer": {"id": "010101-a01015"}}]}}],+}++correct_item_with_tenderer = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["tenderer"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "tender": [{"tenderers": {"id": "010101-a01015"}}],+}+++correct_item_with_procuring_entity = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["procuringEntity"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "tender": [{"procuringEntity": {"id": "010101-a01015"}}],+}++correct_item_with_supplier = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["supplier"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "awards": [{"suppliers": {"id": "010101-a01015"}}],+}+++incorrect_item_with_payee = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["payee"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "contracts": [{"implementation": {"transactions": [{"payee": {"id": "00000000000"}}]}}],+}++incorrect_item_with_payer = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["payer"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "contracts": [{"implementation": {"transactions": [{"payer": {"id": "010101-a01010"}}]}}],+}++incorrect_item_with_tenderer = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["tenderer"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "tender": [{"tenderers": {"id": "wrongID"}}],+}++incorrect_item_with_procuring_entity = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["procuringEntity"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "tender": [{"procuringEntity": {"id": "wrongID"}}],+}++incorrect_item_with_supplier = {+ "parties": [+ {+ "id": "010101-a01015", # empty list of roles+ "name": "Uni",+ "roles": ["supplier"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ],+ "awards": [{"suppliers": {"id": "wrongID"}}],+}+++incorrect_item_with_no_payee = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["payee"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ]+}++incorrect_item_with_no_payer = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["payer"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ]+}++incorrect_item_with_no_tenderer = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["tenderer"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ]+}++incorrect_item_with_no_supplier = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["supplier"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ]+}++incorrect_item_with_no_procuring_entity = {+ "parties": [+ {+ "id": "010101-a01010", # empty list of roles+ "name": "Uni",+ "roles": ["procuringEntity"],+ "memberOf": [{"id": "0rw29R-11341234", "name": "aabbcc"}],+ }+ ]+}+++def test_on_inaction():+ expecting_result = get_empty_result_resource(version)+ expecting_result["reason"] = "There are no parties with set role and id"+ for role in testing_roles:+ result = calculate(item_with_no_correct_parties, role, testing_roles[role])+ assert expecting_result == result+++def test_with_correct_input():+ expecting_result = get_empty_result_resource(version)+ expecting_result["result"] = True+ # expecting_result["value"] = None # already None+ expecting_result["application_count"] = 1+ expecting_result["pass_count"] = 1+ expecting_result["meta"] = {"references": []}+ expecting_result["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payee",+ "resource_identification": "010101-a01010",+ "result": True,+ }+ ]+ result = calculate(correct_item_with_payee, role="payee", path=testing_roles["payee"])+ assert expecting_result == result++ expecting_result["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payer",+ "resource_identification": "010101-a01015",+ "result": True,+ }+ ]+ result = calculate(correct_item_with_payer, role="payer", path=testing_roles["payer"])+ assert expecting_result == result++ expecting_result["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payer",+ "resource_identification": "010101-a01015",+ "result": True,+ }+ ]+ result = calculate(correct_item_with_payer, role="payer", path=testing_roles["payer"])+ assert expecting_result == result++ expecting_result["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "tenderer",+ "resource_identification": "010101-a01015",+ "result": True,+ }+ ]+ result = calculate(correct_item_with_tenderer, role="tenderer", path=testing_roles["tenderer"])+ assert expecting_result == result++ expecting_result["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "supplier",+ "resource_identification": "010101-a01015",+ "result": True,+ }+ ]+ result = calculate(correct_item_with_supplier, role="supplier", path=testing_roles["supplier"])+ assert expecting_result == result++ expecting_result["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "procuringEntity",+ "resource_identification": "010101-a01015",+ "result": True,+ }+ ]+ result = calculate(+ correct_item_with_procuring_entity, role="procuringEntity", path=testing_roles["procuringEntity"]+ )+ assert expecting_result == result+++def test_with_incorrect_input():+ expecting_result1 = get_empty_result_resource(version)+ expecting_result1["result"] = False+ # expecting_result["value"] = None # already None+ expecting_result1["application_count"] = 1+ expecting_result1["pass_count"] = 0+ expecting_result1["meta"] = {"references": []}+ expecting_result1["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payee",+ "resource_identification": "010101-a01010",+ "result": False,+ }+ ]+ result1 = calculate(incorrect_item_with_payee, role="payee", path=testing_roles["payee"])+ assert expecting_result1 == result1++ expecting_result1["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payer",+ "resource_identification": "010101-a01015",+ "result": False,+ }+ ]+ result1 = calculate(incorrect_item_with_payer, role="payer", path=testing_roles["payer"])+ assert expecting_result1 == result1++ expecting_result1["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "tenderer",+ "resource_identification": "010101-a01015",+ "result": False,+ }+ ]+ result1 = calculate(incorrect_item_with_tenderer, role="tenderer", path=testing_roles["tenderer"])+ assert expecting_result1 == result1++ expecting_result1["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "supplier",+ "resource_identification": "010101-a01015",+ "result": False,+ }+ ]+ result1 = calculate(incorrect_item_with_supplier, role="supplier", path=testing_roles["supplier"])+ assert expecting_result1 == result1++ expecting_result1["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "procuringEntity",+ "resource_identification": "010101-a01015",+ "result": False,+ }+ ]+ result1 = calculate(+ incorrect_item_with_procuring_entity, role="procuringEntity", path=testing_roles["procuringEntity"]+ )+ assert expecting_result1 == result1+++def test_with_incorrect_input_no_role():+ expecting_result2 = get_empty_result_resource(version)+ expecting_result2["result"] = False+ # expecting_result["value"] = None # already None+ expecting_result2["application_count"] = 1+ expecting_result2["pass_count"] = 0+ expecting_result2["meta"] = {"references": []}+ expecting_result2["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payee",+ "resource_identification": "010101-a01010",+ "result": False,+ }+ ]+ result2 = calculate(incorrect_item_with_no_payee, role="payee", path=testing_roles["payee"])+ assert expecting_result2 == result2++ expecting_result2["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "payer",+ "resource_identification": "010101-a01010",+ "result": False,+ }+ ]+ result2 = calculate(incorrect_item_with_no_payer, role="payer", path=testing_roles["payer"])+ assert expecting_result2 == result2++ expecting_result2["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "tenderer",+ "resource_identification": "010101-a01010",+ "result": False,+ }+ ]+ result2 = calculate(incorrect_item_with_no_tenderer, role="tenderer", path=testing_roles["tenderer"])+ assert expecting_result2 == result2++ expecting_result2["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "supplier",+ "resource_identification": "010101-a01010",+ "result": False,+ }+ ]+ result2 = calculate(incorrect_item_with_no_supplier, role="supplier", path=testing_roles["supplier"])+ assert expecting_result2 == result2++ expecting_result2["meta"]["references"] = [+ {+ "party_path": "parties[0]",+ "examined_role": "procuringEntity",+ "resource_identification": "010101-a01010",+ "result": False,+ }+ ]+ result2 = calculate(+ incorrect_item_with_no_procuring_entity, role="procuringEntity", path=testing_roles["procuringEntity"]+ )+ assert expecting_result2 == result2diff --git a/contracting_process/resource_level/consistent/tests/period_duration_in_days_test.py b/contracting_process/resource_level/consistent/tests/period_duration_in_days_test.py
index 23e6867..6d5a3ba 100644
--- a/contracting_process/resource_level/consistent/tests/period_duration_in_days_test.py+++ b/contracting_process/resource_level/consistent/tests/period_duration_in_days_test.py@@ -9,13 +9,61 @@
def test_undefined():
- result = calculate({})+ result = calculate({}, "tender.tenderPeriod")
assert result["result"] is None
assert result["application_count"] is None
assert result["pass_count"] is None
assert result["meta"] == {"reason": "there are no values with check-specific properties"}
- result = calculate(item_test_undefined)+ result = calculate({}, "tender.contractPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate({}, "tender.enquiryPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate({}, "awards.contractPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate({}, "contracts.period")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate(item_test_undefined, "tender.tenderPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate(item_test_undefined, "tender.contractPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate(item_test_undefined, "tender.enquiryPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate(item_test_undefined, "awards.contractPeriod")+ assert result["result"] is None+ assert result["application_count"] is None+ assert result["pass_count"] is None+ assert result["meta"] == {"reason": "there are no values with check-specific properties"}++ result = calculate(item_test_undefined, "contracts.period")
assert result["result"] is None
assert result["application_count"] is None
assert result["pass_count"] is None
@@ -73,25 +121,34 @@ def test_undefined():
def test_passed():
- result = calculate(item_test_passed1)+ result = calculate(item_test_passed1, "awards.contractPeriod")
assert result["result"] is True
- assert result["application_count"] == 3- assert result["pass_count"] == 3+ assert result["application_count"] == 1+ assert result["pass_count"] == 1
assert result["meta"] == {
"periods": [
{"path": "awards[0].contractPeriod", "result": True},
+ ]+ }++ result = calculate(item_test_passed1, "contracts.period")+ assert result["result"] is True+ assert result["application_count"] == 2+ assert result["pass_count"] == 2+ assert result["meta"] == {+ "periods": [
{"path": "contracts[0].period", "result": True},
{"path": "contracts[1].period", "result": True},
]
}
- result = calculate(item_test_passed2)+ result = calculate(item_test_passed2, "tender.enquiryPeriod")
assert result["result"] is True
assert result["application_count"] == 1
assert result["pass_count"] == 1
assert result["meta"] == {"periods": [{"path": "tender.enquiryPeriod", "result": True}]}
- result = calculate(item_test_passed3)+ result = calculate(item_test_passed3, "tender.enquiryPeriod")
assert result["result"] is True
assert result["application_count"] == 1
assert result["pass_count"] == 1
@@ -129,13 +186,22 @@ def test_passed():
def test_failed():
- result = calculate(item_test_failed)+ result = calculate(item_test_failed, "awards.contractPeriod")
assert result["result"] is False
- assert result["application_count"] == 3- assert result["pass_count"] == 1+ assert result["application_count"] == 1+ assert result["pass_count"] == 0
assert result["meta"] == {
"periods": [
{"path": "awards[0].contractPeriod", "result": False},
+ ]+ }++ result = calculate(item_test_failed, "contracts.period")+ assert result["result"] is False+ assert result["application_count"] == 2+ assert result["pass_count"] == 1+ assert result["meta"] == {+ "periods": [
{"path": "contracts[0].period", "result": False},
{"path": "contracts[1].period", "result": True},
]
diff --git a/contracting_process/resource_level/definitions.py b/contracting_process/resource_level/definitions.py
index eed7637..9cca9ea 100644
--- a/contracting_process/resource_level/definitions.py+++ b/contracting_process/resource_level/definitions.py@@ -29,7 +29,21 @@
"consistent.number_of_tenderers": number_of_tenderers.calculate,
"consistent.tender_value": tender_value.calculate,
"consistent.contracts_value": contracts_value.calculate,
- "consistent.parties_roles": parties_role.calculate,+ "consistent.supplier_referenced": functools.partial(+ parties_role.calculate, path="awards.suppliers", role="supplier"+ ),+ "consistent.tenderer_referenced": functools.partial(+ parties_role.calculate, path="tender.tenderers", role="tenderer"+ ),+ "consistent.procuringEntity_referenced": functools.partial(+ parties_role.calculate, path="tender.procuringEntity", role="procuringEntity"+ ),+ "consistent.payer_referenced": functools.partial(+ parties_role.calculate, path="contracts.implementation.transactions.payer", role="payer"+ ),+ "consistent.payee_referenced": functools.partial(+ parties_role.calculate, path="contracts.implementation.transactions.payee", role="payee"+ ),
"consistent.supplier_in_parties_roles": functools.partial(
roles.calculate_path_role, path="awards.suppliers", role="supplier"
),
@@ -47,7 +61,24 @@
roles.calculate_path_role, path="contracts.implementation.transactions.payee", role="payee"
),
"consistent.contracts_implementation_transactions_value": contracts_implementation_transactions_value.calculate,
- "consistent.period_duration_in_days": period_duration_in_days.calculate,+ "consistent.period_duration_in_days_tender": functools.partial(+ period_duration_in_days.calculate, path="tender.tenderPeriod"+ ),+ "consistent.period_duration_in_days_enquiry": functools.partial(+ period_duration_in_days.calculate, path="tender.enquiryPeriod"+ ),+ "consistent.period_duration_in_days_award": functools.partial(+ period_duration_in_days.calculate, path="tender.awardPeriod"+ ),+ "consistent.period_duration_in_days_contract": functools.partial(+ period_duration_in_days.calculate, path="tender.contractPeriod"+ ),+ "consistent.period_duration_in_days_award_contract": functools.partial(+ period_duration_in_days.calculate, path="awards.contractPeriod"+ ),+ "consistent.period_duration_in_days_contracts": functools.partial(+ period_duration_in_days.calculate, path="contracts.period"+ ),
"consistent.supplier_name_in_parties": functools.partial(org_ref_name.calculate, path="awards.suppliers"),
"consistent.tenderer_name_in_parties": functools.partial(org_ref_name.calculate, path="tender.tenderers"),
"consistent.buyer_name_in_parties": functools.partial(org_ref_name.calculate, path="buyer"),
Frontend patch:
diff --git a/frontend/src/components/ResourceLevelList.vue b/frontend/src/components/ResourceLevelList.vue
index 3c04fab9..1bf4f210 100644
--- a/frontend/src/components/ResourceLevelList.vue+++ b/frontend/src/components/ResourceLevelList.vue@@ -78,6 +78,17 @@ export default {
"consistent.supplier_name_in_parties",
"consistent.payer_name_in_parties",
"consistent.payee_name_in_parties",
+ "tenderer_referenced",+ "procuringEntity_referenced",+ "supplier_referenced",+ "payer_referenced",+ "payee_referenced",+ "period_duration_in_days_tender",+ "period_duration_in_days_award",+ "period_duration_in_days_contract",+ "period_duration_in_days_enquiry",+ "period_duration_in_days_award_contract",+ "period_duration_in_days_contracts",
"coherent.tender_status",
"coherent.awards_status",
"coherent.contracts_status",
diff --git a/frontend/src/messages/en.js b/frontend/src/messages/en.js
index cd500bd3..ba266a04 100644
--- a/frontend/src/messages/en.js+++ b/frontend/src/messages/en.js@@ -516,6 +516,61 @@ export const messages = {
name: "Tenderer's name is consistent",
description:
"<p>Each <code>tender.tenderers</code> entry has the same value for its <code>name</code> field as the party it references.</p><p>The test is skipped if every referencing <code>id</code> is missing or if none matches the <code>id</code> of exactly one party.</p>"
+ },+ period_duration_in_days_tender: {+ name: "The tender duration is consistent",+ description:+ "<p>For each tender period, <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>endDate</code>. If <code>endDate</code> is blank or unparseable, then <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>maxExtentDate</code>.</p><p>Since the test operates on all period objects, the test silently ignores any dates that can't be parsed.</p>"+ },+ payee_referenced: {+ name: "Payees are referenced",+ description:+ "<p>For each payee, there is a referencing object. <i>Example</i>: If there is a party with role 'payee', it is referenced by at least one transaction's <code>payee</code> field.</p><p>Since the test operates on all organization objects, the test silently ignores any party whose <code>id</code> field is missing, as it cannot be referenced.</p>"+ },+ payer_referenced: {+ name: "Payers are referenced",+ description:+ "<p>For each payee, there is a referencing object. <i>Example</i>: If there is a party with role 'payer', it is referenced by at least one transaction's <code>payer</code> field.</p><p>Since the test operates on all organization objects, the test silently ignores any party whose <code>id</code> field is missing, as it cannot be referenced.</p>"+ },+ period_duration_in_days_award: {+ name: "Tenders have consistent award periods",+ description:+ "<p>For each tender's award period, <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>endDate</code>. If <code>endDate</code> is blank or unparseable, then <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>maxExtentDate</code>.</p><p>Since the test operates on all period objects, the test silently ignores any dates that can't be parsed.</p>"+ },+ period_duration_in_days_award_contract: {+ name: "Awards have consistent contract periods",+ description:+ "<p>For each award's contract's period, <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>endDate</code>. If <code>endDate</code> is blank or unparseable, then <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>maxExtentDate</code>.</p><p>Since the test operates on all period objects, the test silently ignores any dates that can't be parsed.</p>"+ },+ period_duration_in_days_contract: {+ name: "Tenders have consistent contract periods",+ description:+ "<p>For each tender's contract period, <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>endDate</code>. If <code>endDate</code> is blank or unparseable, then <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>maxExtentDate</code>.</p><p>Since the test operates on all period objects, the test silently ignores any dates that can't be parsed.</p>"+ },+ period_duration_in_days_contracts: {+ name: "Contracts have consistent periods",+ description:+ "<p>For each contract's period, <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>endDate</code>. If <code>endDate</code> is blank or unparseable, then <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>maxExtentDate</code>.</p><p>Since the test operates on all period objects, the test silently ignores any dates that can't be parsed.</p>"+ },+ period_duration_in_days_enquiry: {+ name: "Tenders have consistent enquiry periods",+ description:+ "<p>For each tender's enquiry period, <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>endDate</code>. If <code>endDate</code> is blank or unparseable, then <code>durationInDays</code> is equal to the difference between <code>startDate</code> and <code>maxExtentDate</code>.</p><p>Since the test operates on all period objects, the test silently ignores any dates that can't be parsed.</p>"+ },+ procuringEntity_referenced: {+ name: "Procuring entities are referenced",+ description:+ "<p>For each procuring entity, there is a referencing object. <i>Example</i>: If there is a party with role 'procuringEntity', it is referenced by at least one tender's <code>procuringEntity</code> field.</p><p>Since the test operates on all organization objects, the test silently ignores any party whose <code>id</code> field is missing, as it cannot be referenced.</p>"+ },+ supplier_referenced: {+ name: "Suppliers are referenced",+ description:+ "<p>For each supplier, there is a referencing object. <i>Example</i>: If there is a party with role 'procuringEntity', it is referenced by at least one one award's <code>suppliers</code> entry.</p><p>Since the test operates on all organization objects, the test silently ignores any party whose <code>id</code> field is missing, as it cannot be referenced.</p>"+ },+ tenderer_referenced: {+ name: "Tenderers are referenced",+ description:+ "<p>For each tenderer, there is a referencing object. <i>Example</i>: If there is a party with role 'tenderer', it is referenced by at least one one tender's <code>tenderer</code> entry.</p><p>Since the test operates on all organization objects, the test silently ignores any party whose <code>id</code> field is missing, as it cannot be referenced.</p>"
}
},
reference: {
The text was updated successfully, but these errors were encountered:
There were old branches to report these checks for individual fields, instead of aggregate.
I think this came up in open-contracting/pelican-frontend#48, but I think open-contracting/pelican-frontend#49 is a better solution (or at least a better thing to try first), i.e. display more metadata in the results table about where the quality issue occurred.
This is preferred, because disaggregated checks would make the automated reports even longer. It also means more checks for analysts to click through to read.
Backend patch:
Frontend patch:
The text was updated successfully, but these errors were encountered: