Every semester we spend far too much time manually entering team names, uploading them to s3 and inserting bios. This will be a script automating that whole process.
Milestone 1 : Parse CSV into teams
Begin first by making sure you can read the CSV file correctly.
Use the csv-parser library found here. I’ve already installed it into the Github repo.
As you can see on the spreadsheet, there is an overall headers: (DESK, POSITION, SIGNATURE, SLUG…) and teams: (MANAGEMENT, FEATURES, ….)
The DESK, POSITION, SIGNATURE, SLUG… fields should be specific to each member of The Gazelle
Each member should be nested within a TEAM object
This means you’ll need to:
Parse the ENTIRE csv into a list of objects
Begin looping through all objects. When you find an object which looks like a team header, you want to nest all object after it as team members until you find the next team header, and so on:
A good way to identify these team headers is by if the DESK field is populated and all other fields are blank.
Functions
function readCSV(csvFile: string): returns [{}]
Reads any CSV file at the given file path provided (csvFile). Returns the elements as a list of objects. Does not do any logic parsing for teams or team members.
function parseTeams(csvDump): returns [{}]
Reads a dump of CSV objects (from readCSV) and parses all objects into a nested object (See Example Parsed Object below).
function isTeamHeader(object): returns bool
Reads a team object and returns whether an object looks like a team header or not. See above explanation for identifying team headers.
Description
Every semester we spend far too much time manually entering team names, uploading them to s3 and inserting bios. This will be a script automating that whole process.
Milestone 1 : Parse CSV into teams
Begin first by making sure you can read the CSV file correctly.
Use the
csv-parser
library found here. I’ve already installed it into the Github repo.Here’s a quick example script I’ve written to ensure it will work:
**Milestone Requirements**
As you can see on the spreadsheet, there is an overall headers: (DESK, POSITION, SIGNATURE, SLUG…) and teams: (MANAGEMENT, FEATURES, ….)
Each member should be nested within a TEAM object
This means you’ll need to:
DESK
field is populated and all other fields are blank.Functions
function readCSV(csvFile: string): returns [{}]
Reads any CSV file at the given file path provided (
csvFile
). Returns the elements as a list of objects. Does not do any logic parsing for teams or team members.function parseTeams(csvDump): returns [{}]
Reads a dump of CSV objects (from
readCSV
) and parses all objects into a nested object (See Example Parsed Object below).function isTeamHeader(object): returns bool
Reads a team object and returns whether an object looks like a team header or not. See above explanation for identifying team headers.
****Example Parsed Object****