ICM, Wk 7: Data
So, I’ve been eager to play with data. But I’ll be honest, I didn’t imagine the magnitude to how difficult it is to find/work with certain sets of data.
I guess this got me thinking about the nature of “Big Data” and how we understand this information as massive quantities, yet at the same time just see this information as existing in some kind of nethersphere out there on the internet.
I’d read something in The New Inquiry that made mention of how we forget that data centers are actually these physical entities, dealing with “real world” issues like electricity, water, borders, politics, etc. I thought it was funny that we think about our data stored in these “clouds”, but never associate that same data with a physical reality, in a building in Goose Creek, South Carolina. It also prevents us from thinking about the cost of these facilities, particularly in terms of the amount of natural resources they use to power and keep them cool (More on that, here and here). Just recently found out that the NSA was Baltimore Gas and Electric’s biggest customer. (Having paid my own share of BGE bills, can’t imagine what theirs looked like…)
I found a list of the number of data centers in each country (link) and decided to try and make a JSON out of it.
A person could enter a country and then the number of servers would pop up, and (eventually) a cloud representing each data server.
I figured I’d look at the bird one and use that.
I switched the category names to suit my data set, which was easy enough. The trouble was that I wasn’t sure how to assign the number of data centers/servers to each country within the json syntax. After looking at a few examples I asked for help and found out I was doing my object notation wrong. So re-wrote that. (I don’t think this paragraph does justice to the amount of time it took writing/formatting the json file sooo….I’ll just leave that there.)
Once everything looked good it FINALLY loaded and I got
the letter i.
a single i.
It was supposed to be Angola.
So I played around with the code that called the json in my sketch, tried it a different way and got undefined. So at least the data is there.
I looked at some code examples in Getting Started With p5.js but at first wasn’t sure how to modify it in the correct way. Tried a couple different things to suit my json, realized I needed to add an extra array…and YEAH! I GOT IT TO SAY MOROCCO!
But what I reaaaaally want is for it to give me the number of data centers. I guess. ugh. small victories. bigger struggles.
This was another struggle.
Thought maybe I needed an extra array, so that it would read var server = members.country; but it didn’t like that either….Then I substituted it for a specific country name and THAT worked. Still not sure how to isolate just the number 4 though and (still) not sure if that’s going to affect how the rest of sketch works.
At this point, I’d been just printing this information to the consol so I opened it up in the sketch – but WEIRDLY when I tried to get that data in my sketch, I just got [object object].
At this point I decided to take a break from the data stuff and move on to getting some of the other elements of the sketch. Thanks to Ruta, I got my button in my sketch. But it doesn’t search anything…my getServer code didn’t seem to like me. I added variables but…it didn’t seem to like it.
I also was able to make a sketch that mocks up what the screen would look like if it got the right data. Basically one cloud would be drawn for every server in that country.
But yeah, calling the json to make it do that is still not working. So here’s the code I’ve left off with:
One thing I want to play with is creating separate query versus display functions, because right now I think both of those are happening in the same place and I’m not sure if that’s messing things up.
I’ve also realized I’m just generally confused about how to call json files. I’ve tried looking at a couple of examples an modifying them to suit this sketch, but just not getting anything to happen with button. Perhaps it’s my DOM code as well? Or the way I’ve organized my json? I was really confused as to if I should make my “servers” an array (I tried it with some of them).
Oh yeah, here’s the json I made (in the sketch I was playing with, I tried turning just the African countries into arrays for the purpose of testing, doesn’t show in this):