You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
💡 A CSV (comma separated values) file is a text-format for storing spreadsheet-like data. Open up the file above and compare it to the Google Spreadsheet I shared with you both. It should be identical.
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.
Example Parsed Object
[{team: "management",members: [{DESK: 'Githmi Rabel',POSITION: 'Editor-in-Chief','NYU EMAIL': '...',SIGNATURE: '*Githmi Rabel is Editor-in-Chief. Email her at [email protected]*','': '',Slug: 'githmi-rabel'},
....]},{team: "web",members: [{DESK: 'Githmi Rabel',POSITION: 'Editor-in-Chief','NYU EMAIL': '...',SIGNATURE: '*Githmi Rabel is Editor-in-Chief. Email her at [email protected]*','': '',Slug: 'githmi-rabel'},
....]},
....]
The text was updated successfully, but these errors were encountered:
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.
💡 A CSV (comma separated values) file is a text-format for storing spreadsheet-like data. Open up the file above and compare it to the Google Spreadsheet I shared with you both. It should be identical.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
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
The text was updated successfully, but these errors were encountered: