Sfoglia il codice sorgente

bug fix: healthcare-io conversational

Steve Nyemba 2 anni fa
parent
commit
6ddda98527
1 ha cambiato i file con 28 aggiunte e 2 eliminazioni
  1. 28 2
      healthcareio/healthcare-io.py

+ 28 - 2
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