-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Links to related JIRA Tickets
Rule Information
- Standard: USDM
- Rule ID: DDF00085
- Rule Description: Narrative content text is expected to be HTML formatted.
Describe the bug
When the attribute/variable specified in the name parameter for the get_xhtml_errors operation contains missing values (NULL, None, NaN, etc.), the following error occurs and the dataset is skipped:
AttributeError: 'NoneType' object has no attribute 'strip'
The error occurs because each input value is stripped before its presence is verified:
cdisc-rules-engine/cdisc_rules_engine/operations/get_xhtml_errors.py
Lines 72 to 79 in 06b354f
| def _ensure_dataset_is_valid_xhtml(self, value: str) -> list[str]: | |
| value: str = value.strip() | |
| if not value: | |
| return [] | |
| text = value.strip() | |
| if not text: | |
| return [] |
The stripping on line 73 is redundant (it's done again on line 77) and should be removed.
Error returned from Rule Engine
{
"NarrativeContent": [
{
"executionStatus": "skipped",
"dataset": "NarrativeContent.xpt",
"domain": "",
"variables": [],
"message": "rule evaluation skipped - missing metadata",
"errors": [
{
"dataset": "NarrativeContent.xpt",
"error": "Missing field during execution",
"message": "Missing field during execution, rule may not be applicable- unable to process dataset"
}
]
}
]
}Expected behavior
The operation should not fail when there are missing values in the in specified input variable/attribute.
Request.json including test data
Request.json