MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / combine_table

Function combine_table

bmtools/tools/meta_analysis/api.py:473–493  ·  view source on GitHub ↗

combine several tables recorded in the table path into one comprehensive record table and return. give the literature path, table path and the exploring topic as the input.

( literature_path: str, table_path: str, topic: str)

Source from the content-addressed store, hash-verified

471
472 @tool.get('/combine_table')
473 def combine_table( literature_path: str, table_path: str, topic: str):#( table_path_and_topic: str ):
474 """combine several tables recorded in the table path into one comprehensive record table and return. give the literature path, table path and the exploring topic as the input.
475 """
476 #if len(table_path_and_topic.split('&&&'))!=2:
477 # js = {'error': "input path cannot recognize the table path and the topic. please input 'TABLE_PATH&&&TOPIC'. "}
478 # return js
479 #table_path, topic = table_path_and_topic.split('&&&')
480 try:
481 finaldocs = pickle.load(open(literature_path, 'rb'))
482 except Exception as e:
483 js = {'error': "cannot open the given literature path!"}
484 return js
485 orig_tab, dicrec, extra = get_table(table_path.strip(' '), topic)
486 extra_draw('extra_'+table_path.strip(' '), finaldocs, extra)
487 final_tab = final_table('extra_'+table_path.strip(' '), dicrec)
488 allcon = print_table(final_tab)
489 fw = open('big_'+table_path, 'w')
490 fw.write(allcon)
491 fw.close()
492 js = {'big table path': 'big_'+table_path}
493 return js
494
495 @tool.get('/generate_summary')
496 def generate_summary(topic: str, table_path: str):

Callers

nothing calls this directly

Calls 4

get_tableFunction · 0.85
extra_drawFunction · 0.85
final_tableFunction · 0.85
print_tableFunction · 0.85

Tested by

no test coverage detected