Comments

You must log in or register to comment.

Limenoodle_ t1_ivxksli wrote

Is there a reason why it has to load every time? Instead of already having the numbers/emojies stored somewhere?

20

Barnocious t1_ivxl1l6 wrote

Numbers and countries most likely in a cloud mpp database. The load time is due to the api running a query. This is a really great example of embedded analytics!!

14

fearatomato t1_ivyrsd4 wrote

is it a great example because it's really slow?

8

nothxshadow t1_ivyzrcp wrote

this. People forgot how to make good websites. Nothing is slower than javascript shit that queries a database for every little thing.

7

fearatomato t1_ivzoupk wrote

yeah it's only about 1kb data total for every country combined there's no reason you should have multi second loading times every single time

3

hcrx OP t1_ivxl2wd wrote

Good question! This is done on a spreadsheet with a table with the energy breakdown by source per country. Then it builds the emoji table when the country changes.

Having one build emoji table per country would be way too heavy, that’s why.

4

ztbwl t1_iw20pgd wrote

You have 8 numbers (for each energy source) per country - let's say it's a 64 bit number. There is a total of 195 countries on earth.

That's a total weight of about 12.5 KB.

Didn't want to rant, interesting solution though, was fun to discover - but the load times could be better.

1

hcrx OP t1_iw2ae03 wrote

It’s true, it should be faster. The backend of this is a spreadsheet (so is the FE) so it’s a bunch of Vlookups together to create grid.

1

hcrx OP t1_ivxgitq wrote

Link with tool to check for any country

https://rows.com/Henrique/world-data/country-electricity-production-4xqtJEDPR7ppP2bKOjzjFh/live

Source data is from Our World in Data

Visualization tool: rows.com

14

z38ra_ t1_ivxlk0u wrote

Why there are only 90 emojis and not 100?

12

hcrx OP t1_ivxwqiw wrote

It was a bug, thanks for spotting! Just fixed it

8

Super_Hans69 t1_iw09t9r wrote

Really cool thanks for sharing! I'm assuming the breakdown is by energy source proportion of total energy output?

1

Wertoyou t1_ivy6idg wrote

I think it is supposed to say "Electricity production" instead of "Energy production". A lot of most countries energy "production" is done by internal combustion engines in cars.

10

hcrx OP t1_ivy81e3 wrote

You're right, it is electricity. The title is incorrect.

Energy would also count heating (not generated by electricity) and transportation, right.

3

tinwetari t1_ivxx15v wrote

Amazing! And such a great tool to get data automatically from any source!

2

Braddigan t1_ivz75ds wrote

Don't think that data looks right. Data shows Hong Kong at 99.71% generated from oil.

Wiki sources showing them at a much more balanced spread in 2020 with Natural gas (44.26%), Coal (28.63%), Imports (26.51%), Other (0.6%). Considering they also list power stations that use gas-fired, coal, and wind power stations the data may be incorrect.

2

hcrx OP t1_ivzn7mp wrote

I just confirmed and you’re right. I was pulling data from Our world in data be must be doing something wrong in some countries.

According to them, Hong Kong in 2019 is 65% coal and 35% gas.

Thanks for spotting this, I’ll update the underlaying dataset

3

gladyxxx t1_iw1pq6v wrote

Am I missing it or adding combined data of all of the countries could have been nice

1