Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cdisc_rules_engine/services/cache/cache_populator_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def save_rules_locally(self):
rules_directory, rules_by_core_id = self.process_rules_lists(
rules_directory, rules_by_core_id, rules_lists
)

rules_directory.pop("tig/1-0", None)
with open(
os.path.join(self.cache_path, DefaultFilePaths.RULES_CACHE_FILE.value), "wb"
) as f:
Expand Down Expand Up @@ -168,7 +168,6 @@ def process_rules_lists(self, rules_directory, rules_by_core_id, rules_lists):
rules_directory[sub_key] = []
if core_id not in rules_directory[sub_key]:
rules_directory[sub_key].append(core_id)

rules_by_core_id[core_id] = rule
return rules_directory, rules_by_core_id

Expand Down
17 changes: 7 additions & 10 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,26 +585,23 @@ def list_rule_sets(ctx: click.Context, cache_path: str, custom: bool):
rules_file = DefaultFilePaths.RULES_DICTIONARY.value
with open(os.path.join(cache_path, rules_file), "rb") as f:
rules_data = pickle.load(f)

rule_sets = {}
for key in rules_data.keys():
if "/" in key:
parts = key.split("/")
standard = parts[0]
version = parts[1]
substandard = parts[2] if len(parts) > 2 else None
if substandard:
version_key = f"{version}/{substandard}"
else:
version_key = version
if standard not in rule_sets:
rule_sets[standard] = set()
rule_sets[standard].add(version_key)

rule_sets[standard].add((version, substandard))
for standard in sorted(rule_sets.keys()):
versions = sorted(rule_sets[standard])
for version in versions:
print(f"{standard}, {version}")
versions = sorted(rule_sets[standard], key=lambda x: (x[0], x[1] or ""))
for version, substandard in versions:
if substandard:
print(f"{standard}, {version}, {substandard}")
else:
print(f"{standard}, {version}")


@click.command()
Expand Down
Binary file modified resources/cache/rules.pkl
Binary file not shown.
Binary file modified resources/cache/rules_dictionary.pkl
Binary file not shown.
Binary file modified resources/cache/standards_details.pkl
Binary file not shown.
1 change: 1 addition & 0 deletions resources/schema/Organization_CDISC.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
"enum": ["SDTM", "SEND", "ADaM", "CDASH"]
}
},
"required": ["Name", "Version", "Substandard"],
"type": "object"
},
{
Expand Down
Loading