Replies: 1 comment
-
|
hi @bkharade |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have installed cdisc-rules-engine using pip install cdisc-rules-engine on a windows machine and in addition to installing the library, I have also downloaded the rules cache (found in the resources/cache folder of this repository) and stored them in my project.
I tried to execute the steps provided at https://pypi.org/project/cdisc-rules-engine/#description
Step 1: Load the Rules
The rules can be loaded into an in-memory cache by doing the following:
import os
import pathlib
import pickle
from multiprocessing.managers import SyncManager
from cdisc_rules_engine.services.cache import InMemoryCacheService
class CacheManager(SyncManager):
pass
If you're working from a terminal you may need to
use SyncManager directly rather than define CacheManager
CacheManager.register("InMemoryCacheService", InMemoryCacheService)
def load_rules_cache(path_to_rules_cache):
cache_path = pathlib.Path(path_to_rules_cache)
manager = CacheManager()
manager.start()
cache = manager.InMemoryCacheService()
Rules in this cache can also be accessed by standard and version using the get_rules_cache_key function.
from cdisc_rules_engine.utilities.utils import get_rules_cache_key
cache = load_rules_cache("path/to/rules/cache")
Note that the standard version is separated by a dash, not a period
cache_key_prefix = get_rules_cache_key("sdtmig", "3-4")
rules = cache.get_all_by_prefix(cache_key_prefix)
print(rules)
I was expecting rules will be a list of dictionaries as per documentation but I receive [['CORE-000351', 'CORE-000793', 'CORE-000252', 'CORE-000791']] (big list just shortened for discussion).
Can someone help me here if I am missing any settings.
Beta Was this translation helpful? Give feedback.
All reactions