Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the environ variable of database location is used through out. #8

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

kindofluke
Copy link

Great library!

I know you all haven't worked on this in a little while but I wanted to offer this PR.

In looking at rxnorm_link_run, the db_file location is determined through os.environ.get('SQLITE_FILE')

However, when actually running linkage though rxnorm values are looked up using the RxNormLookup class which hardcodes the database to always be in databases directory.

See below from rxnorm.py:

class RxNormLookup (object):
	""" Class for RxNorm lookup. """
	
	sqlite = None
	cache_drug_class = False		# will be set to true when the prepare_to_cache_classes method gets called
	
	
	def __init__(self):
		absolute = os.path.dirname(os.path.realpath(__file__))
		self.sqlite = SQLite.get(os.path.join(absolute, 'databases/rxnorm.db'))

To fix this, I reused the same code from rxnorm_link_run which checks the environment variable first and happily falls back on the databases location if it is not populated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant