Open ASL-rmarshall opened 5 days ago
Test data is available in Excel format in the unitTesting SharePoint under USDM > DDF00074. There are two negative test cases and one positive test case. It is only the negative test case 02 (where there is no StudyIntervention dataset) that fails as described above.
Links to related JIRA Tickets
Rule Information
Describe the bug This rule is checking whether the number of records describing study interventions (from the StudyIntervention dataset) corresponds with the value of the interventionModel code or decode. The rule works correctly when there is a StudyIntervention dataset, but it fails with the following error when there is no StudyIntervention dataset:
The error occurs because the rule includes an operation that references the "STUDYINTERVENTION" domain but a corresponding dataset does not exist, which would be possible if the original USDM JSON file did not contain any instances of the
StudyIntervention
class.The following is a stacktrace for the error:
It shows that validation is falling over when a
None
is passed intoget_dataset_name_from_details
, which expects a dictionary.Error returned from Rule Engine
Expected behavior Instead of failing with an error, the validation should just skip any operation that references a domain that does not exist. This could be achieved by inserting the following between the assignment of
domain_details
and the call toget_dataset_name_from_details
in_execute_operation
(i.e., at line 329 inrule_processor.py
):In this case, if the referenced domain does not exist, the call to the operation just returns the original dataset (without the operation-specific
id
variable). The presence/absence of the result of the operation can then be checked in the rule condition (as shown in rule DDF00074 in the production environment or the attached Request.txt file).