From b7ec1df07217c3c1ab9c5bcbf2664ece364f639a Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Wed, 16 Sep 2020 10:58:32 -0500 Subject: [PATCH] bug fix with claim type --- healthcareio/__init__.py | 48 ++++++++++++++++++++++++++++++++++++++-- healthcareio/__main__.py | 2 +- setup.py | 7 ++++-- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/healthcareio/__init__.py b/healthcareio/__init__.py index da839ce..97f80a5 100644 --- a/healthcareio/__init__.py +++ b/healthcareio/__init__.py @@ -14,6 +14,50 @@ Usage : Embedded : """ -#import healthcareio +import healthcareio +import os +import requests +import platform +import sqlite3 as lite +from transport import factory +import json #import healthcareio.params as params -from healthcareio import params +PATH = os.sep.join([os.environ['HOME'],'.healthcareio']) +OUTPUT_FOLDER = os.sep.join([os.environ['HOME'],'healthcare-io']) + +def register (**args) : + """ + This function will reset/register a user i.e they will download the configuration + :email user's email address + :url url of the provider to register + """ + URL = "https://healthcareio.the-phi.com" if 'url' not in args else args['url'] + + args['out_folder'] = os.sep.join([args['path'],args['out_folder']]) + email = args['email'] + url = args['url'] if 'url' in args else URL + folders = [PATH,OUTPUT_FOLDER] + for path in folders : + if not os.path.exists(path) : + os.mkdir(path) + + # + # + headers = {"email":email,"client":platform.node()} + http = requests.session() + r = http.post(url,headers=headers) + + # + # store = {"type":"disk.DiskWriter","args":{"path":OUTPUT_FOLDER}} + # if 'store' in args : + # store = args['store'] + filename = (os.sep.join([PATH,'config.json'])) + info = r.json() #{"parser":r.json(),"store":store} + info = dict({"owner":email},**info) + info['store']['args']['path'] =os.sep.join([OUTPUT_FOLDER,'healthcare-io.db3']) #-- sql + info['out-folder'] = OUTPUT_FOLDER + + file = open( filename,'w') + file.write( json.dumps(info)) + file.close() + diff --git a/healthcareio/__main__.py b/healthcareio/__main__.py index 9120b32..a047f37 100644 --- a/healthcareio/__main__.py +++ b/healthcareio/__main__.py @@ -14,4 +14,4 @@ Usage : Embedded : """ -import healthcareio +# import healthcareio diff --git a/setup.py b/setup.py index f93959d..d874202 100644 --- a/setup.py +++ b/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.2.3", + "name":"healthcareio","version":"1.2.4", "author":"Vanderbilt University Medical Center", "author_email":"steve.l.nyemba@vumc.org", "license":"MIT", @@ -17,7 +17,10 @@ args = { } 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/healthcare-io.py'] +# args['scripts']= ['healthcareio/healthcare-io.py'] +args['entry_points'] = { + 'console_scripts' : ['healthcareio=healthcareio:register'] +} if sys.version_info[0] == 2 : args['use_2to3'] = False