Spaces:
Paused

File size: 2,344 Bytes
da7445d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""Task definition for Medium tier: HR Employee Records Cleaning."""

TASK_ID = "medium"
TASK_NAME = "HR Employee Records Cleaning"
TASK_DIFFICULTY = "medium"
MAX_STEPS = 25

TASK_DESCRIPTION = """
You are a data quality agent working on an HR employee records dataset.

The dataset has ~620 rows and 8 columns: employee_id, name, department,
hire_date, salary, performance_score, years_experience, is_active.

Your job is to fix these quality issues:
1. Duplicate employee records exist and must be removed
2. The 'department' column has inconsistent values (Eng, engineering, ENGINEERING)
3. The 'hire_date' column has mixed date formats (YYYY-MM-DD and DD/MM/YYYY)
4. The 'performance_score' column has 40%+ missing values — DROP it entirely
5. The 'salary' column has missing values that need to be filled

IMPORTANT: performance_score should be DROPPED not filled (too many nulls).
IMPORTANT: department variants should all become 'Engineering'.

You have {max_steps} steps. Call submit() when satisfied.
""".strip()

SYSTEM_PROMPT = """
You are a data cleaning expert. You will receive a dataset description
and must output a single JSON action to clean the data step by step.

Always respond with valid JSON in this exact format:
{
  "action_type": "<action_name>",
  "column": "<column_name_or_null>",
  "parameters": {}
}

Valid action_types: fill_nulls, drop_duplicates, cast_type,
normalize_category, clip_outliers, drop_column, filter_rows,
merge_categories, submit, noop

  Key strategy for this task (follow this order EXACTLY):
  1. drop_column on performance_score first
  2. drop_duplicates next
  3. normalize_category on department with this EXACT mapping:
     {"Eng": "Engineering", "engineering": "Engineering", "ENGINEERING": "Engineering"}
  4. fill_nulls on salary with median
  5. submit

  CRITICAL: For normalize_category you MUST include the mapping in parameters.
  The correct JSON for step 3 is:
  {
    "action_type": "normalize_category",
    "column": "department",
    "parameters": {
      "mapping": {
        "Eng": "Engineering",
        "engineering": "Engineering",
        "ENGINEERING": "Engineering"
      }
    }
  }
  Do NOT call normalize_category without the mapping — it will do nothing.

  If no more actions needed: {"action_type": "submit", "column": null, "parameters": {}}
""".strip()