@ -37,14 +37,17 @@ class get :
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    @staticmethod 
 
					 
					 
					 
					    @staticmethod 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    def  processes ( _args ) : 
 
					 
					 
					 
					    def  processes ( _args ) : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        _info  =  pd . DataFrame ( smart . top . read ( name = ' healthcare-io.py ' ) ) [ [ ' name ' , ' cpu ' , ' mem ' ] ] 
 
					 
					 
					 
					        APP_NAME  = ' healthcare-io ' 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        _info  =  smart . top . read ( name = APP_NAME )  #pd.DataFrame(smart.top.read(name='healthcare-io'))[['name','cpu','mem']] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        
 
					 
					 
					 
					        
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        if  _info . shape [ 0 ]  ==  0  : 
 
					 
					 
					 
					        if  _info . shape [ 0 ]  ==  0  : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            _info  =  pd . DataFrame ( { " name " : [ " healthcare-io.py " ] , " cpu " : [ 0 ] , " mem " : [ 0 ] } ) 
 
					 
					 
					 
					            _info  =  pd . DataFrame ( { " name " : [ APP_NAME ] , " cpu " : [ 0 ] , " mem " : [ 0 ] } ) 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					        # _info = pd.DataFrame(_info.groupby(['name']).sum()) 
 
					 
					 
					 
					        # _info = pd.DataFrame(_info.groupby(['name']).sum()) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # _info['name'] = ['healthcare-io.py'] 
 
					 
					 
					 
					        # _info['name'] = ['healthcare-io.py'] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        m  =  { ' cpu ' : ' CPU ' , ' mem ' : ' RAM ' , ' name ' : ' name ' } 
 
					 
					 
					 
					        m  =  { ' cpu ' : ' CPU ' , ' mem ' : ' RAM ' , ' name ' : ' name ' } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        _info . columns  =  [ m [ name ]  for  name  in  _info . columns . tolist ( ) ] 
 
					 
					 
					 
					        _info   =  _info . rename ( columns = m ) 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        # _info.columns = [m[name] for name in _info.columns.tolist() if name in m] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        _info . index  =  np . arange ( _info . shape [ 0 ] ) 
 
					 
					 
					 
					        _info . index  =  np . arange ( _info . shape [ 0 ] ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        charts  =  [ ] 
 
					 
					 
					 
					        charts  =  [ ] 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -56,23 +59,20 @@ class get :
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    { " data " : df ,  " chart " : { " type " : " radial " , " axis " : { " x " : label , " y " : " name " } } } 
 
					 
					 
					 
					                    { " data " : df ,  " chart " : { " type " : " radial " , " axis " : { " x " : label , " y " : " name " } } } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    ) [ ' apex ' ] 
 
					 
					 
					 
					                    ) [ ' apex ' ] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                ) 
 
					 
					 
					 
					                ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # 
 
					 
					 
					 
					        
 
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					        # This will update the counts for the processes, upon subsequent requests so as to show the change 
 
					 
					 
					 
					        return  { " process " : { " chart " : charts , " counts " : _info . shape [ 0 ] } } 
 
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					        #      
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        N  =  0 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        lprocs  =  [ ] 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        for  proc  in  get . PROCS  : 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            if  proc . is_alive ( )  : 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                lprocs . append ( proc ) 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        N  =  len ( lprocs )      
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        get . PROCS  =  lprocs 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        return  { " process " : { " chart " : charts , " counts " : N } } 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    @staticmethod 
 
					 
					 
					 
					    @staticmethod 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    def  files  ( _args ) : 
 
					 
					 
					 
					    def  files  ( _args ) : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        _info  =  smart . folder . read ( path = ' /data ' ) 
 
					 
					 
					 
					        folder  =  _args [ ' args ' ] [ ' folder ' ] 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        _info  =  smart . folder . read ( path = folder ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        N  =  _info . files . tolist ( ) [ 0 ] 
 
					 
					 
					 
					        N  =  _info . files . tolist ( ) [ 0 ] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        if  ' mongo '  in  _args [ ' store ' ] [ ' type ' ]  : 
 
					 
					 
					 
					        store_args  =  _args [ ' store ' ] . copy ( ) 
 
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					            store_args  =  dict ( _args [ ' store ' ] . copy ( ) , * * { " type " : " mongo.MongoReader " } ) 
 
					 
					 
					 
					        store_args [ ' context ' ]  =  ' read ' 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        # if 'mongo' in _args['store']['type'] : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        if  _args [ ' store ' ] [ ' provider ' ]  in  [ ' mongo ' ,  ' mongodb ' ] : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					            # store_args = dict(_args['store'].copy(),**{"type":"mongo.MongoReader"}) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            # reader = transport.factory.instance(**_args) 
 
					 
					 
					 
					            # reader = transport.factory.instance(**_args) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            
 
					 
					 
					 
					            
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            pipeline  =  [ { " $group " : { " _id " : " $name " , " count " : { " $sum " : { " $cond " : [ { " $eq " : [ " $completed " , True ] } , 1 , 0 ] } }  } } , { " $group " : { " _id " : None , " count " : { " $sum " : " $count " } } } , { " $project " : { " _id " : 0 , " status " : " completed " , " count " : 1 } } ] 
 
					 
					 
					 
					            pipeline  =  [ { " $group " : { " _id " : " $name " , " count " : { " $sum " : { " $cond " : [ { " $eq " : [ " $completed " , True ] } , 1 , 0 ] } }  } } , { " $group " : { " _id " : None , " count " : { " $sum " : " $count " } } } , { " $project " : { " _id " : 0 , " status " : " completed " , " count " : 1 } } ] 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -83,12 +83,15 @@ class get :
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        else : 
 
					 
					 
					 
					        else : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            store_args  =  dict ( _args [ ' store ' ] . copy ( ) , * * { " type " : " disk.SQLiteReader " } ) 
 
					 
					 
					 
					            # store_args = dict(_args['store'].copy(),**{"type":"disk.SQLiteReader"}) 
 
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					            store_args [ ' args ' ] [ ' table ' ]  =  ' logs ' 
 
					 
					 
					 
					            
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					            # store_args['args']['table'] = 'logs' 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					            store_args [ ' table ' ]  =  ' logs ' 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            query =  { " sql " : " select count(distinct json_extract(data, ' $.name ' )) as count,  ' completed '  status from logs where json_extract(data, ' $.completed ' ) = true " } 
 
					 
					 
					 
					            query =  { " sql " : " select count(distinct json_extract(data, ' $.name ' )) as count,  ' completed '  status from logs where json_extract(data, ' $.completed ' ) = true " } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            _query = { " sql " : " select json_extract(data, ' $.parse ' ) as type,count(distinct json_extract(data, ' $.name ' )) as count from logs group by type " }  #-- distribution claim/remits 
 
					 
					 
					 
					            _query = { " sql " : " select json_extract(data, ' $.parse ' ) as type,count(distinct json_extract(data, ' $.name ' )) as count from logs group by type " }  #-- distribution claim/remits 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        reader  =  transport . factory . instance ( * * store_args ) 
 
					 
					 
					 
					        reader  =  transport . factory . instance ( * * store_args ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        _info  =  pd . DataFrame ( reader . read ( * * query ) ) 
 
					 
					 
					 
					        _info  =  pd . DataFrame ( reader . read ( * * query ) ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        if  not  _info . shape [ 0 ]  : 
 
					 
					 
					 
					        if  not  _info . shape [ 0 ]  : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            _info  =  pd . DataFrame ( { " status " : [ " completed " ] , " count " : [ 0 ] } ) 
 
					 
					 
					 
					            _info  =  pd . DataFrame ( { " status " : [ " completed " ] , " count " : [ 0 ] } ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        _info [ ' count ' ]  =  np . round (  ( _info [ ' count ' ]  *  100  ) / N , 2 ) 
 
					 
					 
					 
					        _info [ ' count ' ]  =  np . round (  ( _info [ ' count ' ]  *  100  ) / N , 2 ) 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -97,11 +100,6 @@ class get :
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # 
 
					 
					 
					 
					        # 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # Let us classify the files now i.e claims / remits 
 
					 
					 
					 
					        # Let us classify the files now i.e claims / remits 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # 
 
					 
					 
					 
					        # 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # pipeline = [{"$group":{"_id":"$parse","claims":{"$addToSet":"$name"}}},{"$project":{"_id":0,"type":"$_id","count":{"$size":"$claims"}}}] 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # _args = {"aggregate":"logs","cursor":{},"allowDiskUse":True,"pipeline":pipeline} 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        # r = pd.DataFrame(reader.read(mongo=_args)) 
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        r  =  pd . DataFrame ( reader . read ( * * _query ) )  #-- distribution claims/remits 
 
					 
					 
					 
					        r  =  pd . DataFrame ( reader . read ( * * _query ) )  #-- distribution claims/remits 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        r  =  Apex . apply ( { " chart " : { " type " : " donut " , " axis " : { " x " : " count " , " y " : " type " } } , " data " : r } ) [ ' apex ' ] 
 
					 
					 
					 
					        r  =  Apex . apply ( { " chart " : { " type " : " donut " , " axis " : { " x " : " count " , " y " : " type " } } , " data " : r } ) [ ' apex ' ] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        r [ ' chart ' ] [ ' height ' ]  =  ' 100 % ' 
 
					 
					 
					 
					        r [ ' chart ' ] [ ' height ' ]  =  ' 100 % '