For my capstone project, I am building a clone of a current website, and expanding it to have a shopping cart component. This week I received the data from the current site to incorporate it into our project.
I got a json file. It had 1,600ish objects in it.
Now, I realize that is not that much data, but it is significantly more than the five I was testing the site with.
The file was big, scary, and not compatible with my site in the initial state.
So I rolled up my sleeves and did some cleaning.
My first step was to figure out what key-values lined up with my project and what data was not relevant. Once I did this, I created a function that assigned the corresponding data to keys that matched up with my Schema and deleted the old data and what was not relevant to my project.
I had a new json file, but there were still some problems. I had to get the data into my database.
Thankfully this was not too challenging. Using mongoimport, I replaced my dummy data with my file and was off to the races. Or so I thought.
The data was rendering on my site, but I had a few more issues to address.
This little data type was scattered throughout my project; so, it was back to the drawing board.
I had null values for some item’s prices, recipient’s locations, item’s categories and a few other places.
The challenge for me, as a beginner in anything, is finding a solution, but also wondering if a better one exists. I found solutions to my problems this week. They might not be perfect, but I’m trying to change my perspective. Find a solution that works, and improve upon it later.
My first solution came with using “Anonymous.”
The site has a number of recipient names and/or locations that are listed as anonymous to respect and protect the privacy of recipients.
I decided to map over my data and replace any null name and location values with “Anonymous” to function as a visual placeholder for the missing data.
Null also created problems in my filter components. I had to adjust my backend to filter my item categories and state list to add everything but null to my array to remove an empty filter option on my front-end.
Finally, I used my friend null to reassign the values of the comments section of my json. The comments contain fulfillment information for the organization. For privacy reasons, this does not need to be on the front end. Since my front-end does not impact my comment value in any way, setting it to null for my response data was an acceptable option for me.
Cleaning up this file was a bit of an adventure and reminded me of times on trail when I had to figure out a solution from what I was given. They might not have been perfect, but they were my best considering the conditions.
…like that one time winter came early, and we were trying to finish the PCT.
Now, a cheap poncho and dish gloves are not a normal part of my thru-hiking gear, but when a snow storm comes to Oregon with only 300 miles left of a thru-hike you do what you have to do!
It wasn’t pretty, and yes, my toes did suffer, but we made it! And it felt amazing to start healing my toes on a black-sand beach in Hawaii as a PCT thru-hiker!
This program has pushed me since day one. I’m constantly learning new things, confronting my insecurities, and moving forward. I have two weeks left.
TWO WEEKS! That’s exciting and scary all at the same time.
But I have what I need to finish this program and start my job search. I might be wearing dollar store dish gloves to get to the end, but I’m going to touch that sign!