diff --git a/eds_scikit/plot/omop_teva.py b/eds_scikit/plot/omop_teva.py index 06ce1a5e..eac15404 100644 --- a/eds_scikit/plot/omop_teva.py +++ b/eds_scikit/plot/omop_teva.py @@ -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."