📢 Inspiration
Every business is deeply intertwined with environmental, social, and governance (ESG) concerns, and it has become of paramount importance to evaluate the risks that the organization is taking on based on the ESG externalities it is generating.
This is key, not only for business growth and investment, as ESG-oriented investing has experienced a meteoric rise as global sustainable investment now tops $30 trillion (Global News Wire, 2022), but also due to the growing impact it has on the public's perception. In fact, 83% of consumers think companies should be actively shaping ESG best practices (PwC, ND). Communication has a big influence on this - the way the company communicates can reflect how they perceive ESG and their strategy towards sustainability.
With this in mind, and using Expert.ai's ESG and Sentiment Analysis Knowledge Models, we set out to build an app to provide holistic insights, both to companies and the public, to raise transparency on companies' attitudes towards ESG and compare their position among the industry and with public perception.
The ultimate goal is two-folded:
- Help companies navigate the ESG world and understand their current status, in order to improve their strategy regarding ESG.
- Provide an easy and transparent way for consumers, employees, and the general public to assess any company's behavior towards ESG.
💻 What it does
Product Definition
A digital platform that raises transparency on companies' ESG actions, helping them enhance ESG strategy by analysing social media perception. SustainaMeter also empowers more responsible investments, career decisions, and purchases, by gathering and reviewing information on how companies communicate ESG accomplishments.
Users
- General audience who wants to review and evaluate a company's attitude towards ESG
- Companies looking to assess their ESG positioning and communication, or test new communications
Activities
SustainaMeter's solution:
- Scrapes LinkedIn posts and respective comments for different companies;
- Scores posts in terms of ESG and detects the sentiment of the comments (using Expert.ai's API);
- Provides visualizations and metrics for assessing companies' communication in terms of ESG, individually and collectively, and how the audience reacts to it;
- Predicts the average sentiment a new post will generate, and provides insights on its ESG score;
The following diagram exemplifies SustainaMeter's activities:

How does the app work?
Users can input:
- Company name, from the list of available (pre-scraped companies);
- Number of posts to analyse, selected in order of highest number of likes;
- Comparison group for comparing the selected company's performance with the top 5 companies sorted by no. of likes, comments, posts or their ESG score
Users, will, then, be able to dive into an individual analysis of the company and compare it with the average ratings of the top 5 companies selected.



Besides, users are able to input text for a new post and analyse the ESG results as well as the predicted sentiment.


Repository Organization
SustainaMeter's GitHub repository contains all the code built to support the app and, simultaneously, hosts the app integrated with Streamlit, that mainly uses the following scripts (in the root folder):
- Home.py has all streamlit code, used to generate the visualizations;
- ExpertaiAPI.py includes the class for handling Expert.ai's API requests;
- LinkedinAPI.py processes all scraping done from LinkedIn;
Support scripts and datasets are organized in separate folders:
- Data Scraping, which includes the linkedin-api package with our own modifications for better performance.
- ESG Models, where we stored all datasets (Data folder), scripts and tests for running Expert.ai's models on scraped posts (LinkedIn expert_AI scores folder) and training our text regressor (LinkedIn Post ESG predictor).
How we built it
🔢 Data
This project uses social media posts and comments (from LinkedIn) as main data sources. The raw text was processed with Expert.ai's Knowledge Models to create datasets with ESG and Sentiment scores. These are the 4 main created datasets:
- Posts contains 9450 posts' information, from a group of 165 selected companies.
- Comments contains a total of 2442 comments, retrieved from each post in the Posts dataset.
- Analysed Posts includes the ESG Knowledge Model predictions for the posts data.
- Analysed Comments includes the Sentiment Analysis Knowledge Model evaluation of comments' text sentiment.
Due to the characters limit on Expert.ai's API (<= 10M characters/month), we had to keep our datasets limited to the top 50 companies with the most posts. With unlimited access to the API, we could populate the dataset with more and more companies and posts to grow the app and amplify its impact.
Finally, we believe that these datasets can enable future research on NLP-related topics, providing relevant labeled data, which could be made public as open-source in a platform like Kaggle.
⚙️ Methods and Tools
1. Creating the Base Datasets
To select the companies, we created a subset of 165 from Fortune 1000 Companies list with social media information from GitHub. It was considered to be a meaningful subset, with some of the most important firms in the list of the 1000 largest American companies.
Then, we resorted to the LinkedIn API to build our own social media datasets. Post and Comment data were scrapped from these companies' pages on LinkedIn.
2. Running ESG and Sentiment Analysis
Posts' and comments' text from the base dataset were analysed using Expert.ai's knowledge models, updating the datasets to include the ESG categorization and subcategories scores (for posts) and the text sentiment (for comments).
3. Building Visualizations
In order to provide deep and holistic insights, we focused on creating visualizations with Matplotlib and Plotly for ESG category counts, total subcategory scores, and sentiment dispersion, allowing the user to easily compare values.
4. Creating a Sentiment Predictor
Using Expert.ai's pre-trained models to provide weak supervision, we trained a model to estimate the sentiment a given post will generate among people. First, we built a dataset consisting of raw LinkedIn posts and the predicted average sentiment score of their comments. Then, we fit a AutoKeras' TextRegressor using the latter as noisy labels. AutoKeras automatically searches for the best model and hyperparameters.
5. Constructing the Web App
By taking advantage of Streamlit's open-source Python library to turn python scripts into shareable web apps, we built a single-page app, with two tabs:
- Company Scoring, where users can review a single company's general post, ESG, and sentiment performance, as well as compare it with a selection of companies;
- New Post Scoring, where users can write a new post, and receive feedback on its ESG rating, and an average sentiment prediction that the post will receive from the audience.
Challenges we ran into
We faced several challenges throughout the development of SustainaMeter, such as:
- the LinkedIn API that we used had a couple of bugs that had to be fixed. Thanks to the help of the Python community, we were able to fix them and get them working to match our needs in constructing the posts and comments databases;
- we found the expert.ai API characters limit a bit too low. Because of that, we had to limit the number of companies, posts and comments to take into consideration, therefore taking conclusions that are not as generalizable and may be biased;
- due to a lack of data balance and companies' representation, the ML models that we produced to predict ESG and comments' sentiment are not as robust as desired. We were limited by data amounts, expert.ai API's character limits, computational power, and time. In any case, we consider it provides a valuable proof-of-concept that can easily be scaled up;
- overall, better documentation in expert.ai API would be useful. Anyway, we were able to take advantage of it in our app and we have shown that NLP can leverage text data for great ESG insights when it comes to companies' policies.
Accomplishments that we're proud of
- We were able to successfully build a working web application, not only a demo or proof of concept, with the results we intended in the first place;
- We achieved reasonable results for our predictive model for the average sentiment generated by a post, even with the data limitations we had;
- We were able to do great work even despite the team is divided into opposite sides of the globe (South America and Europe)!
What we learned
- We learned about the potentialities of Expert.ai's NL API, including all the different knowledge models it provides, which allow us to embed rich NL analysis in our app with minimal development costs;
- We built our first web app with Streamlit and learned how to quickly deploy data science apps;
- We improved our knowledge on ESG, how important it is, and how society (companies, organizations, developers, etc.) is shaping itself to pursue new ESG standards.
What's next for SustainaMeter
💥 Impact
The current generation, with people who are becoming employees, buyers, and investors, is taking note of corporations dedicated to sustainability and rewarding them with loyalty.
SustainaMeter will allow companies to better promote their ESG accomplishments on social media, and align their ESG strategy with their customer base, with transparency at its core.
On the other hand, the community will be able to access and assess reliable information about how each enterprise communicates its ESG, and make better decisions for investments, careers, purchases or partnerships. SustainaMeter is a centralized way to validate companies' ESG credibility, including greenwashing evaluations.
SustainaMeter aims at leveraging Expert.ai's Knowledge Models to make communication and action transparent and accessible to everyone, building towards a more sustainable world and community.
🚀 Scaleability
SustainaMeter is crafted for scalability. Even though in this proof-of-concept we are only looking at 50 companies from the Fortune 1000 list, SustainaMeter is ready to receive any companies' dataset. To make our insights as unbiased and complete as possible, companies of every type must come to play. It is easy to include:
- different markets across the globe;
- companies with different sizes (start-ups, SMEs or large international corporations), assessed in terms of revenue, age, number of employees, etc.;
- firms from diverse industries, to take meaningful conclusions about the sector's impact on ESG policy.
The source of the used data can also be easily scaled to new social media platforms. While LinkedIn provided relevant, ESG-orient content, the comments tend to yield positive sentiment. Twitter, on the other hand, provides more diversity in opinions, which comes with the cost of increased noise. Once again, SustainaMeter can be easily adapted to new data sources and, thanks to Expert.ai's API, further value can be taken from text in companies' social media. All one must do is adapt the input databases.
Finally, using the tools we created (made available on GitHub), one can further leverage SustainaMeter to:
- produce rankings about companies' attitudes towards ESG;
- assess a single new company and compare its performance against our large database;
- extrapolate these tools to evaluate public figures' profiles.
Let's raise transparency on companies' attitudes towards ESG. The sky is the limit!
Log in or sign up for Devpost to join the conversation.