Skip to content

Commit

Permalink
fix possible column error in omop_teva
Browse files Browse the repository at this point in the history
  • Loading branch information
svittoz authored Jun 10, 2024
1 parent 36c63a9 commit 20545e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions eds_scikit/plot/omop_teva.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ def generate_omop_teva(
else:
try:
table = data._read_table(table_name)
table = table.merge(
visit_occurrence, on="visit_occurrence_id", how="left"
)
drop_columns = (set(visit_occurrence.columns).intersection(table.columns)).difference(["visit_occurrence_id"])
if drop_columns:
table = table.merge(
visit_occurrence.drop(columns=drop_columns), on="visit_occurrence_id", how="left"
)
else:
table = table.merge(
visit_occurrence, on="visit_occurrence_id", how="left"
)
except AttributeError:
raise Exception(
f"No {table_name} table in input data object. Skipping procedure_occurrence."
Expand Down

0 comments on commit 20545e2

Please sign in to comment.