Skip to content

Commit 37333d2

Browse files
authored
fixed ref guide nesting, removed operators/ations (#1282)
1 parent cf4d8fa commit 37333d2

14 files changed

Lines changed: 57 additions & 24360 deletions

File tree

cdisc_rules_engine/check_operators/dataframe_operators.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,36 +1526,6 @@ def target_is_sorted_by(self, other_value: dict):
15261526
def target_is_not_sorted_by(self, other_value: dict):
15271527
return ~self.target_is_sorted_by(other_value)
15281528

1529-
@log_operator_execution
1530-
@type_operator(FIELD_DATAFRAME)
1531-
def variable_metadata_equal_to(self, other_value: dict):
1532-
"""
1533-
Validates the metadata for variables,
1534-
provided in the metadata column, is equal to
1535-
the comparator.
1536-
Ex.
1537-
target: STUDYID
1538-
comparator: "Exp"
1539-
metadata_column: {"STUDYID": "Req", "DOMAIN": "Req"}
1540-
result: False
1541-
"""
1542-
target = self.replace_prefix(other_value.get("target"))
1543-
comparator = other_value.get(
1544-
"comparator"
1545-
) # Assumes the comparator is a value not a column
1546-
metadata_column = self.replace_prefix(other_value.get("metadata"))
1547-
result = np.where(
1548-
vectorized_get_dict_key(self.value[metadata_column], target) == comparator,
1549-
True,
1550-
False,
1551-
)
1552-
return self.value.convert_to_series(result)
1553-
1554-
@log_operator_execution
1555-
@type_operator(FIELD_DATAFRAME)
1556-
def variable_metadata_not_equal_to(self, other_value: dict):
1557-
return ~self.variable_metadata_equal_to(other_value)
1558-
15591529
@log_operator_execution
15601530
@type_operator(FIELD_DATAFRAME)
15611531
def shares_at_least_one_element_with(self, other_value: dict):

cdisc_rules_engine/operations/operations_factory.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
from cdisc_rules_engine.operations.whodrug_hierarchy_validator import (
5757
WhodrugHierarchyValidator,
5858
)
59-
from cdisc_rules_engine.operations.variable_library_metadata import (
60-
VariableLibraryMetadata,
61-
)
6259
from cdisc_rules_engine.operations.variable_count import VariableCount
6360
from cdisc_rules_engine.operations.variable_is_null import VariableIsNull
6461
from cdisc_rules_engine.operations.required_variables import RequiredVariables
@@ -117,7 +114,6 @@ class OperationsFactory(FactoryInterface):
117114
"valid_meddra_code_term_pairs": MedDRACodeTermPairsValidator,
118115
"variable_exists": VariableExists,
119116
"variable_names": VariableNames,
120-
"variable_library_metadata": VariableLibraryMetadata,
121117
"variable_value_count": VariableValueCount,
122118
"variable_count": VariableCount,
123119
"variable_is_null": VariableIsNull,

cdisc_rules_engine/operations/variable_library_metadata.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

resources/schema/Operations.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,6 @@
369369
"required": ["id", "operator"],
370370
"type": "object"
371371
},
372-
{
373-
"properties": {
374-
"operator": {
375-
"const": "variable_library_metadata"
376-
}
377-
},
378-
"required": ["id", "operator", "name"],
379-
"type": "object"
380-
},
381372
{
382373
"properties": {
383374
"operator": { "const": "variable_names" }

resources/schema/Operations.md

Lines changed: 57 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,63 @@ will return:
875875
["2023-05-19", "2023-10-26", "2023-12-13"]
876876
```
877877

878+
## variable_count
879+
880+
Returns a mapping of variable names to the number of times that variable appears in a domain within the study.
881+
882+
- Input
883+
884+
```json
885+
{
886+
"AE": ["STUDYID", "DOMAIN", "USUBJID", "AETERM", "AEENDTC"],
887+
"LB": ["STUDYID", "DOMAIN", "USUBJID", "LBTESTCD", "LBENDTC"]
888+
}
889+
```
890+
891+
- Output
892+
893+
```json
894+
{
895+
"STUDYID": 2,
896+
"DOMAIN": 2,
897+
"USUBJID": 2,
898+
"--TERM": 1,
899+
"--TESTCD": 1,
900+
"--ENDTC": 2
901+
}
902+
```
903+
904+
## variable_exists
905+
906+
Flag an error if MIDS is in the dataset currently being evaluated and the TM domain is not present in the study
907+
908+
```yaml
909+
Rule Type: Domain Presence Check
910+
Check:
911+
all:
912+
- name: $MIDS_EXISTS
913+
operator: equal_to
914+
value: true
915+
- name: TM
916+
operator: not_exists
917+
Operations:
918+
- id: $MIDS_EXISTS
919+
name: MIDS
920+
operator: variable_exists
921+
```
922+
923+
## variable_is_null
924+
925+
True if variable is missing or if all values within a variable are null or empty string
926+
927+
## variable_names
928+
929+
Return the set of variable names from the library for the given standard
930+
931+
## variable_value_count
932+
933+
Given a variable `name`, returns a mapping of variable values to the number of times that value appears in the variable within all datasets in the study.
934+
878935
# External Dictionary Validation Operations
879936

880937
## Supported External Dictionary Types
@@ -1087,95 +1144,3 @@ Operations:
10871144
- id: $valid_whodrug_codes
10881145
operator: whodrug_code_hierarchy
10891146
```
1090-
1091-
## variable_count
1092-
1093-
Returns a mapping of variable names to the number of times that variable appears in a domain within the study.
1094-
1095-
- Input
1096-
1097-
```json
1098-
{
1099-
"AE": ["STUDYID", "DOMAIN", "USUBJID", "AETERM", "AEENDTC"],
1100-
"LB": ["STUDYID", "DOMAIN", "USUBJID", "LBTESTCD", "LBENDTC"]
1101-
}
1102-
```
1103-
1104-
- Output
1105-
1106-
```json
1107-
{
1108-
"STUDYID": 2,
1109-
"DOMAIN": 2,
1110-
"USUBJID": 2,
1111-
"--TERM": 1,
1112-
"--TESTCD": 1,
1113-
"--ENDTC": 2
1114-
}
1115-
```
1116-
1117-
## variable_exists
1118-
1119-
Flag an error if MIDS is in the dataset currently being evaluated and the TM domain is not present in the study
1120-
1121-
```yaml
1122-
Rule Type: Domain Presence Check
1123-
Check:
1124-
all:
1125-
- name: $MIDS_EXISTS
1126-
operator: equal_to
1127-
value: true
1128-
- name: TM
1129-
operator: not_exists
1130-
Operations:
1131-
- id: $MIDS_EXISTS
1132-
name: MIDS
1133-
operator: variable_exists
1134-
```
1135-
1136-
## variable_is_null
1137-
1138-
True if variable is missing or if all values within a variable are null or empty string
1139-
1140-
## variable_names
1141-
1142-
Return the set of variable names from the library for the given standard
1143-
1144-
## variable_library_metadata
1145-
1146-
Get the metadata value from the library for all variables in the current dataset. Metadata attribute is specified by the `name`.
1147-
1148-
Result
1149-
1150-
```json
1151-
{
1152-
"STUDYID": "Req",
1153-
"DOMAIN": "Req",
1154-
"AEGRPID": "Perm",
1155-
"AETERM": "Req",
1156-
"AELLT": "Exp",
1157-
"...": "..."
1158-
}
1159-
```
1160-
1161-
> Condition: Variable Core Status = Required
1162-
1163-
> Rule: Variable ^= null
1164-
1165-
```yaml
1166-
Check:
1167-
any:
1168-
- all:
1169-
- operator: variable_metadata_equal_to
1170-
value: Req
1171-
metadata: $var_perm
1172-
- operator: empty
1173-
Operations:
1174-
- id: $var_perm
1175-
operator: variable_library_metadata
1176-
name: core
1177-
```
1178-
1179-
## variable_value_count
1180-
1181-
Given a variable `name`, returns a mapping of variable values to the number of times that value appears in the variable within all datasets in the study.

resources/schema/Operator.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -804,24 +804,6 @@
804804
"required": ["operator", "value"],
805805
"type": "object"
806806
},
807-
{
808-
"properties": {
809-
"operator": {
810-
"const": "variable_metadata_equal_to"
811-
}
812-
},
813-
"required": ["operator", "metadata", "value"],
814-
"type": "object"
815-
},
816-
{
817-
"properties": {
818-
"operator": {
819-
"const": "variable_metadata_not_equal_to"
820-
}
821-
},
822-
"required": ["operator", "metadata", "value"],
823-
"type": "object"
824-
},
825807
{
826808
"properties": {
827809
"operator": {

resources/schema/Operator.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -563,27 +563,6 @@ Check:
563563
operator: "inconsistent_enumerated_columns"
564564
```
565565

566-
## variable_metadata_equal_to
567-
568-
Could be useful, for example, in checking variable permissibility in conjunction with the `variable_library_metadata` operation:
569-
570-
```yaml
571-
Check:
572-
all:
573-
- operator: variable_metadata_equal_to
574-
value: Exp
575-
metadata: $permissibility
576-
- operator: not_exists
577-
Operations:
578-
- id: $permissibility
579-
operator: variable_library_metadata
580-
name: core
581-
```
582-
583-
## variable_metadata_not_equal_to
584-
585-
Complement of `variable_metadata_equal_to`
586-
587566
# Relationship & Set
588567

589568
## is_contained_by

tests/QARegressionTests/test_Issues/test_CoreIssue287.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)