Skip to main content

Visualize side effects from textual data

Project description

Python package sideeffect

sideeffect is a Python library for processing textual health-related data to extract, analyze, and visualize potential side effects of pharmaceutical drugs from text sources such as social media posts, surveys, or reports.

It provides pipeline for:

  • Cleaning and preprocessing text
  • Extracting known and uncommon symptoms
  • Detecting alert-related keywords
  • Generating multiple analytical visualizations

Disclaimer

This library is only for informational, educational, and research purposes only.
It is not intended to provide medical advice, diagnosis, or treatment.
Do not use it as a substitute for professional healthcare guidance.
Always consult a qualified healthcare professional regarding any medical concerns.

Note: The code is provided for demonstration purposes; it is not fully optimized and generates only basic visualizations.


Installation from PyPI:

%pip install sideeffect

Quick Start Example

import warnings warnings.filterwarnings("ignore") # Hide warnings

import os import pandas as pd

Set working directory

os.chdir(r"C:")

Add the project folder to path

import sys sys.path.append(r"C:")

Import the custom functions

from sideeffect.processing import main from sideeffect.visualization import ( plot_day_of_week_distribution, plot_data_count_per_month, plot_known_symptoms, plot_uncommon_side_effects_pie_chart, plot_proportion_of_english_words, plot_create_side_effects_correlation, plot_create_side_effects_visualizations, plot_sentiment_distribution, plot_visualize, plot_symptom_extraction, )

-----------------------------

Step 1: Load a csv file having at least four columns for example:

Headers: Date, month, RT_Like, text

Row values: 3/15/2023 8:23, 4, 1, Day 2 and I feel better

-----------------------------

df = pd.read_csv("data.csv")

-----------------------------

Step 2: Extract symptoms & alert keywords

-----------------------------

This must be done first so that derived columns like 'extracted_symptoms' exist

plot_symptom_extraction(df)

-----------------------------

Step 3: Basic distributions & sentiment analysis

-----------------------------

plot_day_of_week_distribution(df) plot_data_count_per_month(df) plot_sentiment_distribution(df)

-----------------------------

Step 4: Side effects correlation & detailed visualizations

-----------------------------

plot_create_side_effects_correlation(df) plot_create_side_effects_visualizations(df) plot_visualize(df)

-----------------------------

Step 5: Plots that depend on extracted columns

-----------------------------

plot_known_symptoms(df) plot_uncommon_side_effects_pie_chart(df) plot_proportion_of_english_words(df)

print("All plots generated successfully!")

License

MIT License

Copyright (c) 2026 Briti Deb

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drugsideeffect-0.1.4.tar.gz (62.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drugsideeffect-0.1.4-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

Details for the file drugsideeffect-0.1.4.tar.gz.

File metadata

  • Download URL: drugsideeffect-0.1.4.tar.gz
  • Upload date:
  • Size: 62.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for drugsideeffect-0.1.4.tar.gz
Algorithm Hash digest
SHA256 17f5c6495d10222e938e73a7c0bdab3f9e7dfa6d31d2f696905630c651a492c8
MD5 ea0ff3125bd07dbc92d8afac50b57fad
BLAKE2b-256 6a8f14d557027c6dec4a460074a4adc4e2131a762696099eb5230613b1cfda58

See more details on using hashes here.

File details

Details for the file drugsideeffect-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: drugsideeffect-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 63.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for drugsideeffect-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a6729c5379fe417ddd54bdffa700a47131c1163ddffc5069f1065225e25d073a
MD5 6b8b72708f2131b0afa42dbcb6634669
BLAKE2b-256 2abdb196c6945a31b8f4ead5858d77f79c8011077d1d317a3bfba7f64cda9e5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page