From 0e2af265763a62518a6af1a58b20b00859371af2 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 16 Feb 2026 16:32:03 -0500 Subject: [PATCH 01/17] fixes --- README.md | 29 +++++++++++++++++++ .../dataset_builder_factory.py | 1 - cdisc_rules_engine/enums/execution_status.py | 6 ++-- cdisc_rules_engine/enums/rule_types.py | 3 -- cdisc_rules_engine/rules_engine.py | 23 --------------- tests/conftest.py | 22 -------------- 6 files changed, 32 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 0c48aec8a..a73c34714 100644 --- a/README.md +++ b/README.md @@ -387,6 +387,35 @@ Update locally stored cache data (An api-key can be provided through the environ To obtain an api key, please follow the instructions found here: . Please note it can take up to an hour after sign up to have an api key issued +This will show the list of cache update options. + +``` + -c, --cache-path TEXT Relative path to cache. Optional. Only required if the cache has been + moved from its default location. + --apikey TEXT CDISC Library api key. + Can also be provided as an environment + variable CDISC_LIBRARY_API_KEY + -crd, --custom-rules-directory TEXT Relative path to directory containing local + rules in yaml or JSON formats to be added + to the cache + -cr, --custom-rule TEXT Relative path to rule file in yaml or JSON + formats to be added to the cache. + Can be specified multiple times. + -rcr, --remove-custom-rules TEXT Remove rules from the cache. Can be a single + rule ID, a comma-separated list of IDs, + or 'ALL' to remove all custom rules. + -ucr, --update-custom-rule TEXT Relative path to rule file in yaml or JSON + formats. Rule will be updated in cache + with this file. + -cs, --custom-standard TEXT Relative path to JSON file containing custom + standard details. Will update the standard + if it already exists. + -cse, --custom-standard-encoding TEXT Encoding for custom standard details. + -rcs, --remove-custom-standard TEXT Removes a custom standard and version from + the cache. Can be specified multiple times. + --help Show this message and exit. +``` + ##### Custom Standards and Rules ###### Custom Rules Management diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index 69fb46f8e..0d63554f0 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -73,7 +73,6 @@ class DatasetBuilderFactory(FactoryInterface): RuleTypes.DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE.value: DomainListWithDefineDatasetBuilder, RuleTypes.DEFINE_ITEM_METADATA_CHECK.value: DefineVariablesDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE.value: VariablesMetadataWithDefineDatasetBuilder, - RuleTypes.DATASET_CONTENTS_CHECK_AGAINST_DEFINE_AND_LIBRARY.value: ContentsDatasetBuilder, RuleTypes.VALUE_LEVEL_METADATA_CHECK_AGAINST_DEFINE.value: ContentsDatasetBuilder, RuleTypes.DEFINE_ITEM_GROUP_METADATA_CHECK.value: DefineItemGroupDatasetBuilder, RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VARIABLE.value: ContentsDefineVariablesDatasetBuilder, diff --git a/cdisc_rules_engine/enums/execution_status.py b/cdisc_rules_engine/enums/execution_status.py index ab8c1740e..60f9d3a0d 100644 --- a/cdisc_rules_engine/enums/execution_status.py +++ b/cdisc_rules_engine/enums/execution_status.py @@ -4,9 +4,9 @@ class ExecutionStatus(BaseEnum): SUCCESS = "success" SKIPPED = "skipped" - EXECUTION_ERROR = "execution_error" - ISSUE_REPORTED = "issue_reported" - UNKNOWN_STATUS = "unknown_status" + EXECUTION_ERROR = "execution error" + ISSUE_REPORTED = "issue reported" + UNKNOWN_STATUS = "unknown status" class SkippedReason(BaseEnum): diff --git a/cdisc_rules_engine/enums/rule_types.py b/cdisc_rules_engine/enums/rule_types.py index 6f25d4366..a6be4d7df 100644 --- a/cdisc_rules_engine/enums/rule_types.py +++ b/cdisc_rules_engine/enums/rule_types.py @@ -2,9 +2,6 @@ class RuleTypes(BaseEnum): - DATASET_CONTENTS_CHECK_AGAINST_DEFINE_AND_LIBRARY = ( - "Dataset Contents Check against Define XML and Library Metadata" - ) DATASET_CONTENTS_CHECK_AGAINST_DEFINE = "Dataset Contents Check against Define XML" DATASET_METADATA_CHECK = "Dataset Metadata Check" DATASET_METADATA_CHECK_AGAINST_DEFINE = "Dataset Metadata Check against Define XML" diff --git a/cdisc_rules_engine/rules_engine.py b/cdisc_rules_engine/rules_engine.py index 05666741d..1194db5f9 100644 --- a/cdisc_rules_engine/rules_engine.py +++ b/cdisc_rules_engine/rules_engine.py @@ -364,29 +364,6 @@ def validate_rule( ) kwargs["value_level_metadata"] = value_level_metadata - elif ( - rule.get("rule_type") - == RuleTypes.DATASET_CONTENTS_CHECK_AGAINST_DEFINE_AND_LIBRARY.value - ): - library_metadata: dict = self.library_metadata.variables_metadata.get( - dataset_metadata.domain, {} - ) - define_metadata: List[dict] = builder.get_define_xml_variables_metadata() - targets: List[str] = ( - self.data_processor.filter_dataset_columns_by_metadata_and_rule( - dataset.columns.tolist(), define_metadata, library_metadata, rule - ) - ) - rule_copy = deepcopy(rule) - updated_conditions = RuleProcessor.duplicate_conditions_for_all_targets( - rule_copy["conditions"], targets - ) - rule_copy["conditions"].set_conditions(updated_conditions) - # When duplicating conditions, - # rule should be copied to prevent updates to concurrent rule executions - return self.execute_rule( - rule_copy, dataset, datasets, dataset_metadata, **kwargs - ) elif rule.get("rule_type") == RuleTypes.JSONATA.value: return JSONataProcessor.execute_jsonata_rule( rule, dataset, self.jsonata_custom_functions diff --git a/tests/conftest.py b/tests/conftest.py index 5563eb1a1..6a2b53bb9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1059,28 +1059,6 @@ def mock_validation_results() -> list[RuleValidationResult]: ] -@pytest.fixture(scope="function") -def rule_check_dataset_against_library_and_define() -> dict: - return { - "core_id": "MockRule", - "standards": [{"Name": "SDTMIG", "Version": "3.3"}], - "classes": {"Include": [ALL_KEYWORD]}, - "domains": {"Include": ["AE"]}, - "rule_type": "Dataset Contents Check against Define XML and Library Metadata", - "variable_origin_type": "Collected", - "variable_core_status": "Perm", - "conditions": ConditionCompositeFactory.get_condition_composite( - {"any": [{"name": "get_dataset", "operator": "empty"}]} - ), - "actions": [ - { - "name": "generate_dataset_error_objects", - "params": {"message": "Variable metadata is wrong."}, - } - ], - } - - @pytest.fixture(scope="function") def rule_check_dataset_contents_against_library_metadata() -> dict: return { From d38d932fb1d7b5e39600418a5f71d38244a9dab7 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 16 Feb 2026 16:42:31 -0500 Subject: [PATCH 02/17] remove test --- tests/unit/test_rules_engine.py | 118 -------------------------------- 1 file changed, 118 deletions(-) diff --git a/tests/unit/test_rules_engine.py b/tests/unit/test_rules_engine.py index a068ac9a7..50b7cb7c3 100644 --- a/tests/unit/test_rules_engine.py +++ b/tests/unit/test_rules_engine.py @@ -2102,124 +2102,6 @@ def test_validate_additional_columns( ] -@patch( - "cdisc_rules_engine.services.data_services.LocalDataService.get_define_xml_contents" -) -@patch("cdisc_rules_engine.services.data_services.LocalDataService.get_dataset") -@patch("cdisc_rules_engine.services.data_services.LocalDataService.get_dataset_class") -def test_validate_dataset_contents_against_define_and_library_variable_metadata( - mock_get_dataset_class: MagicMock, - mock_get_dataset: MagicMock, - mock_get_define_xml_contents: MagicMock, - rule_check_dataset_against_library_and_define: dict, -): - """ - Test for validating dataset contents against define and library metadata. - Example rule: - Library Variable Core Status = Permissible AND - Define.xml Variable Origin Type = Collected AND - Variable value is null - - What the test does is: - 1. Saves library metadata to in-memory cache and uses it. - (The engine pulls variable metadata from cache). - 2. Mocks Define XML download to return test file contents. - 3. Mocks dataset download to return a DataFrame with invalid columns. - 4. Asserts that the errors have been reported properly. - """ - # use in-memory cache - os.environ.pop("CACHE_TYPE", None) - - # save library metadata to cache - variables_metadata: dict = { - "AE": { - "AELNKID": { - "core": "Exp", - }, - "AESEV": { - "core": "Perm", - }, - "AESER": { - "core": "Perm", - }, - } - } - cache = InMemoryCacheService() - standard: str = "sdtmig" - standard_version: str = "3-1-2" - library_metadata = LibraryMetadataContainer(variables_metadata=variables_metadata) - - # mock define xml download to return test file contents - test_define_path: str = ( - f"{os.path.dirname(__file__)}/../resources/test_defineV21-SDTM.xml" - ) - with open(test_define_path, "rb") as file: - contents: bytes = file.read() - mock_get_define_xml_contents.return_value = contents - - # mock dataset download to return DataFrame with empty values - mock_get_dataset.return_value = PandasDataset( - pd.DataFrame.from_dict( - { - "AELNKID": ["test", None, "alex"], - "AESEV": [None, None, "test"], - "AESER": ["1", "2", None], - } - ) - ) - mock_get_dataset_class.return_value = "EVENTS" - - # run the validation and check result - rules_engine = RulesEngine( - cache=cache, - standard=standard, - standard_version=standard_version, - library_metadata=library_metadata, - ) - dataset_metadata = SDTMDatasetMetadata( - name="AE", - first_record={"DOMAIN": "AE"}, - filename="filename", - full_path="study_id/data_bundle_id/filename", - ) - validation_result: List[dict] = rules_engine.validate_single_dataset( - rule=rule_check_dataset_against_library_and_define, - datasets=[dataset_metadata], - dataset_metadata=dataset_metadata, - ) - assert validation_result == [ - { - "executionStatus": ExecutionStatus.ISSUE_REPORTED.value, - "dataset": "filename", - "domain": "AE", - "variables": [ - "AESEV", - "AESER", - ], # AELNKID must not be included since its core status is not "Perm" - "message": RuleProcessor.extract_message_from_rule( - rule_check_dataset_against_library_and_define - ), - "errors": [ - { - "dataset": "filename", - "row": 1, - "value": {"AESEV": None, "AESER": "1"}, - }, - { - "dataset": "filename", - "row": 2, - "value": {"AESEV": None, "AESER": "2"}, - }, - { - "dataset": "filename", - "row": 3, - "value": {"AESEV": "test", "AESER": None}, - }, - ], - } - ] - - @patch("cdisc_rules_engine.services.data_services.LocalDataService.get_dataset") @patch("cdisc_rules_engine.services.data_services.LocalDataService.get_dataset_class") def test_validate_single_dataset_operation_dataset_larger_than_target_dataset( From e910858b3d3de1f2c0bab2b8bc51bf6a323a3d4f Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 19 Feb 2026 16:34:40 -0500 Subject: [PATCH 03/17] update line --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a73c34714..c10383256 100644 --- a/README.md +++ b/README.md @@ -387,7 +387,7 @@ Update locally stored cache data (An api-key can be provided through the environ To obtain an api key, please follow the instructions found here: . Please note it can take up to an hour after sign up to have an api key issued -This will show the list of cache update options. +The update-cache command options are: ``` -c, --cache-path TEXT Relative path to cache. Optional. Only required if the cache has been From 5302bb7930b5e17793b9fdcf3c2f56a4fcc886ec Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 23 Feb 2026 07:51:10 -0500 Subject: [PATCH 04/17] docs --- resources/schema/rule/Rule_Type.json | 4 ---- resources/schema/rule/Rule_Type.md | 2 -- 2 files changed, 6 deletions(-) diff --git a/resources/schema/rule/Rule_Type.json b/resources/schema/rule/Rule_Type.json index 722efd25b..19377a14a 100644 --- a/resources/schema/rule/Rule_Type.json +++ b/resources/schema/rule/Rule_Type.json @@ -2,10 +2,6 @@ "$id": "Rule_Type.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ - { - "const": "Dataset Contents Check against Define XML and Library Metadata", - "title": "Content data at record level, define xml metadata at variable level, and library metadata at variable level" - }, { "const": "Dataset Contents Check against Define XML", "title": "Content data at record level, dataset metadata at dataset level, and define xml metadata at dataset level" diff --git a/resources/schema/rule/Rule_Type.md b/resources/schema/rule/Rule_Type.md index bbf184d8f..138e1de44 100644 --- a/resources/schema/rule/Rule_Type.md +++ b/resources/schema/rule/Rule_Type.md @@ -1,5 +1,3 @@ -## Dataset Contents Check against Define XML and Library Metadata - #### Columns Columns are the columns within the original dataset From f3c839f40b13b6b9ccfc4bc7f2e0c052c35fe31f Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 26 Feb 2026 13:42:02 -0500 Subject: [PATCH 05/17] spring cleaning --- .../check_operators/dataframe_operators.py | 57 -- .../contents_dataset_builder.py | 33 -- .../dataset_builder_factory.py | 11 +- ...es_metadata_with_define_dataset_builder.py | 1 + cdisc_rules_engine/enums/rule_types.py | 3 - cdisc_rules_engine/rules_engine.py | 26 +- resources/schema/rule/Operator.json | 34 -- resources/schema/rule/Operator.md | 28 - resources/schema/rule/Rule_Type.md | 511 ++++++++++-------- tests/conftest.py | 36 -- .../test_codelist_checks.py | 108 ---- .../test_metadata_checks.py | 49 -- .../test_contents_dataset_builder.py | 389 ------------- 13 files changed, 305 insertions(+), 981 deletions(-) delete mode 100644 cdisc_rules_engine/dataset_builders/contents_dataset_builder.py delete mode 100644 tests/unit/test_check_operators/test_codelist_checks.py delete mode 100644 tests/unit/test_check_operators/test_metadata_checks.py delete mode 100644 tests/unit/test_dataset_builders/test_contents_dataset_builder.py diff --git a/cdisc_rules_engine/check_operators/dataframe_operators.py b/cdisc_rules_engine/check_operators/dataframe_operators.py index 7c98f1942..b4ea07083 100644 --- a/cdisc_rules_engine/check_operators/dataframe_operators.py +++ b/cdisc_rules_engine/check_operators/dataframe_operators.py @@ -1366,48 +1366,6 @@ def is_ordered_set(self, other_value): def is_not_ordered_set(self, other_value): return not self.is_ordered_set(other_value) - @log_operator_execution - @type_operator(FIELD_DATAFRAME) - def non_conformant_value_data_type(self, other_value): - results = False - for vlm in self.value_level_metadata: - results |= self.value.apply( - lambda row: vlm["filter"](row) and not vlm["type_check"](row), axis=1 - ) - return self.value.convert_to_series(results.values) - - @log_operator_execution - @type_operator(FIELD_DATAFRAME) - def non_conformant_value_length(self, other_value): - results = False - for vlm in self.value_level_metadata: - results |= self.value.apply( - lambda row: vlm["filter"](row) and not vlm["length_check"](row), axis=1 - ) - return self.value.convert_to_series(results) - - @log_operator_execution - @type_operator(FIELD_DATAFRAME) - def conformant_value_data_type(self, other_value): - results = False - for vlm in self.value_level_metadata: - results |= self.value.apply( - lambda row: vlm["filter"](row) and vlm["type_check"](row), - axis=1, - meta=pd.Series([True, False], dtype=bool), - ).fillna(False) - return self.value.convert_to_series(results) - - @log_operator_execution - @type_operator(FIELD_DATAFRAME) - def conformant_value_length(self, other_value): - results = False - for vlm in self.value_level_metadata: - results |= self.value.apply( - lambda row: vlm["filter"](row) and vlm["length_check"](row), axis=1 - ) - return self.value.convert_to_series(results) - @log_operator_execution @type_operator(FIELD_DATAFRAME) def has_next_corresponding_record(self, other_value: dict): @@ -1529,21 +1487,6 @@ def check_inconsistency(row): return df.apply(check_inconsistency, axis=1) - @log_operator_execution - @type_operator(FIELD_DATAFRAME) - def references_correct_codelist(self, other_value: dict): - target = other_value.get("target") - comparator = other_value.get("comparator") - result = self.value.apply( - lambda row: self.valid_codelist_reference(row[target], row[comparator]), - axis=1, - ) - return result - - @type_operator(FIELD_DATAFRAME) - def does_not_reference_correct_codelist(self, other_value: dict): - return ~self.references_correct_codelist(other_value) - def next_column_exists_and_previous_is_null(self, row) -> bool: row.reset_index(drop=True, inplace=True) for index in row[ diff --git a/cdisc_rules_engine/dataset_builders/contents_dataset_builder.py b/cdisc_rules_engine/dataset_builders/contents_dataset_builder.py deleted file mode 100644 index 8abec8ed0..000000000 --- a/cdisc_rules_engine/dataset_builders/contents_dataset_builder.py +++ /dev/null @@ -1,33 +0,0 @@ -from cdisc_rules_engine.dataset_builders.base_dataset_builder import BaseDatasetBuilder -from cdisc_rules_engine.utilities.utils import ( - get_corresponding_datasets, -) - - -class ContentsDatasetBuilder(BaseDatasetBuilder): - def build(self, **kwargs): - """ - Returns the contents of a file as a dataframe for evaluation. - """ - return self.data_service.get_dataset(dataset_name=self.dataset_path) - - def build_split_datasets(self, dataset_name, **kwargs): - """ - Returns the contents of a file as a dataframe for evaluation. - """ - return self.data_service.get_dataset( - dataset_name=dataset_name, datasets=self.datasets - ) - - def get_dataset(self, **kwargs): - dataset = super().get_dataset(**kwargs) - length = sum( - [ - dataset.record_count - for dataset in get_corresponding_datasets( - self.datasets, self.dataset_metadata - ) - ] - ) - dataset.length = length - return dataset diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index 0d63554f0..3462b1d6b 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -8,9 +8,6 @@ JSONataDatasetBuilder, ) from cdisc_rules_engine.interfaces import FactoryInterface -from cdisc_rules_engine.dataset_builders.contents_dataset_builder import ( - ContentsDatasetBuilder, -) from cdisc_rules_engine.dataset_builders.contents_define_dataset_builder import ( ContentsDefineDatasetBuilder, ) @@ -73,7 +70,6 @@ class DatasetBuilderFactory(FactoryInterface): RuleTypes.DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE.value: DomainListWithDefineDatasetBuilder, RuleTypes.DEFINE_ITEM_METADATA_CHECK.value: DefineVariablesDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE.value: VariablesMetadataWithDefineDatasetBuilder, - RuleTypes.VALUE_LEVEL_METADATA_CHECK_AGAINST_DEFINE.value: ContentsDatasetBuilder, RuleTypes.DEFINE_ITEM_GROUP_METADATA_CHECK.value: DefineItemGroupDatasetBuilder, RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VARIABLE.value: ContentsDefineVariablesDatasetBuilder, RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VLM.value: ContentsDefineVLMDatasetBuilder, @@ -105,7 +101,11 @@ def get_service( """ Get instance of dataset builder by name. """ - builder = self._builders_map.get(name, ContentsDatasetBuilder)( + builder_class = self._builders_map.get(name) + if builder_class is None: + raise ValueError(f"Invalid Rule Type Entered: '{name}'") + + return builder_class( kwargs.get("rule"), kwargs.get("data_service"), kwargs.get("cache_service"), @@ -120,4 +120,3 @@ def get_service( kwargs.get("standard_substandard", None), kwargs.get("library_metadata"), ) - return builder diff --git a/cdisc_rules_engine/dataset_builders/variables_metadata_with_define_dataset_builder.py b/cdisc_rules_engine/dataset_builders/variables_metadata_with_define_dataset_builder.py index 7d1d1dea7..2a62e0575 100644 --- a/cdisc_rules_engine/dataset_builders/variables_metadata_with_define_dataset_builder.py +++ b/cdisc_rules_engine/dataset_builders/variables_metadata_with_define_dataset_builder.py @@ -29,6 +29,7 @@ def build(self): define_variable_codelist_coded_values, define_variable_codelist_coded_codes, define_variable_mandatory + define_variable_has_comment """ # get Define XML metadata for domain and use it as a rule comparator variable_metadata: List[dict] = self.get_define_xml_variables_metadata() diff --git a/cdisc_rules_engine/enums/rule_types.py b/cdisc_rules_engine/enums/rule_types.py index a6be4d7df..c26db8408 100644 --- a/cdisc_rules_engine/enums/rule_types.py +++ b/cdisc_rules_engine/enums/rule_types.py @@ -10,9 +10,6 @@ class RuleTypes(BaseEnum): DOMAIN_PRESENCE_CHECK = "Domain Presence Check" DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE = "Domain Presence Check against Define XML" JSONATA = "JSONata" - VALUE_LEVEL_METADATA_CHECK_AGAINST_DEFINE = ( - "Value Level Metadata Check against Define XML" - ) VARIABLE_METADATA_CHECK = "Variable Metadata Check" VARIABLE_METADATA_CHECK_AGAINST_DEFINE = ( "Variable Metadata Check against Define XML" diff --git a/cdisc_rules_engine/rules_engine.py b/cdisc_rules_engine/rules_engine.py index 3e9eb5a4b..2d69de749 100644 --- a/cdisc_rules_engine/rules_engine.py +++ b/cdisc_rules_engine/rules_engine.py @@ -344,31 +344,7 @@ def validate_rule( kwargs["codelist_term_maps"] = ( self.library_metadata.get_all_ct_package_metadata() ) - if rule.get("rule_type") == RuleTypes.DEFINE_ITEM_METADATA_CHECK.value: - if self.library_metadata: - kwargs["variable_codelist_map"] = ( - self.library_metadata.variable_codelist_map - ) - kwargs["codelist_term_maps"] = ( - self.library_metadata.get_all_ct_package_metadata() - ) - elif ( - rule.get("rule_type") - == RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE.value - ): - self.rule_processor.add_comparator_to_rule_conditions( - rule, comparator=None, target_prefix="define_" - ) - elif ( - rule.get("rule_type") - == RuleTypes.VALUE_LEVEL_METADATA_CHECK_AGAINST_DEFINE.value - ): - value_level_metadata: List[dict] = self.get_define_xml_value_level_metadata( - dataset_metadata.full_path, dataset_metadata.unsplit_name - ) - kwargs["value_level_metadata"] = value_level_metadata - - elif rule.get("rule_type") == RuleTypes.JSONATA.value: + if rule.get("rule_type") == RuleTypes.JSONATA.value: return JSONataProcessor.execute_jsonata_rule( rule, dataset, self.jsonata_custom_functions ) diff --git a/resources/schema/rule/Operator.json b/resources/schema/rule/Operator.json index 6abac2bfd..5c2ec10c5 100644 --- a/resources/schema/rule/Operator.json +++ b/resources/schema/rule/Operator.json @@ -13,16 +13,6 @@ "required": ["operator"], "type": "object" }, - { - "properties": { "operator": { "const": "conformant_value_data_type" } }, - "required": ["operator"], - "type": "object" - }, - { - "properties": { "operator": { "const": "conformant_value_length" } }, - "required": ["operator"], - "type": "object" - }, { "properties": { "operator": { "const": "contains" } }, "required": ["operator", "value"], @@ -94,13 +84,6 @@ "required": ["operator", "ordering", "value", "within"], "type": "object" }, - { - "properties": { - "operator": { "const": "does_not_reference_correct_codelist" } - }, - "required": ["operator", "value"], - "type": "object" - }, { "properties": { "operator": { "const": "empty" } }, "required": ["operator"], @@ -299,18 +282,6 @@ "required": ["operator", "value"], "type": "object" }, - { - "properties": { - "operator": { "const": "non_conformant_value_data_type" } - }, - "required": ["operator"], - "type": "object" - }, - { - "properties": { "operator": { "const": "non_conformant_value_length" } }, - "required": ["operator"], - "type": "object" - }, { "properties": { "operator": { "const": "non_empty" } }, "required": ["operator"], @@ -407,11 +378,6 @@ "required": ["operator", "within"], "type": "object" }, - { - "properties": { "operator": { "const": "references_correct_codelist" } }, - "required": ["operator", "value"], - "type": "object" - }, { "properties": { "operator": { "const": "shares_at_least_one_element_with" } diff --git a/resources/schema/rule/Operator.md b/resources/schema/rule/Operator.md index f4659ffb3..0f0eebf3b 100644 --- a/resources/schema/rule/Operator.md +++ b/resources/schema/rule/Operator.md @@ -1110,31 +1110,3 @@ Complement of `target_is_sorted_by` ## Define.XML Validation operators specifically for checking compliance with Define.XML metadata specifications, including data type conformance, length validation, and codelist references. - -### conformant_value_data_type - -Value Level Metadata Check against Define XML - -True if the types in the row match the VLM types specified in the define.xml - -### non_conformant_value_data_type - -Complement of `conformant_value_data_type` - -### conformant_value_length - -Value Level Metadata Check against Define XML - -True if the lengths in the row match the VLM lengths specified in the define.xml - -### non_conformant_value_length - -Complement of `conformant_value_length` - -### references_correct_codelist - -True if the codelist named within `value` is a valid codelist for the variable named within `name` in the define.xml. - -### does_not_reference_correct_codelist - -Complement of `references_correct_codelist` diff --git a/resources/schema/rule/Rule_Type.md b/resources/schema/rule/Rule_Type.md index 138e1de44..60eca62ee 100644 --- a/resources/schema/rule/Rule_Type.md +++ b/resources/schema/rule/Rule_Type.md @@ -1,10 +1,64 @@ +# Rule Types + +Rule Types determine how the engine builds the dataset that rule conditions are evaluated against. Each Rule Type produces a different dataset structure by controlling which data sources are included (submission contents, Define-XML, CDISC Library, or combinations thereof) and at what grain (record, variable, dataset, or value level) you want to check data. Selecting the correct Rule Type is essential — it determines which columns are available to reference in rule conditions. + +## Rule Type Descriptions + +### Columns + +The columns made by the rule type that can have check logic performed on. + +### Rule Macro + +The combination of data in each rule type. + +# Rule Type Groupings + +| Group | Rule Type | +| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| **Dataset** | [Record Data](#record-data) | +| | [Dataset Metadata Check](#dataset-metadata-check) | +| | [Dataset Metadata Check against Define XML](#dataset-metadata-check-against-define-xml) | +| | [Dataset Contents Check against Define XML](#dataset-contents-check-against-define-xml) | +| | [Value Level Metadata Check against Define XML](#value-level-metadata-check-against-define-xml) | +| **Domain** | [Domain Presence Check](#domain-presence-check) | +| | [Domain Presence Check against Define XML](#domain-presence-check-against-define-xml) | +| **Define XML** | [Define Item Group Metadata Check](#define-item-group-metadata-check) | +| | [Define Item Metadata Check](#define-item-metadata-check) | +| | [Define Item Metadata Check against Library Metadata](#define-item-metadata-check-against-library-metadata) | +| **Value Check** | [Value Check with Dataset Metadata](#value-check-with-dataset-metadata) | +| | [Value Check with Variable Metadata](#value-check-with-variable-metadata) | +| | [Value Check against Define XML Variable](#value-check-against-define-xml-variable) | +| | [Value Check against Define XML VLM](#value-check-against-define-xml-vlm) | +| **Variable Metadata** | [Variable Metadata Check](#variable-metadata-check) | +| | [Variable Metadata Check against Define XML](#variable-metadata-check-against-define-xml) | +| | [Variable Metadata Check against Library Metadata](#variable-metadata-check-against-library-metadata) | +| | [Variables Metadata Check against Define XML and Library Metadata](#variables-metadata-check-against-define-xml-and-library-metadata) | +| **JSON** | [JSONata](#jsonata) | +| | [JSON Schema Check](#json-schema-check) | + +# Dataset Rule Types + +## Record Data + #### Columns Columns are the columns within the original dataset #### Rule Macro -Attach define xml metadata at variable level and library metadata at variable level +Checks record-level data values sourced directly from submission dataset contents. + +#### Example + +```yaml +all: + - name: --SCAT + operator: non_empty + - name: --SCAT + operator: equal_to + value: --CAT +``` ## Dataset Metadata Check @@ -15,6 +69,10 @@ Attach define xml metadata at variable level and library metadata at variable le - `dataset_name` - `dataset_size` +#### Rule Macro + +Pairs dataset metadata sourced from the submission contents. + #### Example ```yaml @@ -23,28 +81,6 @@ Attach define xml metadata at variable level and library metadata at variable le value: 6 ``` -## Dataset Contents Check against Define XML - -#### Columns - -Columns are the columns within the original dataset along with the following columns: - -- `dataset_label` -- `dataset_location` -- `dataset_name` -- `dataset_size` -- `dataset_domain` -- `define_dataset_class` -- `define_dataset_domain` -- `define_dataset_has_no_data` -- `define_dataset_is_non_standard` -- `define_dataset_key_sequence` -- `define_dataset_label` -- `define_dataset_location` -- `define_dataset_name` -- `define_dataset_structure` -- `define_dataset_variables` - ## Dataset Metadata Check against Define XML Returns a dataset where each dataset is a row in the new dataset. The define xml dataset metadata is attached to each row. @@ -70,7 +106,7 @@ Returns a dataset where each dataset is a row in the new dataset. The define xml #### Rule Macro -Allows comparing content metadata to define xml metadata of the same name. +Allows comparing dataset metadata against define xml dataset metadata. #### Example @@ -91,10 +127,17 @@ any: operator: empty ``` -## Define Item Group Metadata Check +## Dataset Contents Check against Define XML #### Columns +Columns are the columns within the original dataset along with the following columns: + +- `dataset_label` +- `dataset_location` +- `dataset_name` +- `dataset_size` +- `dataset_domain` - `define_dataset_class` - `define_dataset_domain` - `define_dataset_has_no_data` @@ -106,63 +149,36 @@ any: - `define_dataset_structure` - `define_dataset_variables` -## Define Item Metadata Check - -#### Columns - -- `define_variable_name` -- `define_variable_label` -- `define_variable_data_type` -- `define_variable_role` -- `define_variable_size` -- `define_variable_ccode` -- `define_variable_format` -- `define_variable_allowed_terms` -- `define_variable_origin_type` -- `define_variable_is_collected` -- `define_variable_has_no_data` -- `define_variable_order_number` -- `define_variable_has_codelist` -- `define_variable_codelist_coded_values` -- `define_variable_codelist_coded_values` -- `define_variable_has_comment` - #### Rule Macro -Attach variable codelist and codelist terms +Pairs record-level data values from the submission datasets with dataset metadata and Define-XML dataset-level (ItemGroup) metadata broadcast across every row. Each row represents one record from the original dataset, preserving all original columns, with the dataset's metadata and Define-XML dataset metadata repeated on each row. -## Define Item Metadata Check against Library Metadata +# Variable Metadata Rule Types + +## Variable Metadata Check #### Columns -- `define_variable_name` -- `define_variable_label` -- `define_variable_data_type` -- `define_variable_role` -- `define_variable_size` -- `define_variable_ccode` -- `define_variable_format` -- `define_variable_allowed_terms` -- `define_variable_origin_type` -- `define_variable_is_collected` -- `define_variable_has_no_data` -- `define_variable_order_number` -- `define_variable_has_codelist` -- `define_variable_codelist_coded_values` -- `define_variable_codelist_coded_codes` -- `define_variable_mandatory` -- `define_variable_has_comment` -- `library_variable_name` -- `library_variable_order_number` -- `library_variable_label` -- `library_variable_data_type` -- `library_variable_role` -- `library_variable_core` -- `library_variable_ccode` +- `variable_name` +- `variable_order_number` +- `variable_label` +- `variable_size` +- `variable_data_type` +- `variable_format` #### Rule Macro -Attach variable codelist and codelist terms +Checks variable-level metadata sourced from the submission dataset contents. + +#### Example + +```yaml +- name: variable_label + operator: longer_than + value: 40 +``` + +# Domain Rule Types ## Domain Presence Check @@ -174,6 +190,10 @@ Single row contains a column for each domain and the value of that column is the | ------ | ------ | | ae.xpt | ec.xpt | +#### Rule Macro + +Checks which dataset files are physically present in the submission contents. Each column represents one domain that exists in the submission, holding the filename as its value. + #### Example ```yaml @@ -203,6 +223,10 @@ One row per dataset defined in Define-XML: - `define_dataset_key_sequence` - `define_dataset_variables` +#### Rule Macro + +Reconciles dataset file presence in the submission against Define-XML dataset declarations. Each row represents one dataset defined in Define-XML, with the corresponding submission filename joined if the file exists. + #### Example Check if SE domain is defined in Define-XML without HasNoData="Yes" but the dataset file doesn't exist: @@ -219,129 +243,85 @@ all: operator: not_exists ``` -## JSONata - -Apply a JSONata query to a JSON file. [JSONata documentation](https://docs.jsonata.org) - -### Example - -#### Rule - -```yaml -Check: | - **.$filter($, $myutils.equals).{"row":_path, "A":A, "B":B} -Core: - Id: JSONATA Test - Status: Draft -Outcome: - Message: "A equals B" - Output Variables: - - row - - A - - B -Rule Type: JSONata -Scope: - Entities: - Include: - - ALL -Sensitivity: Record -``` - -#### Custom user function contained in external file "equals.jsonata" - -\* Note that in the CLI, you can pass a variable name and directory of such files using `-jcf` or `--jsonata-custom-functions`. The engine's built-in JSONata functions are accessible from the `$utils` variable (see [JSONata Functions](JSONata_Functions.md)). For example to load two more directories containing functions into `$myutils` and `$yourutils`, add the options: -`-jcf myutils path/to/myutils -jcf yourutils path/to/yourutils` - -```yaml -{ - "equals": function($v){ $v.A=$v.B } -} -``` +# Define XML Rule Types -#### JSON Data - -```json -{ - "A": "same value 1", - "B": "same value 1", - "C": { - "A": "different value 1", - "B": "different value 2", - "C": { "A": "same value 2", "B": "same value 2" } - } -} -``` - -#### Result +## Define Item Group Metadata Check -```json -[ - { - "executionStatus": "success", - "dataset": "", - "domain": "", - "variables": ["A", "B", "row"], - "message": "A equals B", - "errors": [ - { - "value": { "row": "", "A": "same value 1", "B": "same value 1" }, - "dataset": "", - "row": "" - }, - { - "value": { - "row": "/C/C", - "A": "same value 2", - "B": "same value 2" - }, - "dataset": "", - "row": "/C/C" - } - ] - } -] -``` +#### Columns -### Preprocessing +- `define_dataset_class` +- `define_dataset_domain` +- `define_dataset_has_no_data` +- `define_dataset_is_non_standard` +- `define_dataset_key_sequence` +- `define_dataset_label` +- `define_dataset_location` +- `define_dataset_name` +- `define_dataset_structure` +- `define_dataset_variables` -When the JSONata Rule Type is used, the input JSON file will be preprocessed to assign a `_path` attribute to each node in the JSON tree. The syntax for this path value will use the [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901) syntax. This `_path` attribute can be referenced throughout the JSONata query. +#### Rule Macro -### Output Variables and Report column mapping +Checks dataset-level (ItemGroup) metadata sourced from Define-XML. Each row represents one ItemGroup/dataset definition in the Define-XML. -You can use `Outcome.Output Variables` to specify which properties to display from the result JSON. The following result property names will map to the column names in the Excel output report. +## Define Item Metadata Check -Mapping of Result property names to Report Issue Details Column Names: +#### Columns -| JSONata Result Name | JSON report property | Excel Column | -| ------------------- | -------------------- | ------------ | -| dataset | dataset | Dataset | -| row | row | Record | -| SEQ | SEQ | Sequence | -| USUBJID | USUBJID | USUBJID | -| entity | entity | Entity | -| instance_id | instance_id | Instance ID | -| path | path | Path | +- `define_variable_name` +- `define_variable_label` +- `define_variable_data_type` +- `define_variable_role` +- `define_variable_size` +- `define_variable_ccode` +- `define_variable_format` +- `define_variable_allowed_terms` +- `define_variable_origin_type` +- `define_variable_is_collected` +- `define_variable_has_no_data` +- `define_variable_order_number` +- `define_variable_has_codelist` +- `define_variable_codelist_coded_values` +- `define_variable_has_comment` -### Scope +#### Rule Macro -A JSONata rule will always run once for the entire JSON file, regardless of the Scope. The `Entity` determination must come from the rule's JSONata result property. +Checks variable-level metadata sourced from Define-XML with variable codelist and codelist terms. -## Record Data +## Define Item Metadata Check against Library Metadata #### Columns -Columns are the columns within the original dataset +- `define_variable_name` +- `define_variable_label` +- `define_variable_data_type` +- `define_variable_role` +- `define_variable_size` +- `define_variable_ccode` +- `define_variable_format` +- `define_variable_allowed_terms` +- `define_variable_origin_type` +- `define_variable_is_collected` +- `define_variable_has_no_data` +- `define_variable_order_number` +- `define_variable_has_codelist` +- `define_variable_codelist_coded_values` +- `define_variable_codelist_coded_codes` +- `define_variable_mandatory` +- `define_variable_has_comment` +- `library_variable_name` +- `library_variable_order_number` +- `library_variable_label` +- `library_variable_data_type` +- `library_variable_role` +- `library_variable_core` +- `library_variable_ccode` -#### Example +#### Rule Macro -```yaml -all: - - name: --SCAT - operator: non_empty - - name: --SCAT - operator: equal_to - value: --CAT -``` +Checks variable-level metadata, codelists, and codelist terms from Define-XML against the corresponding standard variable definitions from the CDISC Library. + +# Value Check Rule Types ## Value Check with Dataset Metadata @@ -355,6 +335,10 @@ all: - `dataset_name` - `dataset_size` +#### Rule Macro + +Checks individual cell values from submission dataset contents pivoted to a long format, with dataset-level metadata attached to each row. + #### Example ```yaml @@ -381,6 +365,10 @@ all: - `variable_format` - `variable_value_length` +#### Rule Macro + +Checks individual cell values from submission dataset contents pivoted to a long format, with variable-level metadata from the submission dataset attached to each row. + #### Example ```yaml @@ -405,6 +393,10 @@ all: - `define_variable_data_type` - `define_variable_`... +#### Rule Macro + +Checks individual cell values from submission dataset contents pivoted to a long format, with the matching Define-XML variable-level metadata joined to each row. + #### Example ```yaml @@ -418,7 +410,7 @@ all: value: true - name: variable_value operator: is_not_contained_by - value: define_variable_codelist_coded_values` + value: define_variable_codelist_coded_values ``` ## Value Check against Define XML VLM @@ -449,6 +441,10 @@ all: - `length_check` - `variable_value_length` +#### Rule Macro + +Checks individual cell values from submission dataset contents pivoted to a long format, with the matching Define-XML Value Level Metadata (VLM) joined to each row. Only rows where VLM exists for that variable are produced — records without matching VLM are excluded. + #### Example ```yaml @@ -474,17 +470,7 @@ all: value: Yes ``` -## Value Level Metadata Check against Define XML - -#### Columns - -Columns are the columns within the original dataset - -#### Rule Macro - -Attach define xml metadata at value level - -## Variable Metadata Check +## Variable Metadata Check against Define XML #### Columns @@ -493,24 +479,6 @@ Attach define xml metadata at value level - `variable_label` - `variable_size` - `variable_data_type` -- `variable_format` - -#### Example - -```yaml -- name: variable_label - operator: longer_than - value: 40 -``` - -## Variable Metadata Check against Define XML - -#### Columns - -- `variable_name` -- `variable_order_number` -- `variable_label` -- `variable_`... - `define_variable_name` - `define_variable_label` - `define_variable_data_type` @@ -532,7 +500,7 @@ Attach define xml metadata at value level #### Rule Macro -Attach define xml metadata at variable level +Combines variable-level metadata from submission dataset contents against the matching variable definitions in Define-XML. #### Example @@ -561,9 +529,13 @@ Attach define xml metadata at variable level - `library_variable_data_type` - `library_variable_ccode` +#### Rule Macro + +Combines variable-level metadata from submission dataset contents against the corresponding CDISC Library standard variable metadata. + ## Variables Metadata Check against Define XML and Library Metadata -#### Columns: +#### Columns - `variable_name` - `variable_label` @@ -597,9 +569,122 @@ Attach define xml metadata at variable level - `library_variable_ccode` - `variable_has_empty_values` +#### Rule Macro + +Combines variable-level metadata from submission dataset contents against both Define-XML variable metadata and CDISC Library standard variable metadata simultaneously. + +# JSON Rule Types + +## JSONata + +Apply a JSONata query to a JSON file. [JSONata documentation](https://docs.jsonata.org) + +### Example + +#### Rule + +```yaml +Check: | + **.$filter($, $myutils.equals).{"row":_path, "A":A, "B":B} +Core: + Id: JSONATA Test + Status: Draft +Outcome: + Message: "A equals B" + Output Variables: + - row + - A + - B +Rule Type: JSONata +Scope: + Entities: + Include: + - ALL +Sensitivity: Record +``` + +#### Custom user function contained in external file "equals.jsonata" + +\* Note that in the CLI, you can pass a variable name and directory of such files using `-jcf` or `--jsonata-custom-functions`. The engine's built-in JSONata functions are accessible from the `$utils` variable (see [JSONata Functions](JSONata_Functions.md)). For example to load two more directories containing functions into `$myutils` and `$yourutils`, add the options: +`-jcf myutils path/to/myutils -jcf yourutils path/to/yourutils` + +```yaml +{ + "equals": function($v){ $v.A=$v.B } +} +``` + +#### JSON Data + +```json +{ + "A": "same value 1", + "B": "same value 1", + "C": { + "A": "different value 1", + "B": "different value 2", + "C": { "A": "same value 2", "B": "same value 2" } + } +} +``` + +#### Result + +```json +[ + { + "executionStatus": "success", + "dataset": "", + "domain": "", + "variables": ["A", "B", "row"], + "message": "A equals B", + "errors": [ + { + "value": { "row": "", "A": "same value 1", "B": "same value 1" }, + "dataset": "", + "row": "" + }, + { + "value": { + "row": "/C/C", + "A": "same value 2", + "B": "same value 2" + }, + "dataset": "", + "row": "/C/C" + } + ] + } +] +``` + +### Preprocessing + +When the JSONata Rule Type is used, the input JSON file will be preprocessed to assign a `_path` attribute to each node in the JSON tree. The syntax for this path value will use the [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901) syntax. This `_path` attribute can be referenced throughout the JSONata query. + +### Output Variables and Report column mapping + +You can use `Outcome.Output Variables` to specify which properties to display from the result JSON. The following result property names will map to the column names in the Excel output report. + +Mapping of Result property names to Report Issue Details Column Names: + +| JSONata Result Name | JSON report property | Excel Column | +| ------------------- | -------------------- | ------------ | +| dataset | dataset | Dataset | +| row | row | Record | +| SEQ | SEQ | Sequence | +| USUBJID | USUBJID | USUBJID | +| entity | entity | Entity | +| instance_id | instance_id | Instance ID | +| path | path | Path | + +### Scope + +A JSONata rule will always run once for the entire JSON file, regardless of the Scope. The `Entity` determination must come from the rule's JSONata result property. + ## JSON Schema Check -#### Columns: +#### Columns - `json_path` - `error_attribute` diff --git a/tests/conftest.py b/tests/conftest.py index 6a2b53bb9..30bf4d10d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -826,42 +826,6 @@ def define_xml_variable_validation_rule() -> dict: } -@pytest.fixture -def define_xml_value_level_metadata_validation_rule() -> dict: - """ - Rule that validates Define XML variable metadata against dataset metadata. - """ - return { - "core_id": "TEST1", - "severity": "Error", - "standards": [], - "domains": {"Include": [ALL_KEYWORD]}, - "rule_type": RuleTypes.VALUE_LEVEL_METADATA_CHECK_AGAINST_DEFINE.value, - "conditions": ConditionCompositeFactory.get_condition_composite( - { - "any": [ - { - "name": "get_dataset", - "operator": "non_conformant_value_length", - "value": {}, - } - ] - } - ), - "actions": [ - { - "name": "generate_dataset_error_objects", - "params": { - "message": ( - "Variable data does not match length " - "specified by value level metadata in define.xml" - ), - }, - } - ], - } - - @pytest.fixture def dataset_rule_record_in_parent_domain_equal_to() -> dict: """ diff --git a/tests/unit/test_check_operators/test_codelist_checks.py b/tests/unit/test_check_operators/test_codelist_checks.py deleted file mode 100644 index 4aa119b83..000000000 --- a/tests/unit/test_check_operators/test_codelist_checks.py +++ /dev/null @@ -1,108 +0,0 @@ -from cdisc_rules_engine.check_operators.dataframe_operators import DataframeType -import pytest -from cdisc_rules_engine.models.dataset.dask_dataset import DaskDataset -from cdisc_rules_engine.models.dataset.pandas_dataset import PandasDataset - - -@pytest.mark.parametrize( - "target, comparator, dataset_type, expected_result", - [ - ( - "define_variable_name", - "define_variable_controlled_terms", - PandasDataset, - [True, True, True], - ), - ( - "define_variable_name", - "define_variable_controlled_terms", - DaskDataset, - [True, True, True], - ), - ( - "define_variable_name", - "define_variable_invalid_terms", - PandasDataset, - [True, True, False], - ), - ( - "define_variable_name", - "define_variable_invalid_terms", - DaskDataset, - [True, True, False], - ), - ], -) -def test_references_correct_codelist(target, comparator, dataset_type, expected_result): - data = { - "define_variable_name": ["TEST", "COOLVAR", "ANOTHERVAR"], - "define_variable_controlled_terms": ["C123", "C456", "C789"], - "define_variable_invalid_terms": ["C123", "C456", "C786"], - } - - df = dataset_type.from_dict(data) - - column_codelist_map = { - "TEST": ["C123", "C456"], - "COOLVAR": ["C123", "C456"], - "ANOTHERVAR": ["C789"], - } - dft = DataframeType({"value": df, "column_codelist_map": column_codelist_map}) - - result = dft.references_correct_codelist( - {"target": target, "comparator": comparator} - ) - assert result.equals(df.convert_to_series(expected_result)) - - -@pytest.mark.parametrize( - "target, comparator, dataset_type, expected_result", - [ - ( - "define_variable_name", - "define_variable_controlled_terms", - PandasDataset, - [False, False, False], - ), - ( - "define_variable_name", - "define_variable_controlled_terms", - DaskDataset, - [False, False, False], - ), - ( - "define_variable_name", - "define_variable_invalid_terms", - PandasDataset, - [False, False, True], - ), - ( - "define_variable_name", - "define_variable_invalid_terms", - DaskDataset, - [False, False, True], - ), - ], -) -def test_does_not_reference_correct_codelist( - target, comparator, dataset_type, expected_result -): - data = { - "define_variable_name": ["TEST", "COOLVAR", "ANOTHERVAR"], - "define_variable_controlled_terms": ["C123", "C456", "C789"], - "define_variable_invalid_terms": ["C123", "C456", "C786"], - } - - df = dataset_type.from_dict(data) - - column_codelist_map = { - "TEST": ["C123", "C456"], - "COOLVAR": ["C123", "C456"], - "ANOTHERVAR": ["C789"], - } - dft = DataframeType({"value": df, "column_codelist_map": column_codelist_map}) - - result = dft.does_not_reference_correct_codelist( - {"target": target, "comparator": comparator} - ) - assert result.equals(df.convert_to_series(expected_result)) diff --git a/tests/unit/test_check_operators/test_metadata_checks.py b/tests/unit/test_check_operators/test_metadata_checks.py deleted file mode 100644 index 2792823a9..000000000 --- a/tests/unit/test_check_operators/test_metadata_checks.py +++ /dev/null @@ -1,49 +0,0 @@ -from cdisc_rules_engine.check_operators.dataframe_operators import DataframeType -import pytest -from cdisc_rules_engine.models.dataset.dask_dataset import DaskDataset -from cdisc_rules_engine.models.dataset.pandas_dataset import PandasDataset - - -@pytest.mark.parametrize("dataset_type", [PandasDataset, DaskDataset]) -def test_conformant_value_length(dataset_type): - def filter_func(row): - return row["IDVAR1"] == "TEST" - - def length_check(row): - return len(row["IDVAR2"]) <= 4 - - data = { - "RDOMAIN": ["LB", "LB", "AE"], - "IDVAR1": ["TEST", "TEST", "AETERM"], - "IDVAR2": ["TEST", "TOOLONG", "AETERM"], - } - df = dataset_type.from_dict(data) - - vlm = [{"filter": filter_func, "length_check": length_check}] - - result = DataframeType( - {"value": df, "value_level_metadata": vlm} - ).conformant_value_length({}) - assert result.equals(df.convert_to_series([True, False, False])) - - -@pytest.mark.parametrize("dataset_type", [PandasDataset, DaskDataset]) -def test_conformant_value_data_type(dataset_type): - def filter_func(row): - return row["IDVAR1"] == "TEST" - - def type_check(row): - return isinstance(row["IDVAR1"], str) - - data = { - "RDOMAIN": ["LB", "LB", "AE"], - "IDVAR1": ["TEST", "TEST", "AETERM"], - "IDVAR2": ["TEST", 1, "AETERM"], - } - - vlm = [{"filter": filter_func, "type_check": type_check}] - df = dataset_type.from_dict(data) - result = DataframeType( - {"value": df, "value_level_metadata": vlm} - ).conformant_value_data_type({}) - assert result.equals(df.convert_to_series([True, True, False])) diff --git a/tests/unit/test_dataset_builders/test_contents_dataset_builder.py b/tests/unit/test_dataset_builders/test_contents_dataset_builder.py deleted file mode 100644 index 3df542ff3..000000000 --- a/tests/unit/test_dataset_builders/test_contents_dataset_builder.py +++ /dev/null @@ -1,389 +0,0 @@ -import pytest -from cdisc_rules_engine.constants.metadata_columns import ( - SOURCE_FILENAME, - SOURCE_ROW_NUMBER, -) -from cdisc_rules_engine.dataset_builders.contents_dataset_builder import ( - ContentsDatasetBuilder, -) -from unittest.mock import MagicMock -from cdisc_rules_engine.models.library_metadata_container import ( - LibraryMetadataContainer, -) -from cdisc_rules_engine.services.data_services import DummyDataService -from cdisc_rules_engine.dummy_models.dummy_dataset import DummyDataset -from cdisc_rules_engine.models.rule_conditions import ConditionCompositeFactory -from conftest import mock_data_service -from cdisc_rules_engine.utilities.rule_processor import RuleProcessor -from cdisc_rules_engine.services.cache.in_memory_cache_service import ( - InMemoryCacheService, -) -from cdisc_rules_engine.models.dataset import PandasDataset -import pandas as pd -import json - -with open(r"tests/resources/CoreIssue499/data.json", "r") as file: - test_data = json.load(file) - - -@pytest.mark.parametrize( - "conditions", - [ - { - "not": { - "any": [ - { - "value": { - "target": "dataset_label", - "comparator": "Adverse Events", - }, - "operator": "equal_to", - }, - { - "all": [ - { - "value": { - "target": "dataset_size", - "unit": "MB", - "comparator": 5, - }, - "operator": "less_than", - }, - ] - }, - ] - } - }, - ], -) -def test_ContentDatasetBuilder_split_datasets(conditions): - - rule: dict = { - "conditions": ConditionCompositeFactory.get_condition_composite(conditions), - } - processor = RuleProcessor(mock_data_service, InMemoryCacheService()) - data_metadata = test_data - datasets = [DummyDataset(data) for data in data_metadata.get("datasets", [])] - expected_output = { - "STUDYID": { - "0": "CDISCCORE01", - "1": "CDISCCORE01", - "2": "CDISCCORE01", - "3": "CDISCCORE01", - "4": "CDISCCORE01", - "5": "CDISCCORE01", - "6": "CDISCCORE01", - "7": "CDISCCORE01", - "8": "CDISCCORE01", - "9": "CDISCCORE01", - "10": "CDISCCORE01", - "11": "CDISCCORE01", - "12": "CDISCCORE01", - "13": "CDISCCORE01", - "14": "CDISCCORE01", - "15": "CDISCCORE01", - "16": "CDISCCORE01", - "17": "CDISCCORE01", - "18": "CDISCCORE01", - "19": "CDISCCORE01", - "20": "CDISCCORE01", - "21": "CDISCCORE01", - "22": "CDISCCORE01", - "23": "CDISCCORE01", - "24": "CDISCCORE01", - "25": "CDISCCORE01", - "26": "CDISCCORE01", - "27": "CDISCCORE01", - }, - "DOMAIN": { - "0": "SS", - "1": "SS", - "2": "SS", - "3": "SS", - "4": "SS", - "5": "SS", - "6": "SS", - "7": "SS", - "8": "SS", - "9": "SS", - "10": "SS", - "11": "SS", - "12": "SS", - "13": "SS", - "14": "SS", - "15": "SS", - "16": "SS", - "17": "SS", - "18": "SS", - "19": "SS", - "20": "SS", - "21": "SS", - "22": "SS", - "23": "SS", - "24": "SS", - "25": "SS", - "26": "SS", - "27": "SS", - }, - "USUBJID": { - "0": "0001", - "1": "0001", - "2": "0001", - "3": "0001", - "4": "0001", - "5": "0001", - "6": "0001", - "7": "0002", - "8": "0002", - "9": "0002", - "10": "0002", - "11": "0002", - "12": "0002", - "13": "0002", - "14": "0001", - "15": "0001", - "16": "0001", - "17": "0001", - "18": "0001", - "19": "0001", - "20": "0001", - "21": "0002", - "22": "0002", - "23": "0002", - "24": "0002", - "25": "0002", - "26": "0002", - "27": "0002", - }, - "SSSEQ": { - "0": 1, - "1": 2, - "2": 3, - "3": 4, - "4": 5, - "5": 6, - "6": 7, - "7": 1, - "8": 1, - "9": 3, - "10": 4, - "11": 5, - "12": 6, - "13": 7, - "14": 8, - "15": 9, - "16": 10, - "17": 11, - "18": 12, - "19": 13, - "20": 14, - "21": 8, - "22": 9, - "23": 10, - "24": 11, - "25": 12, - "26": 13, - "27": 14, - }, - "SSTESTCD": { - "0": "SURVSTAT", - "1": "SURVSTAT", - "2": "SURVSTAT", - "3": "SURVSTAT", - "4": "SURVSTAT", - "5": "SURVSTAT", - "6": "SURVSTAT", - "7": "SURVSTAT", - "8": "SURVSTAT", - "9": "SURVSTAT", - "10": "SURVSTAT", - "11": "SURVSTAT", - "12": "SURVSTAT", - "13": "SURVSTAT", - "14": "SURVSTAT", - "15": "SURVSTAT", - "16": "SURVSTAT", - "17": "SURVSTAT", - "18": "SURVSTAT", - "19": "SURVSTAT", - "20": "SURVSTAT", - "21": "SURVSTAT", - "22": "SURVSTAT", - "23": "SURVSTAT", - "24": "SURVSTAT", - "25": "SURVSTAT", - "26": "SURVSTAT", - "27": "SURVSTAT", - }, - "SSTEST": { - "0": "Survival Status", - "1": "Survival Status", - "2": "Survival Status", - "3": "Survival Status", - "4": "Survival Status", - "5": "Survival Status", - "6": "Survival Status", - "7": "Survival Status", - "8": "Survival Status", - "9": "Survival Status", - "10": "Survival Status", - "11": "Survival Status", - "12": "Survival Status", - "13": "Survival Status", - "14": "Survival Status", - "15": "Survival Status", - "16": "Survival Status", - "17": "Survival Status", - "18": "Survival Status", - "19": "Survival Status", - "20": "Survival Status", - "21": "Survival Status", - "22": "Survival Status", - "23": "Survival Status", - "24": "Survival Status", - "25": "Survival Status", - "26": "Survival Status", - "27": "Survival Status", - }, - "SSORRES": { - "0": "ALIVE", - "1": "DEAD", - "2": "ALIVE", - "3": "DEAD", - "4": "ALIVE", - "5": "DEAD", - "6": "ALIVE", - "7": "DEAD", - "8": "ALIVE", - "9": "DEAD", - "10": "ALIVE", - "11": "DEAD", - "12": "ALIVE", - "13": "DEAD", - "14": "ALIVE", - "15": "DEAD", - "16": "ALIVE", - "17": "DEAD", - "18": "ALIVE", - "19": "DEAD", - "20": "ALIVE", - "21": "DEAD", - "22": "ALIVE", - "23": "DEAD", - "24": "ALIVE", - "25": "DEAD", - "26": "ALIVE", - "27": "DEAD", - }, - "SSSTRESC": { - "0": "ALIVE", - "1": "DEAD", - "2": "ALIVE", - "3": "DEAD", - "4": "ALIVE", - "5": "DEAD", - "6": "ALIVE", - "7": "DEAD", - "8": "ALIVE", - "9": "DEAD", - "10": "ALIVE", - "11": "DEAD", - "12": "ALIVE", - "13": "DEAD", - "14": "ALIVE", - "15": "DEAD", - "16": "ALIVE", - "17": "DEAD", - "18": "ALIVE", - "19": "DEAD", - "20": "ALIVE", - "21": "DEAD", - "22": "ALIVE", - "23": "DEAD", - "24": "ALIVE", - "25": "DEAD", - "26": "ALIVE", - "27": "DEAD", - }, - SOURCE_FILENAME: { - "0": "ss11.xpt", - "1": "ss11.xpt", - "2": "ss11.xpt", - "3": "ss11.xpt", - "4": "ss11.xpt", - "5": "ss11.xpt", - "6": "ss11.xpt", - "7": "ss11.xpt", - "8": "ss11.xpt", - "9": "ss11.xpt", - "10": "ss11.xpt", - "11": "ss11.xpt", - "12": "ss11.xpt", - "13": "ss11.xpt", - "14": "ss12.xpt", - "15": "ss12.xpt", - "16": "ss12.xpt", - "17": "ss12.xpt", - "18": "ss12.xpt", - "19": "ss12.xpt", - "20": "ss12.xpt", - "21": "ss12.xpt", - "22": "ss12.xpt", - "23": "ss12.xpt", - "24": "ss12.xpt", - "25": "ss12.xpt", - "26": "ss12.xpt", - "27": "ss12.xpt", - }, - SOURCE_ROW_NUMBER: { - "0": 1, - "1": 2, - "2": 3, - "3": 4, - "4": 5, - "5": 6, - "6": 7, - "7": 8, - "8": 9, - "9": 10, - "10": 11, - "11": 12, - "12": 13, - "13": 14, - "14": 1, - "15": 2, - "16": 3, - "17": 4, - "18": 5, - "19": 6, - "20": 7, - "21": 8, - "22": 9, - "23": 10, - "24": 11, - "25": 12, - "26": 13, - "27": 14, - }, - } - expected_df = pd.DataFrame.from_dict(expected_output, orient="columns") - expected_df.index = pd.RangeIndex(start=0, stop=len(expected_df), step=1) - expected = PandasDataset(expected_df) - result = ContentsDatasetBuilder( - rule=rule, - data_service=DummyDataService( - MagicMock(), MagicMock(), MagicMock(), data=datasets - ), - cache_service=None, - rule_processor=processor, - data_processor=None, - dataset_path="", - datasets=datasets, - dataset_metadata=DummyDataset(test_data.get("datasets", {})[0]), - define_xml_path=None, - standard="sdtmig", - standard_version="3-4", - standard_substandard=None, - library_metadata=LibraryMetadataContainer(), - ).get_dataset() - assert result.equals(expected) From 2302357e84e2c43a3604496cc062b669d4d2d749 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 26 Feb 2026 14:43:52 -0500 Subject: [PATCH 06/17] restore record data --- .../contents_dataset_builder.py | 33 +++++++++++++++++++ .../dataset_builder_factory.py | 4 +++ cdisc_rules_engine/enums/rule_types.py | 1 + 3 files changed, 38 insertions(+) create mode 100644 cdisc_rules_engine/dataset_builders/contents_dataset_builder.py diff --git a/cdisc_rules_engine/dataset_builders/contents_dataset_builder.py b/cdisc_rules_engine/dataset_builders/contents_dataset_builder.py new file mode 100644 index 000000000..8abec8ed0 --- /dev/null +++ b/cdisc_rules_engine/dataset_builders/contents_dataset_builder.py @@ -0,0 +1,33 @@ +from cdisc_rules_engine.dataset_builders.base_dataset_builder import BaseDatasetBuilder +from cdisc_rules_engine.utilities.utils import ( + get_corresponding_datasets, +) + + +class ContentsDatasetBuilder(BaseDatasetBuilder): + def build(self, **kwargs): + """ + Returns the contents of a file as a dataframe for evaluation. + """ + return self.data_service.get_dataset(dataset_name=self.dataset_path) + + def build_split_datasets(self, dataset_name, **kwargs): + """ + Returns the contents of a file as a dataframe for evaluation. + """ + return self.data_service.get_dataset( + dataset_name=dataset_name, datasets=self.datasets + ) + + def get_dataset(self, **kwargs): + dataset = super().get_dataset(**kwargs) + length = sum( + [ + dataset.record_count + for dataset in get_corresponding_datasets( + self.datasets, self.dataset_metadata + ) + ] + ) + dataset.length = length + return dataset diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index 3462b1d6b..29d1e2eec 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -8,6 +8,9 @@ JSONataDatasetBuilder, ) from cdisc_rules_engine.interfaces import FactoryInterface +from cdisc_rules_engine.dataset_builders.contents_dataset_builder import ( + ContentsDatasetBuilder, +) from cdisc_rules_engine.dataset_builders.contents_define_dataset_builder import ( ContentsDefineDatasetBuilder, ) @@ -62,6 +65,7 @@ class DatasetBuilderFactory(FactoryInterface): _builders_map = { + RuleTypes.RECORD_CHECK.value: ContentsDatasetBuilder, RuleTypes.DATASET_CONTENTS_CHECK_AGAINST_DEFINE.value: ContentsDefineDatasetBuilder, RuleTypes.DATASET_METADATA_CHECK.value: ContentMetadataDatasetBuilder, RuleTypes.DATASET_METADATA_CHECK_AGAINST_DEFINE.value: DatasetMetadataDefineDatasetBuilder, diff --git a/cdisc_rules_engine/enums/rule_types.py b/cdisc_rules_engine/enums/rule_types.py index c26db8408..d01ff277c 100644 --- a/cdisc_rules_engine/enums/rule_types.py +++ b/cdisc_rules_engine/enums/rule_types.py @@ -2,6 +2,7 @@ class RuleTypes(BaseEnum): + RECORD_CHECK = "Record Data" DATASET_CONTENTS_CHECK_AGAINST_DEFINE = "Dataset Contents Check against Define XML" DATASET_METADATA_CHECK = "Dataset Metadata Check" DATASET_METADATA_CHECK_AGAINST_DEFINE = "Dataset Metadata Check against Define XML" From bc6e5de6caa6e8bb6dbb19a4f919654e303f0baf Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 26 Feb 2026 15:04:26 -0500 Subject: [PATCH 07/17] tests --- tests/conftest.py | 22 +++++ .../unit/test_rule_tester/test_rule_tester.py | 6 +- tests/unit/test_rules_engine.py | 86 ------------------- 3 files changed, 25 insertions(+), 89 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 30bf4d10d..0f5fc34c2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -58,6 +58,7 @@ def get_matches_regex_pattern_rule(pattern: str) -> dict: return { "core_id": "MockRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], + "rule_type": RuleTypes.RECORD_CHECK.value, "domains": {"Include": ["AE"]}, "conditions": ConditionCompositeFactory.get_condition_composite( { @@ -112,6 +113,7 @@ def dataset_rule_greater_than() -> dict: }, } ], + "rule_type": RuleTypes.RECORD_CHECK.value, } @@ -120,6 +122,7 @@ def dataset_rule_multiple_conditions() -> dict: return { "core_id": "DatasetRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], + "rule_type": RuleTypes.RECORD_CHECK.value, "domains": {"Include": ["EC"]}, "conditions": ConditionCompositeFactory.get_condition_composite( { @@ -155,6 +158,7 @@ def dataset_rule_has_equal_length() -> dict: return { "core_id": "DatasetRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], + "rule_type": RuleTypes.RECORD_CHECK.value, "domains": {"Include": ["EC"]}, "conditions": ConditionCompositeFactory.get_condition_composite( { @@ -183,6 +187,7 @@ def dataset_rule_has_not_equal_length() -> dict: return { "core_id": "DatasetRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], + "rule_type": RuleTypes.RECORD_CHECK.value, "domains": {"Include": ["EC"]}, "conditions": ConditionCompositeFactory.get_condition_composite( { @@ -210,6 +215,7 @@ def dataset_rule_has_not_equal_length() -> dict: def mock_record_rule_equal_to_string_prefix(): return { "core_id": "MockRule", + "rule_type": RuleTypes.RECORD_CHECK.value, "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "domains": {"Include": ["AE"]}, "output_variables": ["AESTDY"], @@ -246,6 +252,7 @@ def mock_ae_record_rule_equal_to_suffix() -> dict: "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "domains": {"Include": ["AE"]}, "output_variables": ["AESTDY"], + "rule_type": RuleTypes.RECORD_CHECK.value, "conditions": ConditionCompositeFactory.get_condition_composite( { "all": [ @@ -286,6 +293,7 @@ def rule_equal_to_with_extract_metadata_operation() -> dict: "id": "$dataset_name", } ], + "rule_type": RuleTypes.RECORD_CHECK.value, "conditions": ConditionCompositeFactory.get_condition_composite( { "all": [ @@ -320,6 +328,7 @@ def mock_rule_distinct_operation(): return { "core_id": "MockRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], + "rule_type": RuleTypes.RECORD_CHECK.value, "domains": {"Include": ["AE"]}, "operations": [ { @@ -359,6 +368,7 @@ def rule_distinct_operation_is_not_contained_by() -> dict: return { "core_id": "CDISC.SDTMIG.CG0178", "severity": "warning", + "rule_type": RuleTypes.RECORD_CHECK.value, "standards": [{"Name": "SDTMIG", "Version": "3.4"}], "classes": {"Include": [ALL_KEYWORD]}, "domains": {"Include": ["IE"]}, @@ -398,6 +408,7 @@ def dataset_rule_equal_to() -> dict: return { "core_id": "MockRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], + "rule_type": RuleTypes.RECORD_CHECK.value, "classes": {"Include": [ALL_KEYWORD]}, "domains": {"Include": ["EC"]}, "datasets": [ @@ -441,6 +452,7 @@ def dataset_rule_equal_to_compare_same_value() -> dict: "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "classes": {"Include": [ALL_KEYWORD]}, "domains": {"Include": ["EC"]}, + "rule_type": RuleTypes.RECORD_CHECK.value, "datasets": [ {"domain_name": "AE", "match_key": ["STUDYID", "USUBJID"]}, ], @@ -479,6 +491,7 @@ def dataset_rule_equal_to_error_objects() -> dict: """ return { "core_id": "MockRule", + "rule_type": RuleTypes.RECORD_CHECK.value, "severity": "Warning", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "output_variables": ["AESTDY"], @@ -518,6 +531,7 @@ def dataset_rule_not_equal_to_error_objects() -> dict: return { "core_id": "MockRule", "severity": "Warning", + "rule_type": RuleTypes.RECORD_CHECK.value, "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "output_variables": ["AESTDY"], "domains": { @@ -560,6 +574,7 @@ def dataset_rule_one_to_one_related() -> dict: "core_id": "MockRule", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "domains": {"Include": ["EC"]}, + "rule_type": RuleTypes.RECORD_CHECK.value, "datasets": [ { "domain_name": "AE", @@ -836,6 +851,7 @@ def dataset_rule_record_in_parent_domain_equal_to() -> dict: "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "classes": {"Include": [ALL_KEYWORD]}, "domains": {"Include": ["EC"]}, + "rule_type": RuleTypes.RECORD_CHECK.value, "datasets": [ { "domain_name": "SUPPEC", @@ -880,6 +896,7 @@ def dataset_rule_inconsistent_enumerated_columns() -> dict: "core_id": "CDISC.SDTMIG.CG0262", "standards": [{"Name": "SDTMIG", "Version": "3.3"}], "classes": {"Include": [ALL_KEYWORD]}, + "rule_type": RuleTypes.RECORD_CHECK.value, "domains": {"Include": ["TS"]}, "conditions": ConditionCompositeFactory.get_condition_composite( { @@ -913,6 +930,7 @@ def mock_validation_results() -> list[RuleValidationResult]: "core_id": "CORE1", "executability": "Fully Executable", "actions": [{"params": {"message": "TEST RULE 1"}}], + "rule_type": RuleTypes.RECORD_CHECK.value, "authorities": [ { "Organization": "CDISC", @@ -972,6 +990,7 @@ def mock_validation_results() -> list[RuleValidationResult]: "core_id": "CORE2", "executability": "Partially Executable", "actions": [{"params": {"message": "TEST RULE 2"}}], + "rule_type": RuleTypes.RECORD_CHECK.value, "authorities": [ { "Organization": "CDISC", @@ -1086,6 +1105,7 @@ def dataset_rule_get_variable_names_in_given_standard() -> dict: ] } ), + "rule_type": RuleTypes.RECORD_CHECK.value, "actions": [ { "name": "generate_dataset_error_objects", @@ -1127,6 +1147,7 @@ def rule_dataset_references_invalid_whodrug_terms() -> dict: ] } ), + "rule_type": RuleTypes.RECORD_CHECK.value, "actions": [ { "name": "generate_dataset_error_objects", @@ -1150,6 +1171,7 @@ def rule_validate_columns_order_against_library_metadata() -> dict: "classes": {"Include": ["EVENTS"]}, "domains": {"Include": ["AE"]}, "sensitivity": Sensitivity.DATASET.value, + "rule_type": RuleTypes.RECORD_CHECK.value, "operations": [ { "operator": "get_column_order_from_dataset", diff --git a/tests/unit/test_rule_tester/test_rule_tester.py b/tests/unit/test_rule_tester/test_rule_tester.py index de381880f..42d1c4b2e 100644 --- a/tests/unit/test_rule_tester/test_rule_tester.py +++ b/tests/unit/test_rule_tester/test_rule_tester.py @@ -48,7 +48,7 @@ def patched_init(self, *args, **kwargs): "core_id": "QC.CDISC.SDTMIG.CG0032", "classes": {"Include": ["ALL"]}, "domains": {"Include": ["ALL"]}, - "rule_type": "Range & Limit", + "rule_type": "Record Data", "sensitivity": "Value", "severity": "error", "Authorities": [{"Standards": [{"Name": "SDTMIG", "Version": "3.4"}]}], @@ -120,7 +120,7 @@ def patched_init(self, *args, **kwargs): "core_id": "QC.CDISC.SDTMIG.CG0032", "classes": {"Include": ["ALL"]}, "domains": {"Include": ["ALL"]}, - "rule_type": "Range & Limit", + "rule_type": "Record Data", "sensitivity": "Value", "severity": "error", "Authorities": [{"Standards": [{"Name": "SDTMIG", "Version": "3.4"}]}], @@ -177,7 +177,7 @@ def test_rule_skipped(): "core_id": "QC.CDISC.SDTMIG.CG0032", "classes": {"Include": ["ALL"]}, "domains": {"Exclude": ["LB"]}, - "rule_type": "Range & Limit", + "rule_type": "Record Data", "sensitivity": "Value", "severity": "error", "Authorities": [{"Standards": [{"Name": "SDTMIG", "Version": "3.4"}]}], diff --git a/tests/unit/test_rules_engine.py b/tests/unit/test_rules_engine.py index b3726a352..573879a32 100644 --- a/tests/unit/test_rules_engine.py +++ b/tests/unit/test_rules_engine.py @@ -1502,92 +1502,6 @@ def test_validate_variable_metadata_against_define_xml( assert validation_result == expected_validation_result -@patch( - "cdisc_rules_engine.rules_engine.RulesEngine.get_define_xml_value_level_metadata" -) -def test_validate_value_level_metadata_against_define_xml( - mock_get_define_xml_value_level_metadata, - define_xml_value_level_metadata_validation_rule: dict, -): - def check_length_func(row): - return len(row["AETERM"]) < 10 - - def filter_func(row): - return row["FILTER"] == "SHORT" - - df = PandasDataset( - pd.DataFrame.from_dict( - { - "FILTER": ["LONG", "SHORT", "SHORT", "SHORT"], - "AETERM": ["A" * 200, "A" * 200, "A" * 5, "A" * 15], - "USUBJID": [ - 4, - 5, - 5, - 5, - ], - "AESEQ": [ - 1, - 2, - 3, - 4, - ], - } - ) - ) - mock_get_define_xml_value_level_metadata.return_value = [ - { - "define_variable_name": "AETERM", - "filter": filter_func, - "length_check": check_length_func, - } - ] - with patch( - "cdisc_rules_engine.services.data_services.LocalDataService.get_dataset", - return_value=df, - ): - dataset_metadata = SDTMDatasetMetadata( - first_record={"DOMAIN": "AE"}, filename="test", full_path="CDISC01/test" - ) - validation_result: List[dict] = RulesEngine( - standard="sdtmig" - ).validate_single_dataset( - dataset_metadata=dataset_metadata, - rule=define_xml_value_level_metadata_validation_rule, - datasets=[dataset_metadata], - ) - assert validation_result == [ - { - "domain": "AE", - "dataset": "test", - "executionStatus": ExecutionStatus.ISSUE_REPORTED.value, - "variables": [ - "AETERM", - ], - "errors": [ - { - "dataset": "test", - "row": 2, - "value": {"AETERM": "A" * 200}, - "USUBJID": "5", - "SEQ": 2, - }, - { - "dataset": "test", - "row": 4, - "value": {"AETERM": "A" * 15}, - "USUBJID": "5", - "SEQ": 4, - }, - ], - "message": ( - "Variable data does not match length specified " - "by value level metadata in define.xml" - ), - } - ] - - @pytest.mark.parametrize( "include_split_datasets, exclude, result", [ From b04f8c3ad3ec03e46878fc459512536690ff3f31 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 26 Feb 2026 15:25:21 -0500 Subject: [PATCH 08/17] remove --- .../utilities/rule_processor.py | 29 ----- tests/conftest.py | 1 + tests/unit/test_rules_engine.py | 1 + .../test_utilities/test_rule_processor.py | 100 ------------------ 4 files changed, 2 insertions(+), 129 deletions(-) diff --git a/cdisc_rules_engine/utilities/rule_processor.py b/cdisc_rules_engine/utilities/rule_processor.py index 061979714..407f67cb7 100644 --- a/cdisc_rules_engine/utilities/rule_processor.py +++ b/cdisc_rules_engine/utilities/rule_processor.py @@ -560,35 +560,6 @@ def add_operator_to_rule_conditions( condition.clear() # delete all keys from dict condition[AllowedConditionsKeys.ANY.value] = nested_conditions - def add_comparator_to_rule_conditions( - self, rule: dict, comparator: dict = None, target_prefix=None - ): - """ - Adds "comparator" key to rule conditions.value key. - - comparator parameter is a dict where - keys are targets and values are comparators. - - The rule is passed and changed by reference. - """ - conditions: ConditionInterface = rule["conditions"] - for condition in conditions.values(): - value: dict = condition["value"] - if comparator: - # Adding a specific value - comparator_to_add = comparator.get(value["target"]) - elif target_prefix: - # Referencing a target variable in another dataset - comparator_to_add = f"{target_prefix}{value['target']}" - else: - comparator_to_add = None - if comparator_to_add: - value["comparator"] = comparator_to_add - logger.info( - f"Added comparator to rule conditions. " - f"comparator={comparator}, conditions={rule['conditions']}" - ) - def _preprocess_operation_params( self, operation_params: OperationParams, domain_details: dict = None ) -> OperationParams: diff --git a/tests/conftest.py b/tests/conftest.py index 0f5fc34c2..c25c9684a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -822,6 +822,7 @@ def define_xml_variable_validation_rule() -> dict: "operator": "not_equal_to", "value": { "target": "variable_size", + "comparator": "define_variable_size", }, } ] diff --git a/tests/unit/test_rules_engine.py b/tests/unit/test_rules_engine.py index 573879a32..272970256 100644 --- a/tests/unit/test_rules_engine.py +++ b/tests/unit/test_rules_engine.py @@ -1003,6 +1003,7 @@ def test_rule_with_domain_prefix_replacement(mock_get_dataset: MagicMock): ] } ), + "rule_type": "Record Data", "actions": [ { "name": "generate_dataset_error_objects", diff --git a/tests/unit/test_utilities/test_rule_processor.py b/tests/unit/test_utilities/test_rule_processor.py index 25b17a808..197856c64 100644 --- a/tests/unit/test_utilities/test_rule_processor.py +++ b/tests/unit/test_utilities/test_rule_processor.py @@ -926,106 +926,6 @@ def test_perform_extract_metadata_operation( assert dataset_after_operation.equals(expected_dataset) -def test_add_comparator_to_conditions(mock_data_service): - conditions = { - "all": [ - {"value": {"target": "dataset_location"}}, - {"value": {"target": "dataset_name"}}, - ] - } - rule: dict = { - "conditions": ConditionCompositeFactory.get_condition_composite(conditions) - } - comparator: dict = { - "dataset_name": "AE", - "dataset_label": "Adverse Events", - "dataset_location": "ae.xpt", - } - processor = RuleProcessor(mock_data_service, InMemoryCacheService()) - processor.add_comparator_to_rule_conditions(rule, comparator) - assert rule["conditions"].to_dict() == { - "all": [ - { - "value": { - "target": "dataset_location", - "comparator": "ae.xpt", - } - }, - { - "value": { - "target": "dataset_name", - "comparator": "AE", - } - }, - ] - } - - -def test_add_comparator_to_conditions_nested_conditions(mock_data_service): - """ - Unit test for function add_comparator_to_conditions. - Ensuring that comparator is added to nested conditions as well. - """ - conditions = { - "all": [ - { - "any": [ - {"value": {"target": "dataset_name"}}, - {"value": {"target": "dataset_label"}}, - {"all": [{"value": {"target": "dataset_location"}}]}, - ] - }, - {"value": {"target": "dataset_location"}}, - ] - } - rule: dict = { - "conditions": ConditionCompositeFactory.get_condition_composite(conditions) - } - comparator: dict = { - "dataset_name": "AE", - "dataset_label": "Adverse Events", - "dataset_location": "ae.xpt", - } - processor = RuleProcessor(mock_data_service, InMemoryCacheService()) - processor.add_comparator_to_rule_conditions(rule, comparator=comparator) - assert rule["conditions"].to_dict() == { - "all": [ - { - "any": [ - { - "value": { - "target": "dataset_name", - "comparator": "AE", - } - }, - { - "value": { - "target": "dataset_label", - "comparator": "Adverse Events", - } - }, - { - "all": [ - { - "value": { - "target": "dataset_location", - "comparator": "ae.xpt", - } - } - ] - }, - ] - }, - { - "value": { - "target": "dataset_location", - "comparator": "ae.xpt", - } - }, - ] - } - - def test_add_operator_to_conditions(mock_data_service): """ Unit test for add_operator_to_rule_conditions method. From 2d773540c33f475c198c17315828891b283b6062 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 2 Mar 2026 12:41:14 -0500 Subject: [PATCH 09/17] restored test, removed artifacts --- .../dataset_builder_factory.py | 1 - cdisc_rules_engine/enums/rule_types.py | 1 - resources/schema/rule/Rule_Type.json | 4 - resources/schema/rule/Rule_Type.md | 25 -- .../test_contents_dataset_builder.py | 389 ++++++++++++++++++ 5 files changed, 389 insertions(+), 31 deletions(-) create mode 100644 tests/unit/test_dataset_builders/test_contents_dataset_builder.py diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index 29d1e2eec..59703d8dc 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -72,7 +72,6 @@ class DatasetBuilderFactory(FactoryInterface): RuleTypes.VARIABLE_METADATA_CHECK.value: VariablesMetadataDatasetBuilder, RuleTypes.DOMAIN_PRESENCE_CHECK.value: DomainListDatasetBuilder, RuleTypes.DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE.value: DomainListWithDefineDatasetBuilder, - RuleTypes.DEFINE_ITEM_METADATA_CHECK.value: DefineVariablesDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE.value: VariablesMetadataWithDefineDatasetBuilder, RuleTypes.DEFINE_ITEM_GROUP_METADATA_CHECK.value: DefineItemGroupDatasetBuilder, RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VARIABLE.value: ContentsDefineVariablesDatasetBuilder, diff --git a/cdisc_rules_engine/enums/rule_types.py b/cdisc_rules_engine/enums/rule_types.py index d01ff277c..dfdede0ab 100644 --- a/cdisc_rules_engine/enums/rule_types.py +++ b/cdisc_rules_engine/enums/rule_types.py @@ -7,7 +7,6 @@ class RuleTypes(BaseEnum): DATASET_METADATA_CHECK = "Dataset Metadata Check" DATASET_METADATA_CHECK_AGAINST_DEFINE = "Dataset Metadata Check against Define XML" DEFINE_ITEM_GROUP_METADATA_CHECK = "Define Item Group Metadata Check" - DEFINE_ITEM_METADATA_CHECK = "Define Item Metadata Check" DOMAIN_PRESENCE_CHECK = "Domain Presence Check" DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE = "Domain Presence Check against Define XML" JSONATA = "JSONata" diff --git a/resources/schema/rule/Rule_Type.json b/resources/schema/rule/Rule_Type.json index 19377a14a..9df79b0cb 100644 --- a/resources/schema/rule/Rule_Type.json +++ b/resources/schema/rule/Rule_Type.json @@ -18,10 +18,6 @@ "const": "Define Item Group Metadata Check", "title": "Define xml metadata at dataset level" }, - { - "const": "Define Item Metadata Check", - "title": "Define xml metadata at variable level" - }, { "const": "Define Item Metadata Check against Library Metadata", "title": "Define xml metadata at variable level and corresponding library variable metadata" diff --git a/resources/schema/rule/Rule_Type.md b/resources/schema/rule/Rule_Type.md index 60eca62ee..a0c9f5fcc 100644 --- a/resources/schema/rule/Rule_Type.md +++ b/resources/schema/rule/Rule_Type.md @@ -24,7 +24,6 @@ The combination of data in each rule type. | **Domain** | [Domain Presence Check](#domain-presence-check) | | | [Domain Presence Check against Define XML](#domain-presence-check-against-define-xml) | | **Define XML** | [Define Item Group Metadata Check](#define-item-group-metadata-check) | -| | [Define Item Metadata Check](#define-item-metadata-check) | | | [Define Item Metadata Check against Library Metadata](#define-item-metadata-check-against-library-metadata) | | **Value Check** | [Value Check with Dataset Metadata](#value-check-with-dataset-metadata) | | | [Value Check with Variable Metadata](#value-check-with-variable-metadata) | @@ -264,30 +263,6 @@ all: Checks dataset-level (ItemGroup) metadata sourced from Define-XML. Each row represents one ItemGroup/dataset definition in the Define-XML. -## Define Item Metadata Check - -#### Columns - -- `define_variable_name` -- `define_variable_label` -- `define_variable_data_type` -- `define_variable_role` -- `define_variable_size` -- `define_variable_ccode` -- `define_variable_format` -- `define_variable_allowed_terms` -- `define_variable_origin_type` -- `define_variable_is_collected` -- `define_variable_has_no_data` -- `define_variable_order_number` -- `define_variable_has_codelist` -- `define_variable_codelist_coded_values` -- `define_variable_has_comment` - -#### Rule Macro - -Checks variable-level metadata sourced from Define-XML with variable codelist and codelist terms. - ## Define Item Metadata Check against Library Metadata #### Columns diff --git a/tests/unit/test_dataset_builders/test_contents_dataset_builder.py b/tests/unit/test_dataset_builders/test_contents_dataset_builder.py new file mode 100644 index 000000000..3df542ff3 --- /dev/null +++ b/tests/unit/test_dataset_builders/test_contents_dataset_builder.py @@ -0,0 +1,389 @@ +import pytest +from cdisc_rules_engine.constants.metadata_columns import ( + SOURCE_FILENAME, + SOURCE_ROW_NUMBER, +) +from cdisc_rules_engine.dataset_builders.contents_dataset_builder import ( + ContentsDatasetBuilder, +) +from unittest.mock import MagicMock +from cdisc_rules_engine.models.library_metadata_container import ( + LibraryMetadataContainer, +) +from cdisc_rules_engine.services.data_services import DummyDataService +from cdisc_rules_engine.dummy_models.dummy_dataset import DummyDataset +from cdisc_rules_engine.models.rule_conditions import ConditionCompositeFactory +from conftest import mock_data_service +from cdisc_rules_engine.utilities.rule_processor import RuleProcessor +from cdisc_rules_engine.services.cache.in_memory_cache_service import ( + InMemoryCacheService, +) +from cdisc_rules_engine.models.dataset import PandasDataset +import pandas as pd +import json + +with open(r"tests/resources/CoreIssue499/data.json", "r") as file: + test_data = json.load(file) + + +@pytest.mark.parametrize( + "conditions", + [ + { + "not": { + "any": [ + { + "value": { + "target": "dataset_label", + "comparator": "Adverse Events", + }, + "operator": "equal_to", + }, + { + "all": [ + { + "value": { + "target": "dataset_size", + "unit": "MB", + "comparator": 5, + }, + "operator": "less_than", + }, + ] + }, + ] + } + }, + ], +) +def test_ContentDatasetBuilder_split_datasets(conditions): + + rule: dict = { + "conditions": ConditionCompositeFactory.get_condition_composite(conditions), + } + processor = RuleProcessor(mock_data_service, InMemoryCacheService()) + data_metadata = test_data + datasets = [DummyDataset(data) for data in data_metadata.get("datasets", [])] + expected_output = { + "STUDYID": { + "0": "CDISCCORE01", + "1": "CDISCCORE01", + "2": "CDISCCORE01", + "3": "CDISCCORE01", + "4": "CDISCCORE01", + "5": "CDISCCORE01", + "6": "CDISCCORE01", + "7": "CDISCCORE01", + "8": "CDISCCORE01", + "9": "CDISCCORE01", + "10": "CDISCCORE01", + "11": "CDISCCORE01", + "12": "CDISCCORE01", + "13": "CDISCCORE01", + "14": "CDISCCORE01", + "15": "CDISCCORE01", + "16": "CDISCCORE01", + "17": "CDISCCORE01", + "18": "CDISCCORE01", + "19": "CDISCCORE01", + "20": "CDISCCORE01", + "21": "CDISCCORE01", + "22": "CDISCCORE01", + "23": "CDISCCORE01", + "24": "CDISCCORE01", + "25": "CDISCCORE01", + "26": "CDISCCORE01", + "27": "CDISCCORE01", + }, + "DOMAIN": { + "0": "SS", + "1": "SS", + "2": "SS", + "3": "SS", + "4": "SS", + "5": "SS", + "6": "SS", + "7": "SS", + "8": "SS", + "9": "SS", + "10": "SS", + "11": "SS", + "12": "SS", + "13": "SS", + "14": "SS", + "15": "SS", + "16": "SS", + "17": "SS", + "18": "SS", + "19": "SS", + "20": "SS", + "21": "SS", + "22": "SS", + "23": "SS", + "24": "SS", + "25": "SS", + "26": "SS", + "27": "SS", + }, + "USUBJID": { + "0": "0001", + "1": "0001", + "2": "0001", + "3": "0001", + "4": "0001", + "5": "0001", + "6": "0001", + "7": "0002", + "8": "0002", + "9": "0002", + "10": "0002", + "11": "0002", + "12": "0002", + "13": "0002", + "14": "0001", + "15": "0001", + "16": "0001", + "17": "0001", + "18": "0001", + "19": "0001", + "20": "0001", + "21": "0002", + "22": "0002", + "23": "0002", + "24": "0002", + "25": "0002", + "26": "0002", + "27": "0002", + }, + "SSSEQ": { + "0": 1, + "1": 2, + "2": 3, + "3": 4, + "4": 5, + "5": 6, + "6": 7, + "7": 1, + "8": 1, + "9": 3, + "10": 4, + "11": 5, + "12": 6, + "13": 7, + "14": 8, + "15": 9, + "16": 10, + "17": 11, + "18": 12, + "19": 13, + "20": 14, + "21": 8, + "22": 9, + "23": 10, + "24": 11, + "25": 12, + "26": 13, + "27": 14, + }, + "SSTESTCD": { + "0": "SURVSTAT", + "1": "SURVSTAT", + "2": "SURVSTAT", + "3": "SURVSTAT", + "4": "SURVSTAT", + "5": "SURVSTAT", + "6": "SURVSTAT", + "7": "SURVSTAT", + "8": "SURVSTAT", + "9": "SURVSTAT", + "10": "SURVSTAT", + "11": "SURVSTAT", + "12": "SURVSTAT", + "13": "SURVSTAT", + "14": "SURVSTAT", + "15": "SURVSTAT", + "16": "SURVSTAT", + "17": "SURVSTAT", + "18": "SURVSTAT", + "19": "SURVSTAT", + "20": "SURVSTAT", + "21": "SURVSTAT", + "22": "SURVSTAT", + "23": "SURVSTAT", + "24": "SURVSTAT", + "25": "SURVSTAT", + "26": "SURVSTAT", + "27": "SURVSTAT", + }, + "SSTEST": { + "0": "Survival Status", + "1": "Survival Status", + "2": "Survival Status", + "3": "Survival Status", + "4": "Survival Status", + "5": "Survival Status", + "6": "Survival Status", + "7": "Survival Status", + "8": "Survival Status", + "9": "Survival Status", + "10": "Survival Status", + "11": "Survival Status", + "12": "Survival Status", + "13": "Survival Status", + "14": "Survival Status", + "15": "Survival Status", + "16": "Survival Status", + "17": "Survival Status", + "18": "Survival Status", + "19": "Survival Status", + "20": "Survival Status", + "21": "Survival Status", + "22": "Survival Status", + "23": "Survival Status", + "24": "Survival Status", + "25": "Survival Status", + "26": "Survival Status", + "27": "Survival Status", + }, + "SSORRES": { + "0": "ALIVE", + "1": "DEAD", + "2": "ALIVE", + "3": "DEAD", + "4": "ALIVE", + "5": "DEAD", + "6": "ALIVE", + "7": "DEAD", + "8": "ALIVE", + "9": "DEAD", + "10": "ALIVE", + "11": "DEAD", + "12": "ALIVE", + "13": "DEAD", + "14": "ALIVE", + "15": "DEAD", + "16": "ALIVE", + "17": "DEAD", + "18": "ALIVE", + "19": "DEAD", + "20": "ALIVE", + "21": "DEAD", + "22": "ALIVE", + "23": "DEAD", + "24": "ALIVE", + "25": "DEAD", + "26": "ALIVE", + "27": "DEAD", + }, + "SSSTRESC": { + "0": "ALIVE", + "1": "DEAD", + "2": "ALIVE", + "3": "DEAD", + "4": "ALIVE", + "5": "DEAD", + "6": "ALIVE", + "7": "DEAD", + "8": "ALIVE", + "9": "DEAD", + "10": "ALIVE", + "11": "DEAD", + "12": "ALIVE", + "13": "DEAD", + "14": "ALIVE", + "15": "DEAD", + "16": "ALIVE", + "17": "DEAD", + "18": "ALIVE", + "19": "DEAD", + "20": "ALIVE", + "21": "DEAD", + "22": "ALIVE", + "23": "DEAD", + "24": "ALIVE", + "25": "DEAD", + "26": "ALIVE", + "27": "DEAD", + }, + SOURCE_FILENAME: { + "0": "ss11.xpt", + "1": "ss11.xpt", + "2": "ss11.xpt", + "3": "ss11.xpt", + "4": "ss11.xpt", + "5": "ss11.xpt", + "6": "ss11.xpt", + "7": "ss11.xpt", + "8": "ss11.xpt", + "9": "ss11.xpt", + "10": "ss11.xpt", + "11": "ss11.xpt", + "12": "ss11.xpt", + "13": "ss11.xpt", + "14": "ss12.xpt", + "15": "ss12.xpt", + "16": "ss12.xpt", + "17": "ss12.xpt", + "18": "ss12.xpt", + "19": "ss12.xpt", + "20": "ss12.xpt", + "21": "ss12.xpt", + "22": "ss12.xpt", + "23": "ss12.xpt", + "24": "ss12.xpt", + "25": "ss12.xpt", + "26": "ss12.xpt", + "27": "ss12.xpt", + }, + SOURCE_ROW_NUMBER: { + "0": 1, + "1": 2, + "2": 3, + "3": 4, + "4": 5, + "5": 6, + "6": 7, + "7": 8, + "8": 9, + "9": 10, + "10": 11, + "11": 12, + "12": 13, + "13": 14, + "14": 1, + "15": 2, + "16": 3, + "17": 4, + "18": 5, + "19": 6, + "20": 7, + "21": 8, + "22": 9, + "23": 10, + "24": 11, + "25": 12, + "26": 13, + "27": 14, + }, + } + expected_df = pd.DataFrame.from_dict(expected_output, orient="columns") + expected_df.index = pd.RangeIndex(start=0, stop=len(expected_df), step=1) + expected = PandasDataset(expected_df) + result = ContentsDatasetBuilder( + rule=rule, + data_service=DummyDataService( + MagicMock(), MagicMock(), MagicMock(), data=datasets + ), + cache_service=None, + rule_processor=processor, + data_processor=None, + dataset_path="", + datasets=datasets, + dataset_metadata=DummyDataset(test_data.get("datasets", {})[0]), + define_xml_path=None, + standard="sdtmig", + standard_version="3-4", + standard_substandard=None, + library_metadata=LibraryMetadataContainer(), + ).get_dataset() + assert result.equals(expected) From 1c0963bb1f4399fe5cc7626605118eca34890420 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 2 Mar 2026 14:22:04 -0500 Subject: [PATCH 10/17] remove 1 last rule type --- cdisc_rules_engine/enums/rule_types.py | 1 - resources/schema/rule/Rule_Type.json | 8 - resources/schema/rule/Rule_Type.md | 24 +- .../test_Issues/test_CoreIssue286.py | 50 - tests/resources/CoreIssue286/dataset.json | 895 - tests/resources/CoreIssue286/define.xml | 23677 ---------------- tests/resources/CoreIssue286/rule.json | 131 - 7 files changed, 2 insertions(+), 24784 deletions(-) delete mode 100644 tests/QARegressionTests/test_Issues/test_CoreIssue286.py delete mode 100644 tests/resources/CoreIssue286/dataset.json delete mode 100644 tests/resources/CoreIssue286/define.xml delete mode 100644 tests/resources/CoreIssue286/rule.json diff --git a/cdisc_rules_engine/enums/rule_types.py b/cdisc_rules_engine/enums/rule_types.py index dfdede0ab..b9ac44e01 100644 --- a/cdisc_rules_engine/enums/rule_types.py +++ b/cdisc_rules_engine/enums/rule_types.py @@ -6,7 +6,6 @@ class RuleTypes(BaseEnum): DATASET_CONTENTS_CHECK_AGAINST_DEFINE = "Dataset Contents Check against Define XML" DATASET_METADATA_CHECK = "Dataset Metadata Check" DATASET_METADATA_CHECK_AGAINST_DEFINE = "Dataset Metadata Check against Define XML" - DEFINE_ITEM_GROUP_METADATA_CHECK = "Define Item Group Metadata Check" DOMAIN_PRESENCE_CHECK = "Domain Presence Check" DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE = "Domain Presence Check against Define XML" JSONATA = "JSONata" diff --git a/resources/schema/rule/Rule_Type.json b/resources/schema/rule/Rule_Type.json index 9df79b0cb..a23ae54b4 100644 --- a/resources/schema/rule/Rule_Type.json +++ b/resources/schema/rule/Rule_Type.json @@ -14,10 +14,6 @@ "const": "Dataset Metadata Check against Define XML", "title": "Content metadata at dataset level and define xml metadata at dataset level" }, - { - "const": "Define Item Group Metadata Check", - "title": "Define xml metadata at dataset level" - }, { "const": "Define Item Metadata Check against Library Metadata", "title": "Define xml metadata at variable level and corresponding library variable metadata" @@ -50,10 +46,6 @@ "const": "Value Check against Define XML VLM", "title": "Content data at value level and define xml metadata at value level" }, - { - "const": "Value Level Metadata Check against Define XML", - "title": "Content data at record level and define xml metadata at value level" - }, { "const": "Variable Metadata Check", "title": "Content metadata at variable level" diff --git a/resources/schema/rule/Rule_Type.md b/resources/schema/rule/Rule_Type.md index a0c9f5fcc..3f9511948 100644 --- a/resources/schema/rule/Rule_Type.md +++ b/resources/schema/rule/Rule_Type.md @@ -20,11 +20,9 @@ The combination of data in each rule type. | | [Dataset Metadata Check](#dataset-metadata-check) | | | [Dataset Metadata Check against Define XML](#dataset-metadata-check-against-define-xml) | | | [Dataset Contents Check against Define XML](#dataset-contents-check-against-define-xml) | -| | [Value Level Metadata Check against Define XML](#value-level-metadata-check-against-define-xml) | | **Domain** | [Domain Presence Check](#domain-presence-check) | | | [Domain Presence Check against Define XML](#domain-presence-check-against-define-xml) | -| **Define XML** | [Define Item Group Metadata Check](#define-item-group-metadata-check) | -| | [Define Item Metadata Check against Library Metadata](#define-item-metadata-check-against-library-metadata) | +| **Define XML** | [Define Item Metadata Check against Library Metadata](#define-item-metadata-check-against-library-metadata) | | **Value Check** | [Value Check with Dataset Metadata](#value-check-with-dataset-metadata) | | | [Value Check with Variable Metadata](#value-check-with-variable-metadata) | | | [Value Check against Define XML Variable](#value-check-against-define-xml-variable) | @@ -33,6 +31,7 @@ The combination of data in each rule type. | | [Variable Metadata Check against Define XML](#variable-metadata-check-against-define-xml) | | | [Variable Metadata Check against Library Metadata](#variable-metadata-check-against-library-metadata) | | | [Variables Metadata Check against Define XML and Library Metadata](#variables-metadata-check-against-define-xml-and-library-metadata) | +| | [Define Item Metadata Check against Library Metadata](#define-item-metadata-check-against-library-metadata) | | **JSON** | [JSONata](#jsonata) | | | [JSON Schema Check](#json-schema-check) | @@ -244,25 +243,6 @@ all: # Define XML Rule Types -## Define Item Group Metadata Check - -#### Columns - -- `define_dataset_class` -- `define_dataset_domain` -- `define_dataset_has_no_data` -- `define_dataset_is_non_standard` -- `define_dataset_key_sequence` -- `define_dataset_label` -- `define_dataset_location` -- `define_dataset_name` -- `define_dataset_structure` -- `define_dataset_variables` - -#### Rule Macro - -Checks dataset-level (ItemGroup) metadata sourced from Define-XML. Each row represents one ItemGroup/dataset definition in the Define-XML. - ## Define Item Metadata Check against Library Metadata #### Columns diff --git a/tests/QARegressionTests/test_Issues/test_CoreIssue286.py b/tests/QARegressionTests/test_Issues/test_CoreIssue286.py deleted file mode 100644 index e0d85523d..000000000 --- a/tests/QARegressionTests/test_Issues/test_CoreIssue286.py +++ /dev/null @@ -1,50 +0,0 @@ -import subprocess -import os -import openpyxl -import pytest -from conftest import get_python_executable - - -@pytest.mark.regression -def test_negative_case_VS_dataset(): - command = ( - f"{get_python_executable()} -m core test -s sdtmig -v 3.4 -r " - + os.path.join("tests", "resources", "CoreIssue286", "rule.json") - + " -dp " - + os.path.join("tests", "resources", "CoreIssue286", "dataset.json") - ) - - # Construct the command - command = command.split(" ") - - # Run the command in the terminal - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = process.communicate() - - # Get the generated Excel file name from the standard output - file_name = stdout.decode().strip().split(": ")[1] + ".xlsx" - - # Open the Excel file - workbook = openpyxl.load_workbook(file_name) - - # Go to the "Issue Summary" sheet - sheet = workbook["Issue Summary"] - - # Check the "Dataset" column for values - dataset_column = sheet["A"] # Assuming the "Dataset" column is column D - - # Extract all values from the "Dataset" column (excluding the header) - dataset_values = [cell.value for cell in dataset_column[1:]] - - # Remove None values using list comprehension - dataset_values = [value for value in dataset_values if value is not None] - - # Perform the assertion - assert len(dataset_values) == 1 # Ensure only one value - assert dataset_values[0] == "vs.xpt" # Ensure the value is "VS" - - # Close the workbook - workbook.close() - - # Delete the file - os.remove(file_name) diff --git a/tests/resources/CoreIssue286/dataset.json b/tests/resources/CoreIssue286/dataset.json deleted file mode 100644 index 6228b0226..000000000 --- a/tests/resources/CoreIssue286/dataset.json +++ /dev/null @@ -1,895 +0,0 @@ -{ - "datasets": [ - { - "filename": "vs.xpt", - "label": "Vital Signs", - "domain": "VS", - "variables": [ - { - "name": "STUDYID", - "label": "Study Identifier", - "type": "Char", - "length": 12 - }, - { - "name": "DOMAIN", - "label": "Domain Abbreviation", - "type": "Char", - "length": 2 - }, - { - "name": "USUBJID", - "label": "Unique Subject Identifier", - "type": "Char", - "length": 8 - }, - { - "name": "VSSEQ", - "label": "Sequence Number", - "type": "Num", - "length": 8 - }, - { - "name": "VSNOTEST", - "label": "Vital Signs Test Short Name", - "type": "Char", - "length": 8 - }, - { - "name": "VSTEST", - "label": "Vital Signs Test Name", - "type": "Char", - "length": 24 - }, - { - "name": "VSPOS", - "label": "Vital Signs Position of Subject", - "type": "Char", - "length": 8 - }, - { - "name": "VSORRES", - "label": "Result or Finding in Original Units", - "type": "Char", - "length": 8 - }, - { - "name": "VSORRESU", - "label": "Original Units", - "type": "Char", - "length": 9 - }, - { - "name": "VSSTRESC", - "label": "Character Result/Finding in Std Format", - "type": "Char", - "length": 200 - }, - { - "name": "VSSTRESN", - "label": "Numeric Result/Finding in Standard Units", - "type": "Num", - "length": 8 - }, - { - "name": "VSSTRESU", - "label": "Standard Units", - "type": "Char", - "length": 9 - }, - { - "name": "VSSTAT", - "label": "Completion Status", - "type": "Char", - "length": 8 - }, - { - "name": "VSLOC", - "label": "Location of Vital Signs Measurement", - "type": "Char", - "length": 11 - }, - { - "name": "VSLOBXFL", - "label": "Last Observation Before Exposure Flag", - "type": "Char", - "length": 1 - }, - { - "name": "VSREPNUM", - "label": "Repetition Number", - "type": "Num", - "length": 8 - }, - { - "name": "VISITNUM", - "label": "Visit Number", - "type": "Num", - "length": 8 - }, - { - "name": "VISIT", - "label": "Visit Name", - "type": "Char", - "length": 200 - }, - { - "name": "EPOCH", - "label": "Epoch", - "type": "Char", - "length": 9 - }, - { - "name": "VSDTC", - "label": "Date/Time of Measurements", - "type": "Char", - "length": 10 - }, - { - "name": "VSDY", - "label": "Study Day of Vital Signs", - "type": "Num", - "length": 8 - } - ], - "records": { - "STUDYID": [ - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01", - "CDISCPILOT01" - ], - "DOMAIN": [ - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS", - "VS" - ], - "USUBJID": [ - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001", - "CDISC001" - ], - "VSSEQ": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57 - ], - "VSNOTEST": [ - "DIABP_1", - "DIABP", - "DIABP", - "DIABP", - "DIABP", - "DIA_BP", - "DIABP", - "DIABP", - "DIABP", - "PULSE", - "PULSE123", - "PULSE", - "PULSE", - "PULSE", - "PULSE", - "PULSE", - "PULSE", - "PULSE", - "PULSE", - "SYSBP", - "SYSBP", - "SYSBP", - "TEMP", - "TEMP", - "TEMP", - "TEMP", - "TEMP", - "TEMP", - "WEIGHT", - "WEIGHT", - "WEIGHT", - "WEIGHT", - "WEIGHT", - "WEIGHT" - ], - "VSTEST": [ - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Diastolic Blood Pressure", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Pulse Rate", - "Systolic Blood Pressure", - "Systolic Blood Pressure", - "Systolic Blood Pressure", - "Temperature", - "Temperature", - "Temperature", - "Temperature", - "Temperature", - "Temperature", - "Weight", - "Weight", - "Weight", - "Weight", - "Weight", - "Weight" - ], - "VSPOS": [ - "STANDING", - "STANDING", - "STANDING", - "STANDING", - "STANDING", - "SUPINE", - "STANDING", - "STANDING", - "SUPINE", - "STANDING", - "SUPINE", - "STANDING", - "STANDING", - "SUPINE", - "STANDING", - "STANDING", - "SUPINE", - "STANDING", - "STANDING", - "STANDING", - "STANDING", - "STANDING", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "VSORRES": [ - "71", - "71", - "83", - "79", - "68", - "77", - "71", - "69", - "76", - "51", - "52", - "62", - "62", - "50", - "52", - "54", - "79", - "98", - "94", - "137", - "137", - "130", - "98.0", - "98.0", - "97.7", - "97.6", - "97.6", - "97.4", - "173.5", - "174.0", - "174.0", - "173.0", - "173.0", - "173.0" - ], - "VSORRESU": [ - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "mmHg", - "mmHg", - "mmHg", - "F", - "F", - "F", - "F", - "F", - "F", - "LB", - "LB", - "LB", - "LB", - "LB", - "LB" - ], - "VSSTRESC": [ - "71", - "71", - "83", - "79", - "68", - "77", - "71", - "69", - "76", - "51", - "52", - "62", - "62", - "50", - "52", - "54", - "79", - "98", - "94", - "137", - "137", - "130", - "36.67", - "36.67", - "36.5", - "36.44", - "36.44", - "36.33", - "78.7", - "78.93", - "78.93", - "78.47", - "78.47", - "78.47" - ], - "VSSTRESN": [ - 71, - 71, - 83, - 79, - 68, - 77, - 71, - 69, - 76, - 51, - 52, - 62, - 62, - 50, - 52, - 54, - 79, - 98, - 94, - 137, - 137, - 130, - 36.68, - 36.68, - 36.6, - 36.45, - 36.45, - 36.34, - 78.8, - 78.94, - 78.94, - 78.48, - 78.48, - 78.48 - ], - "VSSTRESU": [ - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "mmHg", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "beats/min", - "mmHg", - "mmHg", - "mmHg", - "C", - "C", - "C", - "C", - "C", - "C", - "kg", - "kg", - "kg", - "kg", - "kg", - "kg" - ], - "VSSTAT": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "VSLOC": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "ORAL CAVITY", - "ORAL CAVITY", - "ORAL CAVITY", - "ORAL CAVITY", - "ORAL CAVITY", - "ORAL CAVITY", - "", - "", - "", - "", - "", - "" - ], - "VSLOBXFL": [ - "", - "", - "Y", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "Y", - "Y", - "", - "", - "", - "", - "", - "", - "Y", - "", - "", - "", - "" - ], - "VSREPNUM": [ - null, - null, - null, - null, - null, - 1, - 2, - 3, - 1, - null, - 1, - 2, - 3, - 1, - 2, - 3, - 1, - 2, - 3, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "VISITNUM": [ - 1, - 2, - 3, - 4, - 5, - 7, - 7, - 7, - 8, - 5, - 7, - 7, - 7, - 8, - 8, - 8, - 201, - 201, - 201, - 1, - 2, - 3, - 3, - 4, - 5, - 7, - 8, - 201, - 1, - 3, - 4, - 5, - 7, - 8 - ], - "VISIT": [ - "SCREENING 1", - "SCREENING 2", - "BASELINE", - "WEEK 2", - "WEEK 4", - "WEEK 6", - "WEEK 6", - "WEEK 6", - "WEEK 8", - "WEEK 4", - "WEEK 6", - "WEEK 6", - "WEEK 6", - "WEEK 8", - "WEEK 8", - "WEEK 8", - "EARLY DISCONTINUATION RETRIEVAL", - "EARLY DISCONTINUATION RETRIEVAL", - "EARLY DISCONTINUATION RETRIEVAL", - "SCREENING 1", - "SCREENING 2", - "BASELINE", - "BASELINE", - "WEEK 2", - "WEEK 4", - "WEEK 6", - "WEEK 8", - "EARLY DISCONTINUATION RETRIEVAL", - "SCREENING 1", - "BASELINE", - "WEEK 2", - "WEEK 4", - "WEEK 6", - "WEEK 8" - ], - "EPOCH": [ - "SCREENING", - "SCREENING", - "SCREENING", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "SCREENING", - "SCREENING", - "SCREENING", - "SCREENING", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "SCREENING", - "SCREENING", - "TREATMENT", - "TREATMENT", - "TREATMENT", - "TREATMENT" - ], - "VSDTC": [ - "2012-11-23", - "2012-11-28", - "2012-11-30", - "2012-12-13", - "2012-12-26", - "2013-01-10", - "2013-01-10", - "2013-01-10", - "2013-01-23", - "2012-12-26", - "2013-01-10", - "2013-01-10", - "2013-01-10", - "2013-01-23", - "2013-01-23", - "2013-01-23", - "2013-05-20", - "2013-05-20", - "2013-05-20", - "2012-11-23", - "2012-11-28", - "2012-11-30", - "2012-11-30", - "2012-12-13", - "2012-12-26", - "2013-01-10", - "2013-01-23", - "2013-05-20", - "2012-11-23", - "2012-11-30", - "2012-12-13", - "2012-12-26", - "2013-01-10", - "2013-01-23" - ], - "VSDY": [ - -7, - -2, - 1, - 14, - 27, - 42, - 42, - 42, - 55, - 27, - 42, - 42, - 42, - 55, - 55, - 55, - 172, - 172, - 172, - -7, - -2, - 1, - 1, - 14, - 27, - 42, - 55, - 172, - -7, - 1, - 14, - 27, - 42, - 55 - ] - } - } - ] -} \ No newline at end of file diff --git a/tests/resources/CoreIssue286/define.xml b/tests/resources/CoreIssue286/define.xml deleted file mode 100644 index aa1563194..000000000 --- a/tests/resources/CoreIssue286/define.xml +++ /dev/null @@ -1,23677 +0,0 @@ - - - - - CM4620-203 - A Randomized, Double-Blind, Placebo Controlled Dose-Ranging Study of Auxora in Patients with Acute Pancreatitis and Accompanying Systemic Inflammatory Response Syndrome (CARPO) - CM4620-203 - - - - - - - - - Adverse Events - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - S:\CAL\CDISC\Software\analysis\test\203\DATA\AE.xpt - - - - - Cool VS domain - - - - - - - S:\CAL\CDISC\Software\analysis\test\203\DATA\VS.xpt - - - - - ECG Test Results - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - S:\CAL\CDISC\Software\analysis\test\203\DATA\EG.xpt - - - - - Study Identifier - - - - - - Domain Abbreviation - - - - - - Related Domain Abbreviation - - - - - Unique Subject Identifier - - - - - - Sequence Number - - - - - Identifying Variable - - - - - Identifying Variable Value - - - - - Comment Reference - - - - - Comment - - - - - Evaluator - - - - - Evaluator Identifier - - - - - - Date/Time of Comment - - - - - Study Day of Comment - - - - - Subject Identifier for the Study - - - - - - Subject Reference Start Date/Time - - - - - - Subject Reference End Date/Time - - - - - - Date/Time of First Study Treatment - - - - - - Date/Time of Last Study Treatment - - - - - - Date/Time of Informed Consent - - - - - - Date/Time of End of Participation - - - - - Date/Time of Death - - - - - Subject Death Flag - - - - - - Study Site Identifier - - - - - Investigator Identifier - - - - - Investigator Name - - - - - Date/Time of Birth - - - - - Age - - - - - - - - - - Age Units - - - - - - Sex - - - - - - - - - - - Race - - - - - - - - - - - Ethnicity - - - - - - - - - - - Planned Arm Code - - - - - Description of Planned Arm - - - - - Actual Arm Code - - - - - Description of Actual Arm - - - - - Reason Arm and/or Actual Arm is Null - - - - - Description of Unplanned Actual Arm - - - - - Country - - - - - - Date/Time of Collection - - - - - Study Day of Collection - - - - - Sequence Number - - - - - Element Code - - - - - Description of Element - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Element - - - - - End Date/Time of Element - - - - - Description of Unplanned Element - - - - - Sequence Number - - - - - Disease Milestone Instance Name - - - - - Disease Milestone Type - - - - - Start Date/Time of Milestone - - - - - End Date/Time of Milestone - - - - - Study Day of Start of Milestone - - - - - Study Day of End of Milestone - - - - - Visit Number - - - - - - Visit Name - - - - - - Planned Study Day of Visit - - - - - Start Date/Time of Visit - - - - - - End Date/Time of Visit - - - - - - Study Day of Start of Visit - - - - - - Study Day of End of Visit - - - - - Description of Unplanned Visit - - - - - Sequence Number - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Reported Agent Name - - - - - Modified Reported Name - - - - - Standardized Agent Name - - - - - Category for Agent - - - - - Subcategory for Agent - - - - - AG Pre-Specified - - - - - - AG Occurrence - - - - - - Completion Status - - - - - - Reason Procedure Agent Not Collected - - - - - Agent Class - - - - - Agent Class Code - - - - - Dose per Administration - - - - - Dose Description - - - - - Dose Units - - - - - - Dose Form - - - - - - Dosing Frequency per Interval - - - - - - Route of Administration - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Agent - - - - - End Date/Time of Agent - - - - - Study Day of Start of Agent - - - - - Study Day of End of Agent - - - - - Duration of Agent - - - - - Start Relative to Reference Period - - - - - - End Relative to Reference Period - - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Reported Name of Drug, Med, or Therapy - - - - - - - - - - Modified Reported Name - - - - - Standardized Medication Name - - - - - - Category for Medication - - - - - Subcategory for Medication - - - - - CM Pre-specified - - - - - - CM Occurrence - - - - - - Completion Status - - - - - - Reason Medication Not Collected - - - - - Indication - - - - - - - - - - Medication Class - - - - - Medication Class Code - - - - - Dose per Administration - - - - - - - - - - Dose Description - - - - - Dose Units - - - - - - - - - - - Dose Form - - - - - - Dosing Frequency per Interval - - - - - - - - - - - Total Daily Dose - - - - - - - - - - Intended Dose Regimen - - - - - Route of Administration - - - - - - - - - - - Reason for Dose Adjustment - - - - - Reason the Intervention Was Discontinued - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Medication - - - - - - - - - - End Date/Time of Medication - - - - - - - - - - Study Day of Start of Medication - - - - - Study Day of End of Medication - - - - - Duration - - - - - Start Relative to Reference Period - - - - - - End Relative to Reference Period - - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Name of Treatment - - - - - Category of Treatment - - - - - Subcategory of Treatment - - - - - Dose - - - - - Dose Description - - - - - Dose Units - - - - - - Dose Form - - - - - - Dosing Frequency per Interval - - - - - - Intended Dose Regimen - - - - - Route of Administration - - - - - - Lot Number - - - - - Location of Dose Administration - - - - - - Laterality - - - - - - Directionality - - - - - - Fasting Status - - - - - - Reason for Dose Adjustment - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Treatment - - - - - - - - - - End Date/Time of Treatment - - - - - - - - - - Study Day of Start of Treatment - - - - - Study Day of End of Treatment - - - - - Duration of Treatment - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Name of Treatment - - - - - Mood - - - - - - Category of Treatment - - - - - Subcategory of Treatment - - - - - Pre-Specified - - - - - - Occurrence - - - - - - Dose - - - - - Dose Description - - - - - Dose Units - - - - - - Dose Form - - - - - - Dosing Frequency per Interval - - - - - - Total Daily Dose - - - - - Intended Dose Regimen - - - - - Route of Administration - - - - - - Lot Number - - - - - Location of Dose Administration - - - - - - Laterality - - - - - - Directionality - - - - - - Portion or Totality - - - - - - Fasting Status - - - - - - Pharmaceutical Strength - - - - - Pharmaceutical Strength Units - - - - - Reason for Dose Adjustment - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Treatment - - - - - End Date/Time of Treatment - - - - - Study Day of Start of Treatment - - - - - Study Day of End of Treatment - - - - - Duration of Treatment - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Name of Meal - - - - - - Category for Meal - - - - - Subcategory for Meal - - - - - ML Pre-specified - - - - - - ML Occurrence - - - - - - Completion Status - - - - - - Reason Meal Not Collected - - - - - Dose - - - - - Dose Description - - - - - - - - - - Dose Units - - - - - - Dose Form - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Start Date/Time of Meal - - - - - - - - - - End Date/Time of Meal - - - - - Study Day of Visit/Collection/Exam - - - - - Study Day of Start of Meal - - - - - Study Day of End of Meal - - - - - Duration of Meal - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Disease Milestone Instance Name - - - - - Temporal Relation to Milestone Instance - - - - - Disease Milestone Instance Date/Time - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Reported Name of Procedure - - - - - - - - - - Standardized Procedure Name - - - - - Category - - - - - - - - - - Subcategory - - - - - Pre-specified - - - - - - Occurrence - - - - - - - - - - - Indication - - - - - Dose - - - - - Dose Description - - - - - Dose Units - - - - - - Dose Form - - - - - - Dosing Frequency per Interval - - - - - - Intended Dose Regimen - - - - - Route of Administration - - - - - - Location of Procedure - - - - - - Laterality - - - - - - Directionality - - - - - - Portion or Totality - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Procedure - - - - - - - - - - End Date/Time of Procedure - - - - - Study Day of Start of Procedure - - - - - Study Day of End of Procedure - - - - - Duration of Procedure - - - - - Planned Time Point Name - - - - - - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Reported Name of Substance - - - - - - - - - - Modified Substance Name - - - - - Standardized Substance Name - - - - - Category for Substance Use - - - - - Subcategory for Substance Use - - - - - SU Pre-Specified - - - - - - SU Occurrence - - - - - - - - - - - Completion Status - - - - - - Reason Substance Use Not Collected - - - - - Substance Use Class - - - - - Substance Use Class Code - - - - - Substance Use Consumption - - - - - - - - - - Substance Use Consumption Text - - - - - Consumption Units - - - - - - Dose Form - - - - - Use Frequency Per Interval - - - - - - Total Daily Consumption - - - - - Route of Administration - - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Substance Use - - - - - End Date/Time of Substance Use - - - - - - - - - - Study Day of Start of Substance Use - - - - - Study Day of End of Substance Use - - - - - Duration of Substance Use - - - - - Start Relative to Reference Period - - - - - - End Relative to Reference Period - - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - - - - - - Reported Term for the Adverse Event - - - - - - - - - - Modified Reported Term - - - - - Lowest Level Term - - - - - - Lowest Level Term Code - - - - - - Dictionary-Derived Term - - - - - - Preferred Term Code - - - - - - High Level Term - - - - - - High Level Term Code - - - - - - High Level Group Term - - - - - - High Level Group Term Code - - - - - - Category for Adverse Event - - - - - - - - - - Subcategory for Adverse Event - - - - - Pre-Specified Adverse Event - - - - - - Body System or Organ Class - - - - - Body System or Organ Class Code - - - - - - Primary System Organ Class - - - - - - Primary System Organ Class Code - - - - - - Location of Event - - - - - - Severity/Intensity - - - - - - Serious Event - - - - - - - - - - - Action Taken with Study Treatment - - - - - - - - - - - Other Action Taken - - - - - Causality - - - - - - - - - - - Relationship to Non-Study Treatment - - - - - Pattern of Adverse Event - - - - - Outcome of Adverse Event - - - - - - - - - - - Involves Cancer - - - - - - Congenital Anomaly or Birth Defect - - - - - - Persist or Signif Disability/Incapacity - - - - - - - - - - - Results in Death - - - - - - - - - - - Requires or Prolongs Hospitalization - - - - - - - - - - - Is Life Threatening - - - - - - - - - - - Occurred with Overdose - - - - - - Other Medically Important Serious Event - - - - - - - - - - - Concomitant or Additional Trtmnt Given - - - - - - Standard Toxicity Grade - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Adverse Event - - - - - - - - - - End Date/Time of Adverse Event - - - - - - - - - - Study Day of Start of Adverse Event - - - - - Study Day of End of Adverse Event - - - - - Duration of Adverse Event - - - - - End Relative to Reference Period - - - - - - End Relative to Reference Time Point - - - - - - - - - - - End Reference Time Point - - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Reported Term for the Clinical Event - - - - - - - - - - Dictionary-Derived Term - - - - - Category for the Clinical Event - - - - - Subcategory for the Clinical Event - - - - - Clinical Event Pre-specified - - - - - - Clinical Event Occurrence - - - - - - Completion Status - - - - - - Reason Clinical Event Not Collected - - - - - Body System or Organ Class - - - - - Severity/Intensity - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Event Collection - - - - - Start Date/Time of Clinical Event - - - - - End Date/Time of Clinical Event - - - - - Study Day of Event Collection - - - - - Study Day of Start of Event - - - - - Study Day of End of Event - - - - - Start Relative to Reference Period - - - - - - End Relative to Reference Period - - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Reported Term for the Disposition Event - - - - - - - - - - Standardized Disposition Term - - - - - - - - - - Category for Disposition Event - - - - - - Subcategory for Disposition Event - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Start Date/Time of Disposition Event - - - - - - - - - - Study Day of Collection - - - - - Study Day of Start of Disposition Event - - - - - Sequence Number - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Protocol Deviation Term - - - - - Protocol Deviation Coded Term - - - - - Category for Protocol Deviation - - - - - Subcategory for Protocol Deviation - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Start Date/Time of Deviation - - - - - End Date/Time of Deviation - - - - - Study Day of Start of Deviation Event - - - - - Study Day of End of Observation - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Healthcare Encounter Term - - - - - - Dictionary-Derived Term - - - - - Category for Healthcare Encounter - - - - - - - - - - Subcategory for Healthcare Encounter - - - - - Pre-Specified Healthcare Encounter - - - - - - Healthcare Encounter Occurrence - - - - - - Completion Status - - - - - - Reason Healthcare Encounter Not Done - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Event Collection - - - - - - - - - - Start Date/Time of Healthcare Encounter - - - - - - - - - - End Date/Time of Healthcare Encounter - - - - - Study Day of Event Collection - - - - - Study Day of Start of Encounter - - - - - Study Day of End of Healthcare Encounter - - - - - Duration of Healthcare Encounter - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Reported Term for the Medical History - - - - - - - - - - Modified Reported Term - - - - - Dictionary-Derived Term - - - - - Medical History Event Date Type - - - - - - Category for Medical History - - - - - Subcategory for Medical History - - - - - - - - - - Medical History Event Pre-Specified - - - - - - Medical History Occurrence - - - - - - - - - - - Completion Status - - - - - - Reason Medical History Not Collected - - - - - Body System or Organ Class - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of History Collection - - - - - Start Date/Time of Medical History Event - - - - - End Date/Time of Medical History Event - - - - - Study Day of History Collection - - - - - End Relative to Reference Period - - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Short Name of Accountability Assessment - - - - - - Name of Accountability Assessment - - - - - - Category - - - - - Subcategory - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Result or Finding in Standard Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Sequence Number - - - - - Death Detail Assessment Short Name - - - - - - Death Detail Assessment Name - - - - - - Result or Finding as Collected - - - - - Character Result/Finding in Std Format - - - - - Result Category - - - - - Evaluator - - - - - - Date/Time of Collection - - - - - Study Day of Collection - - - - - Sponsor Device Identifier - - - - - Sequence Number - - - - - - Group ID - - - - - ECG Reference ID - - - - - Sponsor-Defined Identifier - - - - - ECG Test or Examination Short Name - - - - - - - - - - - ECG Test or Examination Name - - - - - - - Category for ECG - - - - - - - - - - Subcategory for ECG - - - - - ECG Position of Subject - - - - - - ECG Beat Number - - - - - Result or Finding in Original Units - - - - - - - - - - Original Units - - - - - - - - - - - Character Result/Finding in Std Format - - - - - - - Numeric Result/Finding in Standard Units - - - - - - Standard Units - - - - - - - Completion Status - - - - - - Reason ECG Not Done - - - - - ECG External File Path - - - - - Vendor Name - - - - - Method of Test or Examination - - - - - - Lead Location Used for Measurement - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Repetition Number - - - - - Visit Number - - - - - - Visit Name - - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - - Date/Time of ECG - - - - - - - - - - Study Day of ECG - - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - - Sponsor-Defined Identifier - - - - - Inclusion/Exclusion Criterion Short Name - - - - - - - Inclusion/Exclusion Criterion - - - - - - - - - - - Inclusion/Exclusion Category - - - - - - - Inclusion/Exclusion Subcategory - - - - - I/E Criterion Original Result - - - - - - I/E Criterion Result in Std Format - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Collection - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Immunogenicity Test/Exam Short Name - - - - - - Immunogenicity Test or Examination Name - - - - - - Category for Immunogenicity Test - - - - - Subcategory for Immunogenicity Test - - - - - Results or Findings in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Results/Findings in Std. Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Vendor Name - - - - - Specimen Type - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Lower Limit of Quantitation - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Sequence Number - - - - - - Group ID - - - - - Specimen ID - - - - - Sponsor-Defined Identifier - - - - - Lab Test or Examination Short Name - - - - - - - Lab Test or Examination Name - - - - - - - Category for Lab Test - - - - - Subcategory for Lab Test - - - - - Result or Finding in Original Units - - - - - - - - - - Original Units - - - - - - - - - - - Reference Range Lower Limit in Orig Unit - - - - - Reference Range Upper Limit in Orig Unit - - - - - Character Result/Finding in Std Format - - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Reference Range Lower Limit-Std Units - - - - - Reference Range Upper Limit-Std Units - - - - - Reference Range for Char Rslt-Std Units - - - - - Reference Result in Standard Format - - - - - Reference Range Indicator - - - - - - Completion Status - - - - - - - - - - - Reason Test Not Done - - - - - Vendor Name - - - - - - - - - - LOINC Code - - - - - Specimen Type - - - - - - Specimen Condition - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Fasting Status - - - - - - Derived Flag - - - - - - Toxicity - - - - - Standard Toxicity Grade - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Specimen Collection - - - - - - - - - - End Date/Time of Specimen Collection - - - - - Study Day of Specimen Collection - - - - - Study Day of End of Observation - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Focus of Study-Specific Interest - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Microbiology Test or Finding Short Name - - - - - - Microbiology Test or Finding Name - - - - - - Measurement, Test or Examination Detail - - - - - Category - - - - - Subcategory - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Result or Finding in Standard Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Result Category - - - - - Completion Status - - - - - - Reason Not Done - - - - - Laboratory/Vendor Name - - - - - LOINC Code - - - - - Specimen Material Type - - - - - - Specimen Condition - - - - - - Specimen Collection Location - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Fasting Status - - - - - - Derived Flag - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Non-host Organism ID - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Short Name of Assessment - - - - - - Name of Assessment - - - - - - Measurement, Test or Examination Detail - - - - - Agent Name - - - - - Modified Reported Name - - - - - Agent Concentration - - - - - Agent Concentration Units - - - - - - Category - - - - - Subcategory - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Result or Finding in Standard Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Normal/Reference Range Indicator - - - - - Result Category - - - - - - Completion Status - - - - - - Reason Not Done - - - - - External File Path - - - - - Laboratory/Vendor Name - - - - - LOINC Code - - - - - Specimen Material Type - - - - - - Specimen Condition - - - - - - Specimen Usability for the Test - - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Analysis Method - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Fasting Status - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Accepted Record Flag - - - - - - Lower Limit of Quantitation - - - - - Upper Limit of Quantitation - - - - - Repetition Number - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - End Date/Time of Observation - - - - - Study Day of Visit/Collection/Exam - - - - - Study Day of End of Observation - - - - - Duration - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Start Relative to Reference Period - - - - - - End Relative to Reference Period - - - - - - Evaluation Interval - - - - - Evaluation Interval Text - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Microscopic Examination Short Name - - - - - - Microscopic Examination Name - - - - - - Microscopic Examination Detail - - - - - - Category for Microscopic Finding - - - - - Subcategory for Microscopic Finding - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Result Category - - - - - Completion Status - - - - - - Reason Not Done - - - - - Laboratory/Vendor Name - - - - - Specimen Material Type - - - - - - Specimen Condition - - - - - - Specimen Collection Location - - - - - - Specimen Laterality within Subject - - - - - - Specimen Directionality within Subject - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Specimen Collection - - - - - Study Day of Specimen Collection - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Test or Examination Short Name - - - - - Test or Examination Name - - - - - Category for Test - - - - - Subcategory for Test - - - - - Position of Subject - - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Test Not Performed - - - - - External File Path - - - - - Vendor Name - - - - - Location Used for Measurement - - - - - - Specimen Laterality within Subject - - - - - - Specimen Directionality within Subject - - - - - - Portion or Totality - - - - - - Method of Procedure Test - - - - - - Analysis Method - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Test - - - - - Study Day of Test - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group - - - - - Short Name of Cardiovascular Test - - - - - - Name of Cardiovascular Test - - - - - - Category for Cardiovascular Test - - - - - Subcategory for Cardiovascular Test - - - - - Position of Subject During Observation - - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Test - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Short Name of Musculoskeletal Test - - - - - - Name of Musculoskeletal Test - - - - - - Category for Musculoskeletal Test - - - - - Subcategory for Musculoskeletal Test - - - - - Position of Subject - - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Focus of Study-Specific Interest - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group - - - - - Short Name of Nervous System Test - - - - - - Name of Nervous System Test - - - - - - Category for Nervous System Test - - - - - Subcategory for Nervous System Test - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Focus of Study-Specific Interest - - - - - - Sequence Number - - - - - Group ID - - - - - Link ID - - - - - Link Group - - - - - Short Name of Ophthalmic Test or Exam - - - - - - Name of Ophthalmic Test or Exam - - - - - - Ophthalmic Test or Exam Detail - - - - - Category for Ophthalmic Test or Exam - - - - - Subcategory for Ophthalmic Test or Exam - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Normal Range Lower Limit-Original Units - - - - - Normal Range Upper Limit-Original Units - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Normal Range Lower Limit-Standard Units - - - - - Normal Range Upper Limit-Standard Units - - - - - Normal Range for Character Results - - - - - Normal/Reference Range Indicator - - - - - - Result Category - - - - - Completion Status - - - - - - Reason Not Done - - - - - External File Path - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Portion or Totality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Accepted Record Flag - - - - - - Repetition Number - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Short Name of Reproductive Test - - - - - - Name of Reproductive Test - - - - - - Category for Reproductive Test - - - - - Subcategory for Reproductive Test - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Duration - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sponsor Device Identifier - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group - - - - - Short Name of Respiratory Test - - - - - - Name of Respiratory Test - - - - - - Category for Respiratory Test - - - - - Subcategory for Respiratory Test - - - - - Position of Subject During Observation - - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Reference Result in Original Units - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Character Reference Result - - - - - Numeric Reference Result in Std Units - - - - - Completion Status - - - - - - Reason Not Done - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Repetition Number - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Short Name of Urinary Test - - - - - - Name of Urinary Test - - - - - - Urinary Test Detail - - - - - Category for Urinary Test - - - - - Subcategory for Urinary Test - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Result Category - - - - - Completion Status - - - - - - Reason Not Done - - - - - Specimen Material Type - - - - - - Specimen Usability for the Test - - - - - - Location Used for the Measurement - - - - - - Laterality - - - - - - Directionality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Pharmacokinetic Test Short Name - - - - - - Pharmacokinetic Test Name - - - - - - Test Category - - - - - Test Subcategory - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - Completion Status - - - - - - - - - - - Reason Test Not Done - - - - - Vendor Name - - - - - Specimen Material Type - - - - - - Specimen Condition - - - - - - Method of Test or Examination - - - - - - Fasting Status - - - - - - Derived Flag - - - - - - Lower Limit of Quantitation - - - - - Upper Limit of Quantitation - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Specimen Collection - - - - - - - - - - End Date/Time of Specimen Collection - - - - - Actual Study Day of Specimen Collection - - - - - Study Day of End of Observation - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Point - - - - - Evaluation Interval - - - - - Sequence Number - - - - - Group ID - - - - - Parameter Short Name - - - - - - Parameter Name - - - - - - Parameter Category - - - - - Parameter Subcategory - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - Completion Status - - - - - - Reason Parameter Not Calculated - - - - - Specimen Material Type - - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Parameter Calculations - - - - - Study Day of Parameter Calculations - - - - - Date/Time of Reference Point - - - - - Planned Start of Assessment Interval - - - - - Planned End of Assessment Interval - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Body System Examined Short Name - - - - - - Body System Examined - - - - - - - - - - Modified Reported Term - - - - - Category for Examination - - - - - Subcategory for Examination - - - - - Body System or Organ Class - - - - - Verbatim Examination Finding - - - - - - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Completion Status - - - - - - Reason Not Examined - - - - - Location of Physical Exam Finding - - - - - - Laterality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Examination - - - - - - - - - - Study Day of Examination - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Short Name of Test - - - - - Name of Test - - - - - Category - - - - - - Subcategory - - - - - Position of Subject During Observation - - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Result or Finding in Standard Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - External File Path - - - - - Vendor Name - - - - - Method of Test - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Repetition Number - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Test - - - - - Study Day of Test - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Question Short Name - - - - - - Question Name - - - - - - - - - - Category of Question - - - - - - - - - - - Subcategory for Question - - - - - - - - - - Finding in Original Units - - - - - - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Performed - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Finding - - - - - - - - - - Study Day of Finding - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Evaluation Interval - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Assessment Short Name - - - - - - Assessment Name - - - - - - Category for Assessment - - - - - Subcategory - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Vendor Name - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Accepted Record Flag - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Assessment - - - - - Study Day of Assessment - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Evaluation Interval - - - - - Evaluation Interval Text - - - - - Start Relative to Reference Time Point - - - - - - Start Reference Time Point - - - - - End Relative to Reference Time Point - - - - - - End Reference Time Point - - - - - Sequence Number - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Subject Characteristic Short Name - - - - - - Subject Characteristic - - - - - - Category for Subject Characteristic - - - - - Subcategory for Subject Characteristic - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Performed - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Examination - - - - - Sequence Number - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Status Short Name - - - - - - Status Name - - - - - - Category for Assessment - - - - - Subcategory for Assessment - - - - - Result or Finding Original Result - - - - - Character Result/Finding in Std Format - - - - - - Completion Status - - - - - - Reason Assessment Not Performed - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Assessment - - - - - Study Day of Assessment - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group ID - - - - - Tumor/Lesion ID Short Name - - - - - - Tumor/Lesion ID Test Name - - - - - - Tumor/Lesion ID Result - - - - - Tumor/Lesion ID Result Std. Format - - - - - - Laboratory/Vendor Name - - - - - Location of the Tumor/Lesion - - - - - - Laterality - - - - - - Directionality - - - - - - Portion or Totality - - - - - - Method of Identification - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Accepted Record Flag - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Tumor/Lesion Identification - - - - - Study Day of Tumor/Lesion Identification - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Link ID - - - - - Link Group - - - - - Tumor/Lesion Assessment Short Name - - - - - - Tumor/Lesion Assessment Test Name - - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Laboratory/Vendor Name - - - - - Method Used to Identify the Tumor/Lesion - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Evaluator Identifier - - - - - - Accepted Record Flag - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Tumor/Lesion Measurement - - - - - Study Day of Tumor/Lesion Measurement - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Vital Signs Test Short Name - - - - - - - Vital Signs Test Name - - - - - - - - - - - Category for Vital Signs - - - - - - - - - - Subcategory for Vital Signs - - - - - Vital Signs Position of Subject - - - - - - Result or Finding in Original Units - - - - - - - - - - Original Units - - - - - - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Performed - - - - - Location of Vital Signs Measurement - - - - - - - - - - - Laterality - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Derived Flag - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Measurements - - - - - - - - - - Study Day of Vital Signs - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Sequence Number - - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Findings About Test Short Name - - - - - - Findings About Test Name - - - - - - Object of the Observation - - - - - - - - - - Category for Findings About - - - - - Subcategory for Findings About - - - - - Result or Finding in Original Units - - - - - - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Performed - - - - - Location of the Finding About - - - - - - Laterality - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - - - - - - Study Day of Collection - - - - - Sequence Number - - - - - Group ID - - - - - Reference ID - - - - - Sponsor-Defined Identifier - - - - - Skin Response Test or Exam Short Name - - - - - - Skin Response Test or Examination Name - - - - - - Object of the Observation - - - - - Category for Test - - - - - Subcategory for Test - - - - - Results or Findings in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Results/Findings in Std. Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Done - - - - - Vendor Name - - - - - Specimen Type - - - - - - Location Used for Measurement - - - - - - Laterality - - - - - - Method of Test or Examination - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Visit/Collection/Exam - - - - - Planned Time Point Name - - - - - Planned Time Point Number - - - - - Planned Elapsed Time from Time Point Ref - - - - - Time Point Reference - - - - - Date/Time of Reference Time Point - - - - - Planned Arm Code - - - - - Description of Planned Arm - - - - - Planned Order of Element within Arm - - - - - Element Code - - - - - Description of Element - - - - - Branch - - - - - Transition Rule - - - - - Epoch - - - - - - Element Code - - - - - Description of Element - - - - - Rule for Start of Element - - - - - Rule for End of Element - - - - - Planned Duration of Element - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Arm Code - - - - - Description of Planned Arm - - - - - Visit Start Rule - - - - - Visit End Rule - - - - - Sequence of Planned Assessment Schedule - - - - - Anchor Variable Name - - - - - Offset from the Anchor - - - - - Planned Assessment Interval - - - - - Planned Assessment Interval Minimum - - - - - Planned Assessment Interval Maximum - - - - - Maximum Number of Actual Assessments - - - - - Disease Milestone Type - - - - - Disease Milestone Definition - - - - - Disease Milestone Repetition Indicator - - - - - - Incl/Excl Criterion Short Name - - - - - - Inclusion/Exclusion Criterion - - - - - - Inclusion/Exclusion Category - - - - - - Inclusion/Exclusion Subcategory - - - - - Inclusion/Exclusion Criterion Rule - - - - - Protocol Criteria Versions - - - - - Sequence Number - - - - - Group ID - - - - - Trial Summary Parameter Short Name - - - - - - Trial Summary Parameter - - - - - - Parameter Value - - - - - Parameter Null Flavor - - - - - - Parameter Value Code - - - - - Name of the Reference Terminology - - - - - Version of the Reference Terminology - - - - - Identifying Variable - - - - - Identifying Variable Value - - - - - Relationship Type - - - - - - Relationship Identifier - - - - - Qualifier Variable Name - - - - - Qualifier Variable Label - - - - - Data Value - - - - - Origin - - - - - Evaluator - - - - - Pool Identifier - - - - - Related Subject or Pool Identifier - - - - - Subject Relationship - - - - - - Non-host Organism Identifier - - - - - Sequence Number - - - - - Non-host Organism ID Element Short Name - - - - - Non-host Organism ID Element Name - - - - - Non-host Organism ID Element Value - - - - - RFSTDTC - - - - - DFENDTC - - - - - RFSTDTCISO - - - - - Did the patient consent to biomarker samples? - - - - - - - - - - Did the patient consent to PK samples? - - - - - - - - - - Childbearing Potential - - - - - - - - - - Specify Other Race - - - - - - - - - - Were all eligibility criteria met? - - - - - - - - - - Weight (kg) - - - - - - - - - - Was the patient randomized into the study? - - - - - - - - - - Hypoxemia Range - - - - - - - - - - Eligibility Hematocrit - - - - - - - - - - Risk Group - - - - - - - - - - Did the patient receive all 3 doses of Study Drug? - - - - - - - - - - Indicate below, which of the three criteria were used for Inclusion number 3 - - - - - - - - - - Temperature < 36°C or > 38°C - - - - - - - - - - Please provide the temperature - - - - - - - - - - Temperature Unit - - - - - - - - - - Visit Not Done - - - - - - - - - - Heart rate > 90 beats/minute - - - - - - - - - - Please provide the heart rate (beats/minute) - - - - - - - - - - Respiratory rate >20 breaths/minute or arterial carbon dioxide tension <32 mmHg - - - - - - - - - - Please provide the value - - - - - - - - - - Please provide the unit - - - - - - - - - - White blood cell count >12,000 mm3, or <4,000 mm3, or >10% immature (band) forms - - - - - - - - - - Please select WBC or Bands value - - - - - Reason the 30 Day Visit was not done - - - - - - - - - - Please provide a final survival status of the patient at Day 30 - - - - - - - - - - At study end, what was the etiology of acute pancreatitis? - - - - - - - - - - If Other, Specify - - - - - - - - - - Please select WBC or Bands value - - - - - - - - - - ATC1 Code - - - - - ATC1 Text - - - - - - ATC1 Code - - - - - - ATC2 Code - - - - - - ATC2 Text - - - - - - ATC3 Code - - - - - - ATC3 Text - - - - - - ATC4 Code - - - - - - ATC4 Text - - - - - - Smoker - - - - - - - - - - Were all eligibility criteria met? - - - - - - - - - - USUBID - - - - - Specify Other Reason - - - - - - - - - - If the exact time of Discharge is unknown, please provide the range - - - - - - - - - - Was the patient discharged from the ICU? - - - - - Specify other Abdominal findings - - - - - - - - - - If yes to ERCP, specify - - - - - - - - - - Renal Replacement Therapy Type - - - - - - - - - - Other relevant procedures - - - - - - - - - - Other relevant procedures - - - - - - - - - - Sequence Number - - - - - Group ID - - - - - Sponsor-Defined Identifier - - - - - Findings About Test Short Name - - - - - Findings About Test Name - - - - - Object of the Observation - - - - - Category for Findings About - - - - - Subcategory for Findings About - - - - - Result or Finding in Original Units - - - - - Original Units - - - - - - Character Result/Finding in Std Format - - - - - Numeric Result/Finding in Standard Units - - - - - Standard Units - - - - - - Completion Status - - - - - - Reason Not Performed - - - - - Location of the Finding About - - - - - - Laterality - - - - - - Last Observation Before Exposure Flag - - - - - - Baseline Flag - - - - - - Evaluator - - - - - - Visit Number - - - - - Visit Name - - - - - Planned Study Day of Visit - - - - - Planned Order of Element within Arm - - - - - Epoch - - - - - - Date/Time of Collection - - - - - Study Day of Collection - - - - - Was the Screening Lipase used to determine eligibility? - - - - - - - - - - End Reference Time Point - - - - - SDTM-ETL mapping for DM.RFENDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXENDAT - - - - SDTM-ETL mapping for PC.PCSTRESN - - $PC.PCSTRESN = ''; - - - - SDTM-ETL mapping for PC.PCSTRESU - - $PC.PCSTRESU = ''; - - - - SDTM-ETL mapping for DM.RFXENDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXENDAT -# Generalized for all StudyEvents -$EXENDAT = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXENTIM -# Generalized for all StudyEvents -$EXENTIM = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENTIM']/@Value); -$DAT = latestdate($EXENDAT) ; -$TIM = $EXENTIM[last()]; - if($DAT != '' and $TIM != '') { -$DM.RFXENDTC = createdatetime($DAT,$TIM) ; -} - - - - SDTM-ETL mapping for PC.PCSTAT - - # Mapping using ODM element ItemData with ItemOID PC.PCSTAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCSTAT']/@Value); -if ($CODEDVALUE == 'X') { - $NEWCODEDVALUE = 'NOT DONE'; -} else { - $NEWCODEDVALUE = ''; -} -$PC.PCSTAT = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for DM.RFPENDTC - - # Mapping using ODM element ItemData with ItemOID ADM.ADMDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DATE = xpath(/StudyEventData/FormData/ItemGroupData/ItemData[@ItemOID='ADM.ADMDAT' or @ItemOID='AE.AESTDAT' or @ItemOID='AE.AEENDAT' or @ItemOID='CMINS.CMSTDAT' or @ItemOID='CMINS.CMENDAT' or @ItemOID='CMOPI.CMSTDAT' or @ItemOID='CMVAS.CMSTDAT' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT.DSDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='EG.EGDAT' or @ItemOID='EX.EXSTDAT' or @ItemOID='EX.EXENDAT' or @ItemOID='EXINT.INTDAT' or @ItemOID='EXINT.RESDAT' or @ItemOID='HOICU.HOSTDAT' or @ItemOID='HOREAD.HOSTDAT' or @ItemOID='LB.LBDAT' or @ItemOID='LB.LBBIODAT' or @ItemOID='LB.IL6_LBDAT' or @ItemOID='LB.NGAL_LBDAT' or @ItemOID='ML.MLSTDAT' or @ItemOID='PC.PCDAT' or @ItemOID='PE.PEDAT' or @ItemOID='PRCECT.PRDAT' or @ItemOID='QSMGCSI.QSDAT' or @ItemOID='QSPNRS.QSDAT' or @ItemOID='RN.RNUTCDAT' or @ItemOID='RN.RNDAT' or @ItemOID='SEPSIS.SEDAT' or @ItemOID='SV.SVSTDAT' or @ItemOID='VS.VSDAT' or @ItemOID='VSOXY.VSDAT']/@Value); -$DM.RFPENDTC = latestdate($DATE); - - - - SDTM-ETL mapping for DM.SITEID - - # Mapping using ODM element ItemData with ItemOID DSIC.SITENUM -$DM.SITEID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.SITENUM']/@Value); - - - - SDTM-ETL mapping for DM.AGE - - # Mapping using ODM element ItemData with ItemOID DMUNT.AGE -$DM.AGE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DMINT.FO']/ItemGroupData[@ItemGroupOID='DMINT.IG']/ItemData[@ItemOID='DMINT.AGE']/@Value); - - - - SDTM-ETL mapping for PC.VISITNUM - - # Mapping using ODM element ItemData with ItemOID PC.VISITID -# Generalized for all StudyEvents -$PC.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.VISITID']/@Value); - - - - SDTM-ETL mapping for DM.SEX - - # Mapping using ODM element ItemData with ItemOID DMUNT.SEX_DEC -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DMINT.FO']/ItemGroupData[@ItemGroupOID='DMINT.IG']/ItemData[@ItemOID='DMINT.SEX_DEC']/@Value); -if ($CODEDVALUE == 'Female') { - $NEWCODEDVALUE = 'F'; -} elsif ($CODEDVALUE == 'Male') { - $NEWCODEDVALUE = 'M'; -} else { - $NEWCODEDVALUE = 'NULL'; -} -$DM.SEX = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for PC.EPOCH - - # Mapping using ODM element ItemData with ItemOID PC.PCTIM -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$PCTIM = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCTIM']/@Value); - -# Mapping using ODM element ItemData with ItemOID PC.PCDAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$PCDAT = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCDAT']/@Value); - if($PCDAT != '' and $PCTIM != '') { -$PCDTC = createdatetime($PCDAT,$PCTIM); -} else { -$PCDTC = $PCDAT; -} -if($PCDTC = '' or $RFSTDTC = '') { -$PC.EPOCH = ''; -} elsif($PCDTC < $RFSTDTC) { -$PC.EPOCH = 'SCREENING'; -} elsif ($PCDTC > $RFENDTC) { -$PC.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $PCDTC and $PCDTC <= $RFENDTC) { -$PC.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for DM.RACE - - # Mapping using ODM element ItemData with ItemOID DM.RACE -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.RACE']/@Value); -# Using DECODED values for the SDTM codelist CL.cRACE -if ($CODEDVALUE == '1') { - $NEWCODEDVALUE = 'BLACK OR AFRICAN AMERICAN'; -} elsif ($CODEDVALUE == '5') { - $NEWCODEDVALUE = 'WHITE'; -} elsif ($CODEDVALUE == 'O') { - $NEWCODEDVALUE = 'OTHER / MULTIPLE'; -} elsif ($CODEDVALUE == '3') { - $NEWCODEDVALUE = 'ASIAN'; -} else { - $NEWCODEDVALUE = 'NULL'; -} -$DM.RACE = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for DM.ETHNIC - - # Mapping using ODM element ItemData with ItemOID DM.ETHNIC -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.ETHNIC']/@Value); -# Using DECODED values for the SDTM codelist CL.cETHNIC -if ($CODEDVALUE == '2') { - $NEWCODEDVALUE = 'NOT HISPANIC OR LATINO'; -} elsif ($CODEDVALUE == '1') { - $NEWCODEDVALUE = 'HISPANIC OR LATINO'; -} else { - $NEWCODEDVALUE = 'NULL'; -} -$DM.ETHNIC = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for DM.COUNTRY - - $DM.COUNTRY = 'USA'; - - - - SDTM-ETL mapping for DM.DMDTC - - $DM.DMDTC = $DM.RFICDTC; - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "PE"; - - - - SDTM-ETL mapping for DM.DMDY - - if($DM.DMDTC != '' and $DM.RFSTDTC != '') { -$DIFF = datediff($DM.DMDTC, $DM.RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$DM.DMDY = $NUM; -} elsif($NUM >= 0) { -$DM.DMDY = $NUM +1; -} else { -$DM.DMDY = ''; -} - - - - SDTM-ETL mapping for DM.BIOICRES - - # Mapping using ODM element ItemData with ItemOID DSIC.BIO_ICRES_DEC -$DM.BIOICRES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.BIO_ICRES_DEC']/@Value); - - - - PESEQ calculated - - $PE.PESEQ = $SEQUENCE; - - - - SDTM-ETL mapping for PE.PETESTCD - - # Mapping using ODM element ItemData with ItemOID PE.PEABDO_DEC - value from attribute ItemOID -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PEABDO_DEC' or @ItemOID='PE.PEABRT_DEC' or @ItemOID='PE.PEABBRU_DEC' or @ItemOID='PE.PEABBRF_DEC' or @ItemOID='PE.PEABNBS_DEC' or @ItemOID='PE.PEABOTH_DEC']/@ItemOID); - if($ITEM = 'PE.PEABDO_DEC') { -$PE.PETESTCD = 'ABDO'; -} elsif($ITEM = 'PE.PEABRT_DEC') { -$PE.PETESTCD = 'ABRT'; -} elsif($ITEM = 'PE.PEABBRU_DEC') { -$PE.PETESTCD = 'ABBRU'; -} elsif($ITEM = 'PE.PEABBRF_DEC') { -$PE.PETESTCD = 'ABBRF'; -} elsif($ITEM = 'PE.PEABNBS_DEC') { -$PE.PETESTCD = 'ABNBS'; -} elsif($ITEM = 'PE.PEABOTH_DEC') { -$PE.PETESTCD = 'ABOTH'; -} - - - - SDTM-ETL mapping for PE.PETEST - - # Mapping using ODM element ItemData with ItemOID PE.PEABDO_DEC - value from attribute ItemOID -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PEABDO_DEC' or @ItemOID='PE.PEABRT_DEC' or @ItemOID='PE.PEABBRU_DEC' or @ItemOID='PE.PEABBRF_DEC' or @ItemOID='PE.PEABNBS_DEC' or @ItemOID='PE.PEABOTH_DEC']/@ItemOID); - if($ITEM = 'PE.PEABDO_DEC') { -$PE.PETEST = 'Abdominal guarding'; -} elsif($ITEM = 'PE.PEABRT_DEC') { -$PE.PETEST = 'Abdominal rebound tenderness'; -} elsif($ITEM = 'PE.PEABBRU_DEC') { -$PE.PETEST = 'Cullens sign'; -} elsif($ITEM = 'PE.PEABBRF_DEC') { -$PE.PETEST = 'Bruising in the flanks'; -} elsif($ITEM = 'PE.PEABNBS_DEC') { -$PE.PETEST = 'Normoactive bowel sounds'; -} elsif($ITEM = 'PE.PEABOTH_DEC') { -$PE.PETEST = 'Other Abdominal findings'; -} - - - - SDTM-ETL mapping for DM.IEYN - - # Mapping using ODM element ItemData with ItemOID IE.IEYN_DEC -$DM.IEYN = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IEYN_DEC']/@Value); - - - - SDTM-ETL mapping for PE.PESTRESC - - $PE.PESTRESC = $PE.PEORRES; - - - - SDTM-ETL mapping for PE.VISITNUM - - # Mapping using ODM element ItemData with ItemOID PE.VISITID -$PE.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.VISITID']/@Value); - - - - SDTM-ETL mapping for PE.EPOCH - - # Mapping using ODM element ItemData with ItemOID PE.PEDAT -$PEDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PEDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID PE.PETIM -$PETIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PETIM']/@Value); - if($PEDAT != '' and $PETIM != '') { -$PEDTC = createdatetime($PEDAT,$PETIM); -} else { -$PEDTC = $PEDAT; -} -if($PEDTC = '' or $RFSTDTC = '') { -$PE.EPOCH = ''; -} elsif($PEDTC < $RFSTDTC) { -$PE.EPOCH = 'SCREENING'; -} elsif ($PEDTC > $RFENDTC) { -$PE.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $PEDTC and $PEDTC <= $RFENDTC) { -$PE.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for PE.PEDTC - - # Mapping using ODM element ItemData with ItemOID PE.PEDAT -$PEDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PEDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID PE.PETIM -$PETIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PETIM']/@Value); - if($PEDAT != '' and $PETIM != '') { -$PE.PEDTC = createdatetime($PEDAT,$PETIM); -} else { -$PE.PEDTC = $PEDAT; -} - - - - SDTM-ETL mapping for PE.PEDY - - if($PE.PEDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($PE.PEDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$PE.PEDY = $NUM; -} elsif($NUM >= 0) { -$PE.PEDY = $NUM +1; -} else { -$PE.PEDY = ''; -} - - - - SDTM-ETL mapping for DM.COMPLTYN - - # Mapping using ODM element ItemData with ItemOID DSET.DSCOMPLTYN_DEC -$DM.COMPLTYN = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSET.FO']/ItemGroupData[@ItemGroupOID='DSET.IG']/ItemData[@ItemOID='DSET.DSCOMPLTYN_DEC']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for DM.SIRSTEMP - - # Mapping using ODM element ItemData with ItemOID IE.SIRS_TEMPYN_DEC -$DM.SIRSTEMP = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.SIRS_TEMPYN_DEC']/@Value); - - - - DOMAIN from template - - $DOMAIN = "PR"; - - - - SDTM-ETL mapping for DM.TEMPORES - - # Mapping using ODM element ItemData with ItemOID IE.TEMP_SIRSORRES -$DM.TEMPORES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.TEMP_SIRSORRES']/@Value); - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for DM.TEMPUNIT - - # Mapping using ODM element ItemData with ItemOID IE.TEMP_SIRSOORESU_DEC -$DM.TEMPUNIT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.TEMP_SIRSOORESU_DEC']/@Value); - - - - SDTM-ETL mapping for PR.PRTRT - - # Mapping using ODM element ItemData with ItemOID PRCECT.PRCECTPT_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PR.PRTRT_DEBNEC' or @ItemOID='PR.PRTRT_ERCP' or @ItemOID='PR.PRTRT_ABDRA' or @ItemOID='PR.PRTRT_CHOL' or @ItemOID='PR.PRTRT_RRT' or @ItemOID='PR.PRTRT_ECMO' or @ItemOID='PR.PRTRT_HFLO' or @ItemOID='PR.PRTRT_INVMV' or @ItemOID='PR.PRTRT_LOFLO' or @ItemOID='PR.PRTRT_NINVMV' or @ItemOID='PR.PRTRT_TRACH' or @ItemOID='PR.PROTH1' or @ItemOID='PR.PROTH2' or @ItemOID='PR.PROTH3' or @ItemOID='PRCECT.PRCECTPT']/@ItemOID); - if($ITEM = 'PR.PRTRT_DEBNEC') { -$PR.PRTRT = 'Pancreatic Debridement / Necrosectomy'; -} elsif($ITEM = 'PR.PRTRT_ERCP') { -$PR.PRTRT = 'Endoscopic retrograde cholangiopancreatography (ERCP)'; -} elsif($ITEM = 'PR.PRTRT_ABDRA') { -$PR.PRTRT = 'Percutaneous insertion of abdominal drain'; -} elsif($ITEM = 'PR.PRTRT_CHOL') { -$PR.PRTRT = 'Cholecystectomy'; -} elsif($ITEM = 'PR.PRTRT_RRT') { -$PR.PRTRT = 'Renal Replacement Therapy'; -} elsif($ITEM = 'PR.PRTRT_ECMO') { -$PR.PRTRT = 'Extracorporeal membrane oxygenation (ECMO)'; -} elsif($ITEM = 'PR.PRTRT_HFLO') { -$PR.PRTRT = 'High flow supplemental oxygen using a high flow nasal cannula'; -} elsif($ITEM = 'PR.PRTRT_INVMV') { -$PR.PRTRT = 'Invasive Mechanical Ventilation'; -} elsif($ITEM = 'PR.PRTRT_LOFLO') { -$PR.PRTRT = 'Low flow supplemental oxygen'; -} elsif($ITEM = 'PR.PRTRT_NINVMV' ) { -$PR.PRTRT = 'Non-invasive Mechanical Ventilation (e.g., BIPAP, CPAP)'; -} elsif($ITEM = 'PR.PRTRT_TRACH') { -$PR.PRTRT = 'Tracheostomy inserted'; -} elsif($ITEM = 'PR.PROTH1' or $ITEM = 'PR.PROTH2' or $ITEM='PR.PROTH3') { -$PR.PRTRT = 'Other relevant procedures'; -} elsif($ITEM = 'PRCECT.PRCECTPT') { -$PR.PRTRT = 'Contrast-Enhanced Computer Tomography of Abdomen'; -} - - - - SDTM-ETL mapping for PR.PRCAT - - # Mapping using ODM element ItemData with ItemOID PR.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PR.PRCAT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PR.PAGENAME' or @ItemOID='PRCECT.PAGENAME']/@Value); - - - - SDTM-ETL mapping for DM.SIRSRR - - # Mapping using ODM element ItemData with ItemOID IE.SIRS_RRYN_DEC -$DM.SIRSRR = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.SIRS_RRYN_DEC']/@Value); - - - - SDTM-ETL mapping for DM.RRORRES - - # Mapping using ODM element ItemData with ItemOID IE.RR_SIRSORRES -$DM.RRORRES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.RR_SIRSORRES']/@Value); - - - - SDTM-ETL mapping for PR.VISITNUM - - # Mapping using ODM element ItemData with ItemOID PRCECT.VISITID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PR.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PR.VISITID' or @ItemOID='PRCECT.VISITID']/@Value); - - - - SDTM-ETL mapping for PR.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($PR.VISITNUM != "") { -$PR.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for DM.WBCORRES - - # Mapping using ODM element ItemData with ItemOID IE.WBC_SIRSORRES_DEC -$DM.WBCORRES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.WBC_SIRSORRES_DEC']/@Value); - - - - SDTM-ETL mapping for PR.PRSTDTC - - # Mapping using ODM element ItemData with ItemOID PRCECT.PRDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRDAT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.PRDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID PRCECT.STTIME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRTIM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.STTIME']/@Value); - if($PRDAT != '' and $PRTIM != '') { -$PR.PRSTDTC = createdatetime($PRDAT,$PRTIM); -} else { -$PR.PRSTDTC = $PRDAT; -} - - - - DOMAIN from template - - $DOMAIN = "SV"; - - - - SDTM-ETL mapping for PR.PRTPT - - # Mapping using ODM element ItemData with ItemOID PRCECT.PRCECTPT_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PR.PRTPT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.PRCECTPT_DEC']/@Value); - - - - SDTM-ETL mapping for SV.VISITNUM - - # Mapping using ODM element ItemData with ItemOID SV.VISITID -# Generalized for all StudyEvents -$SV.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='SV.FO']/ItemGroupData[@ItemGroupOID='SV.IG']/ItemData[@ItemOID='SV.VISITID']/@Value); - - - - SDTM-ETL mapping for SV.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); -$SV.VISIT = substring($VISIT,4); - - - - SDTM-ETL mapping for PR.PRSEPC1 - - # Mapping using ODM element ItemData with ItemOID PR.PRSEPC1 -# Generalized for all StudyEvents -$PR.PRSEPC1 = xpath(/StudyEventData/FormData[@FormOID='PR.FO']/ItemGroupData[@ItemGroupOID='PR.IG']/ItemData[@ItemOID='PR.PRSEPC1']/@Value); - - - - SDTM-ETL mapping for SV.SVENDTC - - # Mapping using ODM element ItemData with ItemOID ADM.ADMDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DATE = xpath(/StudyEventData/FormData/ItemGroupData/ItemData[@ItemOID='ADM.ADMDAT' or @ItemOID='AE.AESTDAT' or @ItemOID='AE.AEENDAT' or @ItemOID='CMINS.CMSTDAT' or @ItemOID='CMINS.CMENDAT' or @ItemOID='CMOPI.CMSTDAT' or @ItemOID='CMVAS.CMSTDAT' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT.DSDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='EG.EGDAT' or @ItemOID='EX.EXSTDAT' or @ItemOID='EX.EXENDAT' or @ItemOID='EXINT.INTDAT' or @ItemOID='EXINT.RESDAT' or @ItemOID='HOICU.HOSTDAT' or @ItemOID='HOREAD.HOSTDAT' or @ItemOID='LB.LBDAT' or @ItemOID='LB.LBBIODAT' or @ItemOID='LB.IL6_LBDAT' or @ItemOID='LB.NGAL_LBDAT' or @ItemOID='ML.MLSTDAT' or @ItemOID='PC.PCDAT' or @ItemOID='PE.PEDAT' or @ItemOID='PRCECT.PRDAT' or @ItemOID='QSMGCSI.QSDAT' or @ItemOID='QSPNRS.QSDAT' or @ItemOID='RN.RNUTCDAT' or @ItemOID='RN.RNDAT' or @ItemOID='SEPSIS.SEDAT' or @ItemOID='SV.SVSTDAT' or @ItemOID='VS.VSDAT' or @ItemOID='VSOXY.VSDAT']/@Value); -$SV.SVENDTC = latestdate($DATE); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "FA"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - FASEQ calculated - - $FA.FASEQ = $SEQUENCE; - - - - SDTM-ETL mapping for FA.FATESTCD - - # Mapping using ODM element ItemData with ItemOID SEPSIS.POX_SEORRES_DEC - value from attribute ItemOID -# Generalized for all Items within the ItemGroup -$ORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.POX_SEORRES_DEC' or @ItemOID='SEPSIS.MVENT_SEORRES_DEC' or @ItemOID='SEPSIS.PLAT_SEORRES_DEC' or @ItemOID='SEPSIS.TBILI_SEORRES_DEC' or @ItemOID='SEPSIS.VASO_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT1_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT2_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT3_SEORRES_DEC' or @ItemOID='SEPSIS.RRT_SEORRES_DEC']/@ItemOID); - if($ORRES ='SEPSIS.POX_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES ='SEPSIS.MVENT_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES = 'SEPSIS.PLAT_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES = 'SEPSIS.TBILI_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES ='SEPSIS.VASO_SEORRES_DEC') { -$FA.FAOFA.FATESTCDBJ = 'OCCUR'; -} elsif($ORRES ='SEPSIS.CREAT1_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES = 'SEPSIS.CREAT2_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES = 'SEPSIS.CREAT3_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ORRES ='SEPSIS.RRT_SEORRES_DEC') { -$FA.FATESTCD = 'OCCUR'; -} - - - - SDTM-ETL mapping for FA.FATEST - - $FA.FATEST = 'Occurrence'; - - - - SDTM-ETL mapping for FA.FAOBJ - - # Mapping using ODM element ItemData with ItemOID SEPSIS.POX_SEORRES_DEC - value from attribute ItemOID -# Generalized for all Items within the ItemGroup -$ORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.POX_SEORRES_DEC' or @ItemOID='SEPSIS.MVENT_SEORRES_DEC' or @ItemOID='SEPSIS.PLAT_SEORRES_DEC' or @ItemOID='SEPSIS.TBILI_SEORRES_DEC' or @ItemOID='SEPSIS.VASO_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT1_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT2_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT3_SEORRES_DEC' or @ItemOID='SEPSIS.RRT_SEORRES_DEC']/@ItemOID); - if($ORRES ='SEPSIS.POX_SEORRES_DEC') { -$FA.FAOBJ = 'PaO2/FiO2 &lt;=300 determined by arterial blood gas or imputed using pulse oximetry'; -} elsif($ORRES ='SEPSIS.MVENT_SEORRES_DEC') { -$FA.FAOBJ = 'The use of noninvasive or invasive mechanical ventilation'; -} elsif($ORRES = 'SEPSIS.PLAT_SEORRES_DEC') { -$FA.FAOBJ = 'Platelet count &lt; 100 x103/uL'; -} elsif($ORRES = 'SEPSIS.TBILI_SEORRES_DEC') { -$FA.FAOBJ = 'Total bilirubin >=2.0 mg/dL'; -} elsif($ORRES ='SEPSIS.VASO_SEORRES_DEC') { -$FA.FAOBJ = 'The use of vasopressor or inotropic support'; -} elsif($ORRES ='SEPSIS.CREAT1_SEORRES_DEC') { -$FA.FAOBJ = 'Serum creatinine >=1.9 mg/dL without preexisting chronic kidney disease'; -} elsif($ORRES = 'SEPSIS.CREAT2_SEORRES_DEC') { -$FA.FAOBJ = 'Serum creatinine >4.0 mg/dL with preexisting chronic kidney disease'; -} elsif($ORRES = 'SEPSIS.CREAT3_SEORRES_DEC') { -$FA.FAOBJ = 'Increase in serum creatinine >=300% after hospitalization for acute pancreatitis'; -} elsif($ORRES ='SEPSIS.RRT_SEORRES_DEC') { -$FA.FAOBJ = 'The initiation of renal replacement therapy'; -} - - - - SDTM-ETL mapping for FA.FACAT - - $FA.FACAT = 'Sepsis'; - - - - DOMAIN from template - - $DOMAIN = "EX"; - - - - SDTM-ETL mapping for FA.FASTRESC - - if($FA.FAORRES = 'Yes') { -$FA.FASTRESC = 'Y'; -} elsif($FA.FAORRES = 'No') { -$FA.FASTRESC = 'N'; -} - - - - EXSEQ calculated - - $EX.EXSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for FA.VISITNUM - - # Mapping using ODM element ItemData with ItemOID SEPSIS.VISITID -$FA.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.VISITID']/@Value); - - - - SDTM-ETL mapping for FA.FADTC - - # Mapping using ODM element ItemData with ItemOID SEPSIS.SEDAT -$FA.FADTC = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.SEDAT']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "CM"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - CMSEQ calculated - - $CM.CMSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for EX.EPOCH - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -# Generalized for all StudyEvents -$EXSTDAT = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -# Generalized for all StudyEvents -$EXSTTIM = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$EXSTDTC = createdatetime($EXSTDAT,$EXSTTIM); -} else { -$EXSTDTC = $EXSTDAT; -} -if($EXSTDTC = '') { -$EX.EPOCH = ''; -} elsif($EXSTDTC < $RFSTDTC) { -$EX.EPOCH = 'SCREENING'; -} elsif ($EXSTDTC > $RFENDTC) { -$EX.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $EXSTDTC and $EXSTDTC <= $RFENDTC) { -$EX.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for CM.CMDECOD - - # Mapping using ODM element ItemData with ItemOID PH.PREFERRED_NAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMDECOD = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.PREFERRED_NAME' or @ItemOID='CMINS.PREFERRED_NAME' or @ItemOID='CMOPI.PREFERRED_NAME' or @ItemOID='CMPH.PREFERRED_NAME' or @ItemOID='CMVAS.PREFERRED_NAME']/@Value); - - - - SDTM-ETL mapping for EX.EXSTDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -# Generalized for all StudyEvents -$EXSTDAT = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -# Generalized for all StudyEvents -$EXSTTIM = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$EX.EXSTDTC = createdatetime($EXSTDAT,$EXSTTIM); -} else { -$EX.EXSTDTC = $EXSTDAT; -} - - - - SDTM-ETL mapping for CM.CMCAT - - # Mapping using ODM element ItemData with ItemOID CMPH.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMCAT = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.PAGENAME' or @ItemOID='CMINS.PAGENAME' or @ItemOID='CMOPI.PAGENAME' or @ItemOID='CMPH.PAGENAME' or @ItemOID='CMVAS.PAGENAME']/@Value); - - - - SDTM-ETL mapping for CM.CMPRESP - - # Mapping using ODM element ItemData with ItemOID CMPH.CMTRT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [CM.CMTRT, CMINS.CMTRT, CMOPI.CMTRT, CMPH.CMTRT, CMVAS.CMTRT] to SDTM CodeList CM.CMPRESP -# with CodeList OID 'CL.C66742.NY' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMTRT' or @ItemOID='CMINS.CMTRT' or @ItemOID='CMOPI.CMTRT' or @ItemOID='CMPH.CMTRT' or @ItemOID='CMVAS.CMTRT']/@ItemOID); -if ($CODEDVALUE == 'CM.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMINS.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMOPI.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == 'CMPH.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMVAS.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$CM.CMPRESP = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for EX.EXSTDY - - $NUM = datediff($EX.EXSTDTC, $RFSTDTC); - if($NUM < 0) { -$EX.EXSTDY = $NUM; -} elsif($NUM >= 0) { -$EX.EXSTDY = $NUM +1; -} else { -$EX.EXSTDY = ''; -} - - - - SDTM-ETL mapping for EX.EXENDY - - $NUM = datediff($EX.EXENDTC, $RFSTDTC); - if($NUM < 0) { -$EX.EXENDY = $NUM; -} elsif($NUM >= 0) { -$EX.EXENDY = $NUM +1; -} else { -$EX.EXENDY = ''; -} - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for CM.CMCLAS - - # Mapping using ODM element ItemData with ItemOID PH.DRUG_NAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMCLAS = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.DRUG_NAME' or @ItemOID='CMINS.DRUG_NAME' or @ItemOID='CMOPI.DRUG_NAME' or @ItemOID='CMPH.DRUG_NAME' or @ItemOID='CMVAS.DRUG_NAME']/@Value); - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - SDTM-ETL mapping for CM.CMDOSE - - # Mapping using ODM element ItemData with ItemOID CMOPI.TOTALD_CMDOS -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$TOTALDOSE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.TOTALD_CMDOS' or @ItemOID='CMOPI.TOTALD_CMDOS']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.DAILY_CMDOS -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DOSE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMDOSE' or @ItemOID='CMOPI.DAILY_CMDOS' or @ItemOID='CMVAS.CMDOS']/@Value); - if($DOSE = '') { -$CM.CMDOSE = ''; -} elsif($DOSE != '' and $TOTALDOSE = 'Y') { -$CM.CMDOSE = ''; -} elsif($DOSE != '' and $TOTALDOSE = 'N') { -$CM.CMDOSE = $DOSE; -} - - - - SDTM-ETL mapping for AE.AESPID - - # Mapping using ODM element ItemData with ItemOID AE.AESPID -$AE.AESPID = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESPID']/@Value); - - - - SDTM-ETL mapping for AE.AETERM - - # Mapping using ODM element ItemData with ItemOID AE.AETERM -$AE.AETERM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AETERM']/@Value); - - - - SDTM-ETL mapping for CM.CMDOSTOT - - # Mapping using ODM element ItemData with ItemOID CMOPI.TOTALD_CMDOS -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$TOTALOPIINS = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.TOTALD_CMDOS' or @ItemOID='CMOPI.TOTALD_CMDOS']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.DAILY_CMDOS -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DOSEOPIINS = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMDOSE' or @ItemOID='CMOPI.DAILY_CMDOS']/@Value); - if($TOTALOPIINS = 'Y') { -$CM.CMDOSTOT = $DOSEOPIINS; -} - - - - SDTM-ETL mapping for CM.CMROUTE - - # Mapping using ODM element ItemData with ItemOID CMINS.CMROUTE_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CM.CMROUTE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMROUTE_DEC' or @ItemOID='CMINS.CMROUTE_DEC' or @ItemOID='CMOPI.CMROUTE_DEC' or @ItemOID='CMPH.CMROUTE_DEC' or @ItemOID='CMVAS.CMROUTE_DEC']/@Value); - - - - SDTM-ETL mapping for AE.AEDECOD - - # Mapping using ODM element ItemData with ItemOID AE.PT_TERM -$AE.AEDECOD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.PT_TERM']/@Value); - - - - SDTM-ETL mapping for CM.CMSTDTC - - # Mapping using ODM element ItemData with ItemOID CM.CMSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CMSTDAT = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMSTDAT' or @ItemOID='CMINS.CMSTDAT' or @ItemOID='CMOPI.CMSTDAT' or @ItemOID='CMVAS.CMSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.CMSTTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CMSTTIM = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMOPI.CMSTTIM']/@Value); - if($CMSTTIM != '') { -$CM.CMSTDTC = createdatetime($CMSTDAT,$CMSTTIM); -} else { -$CM.CMSTDTC = $CMSTDAT; -} - - - - SDTM-ETL mapping for AE.AEPTCD - - # Mapping using ODM element ItemData with ItemOID AE.PT_CODE -$AE.AEPTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.PT_CODE']/@Value); - - - - SDTM-ETL mapping for AE.AEHLT - - # Mapping using ODM element ItemData with ItemOID AE.HLT_TERM -$AE.AEHLT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLT_TERM']/@Value); - - - - SDTM-ETL mapping for AE.AEHLTCD - - # Mapping using ODM element ItemData with ItemOID AE.HLT_CODE -$AE.AEHLTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLT_CODE']/@Value); - - - - SDTM-ETL mapping for AE.AEHLGT - - # Mapping using ODM element ItemData with ItemOID AE.HLGT_TERM -$AE.AEHLGT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLGT_TERM']/@Value); - - - - SDTM-ETL mapping for CM.CMENRF - - # Mapping using ODM element ItemData with ItemOID CMINS.CMONGO -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CMONGO = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMONGO' or @ItemOID='CMINS.CMONGO' or @ItemOID='CMPH.CMONGO']/@Value); - -if($CMONGO != '' and $CMONGO != 'N' ) { -$CM.CMENRF = 'ONGOING'; -} elsif($CM.CMENDTC != '' and $CM.CMENDTC < $RFSTDTC) { -$CM.CMENRF = 'BEFORE'; -} elsif($CM.CMENDTC != '' and $CM.CMENDTC > $RFENDTC) { -$CM.CMENRF = 'AFTER'; -} elsif($CM.CMENDTC != '' and $RFSTDTC <= $CM.CMENDTC and $CM.CMENDTC < $RFENDTC) { -$CM.CMENRF = 'DURING'; -} elsif($CM.CMENDTC != '' and $RFSTDTC <= $CM.CMENDTC and $CM.CMENDTC = $RFENDTC) { -$CM.CMENRF = 'COINCIDENT'; -} else { -$CM.CMENRF = 'UNKNOWN'; -} - - - - SDTM-ETL mapping for CM.CMENRTPT - - # Mapping using ODM element ItemData with ItemOID CMINS.CMONGO -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CMONGO = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMONGO' or @ItemOID='CMINS.CMONGO' or @ItemOID='CMPH.CMONGO']/@Value); - -if($CMONGO != '' and $CMONGO != 'N' ) { -$CM.CMENRTPT = 'ONGOING'; -} - - - - SDTM-ETL mapping for AE.AECAT - - $AE.AECAT = 'Adverse Events'; - - - - SDTM-ETL mapping for AE.AEBODSYS - - # Mapping using ODM element ItemData with ItemOID AE.SOC_TERM -$AE.AEBODSYS = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_TERM']/@Value); - - - - SDTM-ETL mapping for CM.CODE1 - - # Mapping using ODM element ItemData with ItemOID CM.CODE1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CODE1 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE1' or @ItemOID='CMINS.CODE1' or @ItemOID='CMOPI.CODE1' or @ItemOID='CMPH.CODE1' or @ItemOID='CMVAS.CODE1']/@Value); - - - - SDTM-ETL mapping for CM.TEXT1 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT1 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT1' or @ItemOID='CMINS.TEXT1' or @ItemOID='CMOPI.TEXT1' or @ItemOID='CMPH.TEXT1' or @ItemOID='CMVAS.TEXT1']/@Value); - - - - SDTM-ETL mapping for CM.CODE2 - - # Mapping using ODM element ItemData with ItemOID CM.CODE1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CODE2 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE2' or @ItemOID='CMINS.CODE2' or @ItemOID='CMOPI.CODE2' or @ItemOID='CMPH.CODE2' or @ItemOID='CMVAS.CODE2']/@Value); - - - - SDTM-ETL mapping for AE.AESOCCD - - # Mapping using ODM element ItemData with ItemOID AE.SOC_CODE -$AE.AESOCCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_CODE']/@Value); - - - - SDTM-ETL mapping for CM.TEXT2 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT2 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT2' or @ItemOID='CMINS.TEXT2' or @ItemOID='CMOPI.TEXT2' or @ItemOID='CMPH.TEXT2' or @ItemOID='CMVAS.TEXT2']/@Value); - - - - SDTM-ETL mapping for AE.AESEV - - # Mapping using ODM element ItemData with ItemOID AE.AESEV_DEC -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESEV = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESEV_DEC']/@Value); - - - - SDTM-ETL mapping for CM.CODE3 - - # Mapping using ODM element ItemData with ItemOID CM.CODE1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CODE3 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE3' or @ItemOID='CMINS.CODE3' or @ItemOID='CMOPI.CODE3' or @ItemOID='CMPH.CODE3' or @ItemOID='CMVAS.CODE3']/@Value); - - - - SDTM-ETL mapping for AE.AESER - - # Mapping using ODM element ItemData with ItemOID AE.AESER -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESER = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESER']/@Value); - - - - SDTM-ETL mapping for CM.TEXT3 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT3 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT3' or @ItemOID='CMINS.TEXT3' or @ItemOID='CMOPI.TEXT3' or @ItemOID='CMPH.TEXT3' or @ItemOID='CMVAS.TEXT3']/@Value); - - - - SDTM-ETL mapping for AE.AEREL - - # Mapping using ODM element ItemData with ItemOID AE.AEREL -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEREL']/@Value); -# Using DECODED values for the SDTM codelist CL.cREL -if ($CODEDVALUE == 'REL2') { - $NEWCODEDVALUE = 'Unlikely'; -} elsif ($CODEDVALUE == 'REL3') { - $NEWCODEDVALUE = 'Possible'; -} elsif ($CODEDVALUE == 'REL1') { - $NEWCODEDVALUE = 'Unrelated'; -} elsif ($CODEDVALUE == 'REL4') { - $NEWCODEDVALUE = 'Probable'; -} else { - $NEWCODEDVALUE = ''; -} -$AE.AEREL = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for CM.TEXT4 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT4 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT4' or @ItemOID='CMINS.TEXT4' or @ItemOID='CMOPI.TEXT4' or @ItemOID='CMPH.TEXT4' or @ItemOID='CMVAS.TEXT4']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for AE.AESCONG - - # Mapping using ODM element ItemData with ItemOID AE.AESCONG -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESCONG = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESCONG']/@Value); - - - - SDTM-ETL mapping for AE.AESDISAB - - # Mapping using ODM element ItemData with ItemOID AE.AESDISAB -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESDISAB = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESDISAB']/@Value); - - - - SDTM-ETL mapping for AE.AESDTH - - # Mapping using ODM element ItemData with ItemOID AE.AESDTH -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESDTH = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESDTH']/@Value); - - - - SDTM-ETL mapping for AE.AESHOSP - - # Mapping using ODM element ItemData with ItemOID AE.AESHOSPR -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AESHOSPR = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESHOSPR']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AESHOSPP -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AESHOSPP = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESHOSPP']/@Value); - if($AESHOSPR = 'Y' or $AESHOSPP = 'Y') { -$AE.AESHOSP = 'Y'; -} else { -$AE.AESHOSP = 'N'; -} - - - - SDTM-ETL mapping for CE.CETERM - - # Mapping using ODM element ItemData with ItemOID AECOM.CARDARRE -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AECOM.FO']/ItemGroupData[@ItemGroupOID='AECOM.IG']/ItemData[@ItemOID='AECOM.CARDARRE' or @ItemOID='AECOM.CARDARRH' or @ItemOID='AECOM.CARDISCH' or @ItemOID='AECOM.CHF' or @ItemOID='AECOM.HYPERG' or @ItemOID='AECOM.HYPOG' or @ItemOID='AECOM.ABCOMS' or @ItemOID='AECOM.GASTRO' or @ItemOID='AECOM.GIISCH' or @ItemOID='AECOM.TRANSAM' or @ItemOID='AECOM.ANEMIA' or @ItemOID='AECOM.ATHROM' or @ItemOID='AECOM.COAG' or @ItemOID='AECOM.VTHROM' or @ItemOID='AECOM.CARDITIS' or @ItemOID='AECOM.MENING' or @ItemOID='AECOM.RHABDOMY' or @ItemOID='AECOM.CHEM' or @ItemOID='AECOM.SEIZURE' or @ItemOID='AECOM.STROKE' or @ItemOID='AECOM.PERIE' or @ItemOID='AECOM.PLEFFUS' or @ItemOID='AECOM.PNEUMOT' or @ItemOID='AECOM.PULME' or @ItemOID='AECOM.ARI']/@ItemOID); - if($ITEM='AECOM.CARDARRE' ) { -$CE.CETERM = 'Cardiac arrest'; -} elsif($ITEM='AECOM.CARDARRH' ) { -$CE.CETERM = 'Cardiac arrhythmia'; -} elsif ($ITEM='AECOM.CARDISCH' ) { -$CE.CETERM = 'Cardiac ischaemia'; -} elsif ($ITEM='AECOM.CHF' ) { -$CE.CETERM = 'Congestive heart failure'; -} elsif ($ITEM='AECOM.HYPERG' ){ -$CE.CETERM = 'Hyperglycemia'; -}elsif ($ITEM='AECOM.HYPOG') { -$CE.CETERM = 'Hypoglycemia'; -} elsif ($ITEM='AECOM.ABCOMS' ) { -$CE.CETERM = 'Abdominal Compartment Syndrome'; -} elsif ($ITEM='AECOM.GASTRO' ) { -$CE.CETERM = 'Gastrointestinal hemorrhage'; -} elsif ($ITEM='AECOM.GIISCH' ) { -$CE.CETERM = 'Gastrointestinal ischemia'; -} elsif ($ITEM='AECOM.TRANSAM') { -$CE.CETERM = 'Transaminitis'; -} elsif ($ITEM='AECOM.ANEMIA' ) { -$CE.CETERM = 'Anemia'; -} elsif ($ITEM='AECOM.ATHROM' ) { -$CE.CETERM = 'Arterial Thrombosis'; -} elsif ($ITEM='AECOM.COAG' ) { -$CE.CETERM = 'Disseminated Intravascular Coagulation'; -} elsif ($ITEM='AECOM.VTHROM' ) { -$CE.CETERM = 'Venous Thrombosis'; -} elsif ($ITEM='AECOM.CARDITIS' ) { -$CE.CETERM = 'Endocarditis / Myocarditis / Pericarditis'; -} elsif ($ITEM='AECOM.MENING') { -$CE.CETERM = 'Meningitis / Encephalitis'; -} elsif ($ITEM='AECOM.RHABDOMY' ) { -$CE.CETERM = 'Rhabdomyolysis / Myositis'; -} elsif ($ITEM='AECOM.CHEM' ) { -$CE.CETERM = 'Cerebral Hemorrhage'; -} elsif ($ITEM='AECOM.SEIZURE' ) { -$CE.CETERM = 'Seizure'; -} elsif ($ITEM='AECOM.STROKE' ) { -$CE.CETERM = 'Stroke / Cerebrovascular accident'; -} elsif ($ITEM='AECOM.PERIE' ) { -$CE.CETERM = 'Peripheral Embolism'; -} elsif ($ITEM='AECOM.PLEFFUS' ) { -$CE.CETERM = 'Pleural effusion'; -} elsif ($ITEM='AECOM.PNEUMOT' ) { -$CE.CETERM = 'Pneumothorax'; -} elsif ($ITEM='AECOM.PULME') { -$CE.CETERM = 'Pulmonary Embolism'; -} elsif ($ITEM='AECOM.ARI') { -$CE.CETERM = 'Acute renal injury/ Acute renal failure'; -} - - - - SDTM-ETL mapping for AE.AESMIE - - # Mapping using ODM element ItemData with ItemOID AE.AESMIE -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESMIE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESMIE']/@Value); - - - - SDTM-ETL mapping for CE.CESCAT - - $CE.CESCAT = 'Between Randomization and Day 30'; - - - - SDTM-ETL mapping for AE.EPOCH - - # Mapping using ODM element ItemData with ItemOID AE.AESTDAT -$AESTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AESTTIM -$AESTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTTIM']/@Value); - if($AESTDAT != '' and $AESTTIM = '') { -$AESTDTC = createdatetime($AESTDAT,$AESTTIM); -} else { -$AESTDTC = $AESTDAT; -} -if($AESTDTC = '') { -$AE.EPOCH = ''; -} elsif($AESTDTC < $RFSTDTC) { -$AE.EPOCH = 'SCREENING'; -} elsif ($AESTDTC > $RFENDTC) { -$AE.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $AESTDTC and $AESTDTC <= $RFENDTC) { -$AE.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for AE.AESTDTC - - # Mapping using ODM element ItemData with ItemOID AE.AESTDAT -$AESTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AESTTIM -$AESTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTTIM']/@Value); - if($AESTDAT != '' and $AESTTIM != '') { -$AE.AESTDTC = createdatetime($AESTDAT,$AESTTIM); -} else { -$AE.AESTDTC = $AESTDAT; -} - - - - SDTM-ETL mapping for AE.AEENDTC - - # Mapping using ODM element ItemData with ItemOID AE.AEENDAT -$AEENDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEENDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AEENTIM -$AEENTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEENTIM']/@Value); - if($AEENDAT != '' and $AEENTIM != '') { -$AE.AEENDTC = createdatetime($AEENDAT,$AEENTIM); -} else { -$AE.AEENDTC = $AEENDAT; -} - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "ML"; - - - - SDTM-ETL mapping for AE.AESTDY - - $NUM = datediff($AE.AESTDTC, $RFSTDTC); - if($NUM < 0) { -$AE.AESTDY = $NUM; -} elsif($NUM >= 0) { -$AE.AESTDY = $NUM +1; -} else { -$AE.AESTDY = ''; -} - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for AE.AEENDY - - if($AE.AEENDTC != '') { -$DIFF = datediff($AE.AEENDTC, $RFSTDTC); -} -$NUM = number($DIFF); - if($NUM < 0) { -$AE.AEENDY = $NUM; -} elsif($NUM >= 0) { -$AE.AEENDY = $NUM +1; -} else { -$AE.AEENDY = ''; -} - - - - MLSEQ calculated - - $ML.MLSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for ML.MLTRT - - # Mapping using ODM element ItemData with ItemOID ML.MLSTDAT - value from attribute ItemOID -# Generalized for all StudyEvents -$ITEM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLDOSE_DEC']/@ItemOID); - if($ITEM = 'ML.MLDOSE_DEC') { -$ML.MLTRT = 'MEAL'; -} - - - - SDTM-ETL mapping for AE.AEENRTPT - - # Mapping using ODM element ItemData with ItemOID AE.AEONGO -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AEONGO = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEONGO']/@Value); -if($AEONGO != '') { -$AE.AEENRTPT = 'ONGOING'; -} - - - - SDTM-ETL mapping for AE.AEENTPT - - # Mapping using ODM element ItemData with ItemOID AE.AEONGO -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AEONGO = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEONGO']/@Value); -if($AEONGO != '') { -$AE.AEENTPT = 'Safety and Mortality Follow-up'; -} - - - - SDTM-ETL mapping for ML.MLDOSTXT - - # Mapping using ODM element ItemData with ItemOID ML.MLDOSE_DEC -# Generalized for all StudyEvents -$ML.MLDOSTXT = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLDOSE_DEC']/@Value); - - - - SDTM-ETL mapping for ML.VISITNUM - - # Mapping using ODM element ItemData with ItemOID ML.VISITID -# Generalized for all StudyEvents -$ML.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.VISITID']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "MH"; - - - - SDTM-ETL mapping for ML.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($ML.VISITNUM != "") { -$ML.VISIT = substring($VISIT,4); -} - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - SDTM-ETL mapping for ML.EPOCH - - # Mapping using ODM element ItemData with ItemOID ML.MLSTDAT -# Generalized for all StudyEvents -$DAT = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID ML.MLSTTIM -# Generalized for all StudyEvents -$TIM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLSTTIM']/@Value); - if($DAT != '' and $TIM != '') { -$MLSTDTC = createdatetime($DAT,$TIM); -} else { -$MLSTDTC = $DAT; -} -if($MLSTDTC = '' or $RFSTDTC = '') { -$ML.EPOCH = ''; -} elsif($MLSTDTC < $RFSTDTC) { -$ML.EPOCH = 'SCREENING'; -} elsif ($MLSTDTC > $RFENDTC) { -$ML.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $MLSTDTC and $MLSTDTC <= $RFENDTC) { -$ML.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for ML.MLSTDTC - - # Mapping using ODM element ItemData with ItemOID ML.MLSTDAT -# Generalized for all StudyEvents -$DAT = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID ML.MLSTTIM -# Generalized for all StudyEvents -$TIM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLSTTIM']/@Value); - if($DAT != '' and $TIM != '') { -$ML.MLSTDTC = createdatetime($DAT,$TIM); -} else { -$ML.MLSTDTC = $DAT; -} - - - - SDTM-ETL mapping for ML.MLSTDY - - if($ML.MLSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($ML.MLSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$ML.MLSTDY = $NUM; -} elsif($NUM >= 0) { -$ML.MLSTDY = $NUM +1; -} else { -$ML.MLSTDY = ''; -} - - - - SDTM-ETL mapping for MH.MHTERM - - # Mapping using ODM element ItemData with ItemOID MH.AA_MHOCCUR -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$MHOCCUR = xpath(/StudyEventData/FormData[@FormOID='MH.FO']/ItemGroupData/ItemData[@ItemOID='MH.AA_MHOCCUR' or @ItemOID='MH.ACPU_MHOCCUR' or @ItemOID='MH.CAF_MHOCCUR' or @ItemOID='MH.CHF_MHOCCUR' or @ItemOID='MH.CAD_MHOCCUR' or @ItemOID='MH.HDC_MHOCCUR' or @ItemOID='MH.HYPERT_MHOCCUR' or @ItemOID='MH.IDU_MHOCCUR' or @ItemOID='MH.LVH_MHOCCUR' or @ItemOID='MH.PAF_MHOCCUR' or @ItemOID='MH.PVD_MHOCCUR' or @ItemOID='MH.RHEU_MHOCCUR' or @ItemOID='MH.DIAB_MHOCCUR' or @ItemOID='MH.HYPERC_MHOCCUR' or @ItemOID='MH.HYPERL_MHOCCUR' or @ItemOID='MH.HYPERTH_MHOCCUR' or @ItemOID='MH.HYPERTR_MHOCCUR' or @ItemOID='MH.HYPOTHY_MHOCCUR' or @ItemOID='MH.OBESE_MHOCCUR' or @ItemOID='MH.CHOLEC_MHOCCUR' or @ItemOID='MH.CHOLE_MHOCCUR' or @ItemOID='MH.GERD_MHOCCUR' or @ItemOID='MH.HEPCIR_MHOCCUR' or @ItemOID='MH.PRIORAP_MHOCCUR' or @ItemOID='MH.CHD_MHOCCUR' or @ItemOID='MH.LIVD_MHOCCUR' or @ItemOID='MH.HEPB_MHOCCUR' or @ItemOID='MH.HEPC_MHOCCUR' or @ItemOID='MH.ACVD_MHOCCUR' or @ItemOID='MH.DEM_MHOCCUR' or @ItemOID='MH.DEP_MHOCCUR' or @ItemOID='MH.NEO_MHOCCUR' or @ItemOID='MH.ASTH_MHOCCUR' or @ItemOID='MH.COPD_MHOCCUR' or @ItemOID='MH.OSAS_MHOCCUR' or @ItemOID='MH.COVID_MHOCCUR' or @ItemOID='MH.PF_MHOCCUR' or @ItemOID='MH.CKD_MHOCCUR' or @ItemOID='MH.ALCO_MHOCCUR' or @ItemOID='MH.SMO_MHOCCUR'or @ItemOID='MH.ANEMIA_MHOCCUR' or @ItemOID='MH.TRANS_MHOCCUR']/@ItemOID); - if($MHOCCUR = 'MH.AA_MHOCCUR') { -$MH.MHTERM = 'Aortic aneurysm'; -} elsif($MHOCCUR = 'MH.ACPU_MHOCCUR') { -$MH.MHTERM = 'Artificial cardiac pacemaker user'; -} elsif($MHOCCUR = 'MH.CAF_MHOCCUR') { -$MH.MHTERM = 'Chronic atrial fibrillation'; -} elsif($MHOCCUR = 'MH.CHF_MHOCCUR') { -$MH.MHTERM = 'Congestive heart failure'; -} elsif($MHOCCUR = 'MH.CAD_MHOCCUR') { -$MH.MHTERM = 'Coronary artery disease'; -} elsif($MHOCCUR = 'MH.HDC_MHOCCUR') { -$MH.MHTERM = 'Heart disease congenital'; -} elsif($MHOCCUR = 'MH.HYPERT_MHOCCUR') { -$MH.MHTERM = 'Hypertension'; -} elsif($MHOCCUR = 'MH.IDU_MHOCCUR') { -$MH.MHTERM = 'Implantable defibrillator user'; -} elsif($MHOCCUR = 'MH.LVH_MHOCCUR') { -$MH.MHTERM = 'Left ventricular hypertrophy'; -} elsif($MHOCCUR = 'MH.PAF_MHOCCUR') { -$MH.MHTERM = 'Paroxysmal atrial fibrillation'; -} elsif($MHOCCUR = 'MH.PVD_MHOCCUR') { -$MH.MHTERM = 'Peripheral vascular disease'; -} elsif($MHOCCUR = 'MH.RHEU_MHOCCUR') { -$MH.MHTERM = 'Rheumatic disorder'; -} elsif($MHOCCUR = 'MH.DIAB_MHOCCUR') { -$MH.MHTERM = 'Diabetes'; -} elsif($MHOCCUR = 'MH.HYPERC_MHOCCUR') { -$MH.MHTERM = 'Hypercholesterolemia'; -} elsif($MHOCCUR = 'MH.HYPERL_MHOCCUR') { -$MH.MHTERM = 'Hyperlipidemia'; -} elsif($MHOCCUR = 'MH.HYPERTH_MHOCCUR') { -$MH.MHTERM = 'Hyperthyroidism'; -} elsif($MHOCCUR = 'MH.HYPERTR_MHOCCUR') { -$MH.MHTERM = 'Hypertriglyceridemia'; -} elsif($MHOCCUR = 'MH.HYPOTHY_MHOCCUR') { -$MH.MHTERM = 'Hypothyroidism'; -} elsif($MHOCCUR = 'MH.OBESE_MHOCCUR') { -$MH.MHTERM = 'Obesity'; -} elsif($MHOCCUR = 'MH.CHOLEC_MHOCCUR') { -$MH.MHTERM = 'Cholecystitis'; -} elsif($MHOCCUR = 'MH.CHOLE_MHOCCUR') { -$MH.MHTERM = 'Cholelithiasis'; -} elsif($MHOCCUR = 'MH.GERD_MHOCCUR') { -$MH.MHTERM = 'Gastroesophageal reflux disease (GERD)'; -} elsif($MHOCCUR = 'MH.HEPCIR_MHOCCUR') { -$MH.MHTERM = 'Hepatic Cirrhosis'; -} elsif($MHOCCUR = 'MH.PRIORAP_MHOCCUR') { -$MH.MHTERM = 'Prior Episode of Acute Pancreatitis'; -} elsif($MHOCCUR = 'MH.CHD_MHOCCUR') { -$MH.MHTERM = 'Chronic hematologic disease'; -} elsif($MHOCCUR = 'MH.LIVD_MHOCCUR') { -$MH.MHTERM = 'Chronic liver disease'; -} elsif($MHOCCUR = 'MH.HEPB_MHOCCUR') { -$MH.MHTERM = 'Hepatitis B'; -} elsif($MHOCCUR = 'MH.HEPC_MHOCCUR') { -$MH.MHTERM = 'Hepatitis C'; -} elsif($MHOCCUR = 'MH.ACVD_MHOCCUR') { -$MH.MHTERM = 'Cerebral atherosclerosis'; -} elsif($MHOCCUR = 'MH.DEM_MHOCCUR') { -$MH.MHTERM = 'Dementia'; -} elsif($MHOCCUR = 'MH.DEP_MHOCCUR') { -$MH.MHTERM = 'Depression'; -} elsif($MHOCCUR = 'MH.NEO_MHOCCUR') { -$MH.MHTERM = 'Neoplasm malignant'; -} elsif($MHOCCUR = 'MH.ASTH_MHOCCUR') { -$MH.MHTERM = 'Asthma'; -} elsif($MHOCCUR = 'MH.COPD_MHOCCUR') { -$MH.MHTERM = 'Chronic obstructive pulmonary disease'; -} elsif($MHOCCUR = 'MH.OSAS_MHOCCUR') { -$MH.MHTERM = 'Obstructive sleep apnea syndrome'; -} elsif($MHOCCUR = 'MH.COVID_MHOCCUR') { -$MH.MHTERM = 'Positive COVID-19 Test'; -} elsif($MHOCCUR = 'MH.PF_MHOCCUR') { -$MH.MHTERM = 'Pulmonary fibrosis'; -} elsif($MHOCCUR = 'MH.CKD_MHOCCUR') { -$MH.MHTERM = 'Chronic kidney disease'; -} elsif($MHOCCUR = 'MH.ALCO_MHOCCUR') { -$MH.MHTERM = 'Alcohol Use Disorder'; -} elsif($MHOCCUR = 'MH.SMO_MHOCCUR') { -$MH.MHTERM = 'Smoker'; -} elsif($MHOCCUR = 'MH.ANEMIA_MHOCCUR') { -$MH.MHTERM = 'Anemia'; -} elsif($MHOCCUR = 'MH.TRANS_MHOCCUR') { -$MH.MHTERM = 'Transaminitis'; -} - - - - SDTM-ETL mapping for MH.MHDECOD - - $MH.MHDECOD = $MH.MHTERM; - - - - SDTM-ETL mapping for MH.MHCAT - - $MH.MHCAT = 'General Medical History'; - - - - DOMAIN from template - - $DOMAIN = "FA"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for MH.MHPRESP - - $MH.MHPRESP = 'Y'; - - - - FASEQ calculated - - $FA.FASEQ = $SEQUENCE; - - - - SDTM-ETL mapping for MH.MHOCCUR - - # Mapping using ODM element ItemData with ItemOID MH.AA_MHOCCUR -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$MHOCCUR = xpath(/StudyEventData/FormData[@FormOID='MH.FO']/ItemGroupData/ItemData[@ItemOID='MH.AA_MHOCCUR' or @ItemOID='MH.ACPU_MHOCCUR' or @ItemOID='MH.CAF_MHOCCUR' or @ItemOID='MH.CHF_MHOCCUR' or @ItemOID='MH.CAD_MHOCCUR' or @ItemOID='MH.HDC_MHOCCUR' or @ItemOID='MH.HYPERT_MHOCCUR' or @ItemOID='MH.IDU_MHOCCUR' or @ItemOID='MH.LVH_MHOCCUR' or @ItemOID='MH.PAF_MHOCCUR' or @ItemOID='MH.PVD_MHOCCUR' or @ItemOID='MH.RHEU_MHOCCUR' or @ItemOID='MH.DIAB_MHOCCUR' or @ItemOID='MH.HYPERC_MHOCCUR' or @ItemOID='MH.HYPERL_MHOCCUR' or @ItemOID='MH.HYPERTH_MHOCCUR' or @ItemOID='MH.HYPERTR_MHOCCUR' or @ItemOID='MH.HYPOTHY_MHOCCUR' or @ItemOID='MH.OBESE_MHOCCUR' or @ItemOID='MH.CHOLEC_MHOCCUR' or @ItemOID='MH.CHOLE_MHOCCUR' or @ItemOID='MH.GERD_MHOCCUR' or @ItemOID='MH.HEPCIR_MHOCCUR' or @ItemOID='MH.PRIORAP_MHOCCUR' or @ItemOID='MH.CHD_MHOCCUR' or @ItemOID='MH.LIVD_MHOCCUR' or @ItemOID='MH.HEPB_MHOCCUR' or @ItemOID='MH.HEPC_MHOCCUR' or @ItemOID='MH.ACVD_MHOCCUR' or @ItemOID='MH.DEM_MHOCCUR' or @ItemOID='MH.DEP_MHOCCUR' or @ItemOID='MH.NEO_MHOCCUR' or @ItemOID='MH.ASTH_MHOCCUR' or @ItemOID='MH.COPD_MHOCCUR' or @ItemOID='MH.OSAS_MHOCCUR' or @ItemOID='MH.COVID_MHOCCUR' or @ItemOID='MH.PF_MHOCCUR' or @ItemOID='MH.CKD_MHOCCUR' or @ItemOID='MH.ALCO_MHOCCUR' or @ItemOID='MH.SMO_MHOCCUR'or @ItemOID='MH.ANEMIA_MHOCCUR' or @ItemOID='MH.TRANS_MHOCCUR']/@Value); - if($MHOCCUR = 'NS') { -$MH.MHOCCUR = 'N'; -} elsif($MHOCCUR = 'FS') { -$MH.MHOCCUR = 'Y'; -} else { -$MH.MHOCCUR = $MHOCCUR; -} - - - - SDTM-ETL mapping for FA.FATESTCD - - # Mapping using ODM element ItemData with ItemOID ML.MLOFFER_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLOFFER_DEC' or @ItemOID='ML.MLREAS_DEC' or @ItemOID='ML.PADFYN_DEC' or @ItemOID='ML.PARFD_DEC' or @ItemOID='ML.SOLID_MLOCCUR_DEC' or @ItemOID='ML.CAL_MLOCCUR_DEC' or @ItemOID='ML.FAT_MLOCCUR_DEC' or @ItemOID='ML.LIQUID_MLOCCUR_DEC' or @ItemOID='ML.MLPAIN_DEC' or @ItemOID='ML.MLVOMIT_DEC' or @ItemOID='ML.MLRANGE_DEC']/@ItemOID); - if($ITEM == 'ML.MLOFFER_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLREAS_DEC') { -$FA.FATESTCD = 'REASNTOF'; -} elsif($ITEM = 'ML.PADFYN_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.PARFD_DEC') { -$FA.FATESTCD = 'FDTYPE'; -} elsif($ITEM = 'ML.SOLID_MLOCCUR_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.CAL_MLOCCUR_DEC') { -$FA.FATESTCD = 'MLTYPE'; -} elsif($ITEM = 'ML.FAT_MLOCCUR_DEC') { -$FA.FATESTCD = 'MLTYPE'; -} elsif($ITEM = 'ML.LIQUID_MLOCCUR_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLPAIN_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLVOMIT_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLRANGE_DEC') { -$FA.FATESTCD = 'TIMRNG'; -} - - - - SDTM-ETL mapping for MH.MHBODSYS - - # Mapping using ODM element ItemData with ItemOID MH.AA_MHOCCUR -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$MHOCCUR = xpath(/StudyEventData/FormData[@FormOID='MH.FO']/ItemGroupData/ItemData[@ItemOID='MH.AA_MHOCCUR' or @ItemOID='MH.ACPU_MHOCCUR' or @ItemOID='MH.CAF_MHOCCUR' or @ItemOID='MH.CHF_MHOCCUR' or @ItemOID='MH.CAD_MHOCCUR' or @ItemOID='MH.HDC_MHOCCUR' or @ItemOID='MH.HYPERT_MHOCCUR' or @ItemOID='MH.IDU_MHOCCUR' or @ItemOID='MH.LVH_MHOCCUR' or @ItemOID='MH.PAF_MHOCCUR' or @ItemOID='MH.PVD_MHOCCUR' or @ItemOID='MH.RHEU_MHOCCUR' or @ItemOID='MH.DIAB_MHOCCUR' or @ItemOID='MH.HYPERC_MHOCCUR' or @ItemOID='MH.HYPERL_MHOCCUR' or @ItemOID='MH.HYPERTH_MHOCCUR' or @ItemOID='MH.HYPERTR_MHOCCUR' or @ItemOID='MH.HYPOTHY_MHOCCUR' or @ItemOID='MH.OBESE_MHOCCUR' or @ItemOID='MH.CHOLEC_MHOCCUR' or @ItemOID='MH.CHOLE_MHOCCUR' or @ItemOID='MH.GERD_MHOCCUR' or @ItemOID='MH.HEPCIR_MHOCCUR' or @ItemOID='MH.PRIORAP_MHOCCUR' or @ItemOID='MH.CHD_MHOCCUR' or @ItemOID='MH.LIVD_MHOCCUR' or @ItemOID='MH.HEPB_MHOCCUR' or @ItemOID='MH.HEPC_MHOCCUR' or @ItemOID='MH.ACVD_MHOCCUR' or @ItemOID='MH.DEM_MHOCCUR' or @ItemOID='MH.DEP_MHOCCUR' or @ItemOID='MH.NEO_MHOCCUR' or @ItemOID='MH.ASTH_MHOCCUR' or @ItemOID='MH.COPD_MHOCCUR' or @ItemOID='MH.OSAS_MHOCCUR' or @ItemOID='MH.COVID_MHOCCUR' or @ItemOID='MH.PF_MHOCCUR' or @ItemOID='MH.CKD_MHOCCUR' or @ItemOID='MH.ALCO_MHOCCUR' or @ItemOID='MH.SMO_MHOCCUR'or @ItemOID='MH.ANEMIA_MHOCCUR' or @ItemOID='MH.TRANS_MHOCCUR']/@ItemOID); - if($MHOCCUR = 'MH.AA_MHOCCUR' or $MHOCCUR = 'MH.ACPU_MHOCCUR' or $MHOCCUR = 'MH.CAF_MHOCCUR' or $MHOCCUR = 'MH.CHF_MHOCCUR' or $MHOCCUR = 'MH.CAD_MHOCCUR' or $MHOCCUR = 'MH.HDC_MHOCCUR' or $MHOCCUR = 'MH.HYPERT_MHOCCUR' or $MHOCCUR = 'MH.IDU_MHOCCUR' or $MHOCCUR = 'MH.LVH_MHOCCUR' or $MHOCCUR = 'MH.PAF_MHOCCUR' or $MHOCCUR = 'MH.PVD_MHOCCUR') { -$MH.MHBODSYS = 'Cardiac disorders'; -} elsif($MHOCCUR = 'MH.RHEU_MHOCCUR') { -$MH.MHBODSYS = 'Musculoskeletal and connective tissue disorders'; -} elsif($MHOCCUR = 'MH.DIAB_MHOCCUR' or $MHOCCUR = 'MH.HYPERC_MHOCCUR' or $MHOCCUR = 'MH.HYPERL_MHOCCUR' or $MHOCCUR = 'MH.HYPERTH_MHOCCUR' or $MHOCCUR = 'MH.HYPERTR_MHOCCUR' or $MHOCCUR = 'MH.HYPOTHY_MHOCCUR' or $MHOCCUR = 'MH.OBESE_MHOCCUR') { -$MH.MHBODSYS = 'Endocrine disorders'; -} elsif($MHOCCUR = 'MH.CHOLEC_MHOCCUR' or $MHOCCUR = 'MH.CHOLE_MHOCCUR' or $MHOCCUR = 'MH.GERD_MHOCCUR' or $MHOCCUR = 'MH.HEPCIR_MHOCCUR' or $MHOCCUR = 'MH.PRIORAP_MHOCCUR') { -$MH.MHBODSYS = 'Gastrointestinal disorders'; -} elsif($MHOCCUR = 'MH.CHD_MHOCCUR' or$MHOCCUR = 'MH.ANEMIA_MHOCCUR') { -$MH.MHBODSYS = 'Blood and lymphatic system disorders'; -} elsif( $MHOCCUR = 'MH.LIVD_MHOCCUR' or $MHOCCUR = 'MH.HEPB_MHOCCUR' or $MHOCCUR = 'MH.HEPC_MHOCCUR' or $MHOCCUR = 'MH.TRANS_MHOCCUR') { -$MH.MHBODSYS = 'Hepatobiliary disorders'; -} elsif( $MHOCCUR = 'MH.ACVD_MHOCCUR' or $MHOCCUR = 'MH.DEM_MHOCCUR' or $MHOCCUR = 'MH.DEP_MHOCCUR') { -$MH.MHBODSYS = 'Nervous system disorders'; -} elsif($MHOCCUR = 'MH.NEO_MHOCCUR') { -$MH.MHBODSYS = 'Neoplasms benign, malignant and unspecified (incl cysts and polyps)'; -} elsif($MHOCCUR = 'MH.ASTH_MHOCCUR' or $MHOCCUR = 'MH.COPD_MHOCCUR' or $MHOCCUR = 'MH.OSAS_MHOCCUR' or $MHOCCUR = 'MH.COVID_MHOCCUR' or $MHOCCUR = 'MH.PF_MHOCCUR') { -$MH.MHBODSYS = 'Respiratory, thoracic and mediastinal disorders'; -} elsif($MHOCCUR = 'MH.CKD_MHOCCUR') { -$MH.MHBODSYS = 'Renal and urinary disorders'; -} elsif($MHOCCUR = 'MH.ALCO_MHOCCUR' or $MHOCCUR = 'MH.SMO_MHOCCUR') { -$MH.MHBODSYS = 'Social circumstances'; -} - - - - SDTM-ETL mapping for MH.EPOCH - - $MH.EPOCH = 'SCREENING'; - - - - SDTM-ETL mapping for FA.FAORRES - - # Mapping using ODM element ItemData with ItemOID ML.MLOFFER_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Items within the ItemGroup -$FAORRES = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLOFFER_DEC' or @ItemOID='ML.MLREAS_DEC' or @ItemOID='ML.PADFYN_DEC' or @ItemOID='ML.PARFD_DEC' or @ItemOID='ML.SOLID_MLOCCUR_DEC' or @ItemOID='ML.CAL_MLOCCUR_DEC' or @ItemOID='ML.FAT_MLOCCUR_DEC' or @ItemOID='ML.LIQUID_MLOCCUR_DEC' or @ItemOID='ML.MLPAIN_DEC' or @ItemOID='ML.MLVOMIT_DEC' or @ItemOID='ML.MLRANGE_DEC']/@Value); -$FA.FAORRES = replace($FAORRES, '≥', '>='); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "EG"; - - - - SDTM-ETL mapping for FA.VISITNUM - - # Mapping using ODM element ItemData with ItemOID ML.VISITID -# Generalized for all StudyEvents -$FA.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.VISITID']/@Value); - - - - SDTM-ETL mapping for FA.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($FA.VISITNUM != "") { -$FA.VISIT = substring($VISIT,4); -} - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - EGSEQ calculated - - $EG.EGSEQ = $SEQUENCE; - - - - DOMAIN from template - - $DOMAIN = "PR"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for EG.EGCAT - - $EG.EGCAT = 'ECG - QTcF Readings'; - - - - SDTM-ETL mapping for EG.EGORRES - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES -$EG.EGORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@Value); - - - - SDTM-ETL mapping for PR.PRCAT - - # Mapping using ODM element ItemData with ItemOID PR.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PR.PRCAT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PR.PAGENAME' or @ItemOID='PRCECT.PAGENAME']/@Value); - - - - SDTM-ETL mapping for EG.EGORRESU - - $EG.EGORRESU = 'ms'; - - - - SDTM-ETL mapping for EG.EGSTRESC - - $EG.EGSTRESC = $EG.EGORRES; - - - - SDTM-ETL mapping for EG.EGSTRESN - - $EG.EGSTRESN = $EG.EGORRES; - - - - SDTM-ETL mapping for PR.VISITNUM - - # Mapping using ODM element ItemData with ItemOID PRCECT.VISITID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PR.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PR.VISITID' or @ItemOID='PRCECT.VISITID']/@Value); - - - - SDTM-ETL mapping for EG.EGSTRESU - - $EG.EGSTRESU = 'msec'; - - - - SDTM-ETL mapping for PR.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($PR.VISITNUM != "") { -$PR.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for PR.EPOCH - - # Mapping using ODM element ItemData with ItemOID PRCECT.PRDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRDAT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.PRDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID PRCECT.STTIME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRTIM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.STTIME']/@Value); - if($PRDAT != '' and $PRTIM != '') { -$PRSTDTC = createdatetime($PRDAT,$PRTIM); -} else { -$PRSTDTC = $PRDAT; -} -if($PRSTDTC = '' or $RFSTDTC = '') { -$PR.EPOCH = ''; -} elsif($PRSTDTC < $RFSTDTC) { -$PR.EPOCH = 'SCREENING'; -} elsif ($PRSTDTC > $RFENDTC) { -$PR.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $PRSTDTC and $PRSTDTC <= $RFENDTC) { -$PR.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for PR.PRSTDTC - - # Mapping using ODM element ItemData with ItemOID PRCECT.PRDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRDAT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.PRDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID PRCECT.STTIME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRTIM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.STTIME']/@Value); - if($PRDAT != '' and $PRTIM != '') { -$PR.PRSTDTC = createdatetime($PRDAT,$PRTIM); -} else { -$PR.PRSTDTC = $PRDAT; -} - - - - SDTM-ETL mapping for PR.PRSTDY - - if($PR.PRSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($PR.PRSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$PR.PRSTDY = $NUM; -} elsif($NUM >= 0) { -$PR.PRSTDY = $NUM +1; -} else { -$PR.PRSTDY = ''; -} - - - - SDTM-ETL mapping for EG.EGDTC - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EG.EGDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EG.EGDTC = $EGDAT; -} - - - - SDTM-ETL mapping for EG.EGDY - - $NUM = datediff($EG.EGDTC, $RFSTDTC); - if($NUM < 0) { -$EG.EGDY = $NUM; -} elsif($NUM >= 0) { -$EG.EGDY = $NUM +1; -} else { -$EG.EGDY = ''; -} - - - - SDTM-ETL mapping for EG.TELEYN - - # Mapping using ODM element ItemData with ItemOID EG.TELEYN_DEC -$EG.TELEYN = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.TELEYN_DEC']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "IE"; - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "FA"; - - - - SDTM-ETL mapping for IE.IETESTCD - - # Mapping using ODM element ItemData with ItemOID IE.IETESTCD -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$IE.IETESTCD = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IETESTCD']/@Value); - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - FASEQ calculated - - $FA.FASEQ = $SEQUENCE; - - - - SDTM-ETL mapping for IE.IECAT - - # Mapping using ODM element ItemData with ItemOID IE.IETESTCD -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IETESTCD']/@Value); -if ($CODEDVALUE == 'I05') { - $NEWCODEDVALUE = 'INCLUSION'; -} elsif ($CODEDVALUE == 'I03') { - $NEWCODEDVALUE = 'INCLUSION'; -} elsif ($CODEDVALUE == 'I02') { - $NEWCODEDVALUE = 'INCLUSION'; -} else { - $NEWCODEDVALUE = ''; -} -$IE.IECAT = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for IE.IEORRES - - # Mapping using ODM element ItemData with ItemOID IE.IETESTCD -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IETESTCD']/@Value); -if ($CODEDVALUE == 'I05') { - $NEWCODEDVALUE = 'N'; -} elsif ($CODEDVALUE == 'I03') { - $NEWCODEDVALUE = 'N'; -} elsif ($CODEDVALUE == 'I02') { - $NEWCODEDVALUE = 'N'; -} else { - $NEWCODEDVALUE = ''; -} -$IE.IEORRES = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for FA.FATEST - - $FA.FATEST = 'Occurrence'; - - - - SDTM-ETL mapping for FA.FAOBJ - - # Mapping using ODM element ItemData with ItemOID SEPSIS.POX_SEORRES_DEC - value from attribute ItemOID -# Generalized for all Items within the ItemGroup -$ORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.POX_SEORRES_DEC' or @ItemOID='SEPSIS.MVENT_SEORRES_DEC' or @ItemOID='SEPSIS.PLAT_SEORRES_DEC' or @ItemOID='SEPSIS.TBILI_SEORRES_DEC' or @ItemOID='SEPSIS.VASO_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT1_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT2_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT3_SEORRES_DEC' or @ItemOID='SEPSIS.RRT_SEORRES_DEC']/@ItemOID); - if($ORRES ='SEPSIS.POX_SEORRES_DEC') { -$FA.FAOBJ = 'PaO2/FiO2 &lt;=300 determined by arterial blood gas or imputed using pulse oximetry'; -} elsif($ORRES ='SEPSIS.MVENT_SEORRES_DEC') { -$FA.FAOBJ = 'The use of noninvasive or invasive mechanical ventilation'; -} elsif($ORRES = 'SEPSIS.PLAT_SEORRES_DEC') { -$FA.FAOBJ = 'Platelet count &lt; 100 x103/uL'; -} elsif($ORRES = 'SEPSIS.TBILI_SEORRES_DEC') { -$FA.FAOBJ = 'Total bilirubin >=2.0 mg/dL'; -} elsif($ORRES ='SEPSIS.VASO_SEORRES_DEC') { -$FA.FAOBJ = 'The use of vasopressor or inotropic support'; -} elsif($ORRES ='SEPSIS.CREAT1_SEORRES_DEC') { -$FA.FAOBJ = 'Serum creatinine >=1.9 mg/dL without preexisting chronic kidney disease'; -} elsif($ORRES = 'SEPSIS.CREAT2_SEORRES_DEC') { -$FA.FAOBJ = 'Serum creatinine >4.0 mg/dL with preexisting chronic kidney disease'; -} elsif($ORRES = 'SEPSIS.CREAT3_SEORRES_DEC') { -$FA.FAOBJ = 'Increase in serum creatinine >=300% after hospitalization for acute pancreatitis'; -} elsif($ORRES ='SEPSIS.RRT_SEORRES_DEC') { -$FA.FAOBJ = 'The initiation of renal replacement therapy'; -} - - - - SDTM-ETL mapping for IE.VISITNUM - - # Mapping using ODM element ItemData with ItemOID IE.VISITID -$IE.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.VISITID']/@Value); - - - - SDTM-ETL mapping for FA.FAORRES - - # Mapping using ODM element ItemData with ItemOID SEPSIS.POX_SEORRES_DEC -# Generalized for all Items within the ItemGroup -$FA.FAORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.POX_SEORRES_DEC' or @ItemOID='SEPSIS.MVENT_SEORRES_DEC' or @ItemOID='SEPSIS.PLAT_SEORRES_DEC' or @ItemOID='SEPSIS.TBILI_SEORRES_DEC' or @ItemOID='SEPSIS.VASO_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT1_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT2_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT3_SEORRES_DEC' or @ItemOID='SEPSIS.RRT_SEORRES_DEC']/@Value); - - - - SDTM-ETL mapping for IE.VISIT - - $IE.VISIT = 'Screening'; - - - - SDTM-ETL mapping for FA.FASTRESC - - if($FA.FAORRES = 'Yes') { -$FA.FASTRESC = 'Y'; -} elsif($FA.FAORRES = 'No') { -$FA.FASTRESC = 'N'; -} - - - - SDTM-ETL mapping for FA.VISITNUM - - # Mapping using ODM element ItemData with ItemOID SEPSIS.VISITID -$FA.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.VISITID']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "LB"; - - - - DOMAIN from template - - $DOMAIN = "CM"; - - - - LBSEQ calculated - - $LB.LBSEQ = $SEQUENCE; - - - - CMSEQ calculated - - $CM.CMSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for LB.LBTESTCD - - # Mapping using ODM element ItemData with ItemOID LB.LBTESTCD -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBTESTCD']/@Value); -if ($CODEDVALUE == 'ALB') { - $NEWCODEDVALUE = 'ALB'; -} elsif ($CODEDVALUE == 'ALP') { - $NEWCODEDVALUE = 'ALP'; -} elsif ($CODEDVALUE == 'ALT') { - $NEWCODEDVALUE = 'ALT'; -} elsif ($CODEDVALUE == 'AST') { - $NEWCODEDVALUE = 'AST'; -} elsif ($CODEDVALUE == 'BASO') { - $NEWCODEDVALUE = 'BASO'; -} elsif ($CODEDVALUE == 'BASOLE') { - $NEWCODEDVALUE = 'BASOLE'; -} elsif ($CODEDVALUE == 'BICARB') { - $NEWCODEDVALUE = 'BICARB'; -} elsif ($CODEDVALUE == 'BILI') { - $NEWCODEDVALUE = 'BILI'; -} elsif ($CODEDVALUE == 'CA') { - $NEWCODEDVALUE = 'CA'; -} elsif ($CODEDVALUE == 'CHOL') { - $NEWCODEDVALUE = 'CHOL'; -} elsif ($CODEDVALUE == 'CK') { - $NEWCODEDVALUE = 'CK'; -} elsif ($CODEDVALUE == 'CL') { - $NEWCODEDVALUE = 'CL'; -} elsif ($CODEDVALUE == 'CREAT') { - $NEWCODEDVALUE = 'CREAT'; -} elsif ($CODEDVALUE == 'EOS') { - $NEWCODEDVALUE = 'EOS'; -} elsif ($CODEDVALUE == 'EOSLE') { - $NEWCODEDVALUE = 'EOSLE'; -} elsif ($CODEDVALUE == 'GLUC') { - $NEWCODEDVALUE = 'GLUC'; -} elsif ($CODEDVALUE == 'HCG') { - $NEWCODEDVALUE = 'HCG'; -} elsif ($CODEDVALUE == 'HCT') { - $NEWCODEDVALUE = 'HCT'; -} elsif ($CODEDVALUE == 'HGB') { - $NEWCODEDVALUE = 'HGB'; -} elsif ($CODEDVALUE == 'INTLK6') { - $NEWCODEDVALUE = 'INTLK6'; -} elsif ($CODEDVALUE == 'K') { - $NEWCODEDVALUE = 'K'; -} elsif ($CODEDVALUE == 'LDH') { - $NEWCODEDVALUE = 'LDH'; -} elsif ($CODEDVALUE == 'LIPASEP') { - $NEWCODEDVALUE = 'LIPASEP'; -} elsif ($CODEDVALUE == 'LYM') { - $NEWCODEDVALUE = 'LYM'; -} elsif ($CODEDVALUE == 'LYMLE') { - $NEWCODEDVALUE = 'LYMLE'; -} elsif ($CODEDVALUE == 'MG') { - $NEWCODEDVALUE = 'MG'; -} elsif ($CODEDVALUE == 'MONO') { - $NEWCODEDVALUE = 'MONO'; -} elsif ($CODEDVALUE == 'MONOLE') { - $NEWCODEDVALUE = 'MONOLE'; -} elsif ($CODEDVALUE == 'NEUT') { - $NEWCODEDVALUE = 'NEUT'; -} elsif ($CODEDVALUE == 'NEUTLE') { - $NEWCODEDVALUE = 'NEUTLE'; -} elsif ($CODEDVALUE == 'NGAL') { - $NEWCODEDVALUE = 'LCN2'; -} elsif ($CODEDVALUE == 'PCT') { - $NEWCODEDVALUE = 'PCT'; -} elsif ($CODEDVALUE == 'PHOS') { - $NEWCODEDVALUE = 'PHOS'; -} elsif ($CODEDVALUE == 'PLAT') { - $NEWCODEDVALUE = 'PLAT'; -} elsif ($CODEDVALUE == 'PROT') { - $NEWCODEDVALUE = 'PROT'; -} elsif ($CODEDVALUE == 'RBC') { - $NEWCODEDVALUE = 'RBC'; -} elsif ($CODEDVALUE == 'SODIUM') { - $NEWCODEDVALUE = 'SODIUM'; -} elsif ($CODEDVALUE == 'TRIG') { - $NEWCODEDVALUE = 'TRIG'; -} elsif ($CODEDVALUE == 'UREAN') { - $NEWCODEDVALUE = 'UREAN'; -} elsif ($CODEDVALUE == 'WBC') { - $NEWCODEDVALUE = 'WBC'; -} elsif ($CODEDVALUE == 'BASEEXCS') { - $NEWCODEDVALUE = 'BASEEXCS'; -} elsif ($CODEDVALUE == 'FiO2') { - $NEWCODEDVALUE = 'FIO2'; -} elsif ($CODEDVALUE == 'OXYSAT') { - $NEWCODEDVALUE = 'OXYSAT'; -} elsif ($CODEDVALUE == 'PH') { - $NEWCODEDVALUE = 'PH'; -} elsif ($CODEDVALUE == 'PO2') { - $NEWCODEDVALUE = 'PO2'; -} else { - $NEWCODEDVALUE = 'NULL'; -} -$LB.LBTESTCD = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for LB.LBTEST - - # Mapping using the decode() function on codelist CL.C65047.LBTESTCD of variable LB.LBTESTCD -$LB.LBTEST = decode($LB.LBTESTCD, 'CL.C65047.LBTESTCD', ''); - - - - SDTM-ETL mapping for CM.CMDECOD - - # Mapping using ODM element ItemData with ItemOID PH.PREFERRED_NAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMDECOD = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.PREFERRED_NAME' or @ItemOID='CMINS.PREFERRED_NAME' or @ItemOID='CMOPI.PREFERRED_NAME' or @ItemOID='CMPH.PREFERRED_NAME' or @ItemOID='CMVAS.PREFERRED_NAME']/@Value); - - - - SDTM-ETL mapping for LB.LBSCAT - - # Mapping using ODM element ItemData with ItemOID LB.LBSCAT -# Generalized for all StudyEvents -$LB.LBSCAT = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBSCAT']/@Value); - - - - SDTM-ETL mapping for CM.CMPRESP - - # Mapping using ODM element ItemData with ItemOID CMPH.CMTRT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [CM.CMTRT, CMINS.CMTRT, CMOPI.CMTRT, CMPH.CMTRT, CMVAS.CMTRT] to SDTM CodeList CM.CMPRESP -# with CodeList OID 'CL.C66742.NY' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMTRT' or @ItemOID='CMINS.CMTRT' or @ItemOID='CMOPI.CMTRT' or @ItemOID='CMPH.CMTRT' or @ItemOID='CMVAS.CMTRT']/@ItemOID); -if ($CODEDVALUE == 'CM.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMINS.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMOPI.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == 'CMPH.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMVAS.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$CM.CMPRESP = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for CM.CMOCCUR - - # Mapping using ODM element ItemData with ItemOID PH.CMTRT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [CM.CMTRT, CMINS.CMTRT, CMOPI.CMTRT, PH.CMTRT, CMVAS.CMTRT] to SDTM CodeList CM.CMOCCUR -# with CodeList OID 'CL.C66742.NY' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMTRT' or @ItemOID='CMINS.CMTRT' or @ItemOID='CMOPI.CMTRT' or @ItemOID='CMPH.CMTRT' or @ItemOID='CMVAS.CMTRT']/@ItemOID); -if ($CODEDVALUE == 'CM.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMINS.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMOPI.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == 'CMPH.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMVAS.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$CM.CMOCCUR = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for LB.LBORRESU - - # Mapping using ODM element ItemData with ItemOID LB.LBORRESU -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LB.LBORRESU = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBORRESU']/@Value); - - - - SDTM-ETL mapping for CM.CMINDC - - # Mapping using ODM element ItemData with ItemOID CM.CMINDC_DEC -# Generalized for all StudyEvents -$CM.CMINDC = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMINDC_DEC']/@Value); - - - - SDTM-ETL mapping for LB.LBORNRHI - - # Mapping using ODM element ItemData with ItemOID LB.RNGHIGH -# Generalized for all StudyEvents -$LB.LBORNRHI = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.RNGHIGH']/@Value); - - - - SDTM-ETL mapping for CM.CMCLASCD - - # Mapping using ODM element ItemData with ItemOID PH.CODE -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMCLASCD = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE' or @ItemOID='CMINS.CODE' or @ItemOID='CMOPI.CODE' or @ItemOID='CMPH.CODE' or @ItemOID='CMVAS.CODE']/@Value); - - - - SDTM-ETL mapping for LB.LBSTRESN - - if( is-a-number($LB.LBSTRESC) ) { -$LB.LBSTRESN = $LB.LBSTRESC; -} - - - - SDTM-ETL mapping for CM.CMDOSE - - # Mapping using ODM element ItemData with ItemOID CMOPI.TOTALD_CMDOS -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$TOTALDOSE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.TOTALD_CMDOS' or @ItemOID='CMOPI.TOTALD_CMDOS']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.DAILY_CMDOS -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DOSE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMDOSE' or @ItemOID='CMOPI.DAILY_CMDOS' or @ItemOID='CMVAS.CMDOS']/@Value); - if($DOSE = '') { -$CM.CMDOSE = ''; -} elsif($DOSE != '' and $TOTALDOSE = 'Y') { -$CM.CMDOSE = ''; -} elsif($DOSE != '' and $TOTALDOSE = 'N') { -$CM.CMDOSE = $DOSE; -} - - - - SDTM-ETL mapping for CM.CMDOSU - - # Mapping using ODM element ItemData with ItemOID CMOPI.CMDOSU_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CMDOSU = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMDOSU_DEC' or @ItemOID='CMOPI.CMDOSU_DEC' or @ItemOID='CMVAS.CMDOSU_DEC']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.CMODOSU -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$OTHER = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMODOSU' or @ItemOID='CMOPI.CMODOSU' or @ItemOID='CMVAS.CMODOSU']/@Value); - if($CMDOSU = 'OTHER' or $CMDOSU = 'Other') { -$CM.CMDOSU = concat($CMDOSU,': ', $OTHER); -} else { -$CM.CMDOSU = $CMDOSU; -} - - - - SDTM-ETL mapping for LB.LBSTNRLO - - # Mapping using ODM element ItemData with ItemOID LB.lonicd -# Generalized for all StudyEvents -$LOINCCD = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.lonicd']/@Value); - if($LB.LBTESTCD != '') { -$LBLOINC = $LOINCCD; -} -$LBSTRESU = rws:siunit4loinc($LBLOINC) ; - if( is-a-number($LB.LBORNRLO)and $LB.LBORRESU != "" and $LBSTRESU != "" and $LBLOINC != '' ) { -$LBSTRESC = rws:unitconversionLoinc($LB.LBORNRLO, $LB.LBORRESU, $LBSTRESU, $LBLOINC ) ; -} - - if($LBSTRESC != '') { -$LB.LBSTNRLO = $LBSTRESC; -} else { -$LB.LBSTNRLO = $LB.LBORNRLO; -} - - - - SDTM-ETL mapping for LB.LBSTNRHI - - # Mapping using ODM element ItemData with ItemOID LB.lonicd -# Generalized for all StudyEvents -$LOINCCD = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.lonicd']/@Value); - if($LB.LBTESTCD != '') { -$LBLOINC = $LOINCCD; -} -$LBSTRESU = rws:siunit4loinc($LBLOINC) ; - if( is-a-number($LB.LBORNRHI)and $LB.LBORRESU != "" and $LBSTRESU != "" and $LBLOINC != '' ) { -$LBSTRESC = rws:unitconversionLoinc($LB.LBORNRHI, $LB.LBORRESU, $LBSTRESU, $LBLOINC ) ; -} - - if($LBSTRESC != '') { -$LB.LBSTNRHI = $LBSTRESC; -} else { -$LB.LBSTNRHI = $LB.LBORNRHI; -} - - - - SDTM-ETL mapping for LB.LBSTAT - - # Mapping using ODM element ItemData with ItemOID LB.LBSTAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBSTAT']/@Value); -if ($CODEDVALUE == 'Not Done') { - $NEWCODEDVALUE = 'NOT DONE'; -} else { - $NEWCODEDVALUE = ''; -} -$LB.LBSTAT = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for CM.CMROUTE - - # Mapping using ODM element ItemData with ItemOID CMINS.CMROUTE_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CM.CMROUTE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMROUTE_DEC' or @ItemOID='CMINS.CMROUTE_DEC' or @ItemOID='CMOPI.CMROUTE_DEC' or @ItemOID='CMPH.CMROUTE_DEC' or @ItemOID='CMVAS.CMROUTE_DEC']/@Value); - - - - SDTM-ETL mapping for CM.EPOCH - - # Mapping using ODM element ItemData with ItemOID CM.CMSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CMSTDAT = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMSTDAT' or @ItemOID='CMINS.CMSTDAT' or @ItemOID='CMOPI.CMSTDAT' or @ItemOID='CMVAS.CMSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.CMSTTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CMSTTIM = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMOPI.CMSTTIM']/@Value); - if($CMSTTIM != '') { -$CMSTDTC = createdatetime($CMSTDAT,$CMSTTIM); -} else { -$CMSTDTC = $CMSTDAT; -} -if($CMSTDTC = '') { -$CM.EPOCH = ''; -} elsif($CMSTDTC < $RFSTDTC) { -$CM.EPOCH = 'SCREENING'; -} elsif ($CMSTDTC > $RFENDTC) { -$CM.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $CMSTDTC and $CMSTDTC <= $RFENDTC) { -$CM.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for CM.CMSTDTC - - # Mapping using ODM element ItemData with ItemOID CM.CMSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CMSTDAT = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMSTDAT' or @ItemOID='CMINS.CMSTDAT' or @ItemOID='CMOPI.CMSTDAT' or @ItemOID='CMVAS.CMSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID CMOPI.CMSTTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CMSTTIM = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMOPI.CMSTTIM']/@Value); - if($CMSTTIM != '') { -$CM.CMSTDTC = createdatetime($CMSTDAT,$CMSTTIM); -} else { -$CM.CMSTDTC = $CMSTDAT; -} - - - - SDTM-ETL mapping for LB.LBSPEC - - # Mapping using ODM element ItemData with ItemOID LB.lbspec -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.lbspec']/@Value); -if ($CODEDVALUE == 'SERUM OR PLASMA') { - $NEWCODEDVALUE = 'SERUM OR PLASMA'; -} elsif ($CODEDVALUE == 'BLOOD') { - $NEWCODEDVALUE = 'BLOOD'; -} elsif ($CODEDVALUE == 'SERUM') { - $NEWCODEDVALUE = 'SERUM'; -} elsif ($CODEDVALUE == 'ARTERIAL BLOOD') { - $NEWCODEDVALUE = 'ARTERIAL BLOOD'; -} else { - $NEWCODEDVALUE = ''; -} -$LB.LBSPEC = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for LB.LBBLFL - - # Mapping using ODM element ItemData with ItemOID LB.LBDAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LBDAT = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID LB.LBTIM -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LBTIM = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBTIM']/@Value); -$LBTIM1 = simpletimetoISOtime($LBTIM); -if($LBDAT != "" and $LBTIM1 != "") { -$LBDT = createdatetime($LBDAT, $LBTIM1) ; -} elsif($LBDAT != "" and $LBTIM1 == "") { -$LBDT = $LBDAT; -} -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']); -# the function returns a list of datetimes separated by the pipe (|) symbol -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'LB.LBDAT','LB.LBTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - if($RFSTDTC != '') { -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; -} - -if($LASTDATETIME = $LBDT) { -$LB.LBBLFL = 'Y'; -} else { -$LB.LBBLFL = ''; -} - - - - SDTM-ETL mapping for CM.CMSTDY - - if(contains($CM.CMSTDTC,'UNK')) { -$CM.CMSTDY = ''; -} elsif ($CM.CMSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($CM.CMSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$CM.CMSTDY = $NUM; -} elsif($NUM >= 0) { -$CM.CMSTDY = $NUM +1; -} else { -$CM.CMSTDY = ''; -} - - - - SDTM-ETL mapping for LB.VISITNUM - - # Mapping using ODM element ItemData with ItemOID LB.VISITID -# Generalized for all StudyEvents -$LB.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.VISITID']/@Value); - - - - SDTM-ETL mapping for CM.CMENRF - - # Mapping using ODM element ItemData with ItemOID CMINS.CMONGO -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CMONGO = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMONGO' or @ItemOID='CMINS.CMONGO' or @ItemOID='CMPH.CMONGO']/@Value); - -if($CMONGO != '' and $CMONGO != 'N' ) { -$CM.CMENRF = 'ONGOING'; -} elsif($CM.CMENDTC != '' and $CM.CMENDTC < $RFSTDTC) { -$CM.CMENRF = 'BEFORE'; -} elsif($CM.CMENDTC != '' and $CM.CMENDTC > $RFENDTC) { -$CM.CMENRF = 'AFTER'; -} elsif($CM.CMENDTC != '' and $RFSTDTC <= $CM.CMENDTC and $CM.CMENDTC < $RFENDTC) { -$CM.CMENRF = 'DURING'; -} elsif($CM.CMENDTC != '' and $RFSTDTC <= $CM.CMENDTC and $CM.CMENDTC = $RFENDTC) { -$CM.CMENRF = 'COINCIDENT'; -} else { -$CM.CMENRF = 'UNKNOWN'; -} - - - - SDTM-ETL mapping for LB.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); -$LB.VISIT = substring($VISIT,4) ; - - - - SDTM-ETL mapping for LB.EPOCH - - # Mapping using ODM element ItemData with ItemOID LB.LBDAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LBDAT = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID LB.LBTIM -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LBTIM = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBTIM']/@Value); -if($LBDAT != '' and $LBTIM != '') { -$LBDTC = createdatetime($LBDAT,$LBTIM); -} else { -$LBDTC = $LBDAT; -} -if($LBDTC = '') { -$LB.EPOCH = ''; -} elsif($LBDTC < $RFSTDTC) { -$LB.EPOCH = 'SCREENING'; -} elsif ($LBDTC > $RFENDTC) { -$LB.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $LBDTC and $LBDTC <= $RFENDTC) { -$LB.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for LB.LBDTC - - # Mapping using ODM element ItemData with ItemOID LB.LBDAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LBDAT = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID LB.LBTIM -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LBTIM = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBTIM']/@Value); -if($LBDAT != '' and $LBTIM != '') { -$LB.LBDTC = createdatetime($LBDAT,$LBTIM); -} else { -$LB.LBDTC = $LBDAT; -} - - - - SDTM-ETL mapping for CM.CODE1 - - # Mapping using ODM element ItemData with ItemOID CM.CODE1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CODE1 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE1' or @ItemOID='CMINS.CODE1' or @ItemOID='CMOPI.CODE1' or @ItemOID='CMPH.CODE1' or @ItemOID='CMVAS.CODE1']/@Value); - - - - SDTM-ETL mapping for CM.TEXT1 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT1 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT1' or @ItemOID='CMINS.TEXT1' or @ItemOID='CMOPI.TEXT1' or @ItemOID='CMPH.TEXT1' or @ItemOID='CMVAS.TEXT1']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for CM.TEXT2 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT2 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT2' or @ItemOID='CMINS.TEXT2' or @ItemOID='CMOPI.TEXT2' or @ItemOID='CMPH.TEXT2' or @ItemOID='CMVAS.TEXT2']/@Value); - - - - DOMAIN from template - - $DOMAIN = "DS"; - - - - SDTM-ETL mapping for CM.CODE3 - - # Mapping using ODM element ItemData with ItemOID CM.CODE1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CODE3 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE3' or @ItemOID='CMINS.CODE3' or @ItemOID='CMOPI.CODE3' or @ItemOID='CMPH.CODE3' or @ItemOID='CMVAS.CODE3']/@Value); - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for CM.TEXT3 - - # Mapping using ODM element ItemData with ItemOID CM.TEXT1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.TEXT3 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.TEXT3' or @ItemOID='CMINS.TEXT3' or @ItemOID='CMOPI.TEXT3' or @ItemOID='CMPH.TEXT3' or @ItemOID='CMVAS.TEXT3']/@Value); - - - - SDTM-ETL mapping for CM.CODE4 - - # Mapping using ODM element ItemData with ItemOID CM.CODE1 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CODE4 = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CODE4' or @ItemOID='CMINS.CODE4' or @ItemOID='CMOPI.CODE4' or @ItemOID='CMPH.CODE4' or @ItemOID='CMVAS.CODE4']/@Value); - - - - SDTM-ETL mapping for DS.DSDECOD - - $DS.DSDECOD = $DS.DSTERM; - - - - SDTM-ETL mapping for DS.DSCAT - - # Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='IE.IEYN_DEC' or @ItemOID='RN.RNDAT' or @ItemOID='DSET.DSDECOD_DEC']/@ItemOID); - -# Mapping using ODM element ItemData with ItemOID IE.IEYN_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$IEYN =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='IE.IEYN_DEC']/@Value); - -# Mapping using ODM element ItemData with ItemOID CONT.CONTOCCUR_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CONT = xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC']/@Value); - -if($ITEM ='DSIC.DSSTDAT') { -$DS.DSCAT = 'PROTOCOL MILESTONE'; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN = 'No') { -$DS.DSCAT ='PROTOCOL MILESTONE'; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN ='Yes') { -$DS.DSCAT ='PROTOCOL MILESTONE'; -} elsif($ITEM ='RN.RNDAT' ) { -$DS.DSCAT ='PROTOCOL MILESTONE'; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Withdrawal of Consent') { -$DS.DSCAT = 'DISPOSITION EVENT'; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Discharged') { -$DS.DSCAT = 'DISPOSITION EVENT'; -} elsif($ITEM ='DSOUT2.DSDAT2') { -$DS.DSCAT ='DISPOSITION EVENT'; -} elsif($ITEM ='DSET.DSDECOD_DEC' ) { -$DS.DSCAT = 'DISPOSITION EVENT'; -} - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "CE"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for DS.DSSTDTC - - # Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT -$DSSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.DSSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSIC.DSSTTIM -$DSSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.DSSTTIM']/@Value); - if($DSSTDAT != '' and $DSSTTIM != '') { -$DSIC = createdatetime($DSSTDAT,$DSSTTIM); -} else { -$DSIC = $DSSTDAT; -} -# Mapping using ODM element ItemData with ItemOID RN.RNUTCDAT -$RNUTCDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNUTCDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID RN.RNUTCTIM -$RNUTCTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNUTCTIM']/@Value); - if($RNUTCDAT != '' and $RNUTCTIM != '') { -$RNUTC = createdatetime($RNUTCDAT,$RNUTCTIM); -} else { -$RNUTC = $RNUTCDAT; -} -# Mapping using ODM element ItemData with ItemOID RN.RNDAT -$RNDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID RN.RNTIM -$RNTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNTIM']/@Value); - if($RNDAT != '' and $RNTIM != '') { -$RNDTC = createdatetime($RNDAT,$RNTIM); -} else { -$RNDTC = $RNDAT; -} - - -# Mapping using ODM element ItemData with ItemOID DSOUT.DSDAT -$DSDAT = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT.FO']/ItemGroupData[@ItemGroupOID='DSOUT.IG']/ItemData[@ItemOID='DSOUT.DSDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT.STTIME -$DSTIME = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT.FO']/ItemGroupData[@ItemGroupOID='DSOUT.IG']/ItemData[@ItemOID='DSOUT.STTIME']/@Value); - if($DSDAT != '' and $DSTIME != '') { -$DSOUT = createdatetime($DSDAT,$DSTIME); -} else { -$DSOUT = $DSDAT; -} - -# Mapping using ODM element ItemData with ItemOID DSOUT2.DSDAT2 -$DSDAT2 = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT2.FO']/ItemGroupData[@ItemGroupOID='DSOUT2.IG']/ItemData[@ItemOID='DSOUT2.DSDAT2']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT2.STTIME -$DSTIME2 = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT2.FO']/ItemGroupData[@ItemGroupOID='DSOUT2.IG']/ItemData[@ItemOID='DSOUT2.STTIME']/@Value); - if($DSDAT2 != '' and $DSTIME2 != '') { -$DSOUT2 = createdatetime($DSDAT2,$DSTIME2); -} else { -$DSOUT2 = $DSDAT; -} -# Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='IE.IEYN_DEC' or @ItemOID='RN.RNDAT' or @ItemOID='DSET.DSDECOD_DEC']/@ItemOID); - -# Mapping using ODM element ItemData with ItemOID IE.IEYN_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$IEYN =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='IE.IEYN_DEC']/@Value); - -# Mapping using ODM element ItemData with ItemOID CONT.CONTOCCUR_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CONT = xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC']/@Value); - - -if($ITEM ='DSIC.DSSTDAT') { -$DS.DSSTDTC = $DSIC; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN = 'No') { -$DS.DSSTDTC =''; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN ='Yes') { -$DS.DSSTDTC = $RNUTC; -} elsif($ITEM ='RN.RNDAT' ) { -$DS.DSSTDTC = $RNDTC; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Withdrawal of Consent') { -$DS.DSSTDTC = ''; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Discharged') { -$DS.DSSTDTC = $DSOUT; -} elsif($ITEM ='DSOUT2.DSDAT2') { -$DS.DSSTDTC = $DSOUT2; -} elsif($ITEM ='DSET.DSDECOD_DEC' ) { -$DS.DSSTDTC = ''; -} - - - - SDTM-ETL mapping for CE.CETERM - - # Mapping using ODM element ItemData with ItemOID AECOM.CARDARRE -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AECOM.FO']/ItemGroupData[@ItemGroupOID='AECOM.IG']/ItemData[@ItemOID='AECOM.CARDARRE' or @ItemOID='AECOM.CARDARRH' or @ItemOID='AECOM.CARDISCH' or @ItemOID='AECOM.CHF' or @ItemOID='AECOM.HYPERG' or @ItemOID='AECOM.HYPOG' or @ItemOID='AECOM.ABCOMS' or @ItemOID='AECOM.GASTRO' or @ItemOID='AECOM.GIISCH' or @ItemOID='AECOM.TRANSAM' or @ItemOID='AECOM.ANEMIA' or @ItemOID='AECOM.ATHROM' or @ItemOID='AECOM.COAG' or @ItemOID='AECOM.VTHROM' or @ItemOID='AECOM.CARDITIS' or @ItemOID='AECOM.MENING' or @ItemOID='AECOM.RHABDOMY' or @ItemOID='AECOM.CHEM' or @ItemOID='AECOM.SEIZURE' or @ItemOID='AECOM.STROKE' or @ItemOID='AECOM.PERIE' or @ItemOID='AECOM.PLEFFUS' or @ItemOID='AECOM.PNEUMOT' or @ItemOID='AECOM.PULME' or @ItemOID='AECOM.ARI']/@ItemOID); - if($ITEM='AECOM.CARDARRE' ) { -$CE.CETERM = 'Cardiac arrest'; -} elsif($ITEM='AECOM.CARDARRH' ) { -$CE.CETERM = 'Cardiac arrhythmia'; -} elsif ($ITEM='AECOM.CARDISCH' ) { -$CE.CETERM = 'Cardiac ischaemia'; -} elsif ($ITEM='AECOM.CHF' ) { -$CE.CETERM = 'Congestive heart failure'; -} elsif ($ITEM='AECOM.HYPERG' ){ -$CE.CETERM = 'Hyperglycemia'; -}elsif ($ITEM='AECOM.HYPOG') { -$CE.CETERM = 'Hypoglycemia'; -} elsif ($ITEM='AECOM.ABCOMS' ) { -$CE.CETERM = 'Abdominal Compartment Syndrome'; -} elsif ($ITEM='AECOM.GASTRO' ) { -$CE.CETERM = 'Gastrointestinal hemorrhage'; -} elsif ($ITEM='AECOM.GIISCH' ) { -$CE.CETERM = 'Gastrointestinal ischemia'; -} elsif ($ITEM='AECOM.TRANSAM') { -$CE.CETERM = 'Transaminitis'; -} elsif ($ITEM='AECOM.ANEMIA' ) { -$CE.CETERM = 'Anemia'; -} elsif ($ITEM='AECOM.ATHROM' ) { -$CE.CETERM = 'Arterial Thrombosis'; -} elsif ($ITEM='AECOM.COAG' ) { -$CE.CETERM = 'Disseminated Intravascular Coagulation'; -} elsif ($ITEM='AECOM.VTHROM' ) { -$CE.CETERM = 'Venous Thrombosis'; -} elsif ($ITEM='AECOM.CARDITIS' ) { -$CE.CETERM = 'Endocarditis / Myocarditis / Pericarditis'; -} elsif ($ITEM='AECOM.MENING') { -$CE.CETERM = 'Meningitis / Encephalitis'; -} elsif ($ITEM='AECOM.RHABDOMY' ) { -$CE.CETERM = 'Rhabdomyolysis / Myositis'; -} elsif ($ITEM='AECOM.CHEM' ) { -$CE.CETERM = 'Cerebral Hemorrhage'; -} elsif ($ITEM='AECOM.SEIZURE' ) { -$CE.CETERM = 'Seizure'; -} elsif ($ITEM='AECOM.STROKE' ) { -$CE.CETERM = 'Stroke / Cerebrovascular accident'; -} elsif ($ITEM='AECOM.PERIE' ) { -$CE.CETERM = 'Peripheral Embolism'; -} elsif ($ITEM='AECOM.PLEFFUS' ) { -$CE.CETERM = 'Pleural effusion'; -} elsif ($ITEM='AECOM.PNEUMOT' ) { -$CE.CETERM = 'Pneumothorax'; -} elsif ($ITEM='AECOM.PULME') { -$CE.CETERM = 'Pulmonary Embolism'; -} elsif ($ITEM='AECOM.ARI') { -$CE.CETERM = 'Acute renal injury/ Acute renal failure'; -} - - - - SDTM-ETL mapping for DS.DSDY - - if($DS.DSSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($DS.DSSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$DS.DSDY = $NUM; -} elsif($NUM >= 0) { -$DS.DSDY = $NUM +1; -} else { -$DS.DSDY = ''; -} - - - - SDTM-ETL mapping for DS.TERMOTHR - - # Mapping using ODM element ItemData with ItemOID DSET.DSTERM -$DS.TERMOTHR = xpath(/StudyEventData[@StudyEventOID='SE.230']/FormData[@FormOID='DSET.FO']/ItemGroupData[@ItemGroupOID='DSET.IG']/ItemData[@ItemOID='DSET.DSTERM']/@Value); - - - - SDTM-ETL mapping for CE.CESCAT - - $CE.CESCAT = 'Between Randomization and Day 30'; - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for CE.CEPRESP - - $CE.CEPRESP = 'Y'; - - - - SDTM-ETL mapping for CE.CEOCCUR - - $CE.CEOCCUR = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AECOM.FO']/ItemGroupData[@ItemGroupOID='AECOM.IG']/ItemData[@ItemOID='AECOM.CARDARRE' or @ItemOID='AECOM.CARDARRH' or @ItemOID='AECOM.CARDISCH' or @ItemOID='AECOM.CHF' or @ItemOID='AECOM.HYPERG' or @ItemOID='AECOM.HYPOG' or @ItemOID='AECOM.ABCOMS' or @ItemOID='AECOM.GASTRO' or @ItemOID='AECOM.GIISCH' or @ItemOID='AECOM.TRANSAM' or @ItemOID='AECOM.ANEMIA' or @ItemOID='AECOM.ATHROM' or @ItemOID='AECOM.COAG' or @ItemOID='AECOM.VTHROM' or @ItemOID='AECOM.CARDITIS' or @ItemOID='AECOM.MENING' or @ItemOID='AECOM.RHABDOMY' or @ItemOID='AECOM.CHEM' or @ItemOID='AECOM.SEIZURE' or @ItemOID='AECOM.STROKE' or @ItemOID='AECOM.PERIE' or @ItemOID='AECOM.PLEFFUS' or @ItemOID='AECOM.PNEUMOT' or @ItemOID='AECOM.PULME' or @ItemOID='AECOM.ARI']/@Value); - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - DOMAIN from template - - $DOMAIN = "ML"; - - - - SDTM-ETL mapping for VS.VSTESTCD - - # Mapping using ODM element ItemData with ItemOID VS.SYSBP_VSORRES - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [VS.SYSBP_VSORRES, VS.DIABP_VSORRES, VS.HR_VSORRES, VS.RESP_VSORRES, VS.TEMP_VSORRES, VS.INTRA_VSORRES, VS.HEIGHTP_VSORRES, VS.BMI_VSORRES, VS.WEIGHT_VSORRES] to SDTM CodeList VS.VSTESTCD -# with CodeList OID 'CL.C66741.VSTESTCD' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.SYSBP_VSORRES' or @ItemOID='VS.DIABP_VSORRES' or @ItemOID='VS.HR_VSORRES' or @ItemOID='VS.RESP_VSORRES' or @ItemOID='VS.TEMP_VSORRES' or @ItemOID='VS.INTRA_VSORRES' or @ItemOID='VS.HEIGHTP_VSORRES' or @ItemOID='VS.BMI_VSORRES' or @ItemOID='VS.WEIGHT_VSORRES']/@ItemOID); -if ($CODEDVALUE == 'VS.SYSBP_VSORRES') { - $NEWCODEDVALUE = 'SYSBP'; -} elsif ($CODEDVALUE == 'VS.DIABP_VSORRES') { - $NEWCODEDVALUE = 'DIABP'; -} elsif ($CODEDVALUE == 'VS.HR_VSORRES') { - $NEWCODEDVALUE = 'HR'; -} elsif ($CODEDVALUE == 'VS.RESP_VSORRES') { - $NEWCODEDVALUE = 'RESP'; -} elsif ($CODEDVALUE == 'VS.TEMP_VSORRES') { - $NEWCODEDVALUE = 'TEMP'; -} elsif ($CODEDVALUE == 'VS.INTRA_VSORRES') { - $NEWCODEDVALUE = 'INTRA'; -} elsif ($CODEDVALUE == 'VS.HEIGHTP_VSORRES') { - $NEWCODEDVALUE = 'HEIGHT'; -} elsif ($CODEDVALUE == 'VS.BMI_VSORRES') { - $NEWCODEDVALUE = 'BMI'; -} elsif ($CODEDVALUE == 'VS.WEIGHT_VSORRES') { - $NEWCODEDVALUE = 'WEIGHT'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = 'NULL'; -} -$VS.VSTESTCD = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for VS.VSTEST - - # Mapping using ODM element ItemData with ItemOID VS.SYSBP_VSORRES - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [VS.SYSBP_VSORRES, VS.DIABP_VSORRES, VS.HR_VSORRES, VS.RESP_VSORRES, VS.TEMP_VSORRES, VS.INTRA_VSORRES, VS.HEIGHTP_VSORRES, VS.BMI_VSORRES, VS.WEIGHT_VSORRES] to SDTM CodeList VS.VSTESTCD -# with CodeList OID 'CL.C66741.VSTESTCD' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.SYSBP_VSORRES' or @ItemOID='VS.DIABP_VSORRES' or @ItemOID='VS.HR_VSORRES' or @ItemOID='VS.RESP_VSORRES' or @ItemOID='VS.TEMP_VSORRES' or @ItemOID='VS.INTRA_VSORRES' or @ItemOID='VS.HEIGHTP_VSORRES' or @ItemOID='VS.BMI_VSORRES' or @ItemOID='VS.WEIGHT_VSORRES']/@ItemOID); -# Mapping code for variable VS.VSTEST -# automatically generated from the mapping script for the corresponding variable null -# using decoded values of the VS.VSTESTCD codelist -if ($CODEDVALUE == 'VS.SYSBP_VSORRES') { - $NEWCODEDVALUE = 'Systolic Blood Pressure'; -} elsif ($CODEDVALUE == 'VS.DIABP_VSORRES') { - $NEWCODEDVALUE = 'Diastolic Blood Pressure'; -} elsif ($CODEDVALUE == 'VS.HR_VSORRES') { - $NEWCODEDVALUE = 'Heart Rate'; -} elsif ($CODEDVALUE == 'VS.RESP_VSORRES') { - $NEWCODEDVALUE = 'Respiratory Rate'; -} elsif ($CODEDVALUE == 'VS.TEMP_VSORRES') { - $NEWCODEDVALUE = 'Temperature'; -} elsif ($CODEDVALUE == 'VS.INTRA_VSORRES') { - $NEWCODEDVALUE = 'Intra-abdominal pressure'; -} elsif ($CODEDVALUE == 'VS.HEIGHTP_VSORRES') { - $NEWCODEDVALUE = 'Height'; -} elsif ($CODEDVALUE == 'VS.BMI_VSORRES') { - $NEWCODEDVALUE = 'Body Mass Index'; -} elsif ($CODEDVALUE == 'VS.WEIGHT_VSORRES') { - $NEWCODEDVALUE = 'Weight'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$VS.VSTEST = $NEWCODEDVALUE; - - - - MLSEQ calculated - - $ML.MLSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for VS.VSCAT - - # Mapping using ODM element ItemData with ItemOID VS.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$VS.VSCAT = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.PAGENAME']/@Value); - - - - SDTM-ETL mapping for VS.VSORRES - - # Mapping using ODM element ItemData with ItemOID VS.SYSBP_VSORRES -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$VS.VSORRES = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.SYSBP_VSORRES' or @ItemOID='VS.DIABP_VSORRES' or @ItemOID='VS.HR_VSORRES' or @ItemOID='VS.RESP_VSORRES' or @ItemOID='VS.TEMP_VSORRES' or @ItemOID='VS.INTRA_VSORRES' or @ItemOID='VS.HEIGHTP_VSORRES' or @ItemOID='VS.BMI_VSORRES' or @ItemOID='VS.WEIGHT_VSORRES']/@Value); - - - - SDTM-ETL mapping for ML.MLDOSTXT - - # Mapping using ODM element ItemData with ItemOID ML.MLDOSE_DEC -# Generalized for all StudyEvents -$ML.MLDOSTXT = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLDOSE_DEC']/@Value); - - - - SDTM-ETL mapping for ML.VISITNUM - - # Mapping using ODM element ItemData with ItemOID ML.VISITID -# Generalized for all StudyEvents -$ML.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.VISITID']/@Value); - - - - SDTM-ETL mapping for VS.VSSTRESC - - # Mapping using ODM element ItemData with ItemOID VS.TEMP_VSORRESU -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$TEMPU = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.TEMP_VSORRESU']/@Value); - -if($VS.VSTESTCD != "TEMP") { -$VS.VSSTRESC = $VS.VSORRES; -} elsif($VS.VSTESTCD = "TEMP" and $TEMPU = "F") { -$VSSTRESN = (number($VS.VSORRES)-32)*5/9; -$VS.VSSTRESC =round($VSSTRESN, 1); -} elsif($VS.VSTESTCD = "TEMP" and $TEMPU = "C") { -$VS.VSSTRESC = $VS.VSORRES; -} - - - - SDTM-ETL mapping for VS.VSSTRESN - - # Mapping using ODM element ItemData with ItemOID VS.TEMP_VSORRESU -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$TEMPU = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.TEMP_VSORRESU']/@Value); - if($VS.VSTESTCD != "TEMP") { -$VS.VSSTRESN = $VS.VSORRES; -} elsif($VS.VSTESTCD = "TEMP" and $TEMPU = "F") { -$VSSTRESN = (number($VS.VSORRES)-32)*5/9; -$VS.VSSTRESN =round($VSSTRESN, 1); -} elsif($VS.VSTESTCD = "TEMP" and $TEMPU = "C") { -$VS.VSSTRESN = $VS.VSORRES; -} - - - - SDTM-ETL mapping for ML.MLSTDTC - - # Mapping using ODM element ItemData with ItemOID ML.MLSTDAT -# Generalized for all StudyEvents -$DAT = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID ML.MLSTTIM -# Generalized for all StudyEvents -$TIM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLSTTIM']/@Value); - if($DAT != '' and $TIM != '') { -$ML.MLSTDTC = createdatetime($DAT,$TIM); -} else { -$ML.MLSTDTC = $DAT; -} - - - - SDTM-ETL mapping for VS.VSSTRESU - - if($VS.VSORRESU = 'F') { -$VS.VSSTRESU = 'C'; -} else { -$VS.VSSTRESU = $VS.VSORRESU; -} - - - - SDTM-ETL mapping for VS.VSLOC - - $VS.VSLOC = ''; - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "FA"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - FASEQ calculated - - $FA.FASEQ = $SEQUENCE; - - - - SDTM-ETL mapping for VS.VSDTC - - # Mapping using ODM element ItemData with ItemOID VS.VSTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VSTIM = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VSTIM']/@Value); - -# Mapping using ODM element ItemData with ItemOID VS.VSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VSDT = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VSDAT']/@Value); - -if($VSDT != "" and $VSTIM != "") { - $VS.VSDTC = createdatetime($VSDT, $VSTIM) ; -} elsif($VSDT != "" and $VSTIM == "") { - $VS.VSDTC = $VSDT; -} - - - - SDTM-ETL mapping for FA.FATESTCD - - # Mapping using ODM element ItemData with ItemOID ML.MLOFFER_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLOFFER_DEC' or @ItemOID='ML.MLREAS_DEC' or @ItemOID='ML.PADFYN_DEC' or @ItemOID='ML.PARFD_DEC' or @ItemOID='ML.SOLID_MLOCCUR_DEC' or @ItemOID='ML.CAL_MLOCCUR_DEC' or @ItemOID='ML.FAT_MLOCCUR_DEC' or @ItemOID='ML.LIQUID_MLOCCUR_DEC' or @ItemOID='ML.MLPAIN_DEC' or @ItemOID='ML.MLVOMIT_DEC' or @ItemOID='ML.MLRANGE_DEC']/@ItemOID); - if($ITEM == 'ML.MLOFFER_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLREAS_DEC') { -$FA.FATESTCD = 'REASNTOF'; -} elsif($ITEM = 'ML.PADFYN_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.PARFD_DEC') { -$FA.FATESTCD = 'FDTYPE'; -} elsif($ITEM = 'ML.SOLID_MLOCCUR_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.CAL_MLOCCUR_DEC') { -$FA.FATESTCD = 'MLTYPE'; -} elsif($ITEM = 'ML.FAT_MLOCCUR_DEC') { -$FA.FATESTCD = 'MLTYPE'; -} elsif($ITEM = 'ML.LIQUID_MLOCCUR_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLPAIN_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLVOMIT_DEC') { -$FA.FATESTCD = 'OCCUR'; -} elsif($ITEM = 'ML.MLRANGE_DEC') { -$FA.FATESTCD = 'TIMRNG'; -} - - - - SDTM-ETL mapping for VS.VSDY - - if($VS.VSDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($VS.VSDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$VS.VSDY = $NUM; -} elsif($NUM >= 0) { -$VS.VSDY = $NUM +1; -} else { -$VS.VSDY = ''; -} - - - - SDTM-ETL mapping for FA.FATEST - - # Mapping using ODM element ItemData with ItemOID ML.MLOFFER_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLOFFER_DEC' or @ItemOID='ML.MLREAS_DEC' or @ItemOID='ML.PADFYN_DEC' or @ItemOID='ML.PARFD_DEC' or @ItemOID='ML.SOLID_MLOCCUR_DEC' or @ItemOID='ML.CAL_MLOCCUR_DEC' or @ItemOID='ML.FAT_MLOCCUR_DEC' or @ItemOID='ML.LIQUID_MLOCCUR_DEC' or @ItemOID='ML.MLPAIN_DEC' or @ItemOID='ML.MLVOMIT_DEC' or @ItemOID='ML.MLRANGE_DEC']/@ItemOID); - if($ITEM == 'ML.MLOFFER_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLREAS_DEC') { -$FA.FATEST = 'Reason not offered'; -} elsif($ITEM = 'ML.PADFYN_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.PARFD_DEC') { -$FA.FATEST = 'Feeds type'; -} elsif($ITEM = 'ML.SOLID_MLOCCUR_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.CAL_MLOCCUR_DEC') { -$FA.FATEST = 'Meal type'; -} elsif($ITEM = 'ML.FAT_MLOCCUR_DEC') { -$FA.FATEST = 'Meal type'; -} elsif($ITEM = 'ML.LIQUID_MLOCCUR_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLPAIN_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLVOMIT_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLRANGE_DEC') { -$FA.FATEST = 'Time range'; -} - - - - SDTM-ETL mapping for VS.VSRFTDTC - - $VS.VSRFTDTC = $RFSTDTC; - - - - SDTM-ETL mapping for FA.FAORRES - - # Mapping using ODM element ItemData with ItemOID ML.MLOFFER_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Items within the ItemGroup -$FAORRES = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLOFFER_DEC' or @ItemOID='ML.MLREAS_DEC' or @ItemOID='ML.PADFYN_DEC' or @ItemOID='ML.PARFD_DEC' or @ItemOID='ML.SOLID_MLOCCUR_DEC' or @ItemOID='ML.CAL_MLOCCUR_DEC' or @ItemOID='ML.FAT_MLOCCUR_DEC' or @ItemOID='ML.LIQUID_MLOCCUR_DEC' or @ItemOID='ML.MLPAIN_DEC' or @ItemOID='ML.MLVOMIT_DEC' or @ItemOID='ML.MLRANGE_DEC']/@Value); -$FA.FAORRES = replace($FAORRES, '≥', '>='); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for FA.FASTRESC - - if($FA.FAORRES = 'Yes') { -$FA.FASTRESC = 'Y'; -} elsif($FA.FAORRES = 'No') { -$FA.FASTRESC = 'N'; -} else { -$FA.FASTRESC = $FA.FAORRES; -} - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - VSSEQ calculated - - $VS.VSSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for FA.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($FA.VISITNUM != "") { -$FA.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for VS.VSSTRESC - - $VS.VSSTRESC = $VS.VSORRES; - - - - SDTM-ETL mapping for VS.VSLOC - - # Mapping using ODM element ItemData with ItemOID VSOXY.OXYSATON_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VS.VSLOC = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.OXYSATON_DEC']/@Value); - - - - SDTM-ETL mapping for VS.VSBLFL - - $VSTIM = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VSTIM']/@Value); -$VSDT = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VSDAT']/@Value); - -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$TESTOID =xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.OXYSAT_VSORRES' or @ItemOID='VSOXY.FIO2_VSORRES']/@ItemOID); -$VSTIM1 = simpletimetoISOtime($VSTIM); -if($VSDT != "" and $VSTIM1 != "") { - $VSDTC = createdatetime($VSDT, $VSTIM1) ; -} elsif($VSDT != "" and $VSTIM1 == "") { - $VSDTC = $VSDT; -} - -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData[@ItemGroupOID='VSOXY.IG']); -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'VSOXY.VSDAT','VSOXY.VSTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - if($RFSTDTCISO != '') { -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; -} - -if($LASTDATETIME = $VSDTC) { - $VS.VSBLFL = 'Y'; -} else { - $VS.VSBLFL = ''; -} - - - - SDTM-ETL mapping for VS.VSDTC - - $VSTIM = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VSTIM']/@Value); -$VSDT = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VSDAT']/@Value); - -if($VSDT != "" and $VSTIM != "") { - $VS.VSDTC = createdatetime($VSDT, $VSTIM) ; -} elsif($VSDT != "" and $VSTIM == "") { - $VS.VSDTC = $VSDT; -} - - - - SDTM-ETL mapping for VS.VSDY - - if($VS.VSDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($VS.VSDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$VS.VSDY = $NUM; -} elsif($NUM >= 0) { -$VS.VSDY = $NUM +1; -} else { -$VS.VSDY = ''; -} - - - - SDTM-ETL mapping for VS.VSRFTDTC - - $VS.VSRFTDTC = $RFSTDTC; - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SUSEQ calculated - - $SU.SUSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for SU.SUTRT - - # Mapping using ODM element ItemData with ItemOID SU.ALCOHOL_SUNCF -$OCCUR = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='SU.FO']/ItemGroupData[@ItemGroupOID='SU.IG']/ItemData[@ItemOID='SU.ALCOHOL_SUNCF']/@Value); - if($OCCUR != '') { -$SU.SUTRT = 'Alcohol'; -} - - - - SDTM-ETL mapping for SU.SUCAT - - $SU.SUCAT = 'ALCOHOL'; - - - - SDTM-ETL mapping for SU.SUDOSU - - $SU.SUDOSU = 'DRINK'; - - - - SDTM-ETL mapping for SU.SUENDTC - - # Mapping using ODM element ItemData with ItemOID SU.ALCOHOL_DTC -$SU.SUENDTC = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='SU.FO']/ItemGroupData[@ItemGroupOID='SU.IG']/ItemData[@ItemOID='SU.ALCOHOL_DTC']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "HO"; - - - - SDTM-ETL mapping for HO.HOCAT - - # Mapping using ODM element ItemData with ItemOID ADM.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$HO.HOCAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.PAGENAME' or @ItemOID='DSOUT2.PAGENAME' or @ItemOID='HOICU.PAGENAME' or @ItemOID='HOREAD.PAGENAME']/@Value); - - - - SDTM-ETL mapping for HO.EPOCH - - # Mapping using ODM element ItemData with ItemOID ADM.ADMDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$ADMDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.ADMDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID HOICU.HOSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$HOICUDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='HOICU.HOSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID HOICU.HOSTTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$HOICUTIM = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='HOICU.HOSTTIM']/@Value); - if($HOICUDAT != '' and $HOICUTIM != '') { -$HOICUDTC = createdatetime($HOICUDAT,$HOICUTIM); -} else { -$HOICUDTC = $HOICUDAT; -} -# Mapping using ODM element ItemData with ItemOID HOREAD.HOSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$HOREADDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='HOREAD.HOSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT2.DSDAT2 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$DSDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='DSOUT2.DSDAT2']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT2.STTIME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$DSTIM = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='DSOUT2.STTIME']/@Value); - if($DSDAT != '' and $DSTIM != '') { -$DSDTC = createdatetime($DSDAT,$DSTIM); -} else { -$DSDTC = $DSDAT; -} -# Mapping using ODM element ItemData with ItemOID ADM.PAGENAME - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEMS = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.ADMDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='HOICU.HOSTDAT' or @ItemOID='HOREAD.HOSTDAT']/@ItemOID); - if($ITEMS = 'ADM.ADMDAT') { -$HODTC = $ADMDAT ; -} elsif($ITEMS = 'DSOUT2.DSDAT2') { -$HODTC = $DSDTC; -} elsif($ITEMS = 'HOICU.HOSTDAT') { -$HODTC = $HOICUDTC; -} elsif($ITEMS = 'HOREAD.HOSTDAT') { -$HODTC = $HOREADDAT ; -} -if($HODTC = '' or $RFSTDTC = '') { -$HO.EPOCH = ''; -} elsif($HODTC < $RFSTDTC) { -$HO.EPOCH = 'SCREENING'; -} elsif ($HODTC > $RFENDTC) { -$HO.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $HODTC and $HODTC <= $RFENDTC) { -$HO.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for HO.HOSTDTC - - # Mapping using ODM element ItemData with ItemOID ADM.ADMDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$ADMDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.ADMDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID HOICU.HOSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$HOICUDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='HOICU.HOSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID HOICU.HOSTTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$HOICUTIM = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='HOICU.HOSTTIM']/@Value); - if($HOICUDAT != '' and $HOICUTIM != '') { -$HOICUDTC = createdatetime($HOICUDAT,$HOICUTIM); -} else { -$HOICUDTC = $HOICUDAT; -} -# Mapping using ODM element ItemData with ItemOID HOREAD.HOSTDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$HOREADDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='HOREAD.HOSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT2.DSDAT2 -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$DSDAT = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='DSOUT2.DSDAT2']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT2.STTIME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$DSTIM = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='DSOUT2.STTIME']/@Value); - if($DSDAT != '' and $DSTIM != '') { -$DSDTC = createdatetime($DSDAT,$DSTIM); -} else { -$DSDTC = $DSDAT; -} -# Mapping using ODM element ItemData with ItemOID ADM.PAGENAME - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEMS = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.ADMDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='HOICU.HOSTDAT' or @ItemOID='HOREAD.HOSTDAT']/@ItemOID); - if($ITEMS = 'ADM.ADMDAT') { -$HO.HOSTDTC = $ADMDAT ; -} elsif($ITEMS = 'DSOUT2.DSDAT2') { -$HO.HOSTDTC = $DSDTC; -} elsif($ITEMS = 'HOICU.HOSTDAT') { -$HO.HOSTDTC = $HOICUDTC; -} elsif($ITEMS = 'HOREAD.HOSTDAT') { -$HO.HOSTDTC = $HOREADDAT ; -} - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - DOMAIN from template - - $DOMAIN = "QS"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - QSSEQ calculated - - $QS.QSSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for QS.QSTESTCD - - # Mapping using ODM element ItemData with ItemOID QSPNRS.OPIOID_QSORRES_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.QSHOSPYN_DEC' or @ItemOID='QSMGCSI.QSTPT_DEC' or @ItemOID='QSMGCSI.NAUSEA_QSORRES_DEC' or @ItemOID='QSMGCSI.MEAL_QSORRES_DEC' or @ItemOID='QSMGCSI.FULL_QSORRES_DEC' or @ItemOID='QSMGCSI.ABPAIN_QSORRES_DEC' or @ItemOID='QSMGCSI.VOMIT_QSORRES' or @ItemOID='QSMGCSI.SEV_QSORRES_DEC' or @ItemOID='QSPNRS.OPIOID_QSORRES_DEC' or @ItemOID='QSPNRS.SCALE_QSORRES' or @ItemOID='QSPNRS.PAIN_QSORRES_DEC' or @ItemOID='QSPNRS.CRITERIA_DEC']/@ItemOID); - if($ITEM = 'QSPNRS.CRITERIA_DEC') { -$QS.QSTESTCD = 'CRITERIA'; -} elsif($ITEM = 'QSPNRS.PAIN_QSORRES_DEC') { -$QS.QSTESTCD = 'PAIN'; -} elsif($ITEM = 'QSPNRS.SCALE_QSORRES') { -$QS.QSTESTCD = 'SCALE'; -} elsif($ITEM = 'QSPNRS.OPIOID_QSORRES_DEC') { -$QS.QSTESTCD = 'OPIOID'; -} elsif($ITEM = 'QSMGCSI.SEV_QSORRES_DEC') { -$QS.QSTESTCD = 'SEV'; -} elsif($ITEM = 'QSMGCSI.VOMIT_QSORRES') { -$QS.QSTESTCD = 'VOMIT'; -} elsif($ITEM = 'QSMGCSI.ABPAIN_QSORRES_DEC') { -$QS.QSTESTCD = 'ABPAIN'; -} elsif($ITEM = 'QSMGCSI.FULL_QSORRES_DEC') { -$QS.QSTESTCD = 'FULL'; -} elsif($ITEM = 'QSMGCSI.MEAL_QSORRES_DEC') { -$QS.QSTESTCD = 'MEAL'; -} elsif($ITEM = 'QSMGCSI.NAUSEA_QSORRES_DEC') { -$QS.QSTESTCD = 'NAUSEA'; -} elsif($ITEM = 'QSMGCSI.QSTPT_DEC') { -$QS.QSTESTCD = 'QSTPT'; -} elsif($ITEM = 'QSMGCSI.QSHOSPYN_DEC') { -$QS.QSTESTCD = 'QSHOSPYN'; -} - - - - SDTM-ETL mapping for QS.QSTEST - - # Mapping using ODM element ItemData with ItemOID QSPNRS.OPIOID_QSORRES_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.QSHOSPYN_DEC' or @ItemOID='QSMGCSI.QSTPT_DEC' or @ItemOID='QSMGCSI.NAUSEA_QSORRES_DEC' or @ItemOID='QSMGCSI.MEAL_QSORRES_DEC' or @ItemOID='QSMGCSI.FULL_QSORRES_DEC' or @ItemOID='QSMGCSI.ABPAIN_QSORRES_DEC' or @ItemOID='QSMGCSI.VOMIT_QSORRES' or @ItemOID='QSMGCSI.SEV_QSORRES_DEC' or @ItemOID='QSPNRS.OPIOID_QSORRES_DEC' or @ItemOID='QSPNRS.SCALE_QSORRES' or @ItemOID='QSPNRS.PAIN_QSORRES_DEC' or @ItemOID='QSPNRS.CRITERIA_DEC']/@ItemOID); -if($ITEM = 'QSPNRS.CRITERIA_DEC') { -$QS.QSTEST = 'Meet Discharge Criteria'; -} elsif($ITEM = 'QSPNRS.PAIN_QSORRES_DEC') { -$QS.QSTEST = 'Compare Pain'; -} elsif($ITEM = 'QSPNRS.SCALE_QSORRES') { -$QS.QSTEST = 'Pain Numeric Rating Scale'; -} elsif($ITEM = 'QSPNRS.OPIOID_QSORRES_DEC') { -$QS.QSTEST = 'Opioids Within Two Hours'; -} elsif($ITEM = 'QSMGCSI.SEV_QSORRES_DEC') { -$QS.QSTEST = 'Severity Of Symptoms Over Past 24 Hours'; -} elsif($ITEM = 'QSMGCSI.VOMIT_QSORRES') { -$QS.QSTEST = 'Number Of Vomits'; -} elsif($ITEM = 'QSMGCSI.ABPAIN_QSORRES_DEC') { -$QS.QSTEST = 'Abdominal Pain'; -} elsif($ITEM = 'QSMGCSI.FULL_QSORRES_DEC') { -$QS.QSTEST = 'Feeling Excessively Full After Meals'; -} elsif($ITEM = 'QSMGCSI.MEAL_QSORRES_DEC') { -$QS.QSTEST = 'Not Able To Finish a Normal Sized Meal'; -} elsif($ITEM = 'QSMGCSI.NAUSEA_QSORRES_DEC') { -$QS.QSTEST = 'Nausea'; -} elsif($ITEM = 'QSMGCSI.QSTPT_DEC') { -$QS.QSTEST = 'Select Timepoint Diary Corresponds With'; -} elsif($ITEM = 'QSMGCSI.QSHOSPYN_DEC') { -$QS.QSTEST = 'Daily Diary Page Completed In Hospital'; -} - - - - SDTM-ETL mapping for QS.QSCAT - - # Mapping using ODM element ItemData with ItemOID QSPNRS.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$QS.QSCAT = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.PAGENAME' or @ItemOID='QSPNRS.PAGENAME']/@Value); - - - - SDTM-ETL mapping for QS.QSSCAT - - if($QS.QSCAT = 'mGCSI Daily Diary') { -$QS.QSSCAT = ''; -} elsif($QS.QSTESTCD = 'CRITERIA') { -$QS.QSSCAT = 'MEDICALLY INDICATED DISCHARGE'; -} else { -$QS.QSSCAT = 'PAIN NUMERIC RATING SCALE'; -} - - - - SDTM-ETL mapping for QS.QSORRES - - # Mapping using ODM element ItemData with ItemOID QSPNRS.OPIOID_QSORRES_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QS.QSORRES = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.QSHOSPYN_DEC' or @ItemOID='QSMGCSI.QSTPT_DEC' or @ItemOID='QSMGCSI.NAUSEA_QSORRES_DEC' or @ItemOID='QSMGCSI.MEAL_QSORRES_DEC' or @ItemOID='QSMGCSI.FULL_QSORRES_DEC' or @ItemOID='QSMGCSI.ABPAIN_QSORRES_DEC' or @ItemOID='QSMGCSI.VOMIT_QSORRES' or @ItemOID='QSMGCSI.SEV_QSORRES_DEC' or @ItemOID='QSPNRS.OPIOID_QSORRES_DEC' or @ItemOID='QSPNRS.SCALE_QSORRES' or @ItemOID='QSPNRS.PAIN_QSORRES_DEC' or @ItemOID='QSPNRS.CRITERIA_DEC']/@Value); - - - - SDTM-ETL mapping for QS.VISITNUM - - # Mapping using ODM element ItemData with ItemOID QSMGCSI.VISITID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QS.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.VISITID' or @ItemOID='QSPNRS.VISITID']/@Value); - - - - SDTM-ETL mapping for AE.AEENRF - - A - - - - SDTM-ETL mapping for AE.AEENRTPT - - A - - - - SDTM-ETL mapping for AE.AEENTPT - - A - - - - SDTM-ETL mapping for SU.SUPRESP - - $SU.SUPRESP = 'Y'; - - - - SDTM-ETL mapping for SU.SUOCCUR - - # Mapping using ODM element ItemData with ItemOID SU.ALCOHOL_SUNCF -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$SU.SUOCCUR = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='SU.FO']/ItemGroupData[@ItemGroupOID='SU.IG']/ItemData[@ItemOID='SU.ALCOHOL_SUNCF']/@Value); - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - SDTM-ETL mapping for DM.RFXSTDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -$EXSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -$EXSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$DM.RFXSTDTC = createdatetime($EXSTDAT,$EXSTTIM); -} else { -$DM.RFXSTDTC = $EXSTDAT; -} - - - - SDTM-ETL mapping for DM.RFICDTC - - # Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT -$DSSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.DSSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSIC.DSSTTIM -$DSSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.DSSTTIM']/@Value); - if($DSSTDAT != '' and $DSSTTIM != '') { -$DM.RFICDTC = createdatetime($DSSTDAT,$DSSTTIM) ; -} else { -$DM.RFICDTC = $DSSTDAT; -} - - - - HOSEQ calculated - - $HO.HOSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for HO.HODTC - - # Mapping using ODM element ItemData with ItemOID ADM.ONSET -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DAT= xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.ONSET']/@Value); -# Mapping using ODM element ItemData with ItemOID ADM.STTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$TIM = xpath(/StudyEventData/FormData[@FormOID='ADM.FO' or @FormOID='DSOUT2.FO' or @FormOID='HOICU.FO' or @FormOID='HOREAD.FO']/ItemGroupData/ItemData[@ItemOID='ADM.STTIM']/@Value); - if($DAT != '' and $TIM != '') { -$HO.HODTC = createdatetime($DAT,$TIM); -} else { -$HO.HODTC = $DAT; -} - - - - SDTM-ETL mapping for HO.HOSTDY - - if($HO.HOSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($HO.HOSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$HO.HOSTDY = $NUM; -} elsif($NUM >= 0) { -$HO.HOSTDY = $NUM +1; -} else { -$HO.HOSTDY = ''; -} - - - - SDTM-ETL mapping for DM.PKICRES - - # Mapping using ODM element ItemData with ItemOID DSIC.PK_ICRES_DEC -$DM.PKICRES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.PK_ICRES_DEC']/@Value); - - - - SDTM-ETL mapping for DM.IERANDNY - - # Mapping using ODM element ItemData with ItemOID IE.IERANDNY_DEC -$DM.IERANDNY = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IERANDNY_DEC']/@Value); - - - - SDTM-ETL mapping for DM.IEOXY - - # Mapping using ODM element ItemData with ItemOID IE.IEOXY_DEC -$IEOXY = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IEOXY_DEC']/@Value); -$DM.IEOXY = replace($IEOXY, '≤', '&lt;='); - - - - SDTM-ETL mapping for QS.QSSTRESC - - $QS.QSSTRESC = $QS.QSORRES; - - - - SDTM-ETL mapping for DM.IERISKGR - - # Mapping using ODM element ItemData with ItemOID IE.IERISKGR_DEC -$DM.IERISKGR = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IERISKGR_DEC']/@Value); - - - - SDTM-ETL mapping for QS.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($QS.VISITNUM != "") { -$QS.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for QS.EPOCH - - # Mapping using ODM element ItemData with ItemOID QSPNRS.QSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QSMGCSIDAT = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.QSDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID QSPNRS.QSTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QSPNRSTIM = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSPNRS.QSTIM']/@Value); -# Mapping using ODM element ItemData with ItemOID QSPNRS.QSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QSPNRSDAT = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSPNRS.QSDAT']/@Value); - if($QSPNRSDAT != '' and $QSPNRSTIM != '') { -$QSPNRSDTC = createdatetime($QSPNRSDAT,$QSPNRSTIM); -} else { -$QSPNRSDTC = $QSPNRSDAT; -} - if($QS.QSCAT = 'mGCSI Daily Diary') { -$QSDTC = $QSMGCSIDAT ; -} else { -$QSDTC = $QSPNRSDTC; -} -if($QSDTC = '' or $RFSTDTC = '') { -$QS.EPOCH = ''; -} elsif($QSDTC < $RFSTDTC) { -$QS.EPOCH = 'SCREENING'; -} elsif ($QSDTC > $RFENDTC) { -$QS.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $QSDTC and $QSDTC <= $RFENDTC) { -$QS.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for QS.QSDTC - - # Mapping using ODM element ItemData with ItemOID QSPNRS.QSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QSMGCSIDAT = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSMGCSI.QSDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID QSPNRS.QSTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QSPNRSTIM = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSPNRS.QSTIM']/@Value); -# Mapping using ODM element ItemData with ItemOID QSPNRS.QSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$QSPNRSDAT = xpath(/StudyEventData/FormData[@FormOID='QSMGCSI.FO' or @FormOID='QSPNRS.FO']/ItemGroupData/ItemData[@ItemOID='QSPNRS.QSDAT']/@Value); - if($QSPNRSDAT != '' and $QSPNRSTIM != '') { -$QSPNRSDTC = createdatetime($QSPNRSDAT,$QSPNRSTIM); -} else { -$QSPNRSDTC = $QSPNRSDAT; -} - if($QS.QSCAT = 'mGCSI Daily Diary') { -$QS.QSDTC = $QSMGCSIDAT ; -} else { -$QS.QSDTC = $QSPNRSDTC; -} - - - - SDTM-ETL mapping for QS.QSDY - - if($QS.QSDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($QS.QSDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$QS.QSDY = $NUM; -} elsif($NUM >= 0) { -$QS.QSDY = $NUM +1; -} else { -$QS.QSDY = ''; -} - - - - SDTM-ETL mapping for DM.SIRSHR - - # Mapping using ODM element ItemData with ItemOID IE.SIRS_HRYN_DEC -$DM.SIRSHR = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.SIRS_HRYN_DEC']/@Value); - - - - SDTM-ETL mapping for DM.HRORRES - - # Mapping using ODM element ItemData with ItemOID IE.HR_SIRSORRES -$DM.HRORRES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.HR_SIRSORRES']/@Value); - - - - SDTM-ETL mapping for DM.RRUNIT - - # Mapping using ODM element ItemData with ItemOID IE.RR_SIRSOORESU_DEC -$DM.RRUNIT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.RR_SIRSOORESU_DEC']/@Value); - - - - SDTM-ETL mapping for PC.PCORRES - - $PC.PCORRES = ''; - - - - SDTM-ETL mapping for DM.SIRSWBC - - # Mapping using ODM element ItemData with ItemOID IE.SIRS_WBCYN_DEC -$DM.SIRSWBC = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.SIRS_WBCYN_DEC']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - USUBJID from ODM ClinicalData - - $USUBJID = $USUBID; - - - - SDTM-ETL mapping for PC.PCNAM - - # Mapping using ODM element ItemData with ItemOID PC.PCDAT -# Generalized for all StudyEvents -$VALUE = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCDAT']/@Value); - if($VALUE != '') { -$PC.PCNAM = 'NOT COLLECTED'; -} - - - - SDTM-ETL mapping for PC.PCSPEC - - # Mapping using ODM element ItemData with ItemOID PC.PCDAT -# Generalized for all StudyEvents -$VALUE = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCDAT']/@Value); - if($VALUE != '') { -$PC.PCSPEC = 'PLASMA'; -} - - - - SDTM-ETL mapping for PC.PCLLOQ - - # Mapping using ODM element ItemData with ItemOID PC.PCDAT -# Generalized for all StudyEvents -$VALUE = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCDAT']/@Value); - if($VALUE != '') { -$PC.PCLLOQ = 0; -} - - - - SDTM-ETL mapping for PC.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($PC.VISITNUM != "") { -$PC.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for SV.SVSTDY - - if($SV.SVSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($SV.SVSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$SV.SVSTDY = $NUM; -} elsif($NUM >= 0) { -$SV.SVSTDY = $NUM +1; -} else { -$SV.SVSTDY = ''; -} - - - - SDTM-ETL mapping for SV.SVSTAT - - # Mapping using ODM element ItemData with ItemOID SV.SVSTAT -# Generalized for all StudyEvents -$SVSTAT = xpath(/StudyEventData/FormData[@FormOID='SV.FO']/ItemGroupData[@ItemGroupOID='SV.IG']/ItemData[@ItemOID='SV.SVSTAT']/@Value); - if($SVSTAT != '') { -$SV.SVSTAT = 'Not Done'; -} - - - - SDTM-ETL mapping for PC.PCDTC - - # Mapping using ODM element ItemData with ItemOID PC.PCTIM -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$PCTIM = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCTIM']/@Value); - -# Mapping using ODM element ItemData with ItemOID PC.PCDAT -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$PCDAT = xpath(/StudyEventData/FormData[@FormOID='PC.FO']/ItemGroupData[@ItemGroupOID='PC.IG']/ItemData[@ItemOID='PC.PCDAT']/@Value); - if($PCDAT != '' and $PCTIM != '') { -$PC.PCDTC = createdatetime($PCDAT,$PCTIM); -} else { -$PC.PCDTC = $PCDAT; -} - - - - SDTM-ETL mapping for PC.PCDY - - if($PC.PCDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($PC.PCDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$PC.PCDY = $NUM; -} elsif($NUM >= 0) { -$PC.PCDY = $NUM +1; -} else { -$PC.PCDY = ''; -} - - - - SDTM-ETL mapping for SV.SURVIVAL - - # Mapping using ODM element ItemData with ItemOID SV.SURVIVAL_DEC -# Generalized for all StudyEvents -$SV.SURVIVAL = xpath(/StudyEventData/FormData[@FormOID='SV.FO']/ItemGroupData[@ItemGroupOID='SV.IG']/ItemData[@ItemOID='SV.SURVIVAL_DEC']/@Value); - - - - SDTM-ETL mapping for SV.ETIO - - # Mapping using ODM element ItemData with ItemOID SV.ETIO_DEC -# Generalized for all StudyEvents -$SV.ETIO = xpath(/StudyEventData/FormData[@FormOID='SV.FO']/ItemGroupData[@ItemGroupOID='SV.IG']/ItemData[@ItemOID='SV.ETIO_DEC']/@Value); - - - - SDTM-ETL mapping for SV.ETIOREAS - - # Mapping using ODM element ItemData with ItemOID SV.ETIOREAS -# Generalized for all StudyEvents -$SV.ETIOREAS = xpath(/StudyEventData/FormData[@FormOID='SV.FO']/ItemGroupData[@ItemGroupOID='SV.IG']/ItemData[@ItemOID='SV.ETIOREAS']/@Value); - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - SDTM-ETL mapping for PE.PEORRES - - # Mapping using ODM element ItemData with ItemOID PE.PEABDO_DEC -# Generalized for all Items within the ItemGroup -$PE.PEORRES = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PEABDO_DEC' or @ItemOID='PE.PEABRT_DEC' or @ItemOID='PE.PEABBRU_DEC' or @ItemOID='PE.PEABBRF_DEC' or @ItemOID='PE.PEABNBS_DEC' or @ItemOID='PE.PEABOTH_DEC']/@Value); - - - - SDTM-ETL mapping for EX.EXDOSU - - $EX.EXDOSU = 'mg/kg'; - - - - SDTM-ETL mapping for PE.ABOTHSP - - # Mapping using ODM element ItemData with ItemOID PE.PEABOTHSP -$PE.ABOTHSP = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='PE.FO']/ItemGroupData[@ItemGroupOID='PE.IG']/ItemData[@ItemOID='PE.PEABOTHSP']/@Value); - - - - SDTM-ETL mapping for EX.EXENDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXENDAT -# Generalized for all StudyEvents -$EXENDAT = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXENTIM -# Generalized for all StudyEvents -$EXENTIM = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENTIM']/@Value); - if($EXENDAT != '' and $EXENTIM != '') { -$EX.EXENDTC = createdatetime($EXENDAT,$EXENTIM); -} else { -$EX.EXENDTC = $EXENDAT; -} - - - - PRSEQ calculated - - $PR.PRSEQ = $SEQUENCE; - - - - DOMAIN from template - - $DOMAIN = "AE"; - - - - SDTM-ETL mapping for PR.PRPRESP - - $PR.PRPRESP = 'Y'; - - - - AESEQ calculated - - $AE.AESEQ = $SEQUENCE; - - - - SDTM-ETL mapping for AE.AELLT - - # Mapping using ODM element ItemData with ItemOID AE.LLT_NAME -$AE.AELLT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.LLT_NAME']/@Value); - - - - SDTM-ETL mapping for PR.EPOCH - - # Mapping using ODM element ItemData with ItemOID PRCECT.PRDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRDAT = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.PRDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID PRCECT.STTIME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$PRTIM = xpath(/StudyEventData/FormData[@FormOID='PR.FO' or @FormOID='PRCECT.FO']/ItemGroupData/ItemData[@ItemOID='PRCECT.STTIME']/@Value); - if($PRDAT != '' and $PRTIM != '') { -$PRSTDTC = createdatetime($PRDAT,$PRTIM); -} else { -$PRSTDTC = $PRDAT; -} -if($PRSTDTC = '' or $RFSTDTC = '') { -$PR.EPOCH = ''; -} elsif($PRSTDTC < $RFSTDTC) { -$PR.EPOCH = 'SCREENING'; -} elsif ($PRSTDTC > $RFENDTC) { -$PR.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $PRSTDTC and $PRSTDTC <= $RFENDTC) { -$PR.EPOCH = 'TREATMENT'; -} - - - - SDTM-ETL mapping for AE.AELLTCD - - # Mapping using ODM element ItemData with ItemOID AE.LLT_CODE -$AE.AELLTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.LLT_CODE']/@Value); - - - - SDTM-ETL mapping for PR.PRSTDY - - if($PR.PRSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($PR.PRSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$PR.PRSTDY = $NUM; -} elsif($NUM >= 0) { -$PR.PRSTDY = $NUM +1; -} else { -$PR.PRSTDY = ''; -} - - - - SDTM-ETL mapping for PR.RRTTYPE - - # Mapping using ODM element ItemData with ItemOID PR.RRTTYPE_DEC -# Generalized for all StudyEvents -$PR.RRTTYPE = xpath(/StudyEventData/FormData[@FormOID='PR.FO']/ItemGroupData[@ItemGroupOID='PR.IG']/ItemData[@ItemOID='PR.RRTTYPE_DEC']/@Value); - - - - SDTM-ETL mapping for PR.PRSEPC2 - - # Mapping using ODM element ItemData with ItemOID PR.PRSEPC2 -# Generalized for all StudyEvents -$PR.PRSEPC2 = xpath(/StudyEventData/FormData[@FormOID='PR.FO']/ItemGroupData[@ItemGroupOID='PR.IG']/ItemData[@ItemOID='PR.PRSEPC2']/@Value); - - - - SDTM-ETL mapping for AE.AEBDSYCD - - # Mapping using ODM element ItemData with ItemOID AE.SOC_CODE -$AE.AEBDSYCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_CODE']/@Value); - - - - SDTM-ETL mapping for FA.FAORRES - - # Mapping using ODM element ItemData with ItemOID SEPSIS.POX_SEORRES_DEC -# Generalized for all Items within the ItemGroup -$FA.FAORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='SEPSIS.FO']/ItemGroupData[@ItemGroupOID='SEPSIS.IG']/ItemData[@ItemOID='SEPSIS.POX_SEORRES_DEC' or @ItemOID='SEPSIS.MVENT_SEORRES_DEC' or @ItemOID='SEPSIS.PLAT_SEORRES_DEC' or @ItemOID='SEPSIS.TBILI_SEORRES_DEC' or @ItemOID='SEPSIS.VASO_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT1_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT2_SEORRES_DEC' or @ItemOID='SEPSIS.CREAT3_SEORRES_DEC' or @ItemOID='SEPSIS.RRT_SEORRES_DEC']/@Value); - - - - SDTM-ETL mapping for AE.AEOUT - - # Mapping using ODM element ItemData with ItemOID AE.AEOUT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEOUT']/@Value); -# Using DECODED values for the SDTM codelist CL.cOUT -if ($CODEDVALUE == 'OUT1') { - $NEWCODEDVALUE = 'Recovered'; -} elsif ($CODEDVALUE == 'OUT4') { - $NEWCODEDVALUE = 'Not Recovered'; -} elsif ($CODEDVALUE == 'OUT3') { - $NEWCODEDVALUE = 'Recovered with Sequelae'; -} elsif ($CODEDVALUE == 'OUT2') { - $NEWCODEDVALUE = 'Recovering'; -} else { - $NEWCODEDVALUE = ''; -} -$AE.AEOUT = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for AE.AESLIFE - - # Mapping using ODM element ItemData with ItemOID AE.AESLIFE -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESLIFE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESLIFE']/@Value); - - - - SDTM-ETL mapping for CM.CMTRT - - # Mapping using ODM element ItemData with ItemOID CMVAS.CMTRT_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMTRT = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMTRT' or @ItemOID='CMINS.CMTRT' or @ItemOID='CMOPI.CMTRT_DEC' or @ItemOID='CMPH.CMTRT' or @ItemOID='CMVAS.CMTRT_DEC']/@Value); - - - - SDTM-ETL mapping for CM.CMOCCUR - - # Mapping using ODM element ItemData with ItemOID PH.CMTRT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [CM.CMTRT, CMINS.CMTRT, CMOPI.CMTRT, PH.CMTRT, CMVAS.CMTRT] to SDTM CodeList CM.CMOCCUR -# with CodeList OID 'CL.C66742.NY' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMTRT' or @ItemOID='CMINS.CMTRT' or @ItemOID='CMOPI.CMTRT' or @ItemOID='CMPH.CMTRT' or @ItemOID='CMVAS.CMTRT']/@ItemOID); -if ($CODEDVALUE == 'CM.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMINS.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMOPI.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == 'CMPH.CMTRT') { - $NEWCODEDVALUE = ''; -} elsif ($CODEDVALUE == 'CMVAS.CMTRT') { - $NEWCODEDVALUE = 'Y'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$CM.CMOCCUR = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for CM.CMINDC - - # Mapping using ODM element ItemData with ItemOID CM.CMINDC_DEC -# Generalized for all StudyEvents -$CM.CMINDC = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMINDC_DEC']/@Value); - - - - SDTM-ETL mapping for CM.CMDOSFRQ - - # Mapping using ODM element ItemData with ItemOID CMINS.CMDOSFRQ_DEC -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CMDOSFRQ = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMDOSFRQ_DEC']/@Value); -# Mapping using ODM element ItemData with ItemOID CMINS.CMODOSFRQ -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$OTHER = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CMINS.CMODOSFRQ']/@Value); - if($CMDOSFRQ = 'OTHER') { -$CM.CMDOSFRQ = concat($CMDOSFRQ,': ',$OTHER); -} else { -$CM.CMDOSFRQ = $CMDOSFRQ; -} - - - - MHSEQ calculated - - $MH.MHSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for CM.CMENDTC - - # Mapping using ODM element ItemData with ItemOID CM.CMENDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CM.CMENDTC = xpath(/StudyEventData/FormData[@FormOID='CM.FO' or @FormOID='CMINS.FO' or @FormOID='CMOPI.FO' or @FormOID='CMPHI.FO' or @FormOID='CMVAS.FO']/ItemGroupData/ItemData[@ItemOID='CM.CMENDAT' or @ItemOID='CMINS.CMENDAT']/@Value); - - - - SDTM-ETL mapping for CM.CMSTDY - - if(contains($CM.CMSTDTC,'UNK')) { -$CM.CMSTDY = ''; -} elsif ($CM.CMSTDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($CM.CMSTDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$CM.CMSTDY = $NUM; -} elsif($NUM >= 0) { -$CM.CMSTDY = $NUM +1; -} else { -$CM.CMSTDY = ''; -} - - - - SDTM-ETL mapping for CM.CMENDY - - if($CM.CMENDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($CM.CMENDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$CM.CMENDY = $NUM; -} elsif($NUM >= 0) { -$CM.CMENDY = $NUM +1; -} else { -$CM.CMENDY = ''; -} - - - - SDTM-ETL mapping for CM.CMENTPT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$SE = xpath(/StudyEventData/@StudyEventOID/); - if($SE = 'SE.Screening') { -$CM.CMENTPT = 'Screening Visit'; -} elsif($SE = 'SE.Patient Level Forms') { -$CM.CMENTPT = 'Outcome Visit'; -} - - - - SDTM-ETL mapping for MH.SMOKER - - # Mapping using ODM element ItemData with ItemOID MH.SMO_MHOCCUR_DEC -$SMOKER = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='MH.FO']/ItemGroupData[@ItemGroupOID='MH.IG']/ItemData[@ItemOID='MH.SMO_MHOCCUR_DEC']/@Value); - if($SMOKER != 'Yes') { -$MH.SMOKER = $SMOKER; -} - - - - SDTM-ETL mapping for EG.EGTESTCD - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES - value from attribute ItemOID -# Mapping for ODM Items [EG.QTCF_EGORRES] to SDTM CodeList EG.EGTESTCD -# with CodeList OID 'CL.C71153.EGTESTCD' -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@ItemOID); -if ($CODEDVALUE == 'EG.QTCF_EGORRES') { - $NEWCODEDVALUE = 'QTCFAG'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$EG.EGTESTCD = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for EG.EGTEST - - # Mapping using the decode() function on codelist CL.C71153.EGTESTCD of variable EG.EGTESTCD -$EG.EGTEST = decode($EG.EGTESTCD, 'CL.C71153.EGTESTCD', ''); - - - - SDTM-ETL mapping for EG.EGBLFL - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); -$EGTIM1 = simpletimetoISOtime($EGTIM); - if($EGDAT != '' and $EGTIM1 != '') { -$EGDTC = createdatetime($EGDAT,$EGTIM1); -} else { -$EGDTC = $EGDAT; -} -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']); -# the function returns a list of datetimes separated by the pipe (|) symbol -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'EG.EGDAT','EG.EGTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; - -if($LASTDATETIME = $EGDTC) { -$EG.EGBLFL = 'Y'; -} else { -$EG.EGBLFL = ''; -} - - - - SDTM-ETL mapping for EG.VISITNUM - - # Mapping using ODM element ItemData with ItemOID EG.VISITID -$EG.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.VISITID']/@Value); - - - - SDTM-ETL mapping for CE.CEPRESP - - $CE.CEPRESP = 'Y'; - - - - SDTM-ETL mapping for EG.VISIT - - $EG.VISIT = 'Patient Level Forms'; - - - - SDTM-ETL mapping for EG.EPOCH - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EGSTDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EGSTDTC = $EGDAT; -} -if($EGSTDTC = '') { -$EG.EPOCH = ''; -} elsif($EGSTDTC < $RFSTDTC) { -$EG.EPOCH = 'SCREENING'; -} elsif ($EGSTDTC > $RFENDTC) { -$EG.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $EGSTDTC and $EGSTDTC <= $RFENDTC) { -$EG.EPOCH = 'TREATMENT'; -} - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - IESEQ calculated - - $IE.IESEQ = $SEQUENCE; - - - - SDTM-ETL mapping for IE.IESTRESC - - # Mapping using ODM element ItemData with ItemOID IE.IETESTCD -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='IE.FO']/ItemGroupData[@ItemGroupOID='IE.IG']/ItemData[@ItemOID='IE.IETESTCD']/@Value); -if ($CODEDVALUE == 'I05') { - $NEWCODEDVALUE = 'N'; -} elsif ($CODEDVALUE == 'I03') { - $NEWCODEDVALUE = 'N'; -} elsif ($CODEDVALUE == 'I02') { - $NEWCODEDVALUE = 'N'; -} else { - $NEWCODEDVALUE = ''; -} -$IE.IESTRESC = $NEWCODEDVALUE; - - - - STUDYID from ODM Study-OID - - $STUDYID = "CM4620-203"; - - - - SDTM-ETL mapping for IE.EPOCH - - $IE.EPOCH = 'SCREENING'; - - - - SDTM-ETL mapping for FA.FATEST - - # Mapping using ODM element ItemData with ItemOID ML.MLOFFER_DEC - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Items within the ItemGroup -$ITEM = xpath(/StudyEventData/FormData[@FormOID='ML.FO']/ItemGroupData[@ItemGroupOID='ML.IG']/ItemData[@ItemOID='ML.MLOFFER_DEC' or @ItemOID='ML.MLREAS_DEC' or @ItemOID='ML.PADFYN_DEC' or @ItemOID='ML.PARFD_DEC' or @ItemOID='ML.SOLID_MLOCCUR_DEC' or @ItemOID='ML.CAL_MLOCCUR_DEC' or @ItemOID='ML.FAT_MLOCCUR_DEC' or @ItemOID='ML.LIQUID_MLOCCUR_DEC' or @ItemOID='ML.MLPAIN_DEC' or @ItemOID='ML.MLVOMIT_DEC' or @ItemOID='ML.MLRANGE_DEC']/@ItemOID); - if($ITEM == 'ML.MLOFFER_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLREAS_DEC') { -$FA.FATEST = 'Reason not offered'; -} elsif($ITEM = 'ML.PADFYN_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.PARFD_DEC') { -$FA.FATEST = 'Feeds type'; -} elsif($ITEM = 'ML.SOLID_MLOCCUR_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.CAL_MLOCCUR_DEC') { -$FA.FATEST = 'Meal type'; -} elsif($ITEM = 'ML.FAT_MLOCCUR_DEC') { -$FA.FATEST = 'Meal type'; -} elsif($ITEM = 'ML.LIQUID_MLOCCUR_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLPAIN_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLVOMIT_DEC') { -$FA.FATEST = 'Occurrence'; -} elsif($ITEM = 'ML.MLRANGE_DEC') { -$FA.FATEST = 'Time range'; -} - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - SDTM-ETL mapping for FA.FASTRESC - - if($FA.FAORRES = 'Yes') { -$FA.FASTRESC = 'Y'; -} elsif($FA.FAORRES = 'No') { -$FA.FASTRESC = 'N'; -} else { -$FA.FASTRESC = $FA.FAORRES; -} - - - - SDTM-ETL mapping for LB.LBCAT - - # Mapping using ODM element ItemData with ItemOID LB.LBCAT -# Generalized for all StudyEvents -$LB.LBCAT = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBCAT']/@Value); - - - - SDTM-ETL mapping for LB.LBORRES - - # Mapping using ODM element ItemData with ItemOID LB.LBORRES -# Generalized for all StudyEvents -$LB.LBORRES = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.LBORRES']/@Value); - - - - SDTM-ETL mapping for LB.LBSTRESU - - # Mapping using ODM element ItemData with ItemOID LB.lonicd -# Generalized for all StudyEvents -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$LOINCCD = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.lonicd']/@Value); - if($LB.LBTESTCD != '') { -$LBLOINC = $LOINCCD; -} -$LBSTRESU = rws:siunit4loinc($LBLOINC) ; - if($LBSTRESU != '' and $LB.LBORRESU != '') { -$LB.LBSTRESU = $LBSTRESU; -} else { -$LB.LBSTRESU = $LB.LBORRESU; -} - - - - SDTM-ETL mapping for LB.LBLOINC - - # Mapping using ODM element ItemData with ItemOID LB.lonicd -# Generalized for all StudyEvents -$LB.LBLOINC = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.lonicd']/@Value); - - - - SDTM-ETL mapping for LB.LBDY - - if($LB.LBDTC != '' and $RFSTDTC != '') { -$DIFF = datediff($LB.LBDTC, $RFSTDTC); -} -$NUM = number($DIFF ) ; - if($NUM < 0) { -$LB.LBDY = $NUM; -} elsif($NUM >= 0) { -$LB.LBDY = $NUM +1; -} else { -$LB.LBDY = ''; -} - - - - SDTM-ETL mapping for LB.ELIG - - # Mapping using ODM element ItemData with ItemOID LB.ELIG_DEC -# Generalized for all StudyEvents -$LB.ELIG = xpath(/StudyEventData/FormData[@FormOID='LB.FO']/ItemGroupData[@ItemGroupOID='LB.IG']/ItemData[@ItemOID='LB.ELIG_DEC']/@Value); - - - - DSSEQ calculated - - $DS.DSSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for DS.DSTERM - - # Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='IE.IEYN_DEC' or @ItemOID='RN.RNDAT' or @ItemOID='DSET.DSDECOD_DEC']/@ItemOID); - -# Mapping using ODM element ItemData with ItemOID IE.IEYN_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$IEYN =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='IE.IEYN_DEC']/@Value); - -# Mapping using ODM element ItemData with ItemOID CONT.CONTOCCUR_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CONT = xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC']/@Value); - -# Mapping using ODM element ItemData with ItemOID DSET.DSDECOD_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$DSDECOD = xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='DSET.DSDECOD_DEC']/@Value); - -if($ITEM ='DSIC.DSSTDAT') { -$DS.DSTERM = 'INFORMED CONSENT OBTAINED'; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN = 'No') { -$DS.DSTERM ='SCREEN FAILURE'; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN ='Yes') { -$DS.DSTERM ='RANDOMIZED (UTC)'; -} elsif($ITEM ='RN.RNDAT' ) { -$DS.DSTERM ='RANDOMIZED (Local Time)'; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Withdrawal of Consent') { -$DS.DSTERM = upper-case($CONT); -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Discharged') { -$DS.DSTERM = 'DISCHARGE OUTCOME'; -} elsif($ITEM ='DSOUT2.DSDAT2') { -$DS.DSTERM ='SECOND DISCHARGE OUTCOME'; -} elsif($ITEM ='DSET.DSDECOD_DEC' ) { -$DS.DSTERM = upper-case($DSDECOD); -} - - - - SDTM-ETL mapping for DS.DSSCAT - - # Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='IE.IEYN_DEC' or @ItemOID='RN.RNDAT' or @ItemOID='DSET.DSDECOD_DEC']/@ItemOID); - -# Mapping using ODM element ItemData with ItemOID IE.IEYN_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$IEYN =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='IE.IEYN_DEC']/@Value); - -# Mapping using ODM element ItemData with ItemOID CONT.CONTOCCUR_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CONT = xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC']/@Value); - -if($ITEM ='DSIC.DSSTDAT') { -$DS.DSSCAT = 'INFORMED CONSENT'; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN = 'No') { -$DS.DSSCAT ='RANDOMIZATION'; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN ='Yes') { -$DS.DSSCAT ='RANDOMIZATION'; -} elsif($ITEM ='RN.RNDAT' ) { -$DS.DSSCAT ='RANDOMIZATION'; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Withdrawal of Consent') { -$DS.DSSCAT = 'DISCHARGE OUTCOME'; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Discharged') { -$DS.DSSCAT = 'DISCHARGE OUTCOME'; -} elsif($ITEM ='DSOUT2.DSDAT2') { -$DS.DSSCAT ='DISCHARGE OUTCOME'; -} elsif($ITEM ='DSET.DSDECOD_DEC' ) { -$DS.DSSCAT = 'END OF TREATMENT'; -} - - - - SDTM-ETL mapping for DS.EPOCH - - # Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT -$DSSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.DSSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSIC.DSSTTIM -$DSSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DSIC.FO']/ItemGroupData[@ItemGroupOID='DSIC.IG']/ItemData[@ItemOID='DSIC.DSSTTIM']/@Value); -#$DSDTTIM1 = simpletimetoISOtime($DSSTTIM); - if($DSSTDAT != '' and $DSSTTIM != '') { -$DSIC = createdatetime($DSSTDAT,$DSSTTIM); -} else { -$DSIC = $DSSTDAT; -} -# Mapping using ODM element ItemData with ItemOID RN.RNUTCDAT -$RNUTCDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNUTCDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID RN.RNUTCTIM -$RNUTCTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNUTCTIM']/@Value); -#$RNUTCTIM1 = simpletimetoISOtime($RNUTCTIM); - if($RNUTCDAT != '' and $RNUTCTIM != '') { -$RNUTC = createdatetime($RNUTCDAT,$RNUTCTIM); -} else { -$RNUTC = $RNUTCDAT; -} -# Mapping using ODM element ItemData with ItemOID RN.RNDAT -$RNDAT = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID RN.RNTIM -$RNTIM = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='RN.FO']/ItemGroupData[@ItemGroupOID='RN.IG']/ItemData[@ItemOID='RN.RNTIM']/@Value); - if($RNDAT != '' and $RNTIM != '') { -$RNDTC = createdatetime($RNDAT,$RNTIM); -} else { -$RNDTC = $RNDAT; -} - - -# Mapping using ODM element ItemData with ItemOID DSOUT.DSDAT -$DSDAT = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT.FO']/ItemGroupData[@ItemGroupOID='DSOUT.IG']/ItemData[@ItemOID='DSOUT.DSDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT.STTIME -$DSTIME = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT.FO']/ItemGroupData[@ItemGroupOID='DSOUT.IG']/ItemData[@ItemOID='DSOUT.STTIME']/@Value); - if($DSDAT != '' and $DSTIME != '') { -$DSOUT = createdatetime($DSDAT,$DSTIME); -} else { -$DSOUT = $DSDAT; -} - -# Mapping using ODM element ItemData with ItemOID DSOUT2.DSDAT2 -$DSDAT2 = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT2.FO']/ItemGroupData[@ItemGroupOID='DSOUT2.IG']/ItemData[@ItemOID='DSOUT2.DSDAT2']/@Value); -# Mapping using ODM element ItemData with ItemOID DSOUT2.STTIME -$DSTIME2 = xpath(/StudyEventData[@StudyEventOID='SE.Study Milestones']/FormData[@FormOID='DSOUT2.FO']/ItemGroupData[@ItemGroupOID='DSOUT2.IG']/ItemData[@ItemOID='DSOUT2.STTIME']/@Value); - if($DSDAT2 != '' and $DSTIME2 != '') { -$DSOUT2 = createdatetime($DSDAT2,$DSTIME2); -} else { -$DSOUT2 = $DSDAT; -} -# Mapping using ODM element ItemData with ItemOID DSIC.DSSTDAT - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$ITEM =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC' or @ItemOID='DSIC.DSSTDAT' or @ItemOID='DSOUT2.DSDAT2' or @ItemOID='IE.IEYN_DEC' or @ItemOID='RN.RNDAT' or @ItemOID='DSET.DSDECOD_DEC']/@ItemOID); - -# Mapping using ODM element ItemData with ItemOID IE.IEYN_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$IEYN =xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='IE.IEYN_DEC']/@Value); - -# Mapping using ODM element ItemData with ItemOID CONT.CONTOCCUR_DEC -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$CONT = xpath(/StudyEventData/FormData[@FormOID='CONT.FO' or @FormOID='DSIC.FO' or @FormOID='DSOUT.FO' or @FormOID='DSOUT2.FO' or @FormOID='IE.FO' or @FormOID='RN.FO' or @FormOID='DSET.FO']/ItemGroupData/ItemData[@ItemOID='CONT.CONTOCCUR_DEC']/@Value); - - -if($ITEM ='DSIC.DSSTDAT') { -$DSSTDTC = $DSIC; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN = 'No') { -$DSSTDTC =''; -} elsif($ITEM ='IE.IEYN_DEC' and $IEYN ='Yes') { -$DSSTDTC = $RNUTC; -} elsif($ITEM ='RN.RNDAT' ) { -$DSSTDTC = $RNDAT; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Withdrawal of Consent') { -$DSSTDTC = ''; -} elsif($ITEM ='CONT.CONTOCCUR_DEC' and $CONT='Discharged') { -$DSSTDTC = $DSOUT; -} elsif($ITEM ='DSOUT2.DSDAT2') { -$DSSTDTC = $DSOUT2; -} elsif($ITEM ='DSET.DSDECOD_DEC' ) { -$DSSTDTC = ''; -} -if($DSSTDTC = '' or $RFSTDTC = '') { -$DS.EPOCH = ''; -} elsif($DSSTDTC < $RFSTDTC) { -$DS.EPOCH = 'SCREENING'; -} elsif ($DSSTDTC > $RFENDTC) { -$DS.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $DSSTDTC and $DSSTDTC <= $RFENDTC) { -$DS.EPOCH = 'TREATMENT'; -} - - - - VSSEQ calculated - - $VS.VSSEQ = $SEQUENCE; - - - - SDTM-ETL mapping for VS.VSBLFL - - # Mapping using ODM element ItemData with ItemOID VS.VSTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VSTIM = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VSTIM']/@Value); - -# Mapping using ODM element ItemData with ItemOID VS.VSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VSDT = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VSDAT']/@Value); - -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$TESTOID = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.SYSBP_VSORRES' or @ItemOID='VS.DIABP_VSORRES' or @ItemOID='VS.HR_VSORRES' or @ItemOID='VS.RESP_VSORRES' or @ItemOID='VS.TEMP_VSORRES' or @ItemOID='VS.INTRA_VSORRES' or @ItemOID='VS.HEIGHTP_VSORRES' or @ItemOID='VS.BMI_VSORRES' or @ItemOID='VS.WEIGHT_VSORRES']/@ItemOID); -$VSTIM1 = simpletimetoISOtime($VSTIM); -if($VSDT != "" and $VSTIM1 != "") { - $VSDTC = createdatetime($VSDT, $VSTIM1) ; -} elsif($VSDT != "" and $VSTIM1 == "") { - $VSDTC = $VSDT; -} - -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData[@ItemGroupOID='VS.IG']); -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'VS.VSDAT','VS.VSTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - if($RFSTDTCISO != '') { -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; -} - -if($LASTDATETIME = $VSDTC) { - $VS.VSBLFL = 'Y'; -} else { - $VS.VSBLFL = ''; -} - - - - SDTM-ETL mapping for VS.VISITNUM - - # Mapping using ODM element ItemData with ItemOID VS.VISITID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$VS.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VISITID']/@Value); - - - - SDTM-ETL mapping for VS.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($VS.VISITNUM != "") { -$VS.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for VS.EPOCH - - # Mapping using ODM element ItemData with ItemOID VS.VSTIM -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VSTIM = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VSTIM']/@Value); - -# Mapping using ODM element ItemData with ItemOID VS.VSDAT -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$VSDT = xpath(/StudyEventData/FormData[@FormOID='VS.FO']/ItemGroupData/ItemData[@ItemOID='VS.VSDAT']/@Value); - -if($VSDT != "" and $VSTIM != "") { - $VSDTC = createdatetime($VSDT, $VSTIM) ; -} elsif($VSDT != "" and $VSTIM == "") { - $VSDTC = $VSDT; -} -if($VSDTC = '' or $RFSTDTC = '') { -$VS.EPOCH = ''; -} elsif($VSDTC < $RFSTDTC) { -$VS.EPOCH = 'SCREENING'; -} elsif ($VSDTC > $RFENDTC) { -$VS.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $VSDTC and $VSDTC <= $RFENDTC) { -$VS.EPOCH = 'TREATMENT'; -} - - - - DOMAIN from template - - $DOMAIN = "VS"; - - - - SDTM-ETL mapping for VS.VSTESTCD - - # Mapping using ODM element ItemData with ItemOID VSOXY.OXYSAT_VSORRES - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [VSOXY.OXYSAT_VSORRES, VSOXY.FIO2_VSORRES] to SDTM CodeList VS.VSTESTCD -# with CodeList OID 'CL.C66741.VSTESTCD' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.OXYSAT_VSORRES' or @ItemOID='VSOXY.FIO2_VSORRES']/@ItemOID); -if ($CODEDVALUE == 'VSOXY.OXYSAT_VSORRES') { - $NEWCODEDVALUE = 'OXYSAT'; -} elsif ($CODEDVALUE == 'VSOXY.FIO2_VSORRES') { - $NEWCODEDVALUE = 'FIO2'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$VS.VSTESTCD = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for VS.VSTEST - - # Mapping using the decode() function on codelist CL.C66741.VSTESTCD of variable VS.VSTESTCD -$VS.VSTEST = decode($VS.VSTESTCD, 'CL.C66741.VSTESTCD', ''); - - - - SDTM-ETL mapping for VS.VSCAT - - # Mapping using ODM element ItemData with ItemOID VSOXY.PAGENAME -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$VS.VSCAT = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.PAGENAME']/@Value); - - - - SDTM-ETL mapping for VS.VSORRES - - # Mapping using ODM element ItemData with ItemOID VSOXY.OXYSAT_VSORRES -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$VS.VSORRES = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.OXYSAT_VSORRES' or @ItemOID='VSOXY.FIO2_VSORRES']/@Value); - - - - SDTM-ETL mapping for VS.VSORRESU - - # Mapping using ODM element ItemData with ItemOID VSOXY.OXYSAT_VSORRES - value from attribute ItemOID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -# Mapping for ODM Items [VSOXY.OXYSAT_VSORRES, VSOXY.FIO2_VSORRES] to SDTM CodeList VS.VSORRESU -# with CodeList OID 'CL.C66770.VSRESU' -$CODEDVALUE = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.OXYSAT_VSORRES' or @ItemOID='VSOXY.FIO2_VSORRES']/@ItemOID); -if ($CODEDVALUE == 'VSOXY.OXYSAT_VSORRES') { - $NEWCODEDVALUE = '%'; -} elsif ($CODEDVALUE == 'VSOXY.FIO2_VSORRES') { - $NEWCODEDVALUE = '%'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$VS.VSORRESU = $NEWCODEDVALUE; - - - - SDTM-ETL mapping for VS.VSSTRESN - - $VS.VSSTRESN = $VS.VSSTRESC; - - - - SDTM-ETL mapping for VS.VSSTRESU - - $VS.VSSTRESU = $VS.VSORRESU; - - - - SDTM-ETL mapping for VS.VISITNUM - - # Mapping using ODM element ItemData with ItemOID VSOXY.VISITID -# Generalized for all StudyEvents -# Generalized for all Forms within the StudyEvent -# Generalized for all ItemGroups within the Form -# Generalized for all Items within the ItemGroup -$VS.VISITNUM = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VISITID']/@Value); - - - - SDTM-ETL mapping for VS.VISIT - - # Mapping using ODM element StudyEventData using value from attribute StudyEventOID -# Generalized for all StudyEvents -$VISIT = xpath(/StudyEventData/@StudyEventOID/); - if($VS.VISITNUM != "") { -$VS.VISIT = substring($VISIT,4); -} - - - - SDTM-ETL mapping for VS.EPOCH - - $VSTIM = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VSTIM']/@Value); -$VSDT = xpath(/StudyEventData/FormData[@FormOID='VSOXY.FO']/ItemGroupData/ItemData[@ItemOID='VSOXY.VSDAT']/@Value); - -if($VSDT != "" and $VSTIM != "") { - $VSDTC = createdatetime($VSDT, $VSTIM) ; -} elsif($VSDT != "" and $VSTIM == "") { - $VSDTC = $VSDT; -} -if($VSDTC = '' or $RFSTDTC = '') { -$VS.EPOCH = ''; -} elsif($VSDTC < $RFSTDTC) { -$VS.EPOCH = 'SCREENING'; -} elsif ($VSDTC > $RFENDTC) { -$VS.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $VSDTC and $VSDTC <= $RFENDTC) { -$VS.EPOCH = 'TREATMENT'; -} - - - - "CM4620-203" - - $STUDYID = "CM4620-203"; - - - - "EG" - - $DOMAIN = "EG"; - - - - Test - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - Sort by STUDYID, USUBJID, EGTESTCD, VISITNUM and EGDTC then assign value. Start at 1 for each subject. No duplicates allowed within a subject. - - $EG.EGSEQ = $SEQUENCE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES - value from attribute ItemOID -# Mapping for ODM Items [EG.QTCF_EGORRES] to SDTM CodeList EG.EGTESTCD -# with CodeList OID 'CL.C71153.EGTESTCD' -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@ItemOID); -if ($CODEDVALUE == 'EG.QTCF_EGORRES') { - $NEWCODEDVALUE = 'QTCFAG'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$EG.EGTESTCD = $NEWCODEDVALUE; - - - - Test - - # Mapping using the decode() function on codelist CL.C71153.EGTESTCD of variable EG.EGTESTCD -$EG.EGTEST = decode($EG.EGTESTCD, 'CL.C71153.EGTESTCD', ''); - - - - Test - - $EG.EGCAT = 'ECG - QTcF Readings'; - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES -$EG.EGORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@Value); - - - - Test - - $EG.EGORRESU = 'ms'; - - - - EGSTRESC=EGORRES - - $EG.EGSTRESC = $EG.EGORRES; - - - - EGSTRESN=EGORRES - - $EG.EGSTRESN = $EG.EGORRES; - - - - Test - - $EG.EGSTRESU = 'msec'; - - - - Last non-missing value for each EGTESTCD completed on or before DM.RFSTDTC. - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); -$EGTIM1 = simpletimetoISOtime($EGTIM); - if($EGDAT != '' and $EGTIM1 != '') { -$EGDTC = createdatetime($EGDAT,$EGTIM1); -} else { -$EGDTC = $EGDAT; -} -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']); -# the function returns a list of datetimes separated by the pipe (|) symbol -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'EG.EGDAT','EG.EGTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; - -if($LASTDATETIME = $EGDTC) { -$EG.EGBLFL = 'Y'; -} else { -$EG.EGBLFL = ''; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.VISITID -$EG.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.VISITID']/@Value); - - - - SDTM-ETL mapping for EG.VISIT - - $EG.VISIT = 'Patient Level Forms'; - - - - Only populated when EXSTDTC is a complete date: If .<EXSTDTC<RFSTDTC , then EPOCH='SCREENING'; Else if .<RFSTDTC<=EXSTDTC<=RFENDTC, then EPOCH=' TREATMENT'; Else if .<RFENDTC<EXSTDTC, then EPOCH='FOLLOW-UP'.Formal Expression - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EGSTDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EGSTDTC = $EGDAT; -} -if($EGSTDTC = '') { -$EG.EPOCH = ''; -} elsif($EGSTDTC < $RFSTDTC) { -$EG.EPOCH = 'SCREENING'; -} elsif ($EGSTDTC > $RFENDTC) { -$EG.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $EGSTDTC and $EGSTDTC <= $RFENDTC) { -$EG.EPOCH = 'TREATMENT'; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EG.EGDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EG.EGDTC = $EGDAT; -} - - - - The Subject Reference Start Date (DM.RFSTDTC) is designated as Study Day 1. The Study Day value is incremented by 1 for each date following RFSTDTC. Dates prior to RFSTDTC are decremented by 1, with the date preceding RFSTDTC designated as Study Day -1.Formal Expression - - $NUM = datediff($EG.EGDTC, $RFSTDTC); - if($NUM < 0) { -$EG.EGDY = $NUM; -} elsif($NUM >= 0) { -$EG.EGDY = $NUM +1; -} else { -$EG.EGDY = ''; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.TELEYN_DEC -$EG.TELEYN = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.TELEYN_DEC']/@Value); - - - - SDTM-ETL mapping for RFSTDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -$EXSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -$EXSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$RFSTDTC = createdatetime($EXSTDAT,$EXSTTIM); -} else { -$RFSTDTC = $EXSTDAT; -} - - - - SDTM-ETL mapping for DFENDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXENDAT -# Generalized for all StudyEvents -$EXENDAT = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXENTIM -# Generalized for all StudyEvents -$EXENTIM = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENTIM']/@Value); -$DAT = latestdate($EXENDAT) ; -$TIM = $EXENTIM[last()]; - if($DAT != '' and $TIM != '') { -$RFENDTC = createdatetime($DAT,$TIM) ; -} - - - - SDTM-ETL mapping for RFSTDTCISO - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -$EXSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -$EXSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$EXSTTIM1 = simpletimetoISOtime($EXSTTIM); -$RFSTDTCISO = createdatetime($EXSTDAT,$EXSTTIM1); -} else { -$RFSTDTCISO = $EXSTDAT; -} - - - - SDTM-ETL mapping for USUBID - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - "CM4620-203" - - $STUDYID = "CM4620-203"; - - - - "EG" - - $DOMAIN = "EG"; - - - - Test - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - Sort by STUDYID, USUBJID, EGTESTCD, VISITNUM and EGDTC then assign value. Start at 1 for each subject. No duplicates allowed within a subject. - - $EG.EGSEQ = $SEQUENCE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES - value from attribute ItemOID -# Mapping for ODM Items [EG.QTCF_EGORRES] to SDTM CodeList EG.EGTESTCD -# with CodeList OID 'CL.C71153.EGTESTCD' -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@ItemOID); -if ($CODEDVALUE == 'EG.QTCF_EGORRES') { - $NEWCODEDVALUE = 'QTCFAG'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$EG.EGTESTCD = $NEWCODEDVALUE; - - - - Test - - # Mapping using the decode() function on codelist CL.C71153.EGTESTCD of variable EG.EGTESTCD -$EG.EGTEST = decode($EG.EGTESTCD, 'CL.C71153.EGTESTCD', ''); - - - - Test - - $EG.EGCAT = 'ECG - QTcF Readings'; - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES -$EG.EGORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@Value); - - - - Test - - $EG.EGORRESU = 'ms'; - - - - EGSTRESC=EGORRES - - $EG.EGSTRESC = $EG.EGORRES; - - - - EGSTRESN=EGORRES - - $EG.EGSTRESN = $EG.EGORRES; - - - - Test - - $EG.EGSTRESU = 'msec'; - - - - Last non-missing value for each EGTESTCD completed on or before DM.RFSTDTC. - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); -$EGTIM1 = simpletimetoISOtime($EGTIM); - if($EGDAT != '' and $EGTIM1 != '') { -$EGDTC = createdatetime($EGDAT,$EGTIM1); -} else { -$EGDTC = $EGDAT; -} -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']); -# the function returns a list of datetimes separated by the pipe (|) symbol -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'EG.EGDAT','EG.EGTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; - -if($LASTDATETIME = $EGDTC) { -$EG.EGBLFL = 'Y'; -} else { -$EG.EGBLFL = ''; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.VISITID -$EG.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.VISITID']/@Value); - - - - SDTM-ETL mapping for EG.VISIT - - $EG.VISIT = 'Patient Level Forms'; - - - - Only populated when EXSTDTC is a complete date: If .<EXSTDTC<RFSTDTC , then EPOCH='SCREENING'; Else if .<RFSTDTC<=EXSTDTC<=RFENDTC, then EPOCH=' TREATMENT'; Else if .<RFENDTC<EXSTDTC, then EPOCH='FOLLOW-UP'.Formal Expression - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EGSTDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EGSTDTC = $EGDAT; -} -if($EGSTDTC = '') { -$EG.EPOCH = ''; -} elsif($EGSTDTC < $RFSTDTC) { -$EG.EPOCH = 'SCREENING'; -} elsif ($EGSTDTC > $RFENDTC) { -$EG.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $EGSTDTC and $EGSTDTC <= $RFENDTC) { -$EG.EPOCH = 'TREATMENT'; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EG.EGDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EG.EGDTC = $EGDAT; -} - - - - The Subject Reference Start Date (DM.RFSTDTC) is designated as Study Day 1. The Study Day value is incremented by 1 for each date following RFSTDTC. Dates prior to RFSTDTC are decremented by 1, with the date preceding RFSTDTC designated as Study Day -1.Formal Expression - - $NUM = datediff($EG.EGDTC, $RFSTDTC); - if($NUM < 0) { -$EG.EGDY = $NUM; -} elsif($NUM >= 0) { -$EG.EGDY = $NUM +1; -} else { -$EG.EGDY = ''; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.TELEYN_DEC -$EG.TELEYN = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.TELEYN_DEC']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.TELEYN_DEC -$EG.TELEYN = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.TELEYN_DEC']/@Value); - - - - SDTM-ETL mapping for RFSTDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -$EXSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -$EXSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$RFSTDTC = createdatetime($EXSTDAT,$EXSTTIM); -} else { -$RFSTDTC = $EXSTDAT; -} - - - - SDTM-ETL mapping for DFENDTC - - # Mapping using ODM element ItemData with ItemOID EX.EXENDAT -# Generalized for all StudyEvents -$EXENDAT = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXENTIM -# Generalized for all StudyEvents -$EXENTIM = xpath(/StudyEventData/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXENTIM']/@Value); -$DAT = latestdate($EXENDAT) ; -$TIM = $EXENTIM[last()]; - if($DAT != '' and $TIM != '') { -$RFENDTC = createdatetime($DAT,$TIM) ; -} - - - - SDTM-ETL mapping for RFSTDTCISO - - # Mapping using ODM element ItemData with ItemOID EX.EXSTDAT -$EXSTDAT = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EX.EXSTTIM -$EXSTTIM = xpath(/StudyEventData[@StudyEventOID='SE.0 Hour']/FormData[@FormOID='EX.FO']/ItemGroupData[@ItemGroupOID='EX.IG']/ItemData[@ItemOID='EX.EXSTTIM']/@Value); - if($EXSTDAT != '' and $EXSTTIM != '') { -$EXSTTIM1 = simpletimetoISOtime($EXSTTIM); -$RFSTDTCISO = createdatetime($EXSTDAT,$EXSTTIM1); -} else { -$RFSTDTCISO = $EXSTDAT; -} - - - - SDTM-ETL mapping for USUBID - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - "CM4620-203" - - $STUDYID = "CM4620-203"; - - - - "AE" - - $DOMAIN = "AE"; - - - - USUBJID from ODM ClinicalData - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - Sort by STUDYID, USUBJID, AESTDTC, AETERM, AEDECOD and AEENDTC then assign value. Start at 1 for each subject. No duplicates allowed within a subject. - - $AE.AESEQ = $SEQUENCE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESPID -$AE.AESPID = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESPID']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AETERM -$AE.AETERM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AETERM']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.LLT_NAME -$AE.AELLT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.LLT_NAME']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.LLT_CODE -$AE.AELLTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.LLT_CODE']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.PT_TERM -$AE.AEDECOD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.PT_TERM']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.PT_CODE -$AE.AEPTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.PT_CODE']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.HLT_TERM -$AE.AEHLT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLT_TERM']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.HLT_CODE -$AE.AEHLTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLT_CODE']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.HLGT_TERM -$AE.AEHLGT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLGT_TERM']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.HLGT_CODE -$AE.AEHLGTCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.HLGT_CODE']/@Value); - - - - SDTM-ETL mapping for AE.AECAT - - $AE.AECAT = 'Adverse Events'; - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.SOC_TERM -$AE.AEBODSYS = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_TERM']/@Value); - - - - MedDRA dictionary assigned. - - # Mapping using ODM element ItemData with ItemOID AE.SOC_CODE -#$AE.AEBDSYCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_CODE']/@Value); -$AE.AEBDSYCD = generate-id(.); - - - - MedDRA dictionary assigned. Will be the same as AEBODSYS if the primary SOC was used for analysis. - - # Mapping using ODM element ItemData with ItemOID AE.SOC_TERM -$AE.AESOC = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_TERM']/@Value); - - - - MedDRA dictionary assigned. Will be the same as AEBODSYS if the primary SOC was used for analysis. - - # Mapping using ODM element ItemData with ItemOID AE.SOC_CODE -$AE.AESOCCD = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.SOC_CODE']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESEV_DEC -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESEV_DEC']/@Value); -if ($CODEDVALUE == 'Mild') { - $NEWCODEDVALUE = 'MILD'; -} elsif ($CODEDVALUE == 'Moderate') { - $NEWCODEDVALUE = 'MODERATE'; -} elsif ($CODEDVALUE == 'Severe') { - $NEWCODEDVALUE = 'SEVERE'; -} else { - $NEWCODEDVALUE = ''; -} -$AE.AESEV = $NEWCODEDVALUE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESER -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESER = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESER']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AEACN -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEACN']/@Value); -# Using DECODED values for the SDTM codelist CL.cACN -if ($CODEDVALUE == 'ACN1') { - $NEWCODEDVALUE = 'No Action Taken'; -} elsif ($CODEDVALUE == 'ACN4') { - $NEWCODEDVALUE = 'Permanently Discontinued'; -} elsif ($CODEDVALUE == 'NA') { - $NEWCODEDVALUE = 'N/A'; -} elsif ($CODEDVALUE == 'ACN3') { - $NEWCODEDVALUE = 'Temporarily Interrupted'; -} else { - $NEWCODEDVALUE = ''; -} -$AE.AEACN = $NEWCODEDVALUE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AEREL -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEREL']/@Value); -# Using DECODED values for the SDTM codelist CL.cREL -if ($CODEDVALUE == 'REL2') { - $NEWCODEDVALUE = 'Unlikely'; -} elsif ($CODEDVALUE == 'REL3') { - $NEWCODEDVALUE = 'Possible'; -} elsif ($CODEDVALUE == 'REL1') { - $NEWCODEDVALUE = 'Unrelated'; -} elsif ($CODEDVALUE == 'REL4') { - $NEWCODEDVALUE = 'Probable'; -} else { - $NEWCODEDVALUE = ''; -} -$AE.AEREL = $NEWCODEDVALUE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AEOUT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEOUT']/@Value); -# Using DECODED values for the SDTM codelist CL.cOUT -if ($CODEDVALUE == 'OUT1') { - $NEWCODEDVALUE = 'Recovered'; -} elsif ($CODEDVALUE == 'OUT4') { - $NEWCODEDVALUE = 'Not Recovered'; -} elsif ($CODEDVALUE == 'OUT3') { - $NEWCODEDVALUE = 'Recovered with Sequelae'; -} elsif ($CODEDVALUE == 'OUT2') { - $NEWCODEDVALUE = 'Recovering'; -} else { - $NEWCODEDVALUE = ''; -} -$AE.AEOUT = $NEWCODEDVALUE; - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESCONG -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESCONG = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESCONG']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESDISAB -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESDISAB = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESDISAB']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESDTH -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESDTH = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESDTH']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESHOSPR -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AESHOSPR = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESHOSPR']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AESHOSPP -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AESHOSPP = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESHOSPP']/@Value); - if($AESHOSPR = 'Y' or $AESHOSPP = 'Y') { -$AE.AESHOSP = 'Y'; -} else { -$AE.AESHOSP = 'N'; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESLIFE -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESLIFE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESLIFE']/@Value); - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESMIE -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$AE.AESMIE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESMIE']/@Value); - - - - AESEV - - # Mapping using ODM element ItemData with ItemOID AE.AESEV_DEC -$AE.AETOXGR = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESEV_DEC']/@Value); - - - - Only populated when AESTDTC is a complete date: If .<AESTDTC<RFSTDTC, then EPOCH='SCREENING'; Else if .<RFSTDTC<=AESTDTC<=RFENDTC, then EPOCH='TREATMENT'; Else if .<RFENDTC<AESTDTC, then EPOCH='FOLLOW-UP'. - - # Mapping using ODM element ItemData with ItemOID AE.AESTDAT -$AESTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AESTTIM -$AESTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTTIM']/@Value); - if($AESTDAT != '' and $AESTTIM = '') { -$AESTDTC = createdatetime($AESTDAT,$AESTTIM); -} else { -$AESTDTC = $AESTDAT; -} -if($AESTDTC = '') { -$AE.EPOCH = ''; -} elsif($AESTDTC < $RFSTDTC) { -$AE.EPOCH = 'SCREENING'; -} elsif ($AESTDTC > $RFENDTC) { -$AE.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $AESTDTC and $AESTDTC <= $RFENDTC) { -$AE.EPOCH = 'TREATMENT'; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID AE.AESTDAT -$AESTDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AESTTIM -$AESTTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AESTTIM']/@Value); - if($AESTDAT != '' and $AESTTIM != '') { -$AE.AESTDTC = createdatetime($AESTDAT,$AESTTIM); -} else { -$AE.AESTDTC = $AESTDAT; -} - - - - TEST - - # Mapping using ODM element ItemData with ItemOID AE.AEENDAT -$AEENDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEENDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID AE.AEENTIM -$AEENTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='AE.FO']/ItemGroupData[@ItemGroupOID='AE.IG']/ItemData[@ItemOID='AE.AEENTIM']/@Value); - if($AEENDAT != '' and $AEENTIM != '') { -$AE.AEENDTC = createdatetime($AEENDAT,$AEENTIM); -} else { -$AE.AEENDTC = $AEENDAT; -} - - - - The Subject Reference Start Date (DM.RFSTDTC) is designated as Study Day 1. The Study Day value is incremented by 1 for each date following RFSTDTC. Dates prior to RFSTDTC are decremented by 1, with the date preceding RFSTDTC designated as Study Day -1. - - $NUM = datediff($AE.AESTDTC, $RFSTDTC); - if($NUM < 0) { -$AE.AESTDY = $NUM; -} elsif($NUM >= 0) { -$AE.AESTDY = $NUM +1; -} else { -$AE.AESTDY = ''; -} - - - - The Subject Reference Start Date (DM.RFSTDTC) is designated as Study Day 1. The Study Day value is incremented by 1 for each date following RFSTDTC. Dates prior to RFSTDTC are decremented by 1, with the date preceding RFSTDTC designated as Study Day -1. - - if($AE.AEENDTC != '') { -$DIFF = datediff($AE.AEENDTC, $RFSTDTC); -} -$NUM = number($DIFF); - if($NUM < 0) { -$AE.AEENDY = $NUM; -} elsif($NUM >= 0) { -$AE.AEENDY = $NUM +1; -} else { -$AE.AEENDY = ''; -} - - - - "CM4620-203" - - $STUDYID = "CM4620-203"; - - - - "EG" - - $DOMAIN = "EG"; - - - - TEST - - # Mapping using ODM element ItemData with ItemOID DM.SUBNUM -$USUBJID = xpath(/StudyEventData[@StudyEventOID='SE.Screening']/FormData[@FormOID='DM.FO']/ItemGroupData[@ItemGroupOID='DM.IG']/ItemData[@ItemOID='DM.SUBNUM']/@Value); - - - - Sort by STUDYID, USUBJID, EGTESTCD, VISITNUM and EGDTC then assign value. Start at 1 for each subject. No duplicates allowed within a subject. - - $EG.EGSEQ = $SEQUENCE; - - - - TEST - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES - value from attribute ItemOID -# Mapping for ODM Items [EG.QTCF_EGORRES] to SDTM CodeList EG.EGTESTCD -# with CodeList OID 'CL.C71153.EGTESTCD' -$CODEDVALUE = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@ItemOID); -if ($CODEDVALUE == 'EG.QTCF_EGORRES') { - $NEWCODEDVALUE = '123456789'; -} elsif ($CODEDVALUE == '') { - $NEWCODEDVALUE = ''; -} else { - $NEWCODEDVALUE = ''; -} -$EG.EGTESTCD = $NEWCODEDVALUE; - - - - TEST - - # Mapping using the decode() function on codelist CL.C71153.EGTESTCD of variable EG.EGTESTCD -$EG.EGTEST = decode($EG.EGTESTCD, 'CL.C71153.EGTESTCD', ''); - - - - Test - - $EG.EGCAT = 'ECG - QTcF Readings'; - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.QTCF_EGORRES -$EG.EGORRES = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.QTCF_EGORRES']/@Value); - - - - Test - - $EG.EGORRESU = 'ms'; - - - - EGSTRESC=EGORRES - - $EG.EGSTRESC = $EG.EGORRES; - - - - EGSTRESN=EGORRES - - $EG.EGSTRESN = $EG.EGORRES; - - - - Test - - $EG.EGSTRESU = 'msec'; - - - - Last non-missing value for each EGTESTCD completed on or before DM.RFSTDTC. - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); -$EGTIM1 = simpletimetoISOtime($EGTIM); - if($EGDAT != '' and $EGTIM1 != '') { -$EGDTC = createdatetime($EGDAT,$EGTIM1); -} else { -$EGDTC = $EGDAT; -} -$MYSUBJID = xpath(/StudyEventData/../@SubjectKey); -$ALLVSRECORDS = xpath(//SubjectData[@SubjectKey=$MYSUBJID]/StudyEventData/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']); -# the function returns a list of datetimes separated by the pipe (|) symbol -$DATETIMES = my_createdatetimearray($ALLVSRECORDS,'EG.EGDAT','EG.EGTIM'); -$DATETIMES_ARRAY = tokenize($DATETIMES,'\|'); - -$LASTDATETIME = latestorequaldatetimebefore($DATETIMES_ARRAY,$RFSTDTCISO) ; - -if($LASTDATETIME = $EGDTC) { -$EG.EGBLFL = 'Y'; -} else { -$EG.EGBLFL = ''; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.VISITID -$EG.VISITNUM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.VISITID']/@Value); - - - - SDTM-ETL mapping for EG.VISIT - - $EG.VISIT = 'Patient Level Forms'; - - - - Only populated when EXSTDTC is a complete date: If .<EXSTDTC<RFSTDTC , then EPOCH='SCREENING'; Else if .<RFSTDTC<=EXSTDTC<=RFENDTC, then EPOCH=' TREATMENT'; Else if .<RFENDTC<EXSTDTC, then EPOCH='FOLLOW-UP'.Formal Expression - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EGSTDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EGSTDTC = $EGDAT; -} -if($EGSTDTC = '') { -$EG.EPOCH = ''; -} elsif($EGSTDTC < $RFSTDTC) { -$EG.EPOCH = 'SCREENING'; -} elsif ($EGSTDTC > $RFENDTC) { -$EG.EPOCH = 'FOLLOW-UP'; -} elsif ($RFSTDTC <= $EGSTDTC and $EGSTDTC <= $RFENDTC) { -$EG.EPOCH = 'TREATMENT'; -} - - - - Test - - # Mapping using ODM element ItemData with ItemOID EG.EGDAT -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGDAT = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGDAT']/@Value); -# Mapping using ODM element ItemData with ItemOID EG.EGTIM -# Using categorization as a CodeList is associated with the SDTM CodeList -# but no CodeList is associated with the ODM data -$EGTIM = xpath(/StudyEventData[@StudyEventOID='SE.Patient Level Forms']/FormData[@FormOID='EG.FO']/ItemGroupData[@ItemGroupOID='EG.IG']/ItemData[@ItemOID='EG.EGTIM']/@Value); - if($EGDAT != '' and $EGTIM != '') { -$EG.EGDTC = createdatetime($EGDAT,$EGTIM); -} else { -$EG.EGDTC = $EGDAT; -} - - - - The Subject Reference Start Date (DM.RFSTDTC) is designated as Study Day 1. The Study Day value is incremented by 1 for each date following RFSTDTC. Dates prior to RFSTDTC are decremented by 1, with the date preceding RFSTDTC designated as Study Day -1.Formal Expression - - $NUM = datediff($EG.EGDTC, $RFSTDTC); - if($NUM < 0) { -$EG.EGDY = $NUM; -} elsif($NUM >= 0) { -$EG.EGDY = $NUM +1; -} else { -$EG.EGDY = ''; -} - - - - SDTM-ETL mapping for EG.EGENTPT - - - - $EG.EGENTPT = "EGENRTPT should also be present"; - - - - Annotated CRF - - - - - diff --git a/tests/resources/CoreIssue286/rule.json b/tests/resources/CoreIssue286/rule.json deleted file mode 100644 index 1e787a317..000000000 --- a/tests/resources/CoreIssue286/rule.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "Check": { - "all": [ - { - "name": "define_dataset_is_non_standard", - "operator": "equal_to", - "value": "Yes" - }, - { - "name": "define_dataset_class", - "operator": "equal_to", - "value": "FINDINGS" - }, - { - "any": [ - { - "name": "$testcd_exists", - "operator": "not_equal_to", - "value": true - }, - { - "name": "define_dataset_variables", - "operator": "does_not_contain", - "value": "--TESTCD" - } - ] - } - ] - }, - "Core": { - "Id": "DEFINE ", - "Version": "1", - "Status": "Draft" - }, - "Description": "Non standard FINDINGS domain missing TESTCD variable", - "Operations": [ - { - "id": "$testcd_exists", - "name": "--TESTCD", - "operator": "variable_exists" - } - ], - "Outcome": { - "Message": "Non standard FINDINGS domain missing TESTCD variable", - "Output_Variables": ["$testcd_exists", "define_dataset_is_non_standard", "define_dataset_class", "define_dataset_variables"] - }, - "Sensitivity": "Dataset", - "Executability": "Fully Executable", - "Authorities": [ - { - "Organization": "CDISC", - "Standards": [ - { - "Name": "SDTMIG", - "Version": "3.4", - "References": [ - { - "Origin": "SDTM and SDTMIG Conformance Rules", - "Version": "2.0", - "Citations": [ - { - "Document": "SDTMIG v3.4", - "Item": "2.E.2", - "Section": "4.2.6", - "Cited_Guidance": "--LNKGRP is a grouping identifier used to identify a group of records in one domain that is related to a record in another domain, often forming a many-to-one relationship." - } - ], - "Rule_Identifier": { - "Id": "CG0022", - "Version": "1" - } - } - ] - }, - { - "Name": "SDTMIG", - "Version": "3.3", - "References": [ - { - "Origin": "SDTM and SDTMIG Conformance Rules", - "Version": "2.0", - "Citations": [ - { - "Document": "SDTMIG v3.3", - "Item": "2.E.2", - "Section": "4.2.6", - "Cited_Guidance": "--LNKGRP is a grouping identifier used to identify a group of records in one domain that is related to a record in another domain, often forming a many-to-one relationship." - } - ], - "Rule_Identifier": { - "Id": "CG0022", - "Version": "1" - } - } - ] - }, - { - "Name": "SDTMIG", - "Version": "3.2", - "References": [ - { - "Origin": "SDTM and SDTMIG Conformance Rules", - "Version": "2.0", - "Citations": [ - { - "Document": "SDTMIG v3.3", - "Item": "Specification", - "Section": "6.1.", - "Cited_Guidance": "Identifier used to link related, grouped records across domains." - } - ], - "Rule_Identifier": { - "Id": "CG0022", - "Version": "1" - } - } - ] - } - ] - } - ], - "Scope": { - "Classes": { - "Include": ["ALL"] - }, - "Domains": { - "Include": ["ALL"] - } - }, - "Rule_Type": "Define Item Group Metadata Check" - } From 73399671223b9e4bf28e1df3af62a0b91f5885fa Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 2 Mar 2026 14:44:38 -0500 Subject: [PATCH 11/17] update to factory --- .flake8 | 2 +- .../dataset_builder_factory.py | 8 ----- .../define_item_group_dataset_builder.py | 26 ---------------- .../define_variables_dataset_builder.py | 30 ------------------- 4 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 cdisc_rules_engine/dataset_builders/define_item_group_dataset_builder.py delete mode 100644 cdisc_rules_engine/dataset_builders/define_variables_dataset_builder.py diff --git a/.flake8 b/.flake8 index 5527b0cac..eb6063e0f 100644 --- a/.flake8 +++ b/.flake8 @@ -1,7 +1,7 @@ [flake8] max-line-length = 120 max_complexity = 10 -ignore = E203, W503, E713 +ignore = E203, W503, E713, E501 exclude = .github, .pytest_cache, diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index 59703d8dc..a275cb70e 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -1,4 +1,3 @@ -# flake8: noqa from typing import Type from cdisc_rules_engine.dataset_builders.json_schema_check_dataset_builder import ( @@ -23,15 +22,9 @@ from cdisc_rules_engine.dataset_builders.domain_list_dataset_builder import ( DomainListDatasetBuilder, ) -from cdisc_rules_engine.dataset_builders.define_variables_dataset_builder import ( - DefineVariablesDatasetBuilder, -) from cdisc_rules_engine.dataset_builders.variables_metadata_with_define_dataset_builder import ( VariablesMetadataWithDefineDatasetBuilder, ) -from cdisc_rules_engine.dataset_builders.define_item_group_dataset_builder import ( - DefineItemGroupDatasetBuilder, -) from cdisc_rules_engine.dataset_builders.contents_define_variables_dataset_builder import ( ContentsDefineVariablesDatasetBuilder, ) @@ -73,7 +66,6 @@ class DatasetBuilderFactory(FactoryInterface): RuleTypes.DOMAIN_PRESENCE_CHECK.value: DomainListDatasetBuilder, RuleTypes.DOMAIN_PRESENCE_CHECK_AGAINST_DEFINE.value: DomainListWithDefineDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE.value: VariablesMetadataWithDefineDatasetBuilder, - RuleTypes.DEFINE_ITEM_GROUP_METADATA_CHECK.value: DefineItemGroupDatasetBuilder, RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VARIABLE.value: ContentsDefineVariablesDatasetBuilder, RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VLM.value: ContentsDefineVLMDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_LIBRARY.value: VariablesMetadataWithLibraryMetadataDatasetBuilder, diff --git a/cdisc_rules_engine/dataset_builders/define_item_group_dataset_builder.py b/cdisc_rules_engine/dataset_builders/define_item_group_dataset_builder.py deleted file mode 100644 index 8c926b3bb..000000000 --- a/cdisc_rules_engine/dataset_builders/define_item_group_dataset_builder.py +++ /dev/null @@ -1,26 +0,0 @@ -from cdisc_rules_engine.dataset_builders.base_dataset_builder import BaseDatasetBuilder -from typing import List - - -class DefineItemGroupDatasetBuilder(BaseDatasetBuilder): - def build(self): - """ - Returns a dataset containing metadata for the domains - extracted from the define.xml. - Columns available in the dataset are: - "define_dataset_name" - "define_dataset_label" - "define_dataset_location" - "define_dataset_class" - "define_dataset_structure" - "define_dataset_is_non_standard" - "define_dataset_variables" - "define_dataset_key_sequence" - "define_dataset_has_no_data" - """ - item_group_metadata: List[dict] = ( - self.get_define_xml_item_group_metadata_for_domain( - self.dataset_metadata.domain or self.dataset_metadata.name, - ) - ) - return self.dataset_implementation.from_records([item_group_metadata]) diff --git a/cdisc_rules_engine/dataset_builders/define_variables_dataset_builder.py b/cdisc_rules_engine/dataset_builders/define_variables_dataset_builder.py deleted file mode 100644 index 2ac9f98c3..000000000 --- a/cdisc_rules_engine/dataset_builders/define_variables_dataset_builder.py +++ /dev/null @@ -1,30 +0,0 @@ -from cdisc_rules_engine.dataset_builders.base_dataset_builder import BaseDatasetBuilder -from typing import List - - -class DefineVariablesDatasetBuilder(BaseDatasetBuilder): - def build(self): - """ - Returns a dataset containing metadata for the variables - in the specified domain extracted from the define.xml. - Columns available in the dataset are: - "define_variable_name", - "define_variable_label", - "define_variable_data_type", - "define_variable_role", - "define_variable_size", - "define_variable_ccode", - "define_variable_format", - "define_variable_allowed_terms", - "define_variable_origin_type", - "define_variable_is_collected", - "define_variable_has_no_data", - "define_variable_order_number", - "define_variable_has_codelist", - "define_variable_codelist_coded_values", - "define_variable_codelist_coded_codes", - "define_variable_mandatory", - """ - # get Define XML metadata for domain and use it as a rule comparator - variable_metadata: List[dict] = self.get_define_xml_variables_metadata() - return self.dataset_implementation(variable_metadata) From de3ea9f4623d25b2e858516886c01ea99ae4d29f Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 2 Mar 2026 14:48:00 -0500 Subject: [PATCH 12/17] get linters to read .flake8 --- .github/workflows/lint-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 1e7be35ec..4c7f70fe0 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -53,7 +53,7 @@ jobs: - name: Run flake8 run: | flake8 ${{needs.get_changed_files.outputs.py}} --count --select=E9,F63,F7,F82 --show-source --statistics - flake8 ${{needs.get_changed_files.outputs.py}} --ignore E203,W503 --count --statistics + flake8 ${{needs.get_changed_files.outputs.py}} --count --statistics - name: Run black run: | black --check ${{needs.get_changed_files.outputs.py}} From b090426a13c4f0ecccc3b51bf5f024748239b557 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 2 Mar 2026 14:53:21 -0500 Subject: [PATCH 13/17] ignore --- .flake8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index eb6063e0f..5f8887fce 100644 --- a/.flake8 +++ b/.flake8 @@ -1,8 +1,8 @@ [flake8] max-line-length = 120 max_complexity = 10 -ignore = E203, W503, E713, E501 - +ignore = W503, E713, E501 +extend-ignore = E203 exclude = .github, .pytest_cache, cdisc_rules_engine/resources, From 5bab3c74a7b6187049aa2eaf1832048be3295b23 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 2 Mar 2026 14:56:10 -0500 Subject: [PATCH 14/17] restore line enforcement --- .flake8 | 3 +-- cdisc_rules_engine/dataset_builders/dataset_builder_factory.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 5f8887fce..e79865cd4 100644 --- a/.flake8 +++ b/.flake8 @@ -1,8 +1,7 @@ [flake8] max-line-length = 120 max_complexity = 10 -ignore = W503, E713, E501 -extend-ignore = E203 +ignore = E203, W503, E713 exclude = .github, .pytest_cache, cdisc_rules_engine/resources, diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index a275cb70e..13c531df3 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -70,7 +70,7 @@ class DatasetBuilderFactory(FactoryInterface): RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VLM.value: ContentsDefineVLMDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_LIBRARY.value: VariablesMetadataWithLibraryMetadataDatasetBuilder, RuleTypes.DEFINE_ITEM_METADATA_CHECK_AGAINST_LIBRARY.value: DefineVariablesWithLibraryMetadataDatasetBuilder, - RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE_XML_AND_LIBRARY.value: VariablesMetadataWithDefineAndLibraryDatasetBuilder, + RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE_XML_AND_LIBRARY.value: VariablesMetadataWithDefineAndLibraryDatasetBuilder, # noqa: E501 RuleTypes.VALUE_CHECK_WITH_DATASET_METADATA.value: ValueCheckDatasetMetadataDatasetBuilder, RuleTypes.VALUE_CHECK_WITH_VARIABLE_METADATA.value: ValueCheckVariableMetadataDatasetBuilder, RuleTypes.JSONATA.value: JSONataDatasetBuilder, From 7e82db01a2a0eef4db20e1a8aec3cf0591161b35 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Wed, 4 Mar 2026 13:34:11 -0500 Subject: [PATCH 15/17] flake8 changes --- .flake8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index e79865cd4..069c56121 100644 --- a/.flake8 +++ b/.flake8 @@ -1,7 +1,7 @@ [flake8] -max-line-length = 120 max_complexity = 10 -ignore = E203, W503, E713 +ignore = E203, W503, E713, E501 +# E203, E501, and W503 are ignored as they conflict with Black exclude = .github, .pytest_cache, cdisc_rules_engine/resources, From 7bac61cd2a66ec3b11b94a5db68e1279762fca4c Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Thu, 5 Mar 2026 06:19:11 -0500 Subject: [PATCH 16/17] removed inline e501 exceptions --- .../dataset_builders/dataset_builder_factory.py | 2 +- .../test_contents_define_variables_dataset_builder.py | 2 +- .../test_contents_define_vlm_dataset_builder.py | 2 +- ...bles_metadata_with_library_metadata_dataset_builder.py | 2 +- tests/unit/test_operations/test_get_xhtml_errors.py | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py index 13c531df3..a275cb70e 100644 --- a/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py +++ b/cdisc_rules_engine/dataset_builders/dataset_builder_factory.py @@ -70,7 +70,7 @@ class DatasetBuilderFactory(FactoryInterface): RuleTypes.VALUE_CHECK_AGAINST_DEFINE_XML_VLM.value: ContentsDefineVLMDatasetBuilder, RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_LIBRARY.value: VariablesMetadataWithLibraryMetadataDatasetBuilder, RuleTypes.DEFINE_ITEM_METADATA_CHECK_AGAINST_LIBRARY.value: DefineVariablesWithLibraryMetadataDatasetBuilder, - RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE_XML_AND_LIBRARY.value: VariablesMetadataWithDefineAndLibraryDatasetBuilder, # noqa: E501 + RuleTypes.VARIABLE_METADATA_CHECK_AGAINST_DEFINE_XML_AND_LIBRARY.value: VariablesMetadataWithDefineAndLibraryDatasetBuilder, RuleTypes.VALUE_CHECK_WITH_DATASET_METADATA.value: ValueCheckDatasetMetadataDatasetBuilder, RuleTypes.VALUE_CHECK_WITH_VARIABLE_METADATA.value: ValueCheckVariableMetadataDatasetBuilder, RuleTypes.JSONATA.value: JSONataDatasetBuilder, diff --git a/tests/unit/test_dataset_builders/test_contents_define_variables_dataset_builder.py b/tests/unit/test_dataset_builders/test_contents_define_variables_dataset_builder.py index d17cd32c6..dec0fc4d3 100644 --- a/tests/unit/test_dataset_builders/test_contents_define_variables_dataset_builder.py +++ b/tests/unit/test_dataset_builders/test_contents_define_variables_dataset_builder.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock, patch import pandas as pd import numpy as np -from cdisc_rules_engine.dataset_builders.contents_define_variables_dataset_builder import ( # noqa: E501 +from cdisc_rules_engine.dataset_builders.contents_define_variables_dataset_builder import ( ContentsDefineVariablesDatasetBuilder, ) from cdisc_rules_engine.services.data_services import LocalDataService diff --git a/tests/unit/test_dataset_builders/test_contents_define_vlm_dataset_builder.py b/tests/unit/test_dataset_builders/test_contents_define_vlm_dataset_builder.py index 7bebcc6c6..e789c8a23 100644 --- a/tests/unit/test_dataset_builders/test_contents_define_vlm_dataset_builder.py +++ b/tests/unit/test_dataset_builders/test_contents_define_vlm_dataset_builder.py @@ -3,7 +3,7 @@ ) import pytest from unittest.mock import MagicMock, patch -from cdisc_rules_engine.dataset_builders.contents_define_vlm_dataset_builder import ( # noqa: E501 +from cdisc_rules_engine.dataset_builders.contents_define_vlm_dataset_builder import ( ContentsDefineVLMDatasetBuilder, ) from cdisc_rules_engine.services.data_services import LocalDataService diff --git a/tests/unit/test_dataset_builders/test_variables_metadata_with_library_metadata_dataset_builder.py b/tests/unit/test_dataset_builders/test_variables_metadata_with_library_metadata_dataset_builder.py index 4ca4fee95..f24568005 100644 --- a/tests/unit/test_dataset_builders/test_variables_metadata_with_library_metadata_dataset_builder.py +++ b/tests/unit/test_dataset_builders/test_variables_metadata_with_library_metadata_dataset_builder.py @@ -8,7 +8,7 @@ InMemoryCacheService, ) import pandas as pd -from cdisc_rules_engine.dataset_builders.variables_metadata_with_library_metadata import ( # noqa: E501 +from cdisc_rules_engine.dataset_builders.variables_metadata_with_library_metadata import ( VariablesMetadataWithLibraryMetadataDatasetBuilder, ) from cdisc_rules_engine.services.data_services import LocalDataService diff --git a/tests/unit/test_operations/test_get_xhtml_errors.py b/tests/unit/test_operations/test_get_xhtml_errors.py index cc4bdf0f8..04bf0392e 100644 --- a/tests/unit/test_operations/test_get_xhtml_errors.py +++ b/tests/unit/test_operations/test_get_xhtml_errors.py @@ -30,7 +30,7 @@ PandasDataset.from_records( [ { - "target": '

Table LZZT.1 lists the clinical laboratory tests that will be performed at Visit 1.

\r\n

Table LZZT.1. Laboratory Tests Performed at Admission (Visit 1)

\r\n\r\n

Safety Laboratory Tests

\r\n\r\n\r\n\r\n\r\n\r\n
\r\n

Hematology:

\r\n

    \r\n
  • Hemoglobin
  • \r\n
  • Hematocrit
  • \r\n
  • Erythrocyte count (RBC)
  • \r\n
  • Mean cell volume (MCV)
  • \r\n
  • Mean cell hemoglobin (MCH)
  • \r\n
  • Mean cell hemoglobin concentration (MCHC)
  • \r\n
  • Leukocytes (WBC)
  • \r\n
  • Neutrophils, segmented
  • \r\n
  • Neutrophils, juvenile (bands)
  • \r\n
  • Lymphocytes
  • \r\n
  • Monocytes
  • \r\n
  • Eosinophils
  • \r\n
  • Basophils
  • \r\n
  • Platelet
  • \r\n
  • Cell morphology
  • \r\n

\r\n

Urinalysis:

\r\n

    \r\n
  • Color
  • \r\n
  • Specific gravity
  • \r\n
  • pH
  • \r\n
  • Protein
  • \r\n
  • Glucose
  • \r\n
  • Ketones
  • \r\n
  • Bilirubin
  • \r\n
  • Urobilinogen
  • \r\n
  • Blood
  • \r\n
  • Nitrite
  • \r\n
  • Microscopic examination of sediment
  • \r\n

\r\n
\r\n

Clinical Chemistry - Serum Concentration of:

\r\n

    \r\n
  • Sodium
  • \r\n
  • Potassium
  • \r\n
  • Bicarbonate
  • \r\n
  • Total bilirubin
  • \r\n
  • Alkaline phosphatase (ALP)
  • \r\n
  • Gamma-glutamyl transferase (GGT)
  • \r\n
  • Alanine transaminase (ALT/SGPT)
  • \r\n
  • Aspartate transaminase (AST/SGOT)
  • \r\n
  • Blood urea nitrogen (BUN)
  • \r\n
  • Serum creatinine
  • \r\n
  • Uric acid
  • \r\n
  • Phosphorus
  • \r\n
  • Calcium
  • \r\n
  • Glucose, nonfasting
  • \r\n
  • Total protein
  • \r\n
  • Albumin
  • \r\n
  • Cholesterol
  • \r\n
  • Creatine kinase (CK)
  • \r\n

\r\n

Thyroid Function Test (Visit 1 only):

\r\n
    \r\n
  • Free thyroid index
  • \r\n
  • T3 Uptake
  • \r\n
  • T4
  • \r\n
  • Thyroid-stimulating hormone (TSH)
  • \r\n
\r\n

Other Tests (Visit 1 only):

\r\n
    \r\n
  • Folate
  • \r\n
  • Vitamin B 12
  • \r\n
  • Syphilis screening
  • \r\n
  • Hemoglobin A1C (IDDM patients only)
\r\n
\r\n

Laboratory values that fall outside a clinically accepted reference range or values that differ significantly from previous values must be evaluated and commented on by the investigator by marking CS (for clinically significant) or NCS (for not clinically significant) next to the values. Any clinically significant laboratory values that are outside a clinically acceptable range or differ importantly from a previous value should be further commented on in the clinical report form comments page.

\r\n

Hematology, and clinical chemistry will also be performed at Visits 4, 5, 7, 8, 9, 10, 11, 12, and 13. Patients that experience a rash and/or eosinophilia may have additional hematology samples obtained as described in 3.9.3.4 (Other Safety Measures).

\r\n

Urinalysis will also be performed at Visits 4, 9, and 12. The following criteria have been developed to monitor hepatic function.

\r\n
    \r\n
  • Patients with ALT/SGPT levels >120 IU will be retested weekly.

    \r\n
  • Patients with ALT/SGPT values >400 IU, or alternatively, an elevated ALT/SGPT accompanied by GGT and/or ALP values >500 IU will be retested within 2 days. The sponsor\'s clinical research administrator or clinical research physician is to be notified. If the retest value does not decrease by at least 10%, the study drug will be discontinued; additional laboratory tests will be performed until levels return to normal. If the retest value does decrease by 10% or more, the study drug may be continued with monitoring at 3 day intervals until ALT/SGPT values decrease to <400 IU or GGT and/or ALP values decrease to <500 IU. \r\n

' # noqa: E501 + "target": '

Table LZZT.1 lists the clinical laboratory tests that will be performed at Visit 1.

\r\n

Table LZZT.1. Laboratory Tests Performed at Admission (Visit 1)

\r\n\r\n

Safety Laboratory Tests

\r\n\r\n\r\n\r\n\r\n\r\n
\r\n

Hematology:

\r\n

    \r\n
  • Hemoglobin
  • \r\n
  • Hematocrit
  • \r\n
  • Erythrocyte count (RBC)
  • \r\n
  • Mean cell volume (MCV)
  • \r\n
  • Mean cell hemoglobin (MCH)
  • \r\n
  • Mean cell hemoglobin concentration (MCHC)
  • \r\n
  • Leukocytes (WBC)
  • \r\n
  • Neutrophils, segmented
  • \r\n
  • Neutrophils, juvenile (bands)
  • \r\n
  • Lymphocytes
  • \r\n
  • Monocytes
  • \r\n
  • Eosinophils
  • \r\n
  • Basophils
  • \r\n
  • Platelet
  • \r\n
  • Cell morphology
  • \r\n

\r\n

Urinalysis:

\r\n

    \r\n
  • Color
  • \r\n
  • Specific gravity
  • \r\n
  • pH
  • \r\n
  • Protein
  • \r\n
  • Glucose
  • \r\n
  • Ketones
  • \r\n
  • Bilirubin
  • \r\n
  • Urobilinogen
  • \r\n
  • Blood
  • \r\n
  • Nitrite
  • \r\n
  • Microscopic examination of sediment
  • \r\n

\r\n
\r\n

Clinical Chemistry - Serum Concentration of:

\r\n

    \r\n
  • Sodium
  • \r\n
  • Potassium
  • \r\n
  • Bicarbonate
  • \r\n
  • Total bilirubin
  • \r\n
  • Alkaline phosphatase (ALP)
  • \r\n
  • Gamma-glutamyl transferase (GGT)
  • \r\n
  • Alanine transaminase (ALT/SGPT)
  • \r\n
  • Aspartate transaminase (AST/SGOT)
  • \r\n
  • Blood urea nitrogen (BUN)
  • \r\n
  • Serum creatinine
  • \r\n
  • Uric acid
  • \r\n
  • Phosphorus
  • \r\n
  • Calcium
  • \r\n
  • Glucose, nonfasting
  • \r\n
  • Total protein
  • \r\n
  • Albumin
  • \r\n
  • Cholesterol
  • \r\n
  • Creatine kinase (CK)
  • \r\n

\r\n

Thyroid Function Test (Visit 1 only):

\r\n
    \r\n
  • Free thyroid index
  • \r\n
  • T3 Uptake
  • \r\n
  • T4
  • \r\n
  • Thyroid-stimulating hormone (TSH)
  • \r\n
\r\n

Other Tests (Visit 1 only):

\r\n
    \r\n
  • Folate
  • \r\n
  • Vitamin B 12
  • \r\n
  • Syphilis screening
  • \r\n
  • Hemoglobin A1C (IDDM patients only)
\r\n
\r\n

Laboratory values that fall outside a clinically accepted reference range or values that differ significantly from previous values must be evaluated and commented on by the investigator by marking CS (for clinically significant) or NCS (for not clinically significant) next to the values. Any clinically significant laboratory values that are outside a clinically acceptable range or differ importantly from a previous value should be further commented on in the clinical report form comments page.

\r\n

Hematology, and clinical chemistry will also be performed at Visits 4, 5, 7, 8, 9, 10, 11, 12, and 13. Patients that experience a rash and/or eosinophilia may have additional hematology samples obtained as described in 3.9.3.4 (Other Safety Measures).

\r\n

Urinalysis will also be performed at Visits 4, 9, and 12. The following criteria have been developed to monitor hepatic function.

\r\n
    \r\n
  • Patients with ALT/SGPT levels >120 IU will be retested weekly.

    \r\n
  • Patients with ALT/SGPT values >400 IU, or alternatively, an elevated ALT/SGPT accompanied by GGT and/or ALP values >500 IU will be retested within 2 days. The sponsor\'s clinical research administrator or clinical research physician is to be notified. If the retest value does not decrease by at least 10%, the study drug will be discontinued; additional laboratory tests will be performed until levels return to normal. If the retest value does decrease by 10% or more, the study drug may be continued with monitoring at 3 day intervals until ALT/SGPT values decrease to <400 IU or GGT and/or ALP values decrease to <500 IU. \r\n

' }, ] ), @@ -46,7 +46,7 @@ PandasDataset.from_records( [ { - "target": '

Table LZZT.1 lists the clinical laboratory tests that will be performed at Visit 1.

\r\n

Table LZZT.1. Laboratory Tests Performed at Admission (Visit 1)

\r\n

Safety Laboratory Tests

\r\n\r\n\r\n\r\n\r\n\r\n
\r\n

Hematology:

\r\n

\r\n

Urinalysis:

\r\n

\r\n
\r\n

Clinical Chemistry - Serum Concentration of:

\r\n

\r\n

Thyroid Function Test (Visit 1 only):

\r\n

Other Tests (Visit 1 only):

\r\n
\r\n

Laboratory values that fall outside a clinically accepted reference range or values that differ significantly from previous values must be evaluated and commented on by the investigator by marking CS (for clinically significant) or NCS (for not clinically significant) next to the values. Any clinically significant laboratory values that are outside a clinically acceptable range or differ importantly from a previous value should be further commented on in the clinical report form comments page.

\r\n

Hematology, and clinical chemistry will also be performed at Visits 4, 5, 7, 8, 9, 10, 11, 12, and 13. Patients that experience a rash and/or eosinophilia may have additional hematology samples obtained as described in 3.9.3.4 (Other Safety Measures).

\r\n

Urinalysis will also be performed at Visits 4, 9, and 12. The following criteria have been developed to monitor hepatic function.

\r\n
' # noqa: E501 + "target": '

Table LZZT.1 lists the clinical laboratory tests that will be performed at Visit 1.

\r\n

Table LZZT.1. Laboratory Tests Performed at Admission (Visit 1)

\r\n

Safety Laboratory Tests

\r\n\r\n\r\n\r\n\r\n\r\n
\r\n

Hematology:

\r\n

\r\n

Urinalysis:

\r\n

\r\n
\r\n

Clinical Chemistry - Serum Concentration of:

\r\n

\r\n

Thyroid Function Test (Visit 1 only):

\r\n

Other Tests (Visit 1 only):

\r\n
\r\n

Laboratory values that fall outside a clinically accepted reference range or values that differ significantly from previous values must be evaluated and commented on by the investigator by marking CS (for clinically significant) or NCS (for not clinically significant) next to the values. Any clinically significant laboratory values that are outside a clinically acceptable range or differ importantly from a previous value should be further commented on in the clinical report form comments page.

\r\n

Hematology, and clinical chemistry will also be performed at Visits 4, 5, 7, 8, 9, 10, 11, 12, and 13. Patients that experience a rash and/or eosinophilia may have additional hematology samples obtained as described in 3.9.3.4 (Other Safety Measures).

\r\n

Urinalysis will also be performed at Visits 4, 9, and 12. The following criteria have been developed to monitor hepatic function.

\r\n
' }, ] ), @@ -58,7 +58,7 @@ PandasDataset.from_records( [ { - "target": '

Table LZZT.1 lists the clinical laboratory tests that will be performed at Visit 1.

\r\n

Table LZZT.1. Laboratory Tests Performed at Admission (Visit 1)

\r\n

Safety Laboratory Tests

\r\n\r\n\r\n\r\n\r\n\r\n
\r\n

Hematology:

\r\n

\r\n

Urinalysis:

\r\n

\r\n
\r\n

Clinical Chemistry - Serum Concentration of:

\r\n

\r\n

Thyroid Function Test (Visit 1 only):

\r\n

Other Tests (Visit 1 only):

\r\n
\r\n

Laboratory values that fall outside a clinically accepted reference range or values that differ significantly from previous values must be evaluated and commented on by the investigator by marking CS (for clinically significant) or NCS (for not clinically significant) next to the values. Any clinically significant laboratory values that are outside a clinically acceptable range or differ importantly from a previous value should be further commented on in the clinical report form comments page.

\r\n

Hematology, and clinical chemistry will also be performed at Visits 4, 5, 7, 8, 9, 10, 11, 12, and 13. Patients that experience a rash and/or eosinophilia may have additional hematology samples obtained as described in 3.9.3.4 (Other Safety Measures).

\r\n

Urinalysis will also be performed at Visits 4, 9, and 12. The following criteria have been developed to monitor hepatic function.

\r\n
' # noqa: E501 + "target": '

Table LZZT.1 lists the clinical laboratory tests that will be performed at Visit 1.

\r\n

Table LZZT.1. Laboratory Tests Performed at Admission (Visit 1)

\r\n

Safety Laboratory Tests

\r\n\r\n\r\n\r\n\r\n\r\n
\r\n

Hematology:

\r\n

\r\n

Urinalysis:

\r\n

\r\n
\r\n

Clinical Chemistry - Serum Concentration of:

\r\n

\r\n

Thyroid Function Test (Visit 1 only):

\r\n

Other Tests (Visit 1 only):

\r\n
\r\n

Laboratory values that fall outside a clinically accepted reference range or values that differ significantly from previous values must be evaluated and commented on by the investigator by marking CS (for clinically significant) or NCS (for not clinically significant) next to the values. Any clinically significant laboratory values that are outside a clinically acceptable range or differ importantly from a previous value should be further commented on in the clinical report form comments page.

\r\n

Hematology, and clinical chemistry will also be performed at Visits 4, 5, 7, 8, 9, 10, 11, 12, and 13. Patients that experience a rash and/or eosinophilia may have additional hematology samples obtained as described in 3.9.3.4 (Other Safety Measures).

\r\n

Urinalysis will also be performed at Visits 4, 9, and 12. The following criteria have been developed to monitor hepatic function.

\r\n
' }, ] ), @@ -69,7 +69,7 @@ "target", PandasDataset.from_records( [ - {"target": None}, # noqa: E501 + {"target": None}, ] ), "http://www.cdisc.org/ns/usdm/xhtml/v1.0", From 1d60d17fe0de53e0ae3a8ae940844c50bfe48a4b Mon Sep 17 00:00:00 2001 From: Gerry Campion Date: Wed, 11 Mar 2026 14:57:49 -0400 Subject: [PATCH 17/17] prettier operator.md --- resources/schema/rule/Operator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/schema/rule/Operator.md b/resources/schema/rule/Operator.md index 706384736..0405b25d5 100644 --- a/resources/schema/rule/Operator.md +++ b/resources/schema/rule/Operator.md @@ -992,7 +992,7 @@ Checking for consistent values across groups and validating that variables maint ### is_inconsistent_across_dataset -Checks if a variable maintains consistent values within groups defined by one or more grouping variables. Groups records by specified value(s) and validates that the target variable maintains the same value within each unique combination of grouping variables. When inconsistency is detected within a group, the operator attempts to identify a majority value. If one value appears more frequently than all others, only the minority records (those not matching the majority value) are flagged. If no single majority exists — i.e., two or more values are tied for the highest frequency — all records in that group are flagged. +Checks if a variable maintains consistent values within groups defined by one or more grouping variables. Groups records by specified value(s) and validates that the target variable maintains the same value within each unique combination of grouping variables. When inconsistency is detected within a group, the operator attempts to identify a majority value. If one value appears more frequently than all others, only the minority records (those not matching the majority value) are flagged. If no single majority exists — i.e., two or more values are tied for the highest frequency — all records in that group are flagged. Single grouping variable - true if the values of BGSTRESU differ within USUBJID: