(tables, tables1=None, crit=None)
| 254 | return dic |
| 255 | |
| 256 | def combine(tables, tables1=None, crit=None): |
| 257 | extra_query = [] |
| 258 | if tables1 is not None: |
| 259 | if len(tables)!=len(tables1): |
| 260 | print('error') |
| 261 | else: |
| 262 | for idx in range(len(tables)): |
| 263 | if tables1[idx] is not None: |
| 264 | tables[idx].update(tables1[idx]) |
| 265 | bigtab = {} |
| 266 | kys = [] |
| 267 | for tab in tables: |
| 268 | kys+=list(tab.keys()) |
| 269 | kys = set(kys) |
| 270 | if crit is not None: |
| 271 | for jdx,tab in enumerate(tables): |
| 272 | prp = '' |
| 273 | for ky in kys: |
| 274 | if ky not in tab: |
| 275 | prp+=ky+', ' |
| 276 | if prp=='': |
| 277 | extra_query.append('') |
| 278 | else: |
| 279 | ask = 'We want to explore '+crit+'. Read the following article and list the '+prp[:-2]+' of the trial into a concise markdown table. Article: ' |
| 280 | extra_query.append(ask) |
| 281 | for ky in kys: |
| 282 | line = ' | ' |
| 283 | for tab in tables: |
| 284 | if ky not in tab: |
| 285 | line+='N/A' |
| 286 | else: |
| 287 | line+=tab[ky] |
| 288 | line+=' | ' |
| 289 | bigtab[ky] = line |
| 290 | return bigtab, extra_query |
| 291 | |
| 292 | def get_table(pth, crit): |
| 293 | lines = open(pth).readlines()[1:] |
no outgoing calls
no test coverage detected