# How the Hiring Agent Generates the Final CSV Export

> Learn how the hiring agent generates the final CSV export by flattening and appending resume, GitHub, and evaluation data. Discover the process in score.py when DEVELOPMENT_MODE is enabled.

- Repository: [HackerRank/hiring-agent](https://github.com/interviewstreet/hiring-agent)
- Tags: internals
- Published: 2026-07-08

---

**The `interviewstreet/hiring-agent` repository creates the final CSV export by flattening resume, GitHub, and evaluation data into a dictionary via `transform_evaluation_response`, then appending that row to `resume_evaluations.csv` inside [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) when `DEVELOPMENT_MODE` is enabled.**

The hiring agent automates technical candidate screening by consolidating multi-source data into a structured format. When running in development mode, the system aggregates parsed resume content, fetched GitHub repository statistics, and AI-generated evaluation scores into a single CSV file. Understanding the final CSV export generation process enables developers to debug evaluation pipelines and build custom analytics workflows.

## Data Aggregation with transform_evaluation_response

The `transform_evaluation_response` function in [`transform.py`](https://github.com/interviewstreet/hiring-agent/blob/main/transform.py) (lines 497-741) serves as the primary data transformation layer. This function receives three distinct input sources and returns a flat dictionary where each key represents a CSV column header.

### The Three Data Sources

The function consolidates the following inputs:

- **`resume_data`** – The parsed JSON representation of the candidate's PDF resume
- **`github_data`** – Fetched profile information and repository statistics from the GitHub API  
- **`evaluation`** – The structured scoring object containing assessments like `open_source_score` and `total_work_experience`

The resulting dictionary maps field names such as `file_name`, `name`, `github_repos`, and `open_source_score` to their corresponding values, creating a CSV-ready row structure.

## CSV Writing Logic in score.py

The actual file I/O operations occur in [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) (lines 41-63). After completing a resume evaluation, the system checks the `DEVELOPMENT_MODE` configuration flag before writing data.

```python
csv_row = transform_evaluation_response(
    file_name=os.path.basename(pdf_path),
    evaluation=score,
    resume_data=resume_data,
    github_data=github_data,
)
csv_path = "resume_evaluations.csv"
file_exists = os.path.exists(csv_path)

with open(csv_path, "a", newline="", encoding="utf-8") as csvfile:
    fieldnames = list(csv_row.keys())
    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

    # Write the header only once

    if not file_exists:
        writer.writeheader()

    # Append the current resume's data

    writer.writerow(csv_row)

```

This implementation uses Python's `csv.DictWriter` to handle column ordering automatically. The code detects whether `resume_evaluations.csv` exists to avoid writing duplicate headers, then appends the current evaluation as a new row using the dictionary keys as column names.

## Triggering the Export Process

The CSV generation activates automatically when the `main` function in [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) processes a resume while `DEVELOPMENT_MODE` is set to `True`. To enable the export functionality:

```bash

# Enable development mode via environment variable

export DEVELOPMENT_MODE=1

# Evaluate a resume and generate the CSV row

python score.py path/to/resume.pdf

```

Executing this command creates `resume_evaluations.csv` in the repository root if it does not exist, or appends the new evaluation data to the existing file. Each row represents one processed resume with consolidated data from all three sources.

## Summary

- **`transform_evaluation_response`** in [`transform.py`](https://github.com/interviewstreet/hiring-agent/blob/main/transform.py) (lines 497-741) flattens resume, GitHub, and evaluation data into a dictionary with CSV column names as keys
- **[`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py)** (lines 41-63) handles the actual file writing using `csv.DictWriter` with append mode and conditional header writing
- The export only occurs when **`DEVELOPMENT_MODE`** is enabled, preventing accidental data accumulation in production environments
- The output file **`resume_evaluations.csv`** contains one row per evaluated candidate with fields spanning technical skills, work experience, and open-source contributions

## Frequently Asked Questions

### What file contains the CSV generation logic?

The CSV writing logic resides in **[`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py)** at lines 41-63, which calls `transform_evaluation_response` from [`transform.py`](https://github.com/interviewstreet/hiring-agent/blob/main/transform.py) to prepare the data structure before appending it to `resume_evaluations.csv`.

### Why is DEVELOPMENT_MODE required for CSV export?

The development mode flag prevents automatic file generation in production environments. According to the source code in [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py), the CSV writing block only executes when `DEVELOPMENT_MODE` is `True`, ensuring that batch processing or automated pipelines do not create unwanted file artifacts.

### Which data fields are included in the final CSV export?

The export includes fields generated by `transform_evaluation_response` such as `file_name`, `name`, `total_work_experience`, `github_repos`, and `open_source_score`, along with other parsed resume and GitHub profile metrics that the evaluation agent extracts from candidate submissions.

### How do I customize the CSV output columns?

To modify the CSV structure, edit the `transform_evaluation_response` function in **[`transform.py`](https://github.com/interviewstreet/hiring-agent/blob/main/transform.py)** (lines 497-741) to add, remove, or rename keys in the returned dictionary. The `csv.DictWriter` in [`score.py`](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) automatically adapts to the dictionary keys, so any changes to the transformation function directly affect the resulting column headers.