Skip to content

About

Can we use it?

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TabPFN Data Quality Assessment Dashboard

A lightweight, containerized Panel-based web application for assessing data quality in clinical medicine CSV files using TabPFN (Prior-Data Fitted Networks).

Features

  • TabPFN-Based Quality Assessment: Uses TabPFN's unsupervised learning capabilities for outlier detection, anomaly detection, and missing value pattern analysis
  • Clinical Quality Checks: Validates clinical data for impossible values, temporal inconsistencies, referential integrity, and clinical plausibility
  • Interactive Visualizations: Real-time quality metrics with pragmatic, understandable visualizations
  • Comprehensive Scoring: Overall and component-level quality scores (0-100 scale)
  • Actionable Recommendations: Provides specific recommendations for data quality improvements
  • Lightweight Container: Easy deployment with Docker

Quick Start

Using Docker (Recommended)

# Build the container
docker build -t tabpfn-data-quality .

# Run the container
docker run -p 5006:5006 tabpfn-data-quality

Then open your browser to http://localhost:5006

Using Docker Compose

For production deployments, you can use Docker Compose:

# Start the application
docker-compose -f docker-compose.prod.yml up -d

# View logs
docker-compose -f docker-compose.prod.yml logs -f

# Stop the application
docker-compose -f docker-compose.prod.yml down

Using GitHub Container Registry (Pre-built Image)

Pre-built Docker images are automatically published to GitHub Container Registry (ghcr.io) on every push to the production branch.

Pull and run the latest image:

# Pull the latest image from GitHub Container Registry
docker pull ghcr.io/salkinii/tabpfn-testing:latest

# Run the container
docker run -p 5006:5006 ghcr.io/salkinii/tabpfn-testing:latest

Using Docker Compose with registry image:

The docker-compose.prod.yml file is configured to use the pre-built image from GitHub Container Registry. Simply run:

# Pull latest image and start
docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -d

Available image tags:

  • latest - Latest production build
  • production - Production branch builds
  • v1.0.0, v1.1.0 - Version tags (when created)
  • production-<sha> - Specific commit builds

Note: If the repository is public, images are publicly accessible. If private, you'll need to authenticate:

# Authenticate with GitHub Container Registry
echo $GITHUB_TOKEN | docker login ghcr.io -u YOUR_USERNAME --password-stdin

Environment Variables

The application supports the following environment variables:

  • HF_TOKEN: (Optional) Hugging Face token for TabPFN model access. If not provided, TabPFN will use statistical fallback methods.
  • PYTHONUNBUFFERED: (Optional) Set to 1 for unbuffered Python output (useful for logging)

Important Security Note: The HF_TOKEN is never baked into Docker images. It must be provided at runtime via environment variables or .env file. This ensures your token remains secure and is never exposed in public repositories or images.

Example with environment variables:

# Using docker run
docker run -p 5006:5006 -e HF_TOKEN=your_token_here ghcr.io/salkinii/tabpfn-testing:latest

# Or using docker-compose with .env file
# Create .env file (not committed to git):
# HF_TOKEN=your_token_here
docker-compose -f docker-compose.prod.yml up -d

Without HF_TOKEN: The application works perfectly without a Hugging Face token, using statistical fallback methods for outlier and anomaly detection. The token is only needed if you want to use TabPFN's authenticated model access.

Usage

  1. Upload CSV File: Use the file upload widget in the sidebar to upload your CSV file
  2. Review Assessment: The dashboard will automatically assess data quality and display:
    • Overall quality score (0-100)
    • Summary cards with key metrics
    • Missing values analysis
    • Outlier detection results
    • Anomaly scores
    • Column-level quality metrics
    • Clinical quality checks (for clinical data)
    • Actionable recommendations

Supported File Formats

  • CSV files with standard delimiters (comma, semicolon, tab)
  • UTF-8 encoding (other encodings may be auto-detected)
  • Headers in first row
  • Any number of rows and columns

Project Structure

.
├── app.py                    # Main Panel application
├── data_quality.py           # TabPFN-based quality assessment
├── visualizations.py          # Panel visualization components
├── clinical_quality.py        # Clinical-specific quality checks
├── utils.py                  # Helper functions
├── requirements.txt          # Python dependencies
├── Dockerfile                # Container definition
├── .dockerignore             # Docker ignore file
├── LICENSE                   # Project license
└── README.md                 # This file

Data Quality Metrics

Overall Quality Score (0-100)

Composite score based on:

  • Missing values (30% weight)
  • Outliers (30% weight)
  • Anomalies (20% weight)
  • Consistency (20% weight)

Component Scores

  • Missing Score: Penalizes missing values
  • Outlier Score: Penalizes statistical outliers
  • Anomaly Score: Penalizes anomalous records
  • Consistency Score: Penalizes duplicate rows and data inconsistencies

Clinical Quality Checks

For clinical medicine data, the application performs additional checks:

  • Impossible values (e.g., age > 150)
  • Temporal inconsistencies (e.g., discharge before admission)
  • Referential integrity (missing/duplicate IDs)
  • Clinical plausibility (e.g., BMI calculations)

Logging

All operations are logged to the logs/ directory:

  • Assessment logs: Quality assessment runs and results
  • Error logs: Application errors and exceptions
  • Operation logs: File uploads and processing events

Logs are stored as JSON files with timestamps for easy parsing and analysis. The logs directory structure is automatically created when the application starts.

Configuration

Docker Deployment

For production deployments, consider:

  1. Volume Mounts: Mount the logs/ directory to persist logs:

    docker run -p 5006:5006 -v /path/to/logs:/app/logs tabpfn-data-quality
  2. Environment Variables: Set via -e flag or .env file:

    docker run -p 5006:5006 -e HF_TOKEN=your_token tabpfn-data-quality
  3. Resource Limits: Set appropriate CPU and memory limits:

    docker run -p 5006:5006 --memory="2g" --cpus="2" tabpfn-data-quality

Port Configuration

The application runs on port 5006 by default. To use a different port:

docker run -p 8080:5006 tabpfn-data-quality

Then access at http://localhost:8080

License

This project is licensed under the BSD 3-Clause License. See LICENSE file for details.

Third-Party Licenses

Documentation

Comprehensive documentation is available in the docs/ folder:

User Documentation

Technical Documentation

Dependencies

  • Panel >= 1.3.0 (BSD-3-Clause)
  • TabPFN >= 6.0.0 (TABPFN-2.5 License)
  • Pandas >= 2.0.0
  • NumPy >= 1.24.0
  • Plotly >= 5.17.0
  • Matplotlib >= 3.7.0

Support

For issues, questions, or contributions, please refer to the project repository or contact the maintainers.

References

About

Can we use it?

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages