From 6ddda985272eada5a830f062c54786a105a6b955 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Sun, 26 Jun 2022 15:45:05 -0500 Subject: [PATCH] bug fix: healthcare-io conversational --- healthcareio/healthcare-io.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/healthcareio/healthcare-io.py b/healthcareio/healthcare-io.py index 0145dda..7134ae5 100644 --- a/healthcareio/healthcare-io.py +++ b/healthcareio/healthcare-io.py @@ -122,7 +122,14 @@ def signup (**args) : file = open( filename,'w') file.write( json.dumps(info)) 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 @@ -155,12 +162,13 @@ def init(): # if 'type' in info['store'] : lwriter = None 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']) is_sqlite = True elif 'provider' in info['store'] and info['store']['provider'] == 'sqlite' : lwriter = transport.instance(**info['store']) ; is_sqlite = True + if lwriter and is_sqlite: for key in info['schema'] : if key != 'logs' : @@ -168,7 +176,7 @@ def init(): else: _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']) 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()] 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