bug fix: configuration file reader
This commit is contained in:
parent
9e085da5bf
commit
b9ad861db9
|
@ -36,17 +36,20 @@ import requests
|
|||
import time
|
||||
|
||||
PATH = os.sep.join([os.environ.get('HOME'),'.healthcareio','config.json'])
|
||||
CONFIG = json.loads((open(PATH)).read())
|
||||
|
||||
STORE_URI = 'http://healthcareio.the-phi.com/store/healthcareio'
|
||||
#
|
||||
# let us see if we have any custom configurations ...
|
||||
|
||||
PATH = os.sep.join([os.environ.get('HOME'),'.healthcareio','custom'])
|
||||
CONFIG = {}
|
||||
CUSTOM_CONFIG = {}
|
||||
if os.path.exists(PATH) and os.listdir(PATH) :
|
||||
CONFIG = json.loads((open(PATH)).read())
|
||||
PATH = os.sep.join([PATH,os.listdir(PATH)[0]])
|
||||
CUSTOM_CONFIG = json.loads((open(PATH)).read())
|
||||
|
||||
_args = dict(CONFIG['store'],**{'type':'mongo.MongoReader'})
|
||||
# _args = dict(CONFIG['store'],**{'type':'mongo.MongoReader'})
|
||||
|
||||
def get_field_names (_map,label):
|
||||
fields = list(_map.keys())
|
||||
|
@ -182,6 +185,18 @@ class Factory:
|
|||
:param type EDI type to be processed i.e 835 or 837
|
||||
:param write_store target data-store (redshift, mariadb,mongodb ...)
|
||||
"""
|
||||
global PATH
|
||||
global CONFIG
|
||||
global CUSTOM_CONFIG
|
||||
PATH = os.sep.join([os.environ.get('HOME'),'.healthcareio','config.json'])
|
||||
if os.path.exists(PATH):
|
||||
CONFIG = json.loads((open(PATH)).read())
|
||||
CUSTOM_PATH = os.sep.join([os.environ.get('HOME'),'.healthcareio','custom'])
|
||||
if os.path.exists(CUSTOM_PATH) and os.listdir(CUSTOM_PATH) :
|
||||
|
||||
CUSTOM_PATH = os.sep.join([CUSTOM_PATH,os.listdir(CUSTOM_PATH)[0]])
|
||||
CUSTOM_CONFIG = json.loads((open(CUSTOM_PATH)).read())
|
||||
|
||||
_features = Factory.license(email=CONFIG['owner'])
|
||||
store = copy.deepcopy(CONFIG['store'])
|
||||
store['type']='mongo.MongoReader'
|
||||
|
|
2
setup.py
2
setup.py
|
@ -8,7 +8,7 @@ import sys
|
|||
def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
args = {
|
||||
"name":"healthcareio","version":"1.4.8",
|
||||
"name":"healthcareio","version":"1.5.0",
|
||||
"author":"Vanderbilt University Medical Center",
|
||||
"author_email":"steve.l.nyemba@vumc.org",
|
||||
"include_package_data":True,
|
||||
|
|
Loading…
Reference in New Issue