kpi_analysis / docs /gradio_app_usage.md
zh3036's picture
Deploy KPI snapshot 2025-06-12
4e67a93

A newer version of the Gradio SDK is available: 6.11.0

Upgrade

KPI Correlation Analysis Gradio App Usage Guide

Overview

This Gradio app provides a simple web interface for analyzing correlations between IPM scores and axiia scores (problem_score and ability_score).

How to Run the App

  1. Navigate to the app directory:

    cd data-analysis/kpi_score_analysis
    
  2. Run the app:

    python3 kpi_correlation_app.py
    
  3. Access the app:

    • The app will start and display a URL (typically http://127.0.0.1:7860)
    • Open this URL in your web browser

Using the App

  1. Upload KPI File:

    • Click on the "Upload KPI File" area
    • Select your KPI file (supports .csv, .xls, .xlsx formats)
    • The file should contain:
      • Email column
      • FY23/24 IPM column
      • FY24/25 IPM column
  2. Analyze:

    • Click the "Analyze Correlations" button
    • The app will process the data and match emails with the scores file
  3. View Results:

    • Analysis Results: Text output showing:

      • Data quality report (number of records, matched emails)
      • Correlation analysis for each pair (AC, AD, BC, BD)
      • Pearson and Spearman correlation coefficients
      • P-values and sample sizes
    • Correlation Plots: Four scatter plots showing:

      • AC: Problem Score vs FY23/24 IPM
      • AD: Problem Score vs FY24/25 IPM
      • BC: Ability Score vs FY23/24 IPM
      • BD: Ability Score vs FY24/25 IPM

Example Files

You can test the app with these files:

  • test_kpi.csv (in the same directory)
  • ../../data/lenovo_kpi.csv
  • ../../data/Copy of 联想 kpi copy.xlsx

Technical Details

  • The app uses a fixed scores file (lenovo-scores-0603.csv) that must be in the same directory
  • Handles both CSV and Excel files for KPI data
  • Automatically converts percentage strings to numeric values
  • Only analyzes records with matching emails and complete data
  • Shows trend lines and correlation coefficients on plots

Troubleshooting

  • "Error: scores file not found": Ensure lenovo-scores-0603.csv is in the same directory as the app
  • "No matching emails found": Check that email addresses in KPI file match those in scores file
  • Empty plots: This indicates insufficient data points for that correlation pair

Requirements

  • Python 3.x
  • Required packages: gradio, pandas, numpy, scipy, matplotlib, seaborn
  • All dependencies should already be installed in the lenovo-reports environment