# Build a Campus Directory Normalizer - Step 27

**URL:** <https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607>\
**Category:** freeCodeCamp Support\
**Tags:** javascript\
**Created:** [October 22, 2026, 2:25pm UTC](https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607 "2026-10-22T14:25:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Djuseppe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/djuseppe/32/419382_2.png) [@Djuseppe](https://forum.freecodecamp.org/u/Djuseppe)\
**Post date:** [October 22, 2026, 2:25pm UTC](https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607/1 "2026-10-22T14:25:10Z")

</div>

### Tell us what’s happening:

Code perfectly correct, validation not working prorperly.  
I removed the console.log line, added the function correctly returning null and still the validation isn’t working. Why?

### Your code so far

```js
const rawData = {
  "Computer Science": {
    Dept_code: "CSE",
    programs: [
      {
        id: "CSE101",
        name: "Database Management System",
        room: "405",
        instructors: [
          { id: "INS001", name: "Alejandro", email: "alejandro@example.com", officeHours: "Sun-Tue 10AM-12PM" },
          { id: "INS002", name: "Kenji", officeHours: null },
        ],
      },
      {
        id: "CSE102",
        name: "Data Structures",
        room: null,
        instructors: [
          { id: "INS003", name: "Fatima", email: "fatima@example.com", officeHours: "Mon-Wed 10AM-2PM" },
        ],
      },
      {
        id: "CSE103",
        name: "Operating Systems",
        room: "401",
        instructors: [
          { id: "INS005", name: "Wei", email: "wei@example.com", officeHours: "Thu 1PM-3PM" },
        ],
      },
    ],
  },
  "Business Administration": {
    Dept_code: "BBA",
    programs: [
      {
        id: "BBA101",
        name: "Financial Accounting",
        room: "201",
        instructors: [{ id: "INS004", name: "Sofia", email: "sofia@example.com" }],
      },
      {
        id: "BBA102",
        name: "Marketing Management",
        room: "204",
        instructors: [
          { id: "INS006", name: "Robin", email: "robin@example.com", officeHours: "Tue-Thu 9AM-11AM" },
        ],
      },
      {
        id: "BBA103",
        name: "Business Law",
        room: "203",
        instructors: [
          { id: "INS007", name: "Priya", email: "priya@example.com", officeHours: "Mon 2PM-4PM" },
        ],
      },
    ],
  },
};

function normalizeDirectory(rawData) {
  const departmentsById = {};
  const programsById = {};
  const instructorsById = {};
  const instructorsByEmail = {};

  const departmentEntries = Object.entries(rawData);

  for (let i = 0; i < departmentEntries.length; i++) {

    const [departmentName, departmentData] = departmentEntries[i];

    const departmentId = departmentData.Dept_code || `dept-${i + 1}`;

    departmentsById[departmentId] = {
      id: departmentId,
      code: departmentData.Dept_code,
      name: departmentName,
      programIds: [],
    };

    for (let j = 0; j < departmentData.programs.length; j++) {
      const program = departmentData.programs[j];

      programsById[program.id] = {
        ...program,
        departmentId,
      };

      departmentsById[departmentId].programIds.push(program.id);
      for (let k = 0; k < program.instructors.length; k++) {
        const instructor = program.instructors[k];

        instructorsById[instructor.id] = {
          ...instructor,
          programId: program.id,
          departmentId,
        };

        if (instructor.email) {
          instructorsByEmail[instructor.email] = instructor.id;
        }
      }
    }
  }

  return {
    departmentsById,
    programsById,
    instructorsById,
    instructorsByEmail,
  };
// User Editable Region
}

function getInstructorByEmail(email, normalizedData){
  return null;
}
// User Editable Region

```

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:158.0) Gecko/20100101 Firefox/158.0`

### Challenge Information:

Build a Campus Directory Normalizer - Step 27

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-v9/workshop-campus-directory-normalizer/step-27)**
>
> Learn to Code for Free

GitHub Link: [freeCodeCamp/curriculum/challenges/english/blocks/workshop-campus-directory-normalizer/6a788a34c6d1107189a0ba1a.md at main · freeCodeCamp/freeCodeCamp · GitHub](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/workshop-campus-directory-normalizer/6a788a34c6d1107189a0ba1a.md)

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [October 22, 2026, 2:30pm UTC](https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607/2 "2026-10-22T14:30:03Z")

</div>

Welcome to the forum @Djuseppe,

It looks like you may have changed the starting code in areas you were not asked to change, which will cause the tests to fail. Please click the reset button to restore the original code and try again.

![image](https://global.discourse-cdn.com/freecodecamp/optimized/4X/a/a/7/aa72a76c651bc9854d2f067de5f3a6fca20da9fb_2_690x46.png)

Happy coding

---

<div class="post-metadata">

**Author:** ![Djuseppe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/djuseppe/32/419382_2.png) [@Djuseppe](https://forum.freecodecamp.org/u/Djuseppe)\
**Post date:** [October 22, 2026, 2:31pm UTC](https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607/3 "2026-10-22T14:31:45Z")

</div>

Thanks a lot, your solution worked but i’m not very sure of what i changed

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [October 22, 2026, 2:33pm UTC](https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607/4 "2026-10-22T14:33:01Z")

</div>

The starting code included this, which you removed:

`const normalizedData = normalizeDirectory(rawData)`;

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [October 24, 2026, 2:33pm UTC](https://forum.freecodecamp.org/t/build-a-campus-directory-normalizer-step-27/802607/5 "2026-10-24T14:33:36Z")

</div>

Closed on October 24, 2026, 2:33pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
