Skip to content

Commit

Permalink
Fix dump of mesh refs.
Browse files Browse the repository at this point in the history
  • Loading branch information
pagreene committed Jul 17, 2020
1 parent 20fb342 commit f40bc66
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions indra_db/reading/read_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,19 +474,16 @@ def dump_results_to_db(self):
insert_raw_agents(self._db, batch_id, stmts, verbose=False)
self.stops['dump_statements_db'] = datetime.utcnow()
else:
mesh_term_tuples = {}
mesh_term_tuples = set()
for sd in self.result_outputs:
tpl = sd.make_tuple(batch_id)
key = (tpl[1], tpl[4], tpl[9])
mesh_term_tuples[key] = tpl
mesh_term_tuples.add(tpl)

# Dump mesh_terms to the table
updated = self._db.copy_lazy(
'mti_ref_annotations_test',
mesh_term_tuples.values(),
DatabaseStatementData.get_cols(),
commit=False
)
updated = self._db.copy_lazy('mti_ref_annotations_test',
mesh_term_tuples,
DatabaseStatementData.get_cols(),
commit=False)

gatherer.add('new_mesh_terms', len(mesh_term_tuples) - len(updated))
gatherer.add('upd_mesh_terms', len(updated))
Expand Down

0 comments on commit f40bc66

Please sign in to comment.