Accessing the COVID-19 EUDRAVIGILANCE Vaccine Reaction reports with Python's Pandas (BASIC)
Channel: VHFILM
Date: 2021-11-26

Just a simple run through on accessing EUDRAVIGILANCE with Python's Pandas (Download and Upload CSV)
#reaction #eudravigilance #pandas

import pandas as pd
import datetime
import plotly.express as px
import re
mod = pd.read_csv('MODERNA.csv',parse_dates=['EV Gateway Receipt Date'])
pfi = pd.read_csv('PFIZER.csv',parse_dates=['EV Gateway Receipt Date'])
ast = pd.read_csv('ASTRA.csv',parse_dates=['EV Gateway Receipt Date'])
jan = pd.read_csv('JANS.csv',parse_dates=['EV Gateway Receipt Date'])
len(mod),len(pfi),len(pfi2),len(ast),len(jan)
mod.head()
pd.set_option('display.max_colwidth', 1500)
mod['Reaction List PT (Duration – Outcome - Seriousness Criteria)']
mod['Suspect/interacting Drug List (Drug Char - Indication PT - Action taken - [Duration - Dose - Route])']
mod['VAXX'] = 'MODERNA'
pfi['VAXX'] = 'PFIZER'
jan['VAXX'] = 'JANSSEN'
ast['VAXX'] = 'ASTRAZENECA'
eucovid  = pd.concat([mod,pfi,ast,jan],ignore_index=True,axis=0)
eucovid.columns
len(mod) + len(pfi) + len(ast) + len(jan)
z = len(mod) + len(pfi) + len(ast) + len(jan)
eucovid19= eucovid.drop(eucovid.columns[[1,3,4,5,7,8,9,11,12,13]],axis=1).copy(deep=True)
eucovid19
eu= pd.DataFrame()
eu[['ID','Date','Age','Reaction','Vaccine']]= eucovid19[['EU Local Number','EV Gateway Receipt Date','Patient Age Group','Reaction List PT (Duration – Outcome - Seriousness Criteria)','VAXX']]
eu = eu.apply(lambda x: x.astype(str).str.upper())
eut = eu.copy(deep=True)
eut
regex1 = (r'\([^()]*\)' )
regex2 = (r'*BR*') #*= Angle Bracket Here
eut['Reaction'] = eu.Reaction.str.replace(regex1,'').str.replace(regex2,'')
eut
eut['Reaction'] = eut['Reaction'].str.split(',')
eux = eut.explode('Reaction')
eux
eux['Reaction'].value_counts()
eur = pd.DataFrame()
eur.index.set_names('REACTION',inplace=True)
eur['Total_Count']=eux['Reaction'].value_counts()
eur
example = eur.query('Total_Count * 10000') #*= Angle Bracket Here
example
fig= px.bar(example, y='Total_Count',width=1500, height=900, color=example.index, title=f"Serious Reactions Reported {z}")
fig.show()