tested on python 3.7 with adjustments

docker
Steve L. Nyemba 4 years ago
parent c0763f1015
commit 6ab3482f62

Binary file not shown.

@ -14,4 +14,6 @@ Usage :
Embedded :
"""
import healthcareio
#import healthcareio
#import healthcareio.params as params
from healthcareio import params

@ -29,10 +29,10 @@ Usage :
conf = json.loads(open('config/837.json').read())
edi.parser.get_content(filename,conf)
"""
from params import SYS_ARGS
from healthcareio.params import SYS_ARGS
from transport import factory
import requests
from parser import get_content
from healthcareio.parser import get_content
import os
import json
import sys
@ -114,7 +114,8 @@ def init():
info = json.loads(file.read())
if not os.path.exists(info['out-folder']) :
os.mkdir(info['out-folder'])
if not os.path.exists(info['store']['args']['path']) :
if info['store']['type'] == 'disk.SQLiteWriter' and not os.path.exists(info['store']['args']['path']) :
conn = lite.connect(info['store']['args']['path'],isolation_level=None)
for key in info['schema'] :
_sql = info['schema'][key]['create']
@ -222,8 +223,11 @@ if __name__ == '__main__' :
elif info['store']['type'] == 'disk.SQLiteWriter' :
# info['store']['args']['path'] += (os.sep + 'healthcare-io.db3')
pass
if info['store']['type'] == 'disk.SQLiteWriter' :
info['store']['args']['table'] = SYS_ARGS['parse'].strip().lower()
else:
info['store']['args']['doc'] = SYS_ARGS['parse'].strip().lower()
writer = factory.instance(**info['store'])
logger = factory.instance(type='disk.DiskWriter',args={'path':os.sep.join([info['out-folder'],SYS_ARGS['parse']+'.log'])})
#logger = factory.instance(type='mongo.MongoWriter',args={'db':'healthcareio','doc':SYS_ARGS['parse']+'_logs'})
@ -240,6 +244,7 @@ if __name__ == '__main__' :
#
try:
content,logs = parse(filename = filename,type=SYS_ARGS['parse'])
print ([filename, len(content)])
if content :
writer.write(content)
if logs :
@ -247,7 +252,7 @@ if __name__ == '__main__' :
else:
logger.write({"name":filename,"completed":True,"rows":len(content)})
except Exception as e:
logger.write({"filename":filename,"completed":False,"rows":-1})
logger.write({"filename":filename,"completed":False,"rows":-1,"msg":e.args[0]})
# print ([filename,len(content)])
#
# @TODO: forward this data to the writer and log engine

@ -71,7 +71,7 @@ def get_config(config,row):
def hash(value):
salt = os.environ['HEALTHCAREIO_SALT'] if 'HEALTHCAREIO_SALT' in os.environ else ''
_value = str(value)+ salt
if sys.info.version[0] > 2 :
if sys.version_info[0] > 2 :
return hashlib.md5(_value.encode('utf-8')).hexdigest()
else:
return hashlib.md5(_value).hexdigest()

@ -8,16 +8,16 @@ import sys
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
args = {
"name":"healthcareio","version":"1.2.2",
"name":"healthcareio","version":"1.2.3",
"author":"Vanderbilt University Medical Center",
"author_email":"steve.l.nyemba@vumc.org",
"license":"MIT",
"packages":find_packages("."),
"packages":find_packages(),
"keywords":["healthcare","edi","x12","analytics","835","837","data","transport","protocol"]
}
args["install_requires"] = ['seaborn','jinja2', 'weasyprint','data-transport@git+https://dev.the-phi.com/git/steve/data-transport.git','pymongo','numpy','cloudant','pika','boto','flask-session','smart_open']
args['url'] = 'https://hiplab.mc.vanderbilt.edu'
args['scripts']= ['healthcareio/healthcareio.py']
args['scripts']= ['healthcareio/healthcare-io.py']
if sys.version_info[0] == 2 :
args['use_2to3'] = False

Loading…
Cancel
Save