Skip to content

prem-prakash-portfolio/employee-milestone-anniversaries

Repository files navigation

It is common in our recognition programs for supervisors to need assistance planning for their direct reports' milestone anniversaries.
To assist the supervisors, you will write a program in the language of your choosing that outputs a list of upcoming anniversaries.

Your program should accept two arguments on the command line. The first argument must be a file name, which contains CSV data. The CSV data is formatted as:

employee_id,first_name,last_name,hire_date,supervisor_id

A sample file is attached of typical data.

The second argument is a "run date" that should be used for date calculations described below.

The program must process the file and write a JSON object to stdout for each employee (regardless if they have direct reports).
The data should show for each person what the next five milestone anniversaries will be (if any) out of their pool of direct reports.

For your program's purposes, a "direct report" of an employee is any other employee who refers directly to them through the supervisor_id field in the input file. A "milestone anniversary" occurs for an employee every 5 years after their hire_date. For example, someone hired on 9/17/2012 would have their first milestone anniversary on 9/17/2017 and their next two on 9/17/2022 and 9/17/2027.

The output data must be structured as the employee's id and then up to five milestone anniversaries in date order. Each milestone anniversary must specify the employee id of the direct report and the calculated upcoming anniversary date.

Example output block from a different data file, assuming a run date of Oct 1, 2015:

{
  "supervisor_id": "0028356",
  "upcoming_milestones": [
    {
      "employee_id": "0018325",
      "anniversary_date": "2015-10-03"
    },
    {
      "employee_id": "0038576",
      "anniversary_date": "2015-10-05"
    },
    {
      "employee_id": "0038679",
      "anniversary_date": "2015-10-05"
    },
    {
      "employee_id": "0029385",
      "anniversary_date": "2015-10-17"
    },
    {
      "employee_id": "0066839",
      "anniversary_date": "2015-10-22"
    }
  ]
}

This output block is conveying that supervisor 0028356 should be aware that the next five milestone anniversaries for their direct reports fall on 10/3, 10/5, 10/17, and 10/22.

Please spend no more than four hours on this assessment. Google, Stack Overflow, and other sources are acceptable for researching this problem. If you copy any code snippets, please attribute the source in a code comment.

When you are finished, please package any files needed to build and run your project in a zip file and return via email attachment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published