Standard
CDISC USDM
Reference Rule ID(s)
DDF00046
Conformance Rule ID(s) (if published in CORE)
CORE-000804
CLI Command Used
core validate -s usdm -v 4-0 -dp /path/to/core-input.json -of JSON -o /path/to/core-report.json -p disabled -l error
CORE engine version: 0.16.0.
Rule YAML / relevant executable contract
The cached CORE contract for DDF00046 includes ScheduledActivityInstance and
ScheduledDecisionInstance, filters relation rows to Timing references, and then
runs grouped distinct(parent_id):
Core:
Id: CORE-000804
Version: '1'
Description: A timing must only be specified as being relative to/from a scheduled activity/decision instance that is defined within the same timeline as the timing.
Entities:
Include:
- ScheduledActivityInstance
- ScheduledDecisionInstance
Operations:
- id: $parent_of_scheduled_instance
name: parent_id
operator: distinct
group:
- id
- rel_type
group_aliases:
- id
- rel_type.Timing
Check:
all:
- get_dataset.instanceType is ScheduledActivityInstance or ScheduledDecisionInstance
- get_dataset.rel_type equals reference
- get_dataset.parent_rel is relativeToScheduledInstanceId or relativeFromScheduledInstanceId
- get_dataset.rel_type.Timing equals definition
- parent_id.Timing does not contain $parent_of_scheduled_instance
Minimal test data / precondition
Use a valid USDM schedule timeline containing:
- one
ScheduledDecisionInstance definition in ScheduleTimeline.instances;
- no
Timing.relativeFromScheduledInstanceId or
Timing.relativeToScheduledInstanceId reference to that decision;
- optionally, valid Timing references to a
ScheduledActivityInstance in the
same timeline.
After DDF00046 conditions are applied for the ScheduledDecisionInstance
domain, the evaluation dataset is empty. This is a valid non-applicable subset:
USDM does not require every scheduled decision instance to be referenced by a
Timing.
A direct unit-level reproducer is to extend the existing grouped Distinct
test with a filter that matches zero rows while retaining the expected columns:
data = PandasDataset.from_dict(
{
"parent_id": ["timeline_1"],
"id": ["decision_1"],
"rel_type": ["definition"],
"parent_rel": ["instances"],
}
)
# Apply a condition equivalent to rel_type == "reference", yielding zero rows,
# then execute grouped Distinct over parent_id.
Actual output
The rule is reported as EXECUTION ERROR:
Failed to execute rule operation. Operation: distinct, Target: parent_id,
Domain: ScheduledDecisionInstance, Error: single positional indexer is out-of-bounds
The failure occurs in
BaseOperation._expand_operation_results_in_grouping when it evaluates
operation_col.iloc[0] on the empty post-condition series.
Expected output
DDF00046 should be non-applicable for the empty ScheduledDecisionInstance
reference subset and complete without an execution error or issue. Other
non-empty entity subsets must continue to be evaluated normally.
Suggested fix
Guard the empty series before reading its first value:
def _expand_operation_results_in_grouping(self, grouping_list):
expanded = []
for item in grouping_list:
if item in self.evaluation_dataset.columns:
operation_col = self.evaluation_dataset[item]
if operation_col.empty:
expanded.append(item)
continue
first_val = operation_col.iloc[0]
# existing list/tuple expansion follows
The grouped operation should then return an empty evaluation result.
Regression coverage requested
- grouped
distinct after filtering to zero rows;
- DDF00046 with activity-only Timing references and an unreferenced decision;
- decision-only references;
- mixed activity and decision references;
- valid same-timeline and invalid cross-timeline references.
This report is based on sanitized structural evidence only. No sponsor or
protocol content is included.
Standard
CDISC USDM
Reference Rule ID(s)
DDF00046
Conformance Rule ID(s) (if published in CORE)
CORE-000804
CLI Command Used
CORE engine version:
0.16.0.Rule YAML / relevant executable contract
The cached CORE contract for DDF00046 includes
ScheduledActivityInstanceandScheduledDecisionInstance, filters relation rows to Timing references, and thenruns grouped
distinct(parent_id):Minimal test data / precondition
Use a valid USDM schedule timeline containing:
ScheduledDecisionInstancedefinition inScheduleTimeline.instances;Timing.relativeFromScheduledInstanceIdorTiming.relativeToScheduledInstanceIdreference to that decision;ScheduledActivityInstancein thesame timeline.
After DDF00046 conditions are applied for the
ScheduledDecisionInstancedomain, the evaluation dataset is empty. This is a valid non-applicable subset:
USDM does not require every scheduled decision instance to be referenced by a
Timing.
A direct unit-level reproducer is to extend the existing grouped
Distincttest with a filter that matches zero rows while retaining the expected columns:
Actual output
The rule is reported as
EXECUTION ERROR:The failure occurs in
BaseOperation._expand_operation_results_in_groupingwhen it evaluatesoperation_col.iloc[0]on the empty post-condition series.Expected output
DDF00046 should be non-applicable for the empty ScheduledDecisionInstance
reference subset and complete without an execution error or issue. Other
non-empty entity subsets must continue to be evaluated normally.
Suggested fix
Guard the empty series before reading its first value:
The grouped operation should then return an empty evaluation result.
Regression coverage requested
distinctafter filtering to zero rows;This report is based on sanitized structural evidence only. No sponsor or
protocol content is included.