--- --- ![](https://raw.githubusercontent.com/obsei/obsei-resources/master/gifs/obsei_flow.gif) --- Note: Obsei is still in alpha stage hence carefully use it in Production. Also, as it is constantly undergoing development hence master branch may contain many breaking changes. Please use released version. --- **Obsei** (pronounced "Ob see" | /Ιb-'sΔ/) is an open-source, low-code, AI powered automation tool. _Obsei_ consists of - - **Observer**: Collect unstructured data from various sources like tweets from Twitter, Subreddit comments on Reddit, page post's comments from Facebook, App Stores reviews, Google reviews, Amazon reviews, News, Website, etc. - **Analyzer**: Analyze unstructured data collected with various AI tasks like classification, sentiment analysis, translation, PII, etc. - **Informer**: Send analyzed data to various destinations like ticketing platforms, data storage, dataframe, etc so that the user can take further actions and perform analysis on the data. All the Observers can store their state in databases (Sqlite, Postgres, MySQL, etc.), making Obsei suitable for scheduled jobs or serverless applications. ![Obsei diagram](https://raw.githubusercontent.com/obsei/obsei-resources/master/images/Obsei_diagram.png) ### Future direction - - Text, Image, Audio, Documents and Video oriented workflows - Collect data from every possible private and public channels - Add every possible workflow to an AI downstream application to automate manual cognitive workflows ## Use cases _Obsei_ use cases are following, but not limited to - - Social listening: Listening about social media posts, comments, customer feedback, etc. - Alerting/Notification: To get auto-alerts for events such as customer complaints, qualified sales leads, etc. - Automatic customer issue creation based on customer complaints on Social Media, Email, etc. - Automatic assignment of proper tags to tickets based content of customer complaint for example login issue, sign up issue, delivery issue, etc. - Extraction of deeper insight from feedbacks on various platforms - Market research - Creation of dataset for various AI tasks - Many more based on creativity π‘ ## Installation ### Prerequisite Install the following (if not present already) - - Install [Python 3.7+](https://www.python.org/downloads/) - Install [PIP](https://pip.pypa.io/en/stable/installing/) ### Install Obsei You can install Obsei either via PIP or Conda based on your preference. To install latest released version - ```shell pip install obsei[all] ``` Install from master branch (if you want to try the latest features) - ```shell git clone https://github.com/obsei/obsei.git cd obsei pip install --editable .[all] ``` Note: `all` option will install all the dependencies which might not be needed for your workflow, alternatively following options are available to install minimal dependencies as per need - - `pip install obsei[source]`: To install dependencies related to all observers - `pip install obsei[sink]`: To install dependencies related to all informers - `pip install obsei[analyzer]`: To install dependencies related to all analyzers, it will install pytorch as well - `pip install obsei[twitter-api]`: To install dependencies related to Twitter observer - `pip install obsei[google-play-scraper]`: To install dependencies related to Play Store review scrapper observer - `pip install obsei[google-play-api]`: To install dependencies related to Google official play store review API based observer - `pip install obsei[app-store-scraper]`: To install dependencies related to Apple App Store review scrapper observer - `pip install obsei[reddit-scraper]`: To install dependencies related to Reddit post and comment scrapper observer - `pip install obsei[reddit-api]`: To install dependencies related to Reddit official api based observer - `pip install obsei[pandas]`: To install dependencies related to TSV/CSV/Pandas based observer and informer - `pip install obsei[google-news-scraper]`: To install dependencies related to Google news scrapper observer - `pip install obsei[facebook-api]`: To install dependencies related to Facebook official page post and comments api based observer - `pip install obsei[atlassian-api]`: To install dependencies related to Jira official api based informer - `pip install obsei[elasticsearch]`: To install dependencies related to elasticsearch informer - `pip install obsei[slack-api]`:To install dependencies related to Slack official api based informer You can also mix multiple dependencies together in single installation command. For example to install dependencies Twitter observer, all analyzer, and Slack informer use following command - ```shell pip install obsei[twitter-api, analyzer, slack-api] ``` ## How to use Expand the following steps and create a workflow -
```python from obsei.source.twitter_source import TwitterCredentials, TwitterSource, TwitterSourceConfig # initialize twitter source config source_config = TwitterSourceConfig( keywords=["issue"], # Keywords, @user or #hashtags lookup_period="1h", # Lookup period from current time, format: ` |
Youtube Scrapper```python from obsei.source.youtube_scrapper import YoutubeScrapperSource, YoutubeScrapperConfig # initialize Youtube source config source_config = YoutubeScrapperConfig( video_url="https://www.youtube.com/watch?v=uZfns0JIlFk", # Youtube video URL fetch_replies=True, # Fetch replies to comments max_comments=10, # Total number of comments and replies to fetch lookup_period="1Y", # Lookup period from current time, format: ` |
```python from obsei.source.facebook_source import FacebookCredentials, FacebookSource, FacebookSourceConfig # initialize facebook source config source_config = FacebookSourceConfig( page_id="110844591144719", # Facebook page id, for example this one for Obsei lookup_period="1h", # Lookup period from current time, format: ` |
```python from obsei.source.email_source import EmailConfig, EmailCredInfo, EmailSource # initialize email source config source_config = EmailConfig( # List of IMAP servers for most commonly used email providers # https://www.systoolsgroup.com/imap/ # Also, if you're using a Gmail account then make sure you allow less secure apps on your account - # https://myaccount.google.com/lesssecureapps?pli=1 # Also enable IMAP access - # https://mail.google.com/mail/u/0/#settings/fwdandpop imap_server="imap.gmail.com", # Enter IMAP server cred_info=EmailCredInfo( # Enter your email account username and password username=" |
Google Maps Reviews Scrapper```python from obsei.source.google_maps_reviews import OSGoogleMapsReviewsSource, OSGoogleMapsReviewsConfig # initialize Outscrapper Maps review source config source_config = OSGoogleMapsReviewsConfig( # Collect API key from https://outscraper.com/ api_key=" |
AppStore Reviews Scrapper```python from obsei.source.appstore_scrapper import AppStoreScrapperConfig, AppStoreScrapperSource # initialize app store source config source_config = AppStoreScrapperConfig( # Need two parameters app_id and country. # `app_id` can be found at the end of the url of app in app store. # For example - https://apps.apple.com/us/app/xcode/id497799835 # `310633997` is the app_id for xcode and `us` is country. countries=["us"], app_id="310633997", lookup_period="1h" # Lookup period from current time, format: ` |
Play Store Reviews Scrapper```python from obsei.source.playstore_scrapper import PlayStoreScrapperConfig, PlayStoreScrapperSource # initialize play store source config source_config = PlayStoreScrapperConfig( # Need two parameters package_name and country. # `package_name` can be found at the end of the url of app in play store. # For example - https://play.google.com/store/apps/details?id=com.google.android.gm&hl=en&gl=US # `com.google.android.gm` is the package_name for xcode and `us` is country. countries=["us"], package_name="com.google.android.gm", lookup_period="1h" # Lookup period from current time, format: ` |
```python from obsei.source.reddit_source import RedditConfig, RedditSource, RedditCredInfo # initialize reddit source config source_config = RedditConfig( subreddits=["wallstreetbets"], # List of subreddits # Reddit account username and password # You can also enter reddit client_id and client_secret or refresh_token # Create credential at https://www.reddit.com/prefs/apps # Also refer https://praw.readthedocs.io/en/latest/getting_started/authentication.html # Currently Password Flow, Read Only Mode and Saved Refresh Token Mode are supported cred_info=RedditCredInfo( username=" |
Reddit ScrapperNote: Reddit heavily rate limit scrappers, hence use it to fetch small data during long period ```python from obsei.source.reddit_scrapper import RedditScrapperConfig, RedditScrapperSource # initialize reddit scrapper source config source_config = RedditScrapperConfig( # Reddit subreddit, search etc rss url. For proper url refer following link - # Refer https://www.reddit.com/r/pathogendavid/comments/tv8m9/pathogendavids_guide_to_rss_and_reddit/ url="https://www.reddit.com/r/wallstreetbets/comments/.rss?sort=new", lookup_period="1h" # Lookup period from current time, format: ` |
Google News```python from obsei.source.google_news_source import GoogleNewsConfig, GoogleNewsSource # initialize Google News source config source_config = GoogleNewsConfig( query='bitcoin', max_results=5, # To fetch full article text enable `fetch_article` flag # By default google news gives title and highlight fetch_article=True, # proxy='http://127.0.0.1:8080' ) # initialize Google News retriever source = GoogleNewsSource() ``` |
Web Crawler```python from obsei.source.website_crawler_source import TrafilaturaCrawlerConfig, TrafilaturaCrawlerSource # initialize website crawler source config source_config = TrafilaturaCrawlerConfig( urls=['https://obsei.github.io/obsei/'] ) # initialize website text retriever source = TrafilaturaCrawlerSource() ``` |
Pandas DataFrame```python import pandas as pd from obsei.source.pandas_source import PandasSource, PandasSourceConfig # Initialize your Pandas DataFrame from your sources like csv, excel, sql etc # In following example we are reading csv which have two columns title and text csv_file = "https://raw.githubusercontent.com/deepset-ai/haystack/master/tutorials/small_generator_dataset.csv" dataframe = pd.read_csv(csv_file) # initialize pandas sink config sink_config = PandasSourceConfig( dataframe=dataframe, include_columns=["score"], text_columns=["name", "degree"], ) # initialize pandas sink sink = PandasSource() ``` |
Some analyzer support GPU and to utilize pass device parameter. List of possible values of device parameter (default value auto):
Text ClassificationText classification: Classify text into user provided categories. ```python from obsei.analyzer.classification_analyzer import ClassificationAnalyzerConfig, ZeroShotClassificationAnalyzer # initialize classification analyzer config # It can also detect sentiments if "positive" and "negative" labels are added. analyzer_config=ClassificationAnalyzerConfig( labels=["service", "delay", "performance"], ) # initialize classification analyzer # For supported models refer https://huggingface.co/models?filter=zero-shot-classification text_analyzer = ZeroShotClassificationAnalyzer( model_name_or_path="typeform/mobilebert-uncased-mnli", device="auto" ) ``` |
Sentiment AnalyzerSentiment Analyzer: Detect the sentiment of the text. Text classification can also perform sentiment analysis but if you don't want to use heavy-duty NLP model then use less resource hungry dictionary based Vader Sentiment detector. ```python from obsei.analyzer.sentiment_analyzer import VaderSentimentAnalyzer # Vader does not need any configuration settings analyzer_config=None # initialize vader sentiment analyzer text_analyzer = VaderSentimentAnalyzer() ``` |
NER AnalyzerNER (Named-Entity Recognition) Analyzer: Extract information and classify named entities mentioned in text into pre-defined categories such as person names, organizations, locations, medical codes, time expressions, quantities, monetary values, percentages, etc ```python from obsei.analyzer.ner_analyzer import NERAnalyzer # NER analyzer does not need configuration settings analyzer_config=None # initialize ner analyzer # For supported models refer https://huggingface.co/models?filter=token-classification text_analyzer = NERAnalyzer( model_name_or_path="elastic/distilbert-base-cased-finetuned-conll03-english", device = "auto" ) ``` |
Translator```python from obsei.analyzer.translation_analyzer import TranslationAnalyzer # Translator does not need analyzer config analyzer_config = None # initialize translator # For supported models refer https://huggingface.co/models?pipeline_tag=translation analyzer = TranslationAnalyzer( model_name_or_path="Helsinki-NLP/opus-mt-hi-en", device = "auto" ) ``` |
PII Anonymizer```python from obsei.analyzer.pii_analyzer import PresidioEngineConfig, PresidioModelConfig, \ PresidioPIIAnalyzer, PresidioPIIAnalyzerConfig # initialize pii analyzer's config analyzer_config = PresidioPIIAnalyzerConfig( # Whether to return only pii analysis or anonymize text analyze_only=False, # Whether to return detail information about anonymization decision return_decision_process=True ) # initialize pii analyzer analyzer = PresidioPIIAnalyzer( engine_config=PresidioEngineConfig( # spacy and stanza nlp engines are supported # For more info refer # https://microsoft.github.io/presidio/analyzer/developing_recognizers/#utilize-spacy-or-stanza nlp_engine_name="spacy", # Update desired spacy model and language models=[PresidioModelConfig(model_name="en_core_web_lg", lang_code="en")] ) ) ``` |
Dummy AnalyzerDummy Analyzer: Does nothing. Its simply used for transforming the input (TextPayload) to output (TextPayload) and adding the user supplied dummy data. ```python from obsei.analyzer.dummy_analyzer import DummyAnalyzer, DummyAnalyzerConfig # initialize dummy analyzer's configuration settings analyzer_config = DummyAnalyzerConfig() # initialize dummy analyzer analyzer = DummyAnalyzer() ``` |
Slack```python from obsei.sink.slack_sink import SlackSink, SlackSinkConfig # initialize slack sink config sink_config = SlackSinkConfig( # Provide slack bot/app token # For more detail refer https://slack.com/intl/en-de/help/articles/215770388-Create-and-regenerate-API-tokens slack_token=" |
Zendesk```python from obsei.sink.zendesk_sink import ZendeskSink, ZendeskSinkConfig, ZendeskCredInfo # initialize zendesk sink config sink_config = ZendeskSinkConfig( # provide zendesk domain domain="zendesk.com", # provide subdomain if you have one subdomain=None, # Enter zendesk user details cred_info=ZendeskCredInfo( email=" |
Jira```python from obsei.sink.jira_sink import JiraSink, JiraSinkConfig # For testing purpose you can start jira server locally # Refer https://developer.atlassian.com/server/framework/atlassian-sdk/atlas-run-standalone/ # initialize Jira sink config sink_config = JiraSinkConfig( url="http://localhost:2990/jira", # Jira server url # Jira username & password for user who have permission to create issue username=" |
ElasticSearch```python from obsei.sink.elasticsearch_sink import ElasticSearchSink, ElasticSearchSinkConfig # For testing purpose you can start Elasticsearch server locally via docker # `docker run -d --name elasticsearch -p 9200:9200 -e "discovery.type=single-node" elasticsearch:8.5.0` # initialize Elasticsearch sink config sink_config = ElasticSearchSinkConfig( # Elasticsearch server hosts="http://localhost:9200", # Index name, it will create if not exist index_name="test", ) # initialize Elasticsearch sink sink = ElasticSearchSink() ``` |
Http```python from obsei.sink.http_sink import HttpSink, HttpSinkConfig # For testing purpose you can create mock http server via postman # For more details refer https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/setting-up-mock/ # initialize http sink config (Currently only POST call is supported) sink_config = HttpSinkConfig( # provide http server url url="https://localhost:8080/api/path", # Here you can add headers you would like to pass with request headers={ "Content-type": "application/json" } ) # To modify or converting the payload, create convertor class # Refer obsei.sink.dailyget_sink.PayloadConvertor for example # initialize http sink sink = HttpSink() ``` |
Pandas DataFrame```python from pandas import DataFrame from obsei.sink.pandas_sink import PandasSink, PandasSinkConfig # initialize pandas sink config sink_config = PandasSinkConfig( dataframe=DataFrame() ) # initialize pandas sink sink = PandasSink() ``` |
LoggerThis is useful for testing and dry running the pipeline. ```python from obsei.sink.logger_sink import LoggerSink, LoggerSinkConfig import logging import sys logger = logging.getLogger("Obsei") logging.basicConfig(stream=sys.stdout, level=logging.INFO) # initialize logger sink config sink_config = LoggerSinkConfig( logger=logger, level=logging.INFO ) # initialize logger sink sink = LoggerSink() ``` |
example.py
and execute the following command -
```shell
python example.py
```
Sr. No. | Title | Author |
---|---|---|
1 | AI based Comparative Customer Feedback Analysis Using Obsei | Reena Bapna |
2 | LinkedIn App - User Feedback Analysis | Himanshu Sharma |
Linux | Mac | Windows | Remark | |
---|---|---|---|---|
Tests | β | β | β | Low Coverage as difficult to test 3rd party libs |
PIP | β | β | β | Fully Supported |
Conda | β | β | β | Not Supported |