bug fix: healthcare-io conversational

dev
Steve Nyemba 2 years ago
parent 1801e3a85d
commit 6ddda98527

@ -122,7 +122,14 @@ def signup (**args) :
file = open( filename,'w') file = open( filename,'w')
file.write( json.dumps(info)) file.write( json.dumps(info))
file.close() file.close()
_m = """
Thank you for signingup!!
Your configuration file is store in :path,
- More information visit https://healthcareio.the-phi.com/parser
- Access the source https://healthcareio.the-phi.com/git/code/parser
""".replace(":path",CONFIG_FILE)
print (_m)
# #
# Create the sqlite3 database to # Create the sqlite3 database to
@ -155,12 +162,13 @@ def init():
# if 'type' in info['store'] : # if 'type' in info['store'] :
lwriter = None lwriter = None
is_sqlite = False is_sqlite = False
if'type' in info['store'] and info['store']['type'] == 'disk.SQLiteWriter' and not os.path.exists(info['store']['args']['path']) : if'type' in info['store'] and info['store']['type'] == 'disk.SQLiteWriter' :
lwriter = transport.factory.instance(**info['store']) lwriter = transport.factory.instance(**info['store'])
is_sqlite = True is_sqlite = True
elif 'provider' in info['store'] and info['store']['provider'] == 'sqlite' : elif 'provider' in info['store'] and info['store']['provider'] == 'sqlite' :
lwriter = transport.instance(**info['store']) ; lwriter = transport.instance(**info['store']) ;
is_sqlite = True is_sqlite = True
if lwriter and is_sqlite: if lwriter and is_sqlite:
for key in info['schema'] : for key in info['schema'] :
if key != 'logs' : if key != 'logs' :
@ -168,7 +176,7 @@ def init():
else: else:
_id = key _id = key
if not lwriter.has(table=_id) : if not lwriter.has(table=_id) :
lwriter.apply(info['schema'][key]['create']) lwriter.apply(info['schema'][key]['create'])
# [lwriter.apply( info['schema'][key]['create']) for key in info['schema'] if not lwriter.has(table=key)] # [lwriter.apply( info['schema'][key]['create']) for key in info['schema'] if not lwriter.has(table=key)]
@ -285,6 +293,24 @@ if __name__ == '__main__' :
procs = [proc for proc in procs if proc.is_alive()] procs = [proc for proc in procs if proc.is_alive()]
time.sleep(2) time.sleep(2)
uri = OUTPUT_FOLDER
store_config = json.loads( (open(CONFIG_FILE)).read() )['store']
if 'type' in store_config :
uri = store_config['args']['host'] if 'host' in store_config['args'] else ( store_config['args']['path'] if 'path' in store_config['args'] else store_config['args']['database'])
if 'SQLite' in store_config['type']:
provider = 'sqlite'
elif 'sql' in store_config['type'] :
provider = 'SQL'
else:
provider = 'mongo'
else:
provider = store_config['provider']
_msg = """
Completed Parsing, The data is available in :provider database at :uri
Logs are equally available for errors and summary statistics to be compiled
""".replace(":provider",provider).replace(":uri",uri)
print (_msg)
pass pass

Loading…
Cancel
Save