Workplace Discrimination Pattern Analysis using AI and Statistical Methods - n8n Workflow

Use this robust n8n workflow to automatically scrape employee demographic review data from Glassdoor using ScrapingBee, leverage OpenAI to perform statistical analysis (Z-Scores, Effect Sizes), and visualize potential workplace discrimination patterns via QuickChart. This is a powerful n8n template for HR and researchers.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • HR professionals and DEI (Diversity, Equity, and Inclusion) specialists focused on organizational culture audits.

  • Data journalists and researchers investigating public perception of large corporations.

  • Organizations seeking advanced examples of combining web scraping, sophisticated statistical calculations, and AI analysis within a single n8n workflow.

  • Users looking for complex, real-world examples of n8n templates.

Overview

Identifying systemic workplace bias can be challenging, often requiring advanced scraping techniques and statistical expertise. This n8n workflow democratizes that process. It provides an end-to-end solution, starting by leveraging the ScrapingBee n8n node to bypass common bot detection mechanisms on sites like Glassdoor and retrieve sensitive demographic review data.

Once the data is retrieved, the workflow shifts into an analytical engine. It uses LangChain n8n nodes integrated with OpenAI to swiftly and accurately extract dozens of structured data points (ratings and review counts) from the raw HTML content. The core value of this n8n template lies in its statistical processing: calculating variance, standard deviation, Z-Scores, and Effect Sizes for various demographics (race, gender, parental status) relative to the organizational average. These metrics quantify disparity. Finally, AI is used to interpret these statistics, providing concise, human-readable key takeaways, making this n8n workflow an invaluable tool for corporate accountability and ethical research.

How it Works

The workflow begins with the manual n8n trigger, initiating the process. First, the 'SET company_name' n8n node defines the target company (e.g., 'Twilio') and the subsequent 'Define dictionary...' n8n node sets up demographic keys for later analysis.


  1. Web Scraping: The process leverages a series of HTTP Request n8n nodes configured for ScrapingBee, which handles JavaScript rendering and proxy rotation. It searches Glassdoor, extracts the company's URL path, retrieves the main company page, finds the reviews URL path, and finally fetches the content of the detailed reviews page.

  2. AI-Powered Extraction: The raw HTML content is split, and two LangChain Information Extractor n8n nodes (using an OpenAI connection) parse the structure, extracting overall ratings and dozens of demographic-specific ratings and review counts into structured JSON objects.

  3. Statistical Calculation: A sequence of Set n8n nodes calculates overall statistical measures (variance and standard deviation). The 'Calculate Z-Scores and Effect Sizes' Set n8n node performs the core quantitative analysis, comparing each demographic group's average rating against the overall average, standardized by the workflow's calculated standard deviation.

  4. Significance Testing: A Code n8n node calculates P-Scores (P-Values), using a custom standard normal distribution function to approximate statistical significance, identifying disparities unlikely to be due to chance.

  5. Visualization: The data is prepared by the 'Format dataset for scatterplot' Code n8n node and then sent to QuickChart to generate two data visualizations: a Bar Chart visualizing effect sizes and a Scatterplot displaying Z-Scores versus Effect Scores.

  6. Final AI Analysis: The culmination of this n8n workflow is the 'Text Analysis of Bias Data' LangChain n8n node. It takes the full statistical results (Z-Scores, P-Scores, Effect Sizes) and instructs the Large Language Model to synthesize an easy-to-understand summary of workplace biases and potential 'Employee Experiences.'

Installation Guide

To use this powerful n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON and import it into your n8n instance.

  2. ScrapingBee Setup: This n8n workflow requires a ScrapingBee account. In n8n, navigate to Credentials, create a new HTTP Query Auth credential named 'ScrapingBee Query Auth', and input your ScrapingBee API key.

  3. OpenAI Setup: This workflow relies heavily on LLM extraction and analysis. Create an OpenAI API Key credential in n8n (if you don't have one already) and link it to the four 'OpenAI Chat Model'/'Text Analysis of Bias Data' n8n node instances.

  4. Configuration: Locate the 'SET company_name' n8n node and replace the default value ('Twilio') with the name of the company you wish to analyze. Note that reliable Glassdoor data often requires large, US-based organizations.

  5. Execution: Once credentials are set, click 'Test workflow' on the 'When clicking ‘Test workflow’ n8n trigger to run the analysis and review the output in the final LLM and QuickChart nodes.

Node Details


  • Manual Trigger (When clicking ‘Test workflow’): The starting n8n trigger point for execution.

  • Set (SET companyname & Define dictionary...): These n8n nodes configure the company target and establish the list of demographic keys (Asian, Black, LGBTQ+, Disabled, etc.) used throughout the mathematical calculations.

  • HTTP Request (ScrapingBee nodes): Four separate instances are used in this n8n workflow to handle navigation and data retrieval from Glassdoor. Crucially, they use ScrapingBee credentials with premiumproxy and stealthproxy enabled to ensure successful scraping of dynamic content.

  • HTML (Extract nodes): Used after the HTTP Requests to isolate the necessary HTML segments, focusing on review-summary and demographics-module divs.

  • Information Extractor (LangChain n8n node): Two instances use schema definitions to instruct OpenAI to extract structured number values (ratings, percentages, counts) from the raw HTML summaries. This is key to converting raw text into usable data for the n8n workflow.

  • Set (Variance and Z-Score Calculation nodes): These n8n nodes perform complex calculations, leveraging JavaScript expressions to define variance, standard deviation (stddev), Z-Scores, and Effect Sizes for statistical comparison.

  • Code (Calculate P-Scores): A custom Code n8n node that implements the statistical function normSDist to accurately compute P-Scores, confirming the statistical significance of the calculated disparities.

  • QuickChart (Bar Chart & Scatterplot): These nodes take the calculated statistical metrics (Effect Sizes and Z-Scores) and dynamically generate two highly informative data visualizations of the bias patterns.

  • Chain LLM (Text Analysis of Bias Data): This final OpenAI/LangChain n8n node interprets the numerical results and generates a coherent, insightful report with key takeaways on potential discrimination patterns.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

If you have any questions about any of the templates I've built, please reach out to me on LinkedIn (https://www.linkedin.com/in/ludwiggerdes) or via my website down below. 👇

Featured*