How to Customize the CSV Output Format in Hiring Agent Development Mode
Set DEVELOPMENT_MODE = True in config.py, then modify the transform_evaluation_response function in transform.py to add, remove, or reorder columns, or adjust the csv.DictWriter parameters in score.py to change delimiters and formatting.
When running the interviewstreet/hiring-agent repository in development mode, the system automatically exports resume evaluation results to a CSV file. Understanding how to customize the CSV output format allows you to tailor the data structure for specific reporting pipelines or downstream processing requirements. The export logic is centralized in two key files: transform.py constructs the row data while score.py handles the file I/O operations.
Understanding the CSV Generation Pipeline
The hiring agent generates CSV output through a coordinated workflow between the configuration, scoring, and transformation modules. When DEVELOPMENT_MODE is enabled in config.py (lines 5‑7), the score.py script automatically creates a file named resume_evaluations.csv in the project root.
The data flow follows three distinct stages:
- Evaluation Transformation: After parsing a resume,
score.pyinvokestransform_evaluation_response(lines 341‑345) to convert the evaluation data into a flat dictionary structure. - Dictionary Construction: The function in
transform.py(lines 511‑703) builds acsv_rowdictionary where each key represents a column header and each value represents the cell content. - File Persistence: The script checks for existing headers at lines 349‑363 in
score.py, then uses Python'scsv.DictWriterto append the row toresume_evaluations.csv, preserving key insertion order for the column layout.
Customization Strategies for CSV Output Format
You can modify the CSV structure through three primary mechanisms, depending on whether you need to change the data content, column arrangement, or file formatting.
Modify Columns in transform_evaluation_response
The transform_evaluation_response function in transform.py serves as the schema definition for your CSV output. To add new columns, insert additional key-value pairs into the csv_row dictionary. To remove unwanted data, delete the corresponding assignment statements.
For example, to add a timestamp column tracking when each resume was processed:
# Inside transform.py, within transform_evaluation_response
from datetime import datetime
csv_row["processed_at"] = datetime.utcnow().isoformat()
To remove the github_bio field (lines 664‑666), comment out or delete:
# csv_row["github_bio"] = github_data.get("bio", "")
Reorder Columns Using Dictionary Insertion Order
Python dictionaries maintain insertion order as of version 3.7+, which determines the left-to-right column sequence in the resulting CSV. To reorder columns, relocate the assignment statements within transform_evaluation_response so that critical fields appear earlier in the function execution.
For instance, to prioritize the total score before individual category breakdowns:
# Place these assignments before category-specific scores
csv_row["total_score"] = total_score
csv_row["total_max"] = total_max
# Then add individual category scores below
Adjust Delimiters and Formatting in score.py
The physical CSV formatting parameters are controlled by the csv.DictWriter instantiation in score.py (lines 349‑363). By default, the writer uses standard comma delimiters, but you can pass additional parameters to support alternative formats.
To change the delimiter to a semicolon for European locale compatibility:
# In score.py, modify the DictWriter initialization
with open(csv_path, "a", newline="", encoding="utf-8") as csvfile:
fieldnames = list(csv_row.keys())
writer = csv.DictWriter(
csvfile,
fieldnames=fieldnames,
delimiter=';',
quoting=csv.QUOTE_MINIMAL
)
Complete Customization Example
Here is a practical implementation combining multiple modifications. This example adds a custom processing ID, removes GitHub repository metadata, and uses tab-separated values:
# transform.py modifications inside transform_evaluation_response
import uuid
csv_row["processing_id"] = str(uuid.uuid4())
# Remove unwanted fields
# csv_row["github_repos"] = github_data.get("public_repos", 0)
# csv_row["github_bio"] = github_data.get("bio", "")
# score.py modifications for TSV output
writer = csv.DictWriter(
csvfile,
fieldnames=fieldnames,
delimiter='\t',
lineterminator='\n'
)
Summary
- Enable development mode by setting
DEVELOPMENT_MODE = Trueinconfig.pyto activate CSV export functionality. - Modify data schema by editing
transform_evaluation_responseintransform.py(lines 511‑703) to add, remove, or rename columns through dictionary key manipulation. - Control column order by rearranging key assignment statements within the dictionary construction, leveraging Python's insertion order preservation.
- Change file formatting by adjusting
csv.DictWriterparameters inscore.py(lines 349‑363) to modify delimiters, quote characters, or line terminators.
Frequently Asked Questions
Where is the CSV output file located when running in development mode?
When DEVELOPMENT_MODE is enabled, the score.py script creates a file named resume_evaluations.csv in the project root directory. The file opens in append mode ("a"), meaning new evaluations are added to existing data rather than overwriting the file.
Can I change the CSV filename or output directory?
The filename and path are hardcoded in score.py within the if DEVELOPMENT_MODE: block (lines 341‑363). To use a different location, modify the csv_path variable before the file opening operation, or replace the hardcoded string with an environment variable or configuration parameter.
Why are my new columns not appearing in the CSV header?
The CSV header row is written only when the file does not already exist (checked at lines 349‑363 in score.py). If you add new dictionary keys to transform_evaluation_response while resume_evaluations.csv already exists from a previous run, the new columns will have data but no corresponding headers. Delete the existing CSV file to regenerate the header with the updated schema.
Does the hiring agent support other export formats besides CSV?
According to the source code in interviewstreet/hiring-agent, the development mode export is implemented exclusively through the CSV writer in score.py. For JSON, Excel, or database exports, you would need to extend the if DEVELOPMENT_MODE: block to include additional serialization logic alongside the existing csv.DictWriter implementation.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →