Skip to content

Bug: CSV export rows shift into wrong columns when basics is missing (46 vs 31 columns under one header) #430

Description

@rajarshidattapy

Description

transform_evaluation_response only adds the name, email, phone, location, summary and all *_url / *_username columns when resume_data.basics is truthy:

https://github.com/interviewstreet/hiring-agent/blob/70fd3ea/transform.py#L516

There is no else branch filling them with empty values. score.py then appends the row using that row's own keys as fieldnames, and only writes a header when the file is new:

https://github.com/interviewstreet/hiring-agent/blob/70fd3ea/score.py#L349-L360

So a resume whose basics section failed to parse (see also the Basics validation issue) produces a 31-column row, which is appended under a 46-column header. Every value after file_name shifts into the wrong column (e.g. total_work_experience lands under name), silently corrupting resume_evaluations_<role>.csv.

Steps to reproduce

r1 = JSONResume(basics={"name": "A", "profiles": []})
r2 = JSONResume(work=[{"name": "X"}])
k1 = list(transform_evaluation_response("a.pdf", r1, {}, ev, role).keys())
k2 = list(transform_evaluation_response("b.pdf", r2, {}, ev, role).keys())
print(len(k1), len(k2), k1[1], k2[1])
# 46 31 name total_work_experience

Related (same function)

location is formatted as f"{basics.location.city}, {basics.location.region}" (L521-L525), which writes the literal string "None, None" when only e.g. countryCode was extracted.

Expected

  • Every row has the same column set in the same order (fill missing values with ""), or DictWriter uses a fixed fieldnames list per role.
  • Location joins only non-empty parts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions