tharunrai/data-quality-env
OpenEnv Data Quality Analyst Environment
This project is a real-world OpenEnv benchmark where an agent performs data quality analysis on tabular datasets. Instead of a game, the agent must find missing values, type errors, duplicates, outliers, and logical inconsistencies.
The environment is fully containerized for Hugging Face Spaces and local Docker execution.
Why This Environment
Data quality checking is a real production workflow used by data teams, analytics teams, and ML teams. This benchmark evaluates whether an agent can:
- read structured tabular data,
- reason over domain constraints,
- incrementally identify issues,
- avoid false positives,
- and submit a final answer with high precision and recall.
OpenEnv Interface
The environment follows the OpenEnv style with typed models and a standard API.
reset()-> initial observationstep(action)-> observation, reward, done, infostate()-> current episode state
Implemented HTTP endpoints:
POST /resetPOST /stepGET /stateGET /tasksGET /healthGET /docs
Observation Space
Each observation contains:
task_idtask_descriptiondataset(list of row objects)columnsstep_numberissues_found_so_farhint
Action Space
Action object fields:
action_typein{flag_issue, fix_value, submit}task_id(optional)issue_typein{missing, type_error, duplicate, outlier, inconsistency}row_index(0-based)columnfixed_value(used withfix_value)
Tasks and Difficulty
Three deterministic tasks with increasing difficulty:
task1_missing_values(easy)- Goal: identify all null/missing cells in employee records.
- Max steps: 20.
task2_type_errors_duplicates(medium)- Goal: find invalid types/values and duplicate records in product sales data.
- Max steps: 25.
task3_outliers_inconsistencies(hard)- Goal: detect statistical outliers and logical inconsistencies in world cities data.
- Max steps: 30.
Reward Design
The reward is shaped across the trajectory:
- positive reward for correct unseen issues,
- negative reward for false positives,
- negative reward for duplicate reports,
- bonus for valid fix actions,
- final score based on precision, recall, and efficiency.
Scores are clamped strictly inside (0.0, 1.0).
Project Structure
.
├── client.py
├── inference.py
├── models.py
├── openenv.yaml
├── requirements.txt
├── Dockerfile
└── server/
├── app.py
└── environment.pyLocal Setup (Docker)
Build image:
docker build -t data-quality-env .Run container (port 7860):
docker run -p 7860:7860 data-quality-envQuick checks:
curl http://localhost:7860/health
curl -X POST http://localhost:7860/reset -H "Content-Type: application/json" -d '{}'Open API docs in browser:
http://localhost:7860/docs
Baseline Inference Script
The required baseline script is at project root:
inference.py
Required environment variables:
API_BASE_URLMODEL_NAMEHF_TOKEN(orOPENAI_API_KEY)ENV_BASE_URL(defaults tohttp://localhost:7860)
Run baseline:
export HF_TOKEN=<your_token>
export MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
export API_BASE_URL=https://router.huggingface.co/v1
export ENV_BASE_URL=http://localhost:7860
python inference.pyThe script emits strict structured logs:
[START] task=<task> env=<benchmark> model=<model>[STEP] step=<n> action=<json> reward=<0.00> done=<true|false> error=<msg|null>[END] success=<true|false> steps=<n> score=<0-1> rewards=<r1,r2,...>
Reproducible Baseline Snapshot
Example baseline run (Qwen/Qwen2.5-72B-Instruct):
Hugging Face Spaces Deployment
- Push this repo to a Docker Space.
- Ensure Space secrets/variables are set (for inference use):
HF_TOKENMODEL_NAMEAPI_BASE_URLENV_BASE_URL(if needed)- Confirm health endpoint:
https://<space>.hf.space/health
Pre-Submission Checklist
- Space responds to
POST /resetwith HTTP 200. - Docker image builds from repo root.
inference.pyruns and logs START/STEP/END format.- Three tasks available with deterministic scoring strictly in
(0.0, 1.0). openenv.yamlmatches implementation.
