Week one Over

0 views
Skip to first unread message

Greg Jackson

unread,
Dec 7, 2015, 11:31:23 AM12/7/15
to thebedroom...@googlegroups.com
Alright Lads, 

I'm a whole week into playing around with API's... Some of the rust is falling off my programming but boy is it still terrible. Anywho, wrapped up the little scripts I was writing into something more useful today.

It takes in a UK postcode, converts it to a set of GPS coordinates via google, then looks up all the air quality monitors in the UK (filtered by those still active using the kings college API) and does a bit of maths to figure out the distance from the address to each unit. Then the closest unit is chosen and polled using a separate API call to see what sensors it has. These sensors are then polled individually using another call, a days info is pulled, averaged and displayed to give an idea of what the air quality is like near you right now. 

I'm happy with it, had never really done any JSON, API or array/list logic before so that took a lot of my time. I'm going to play with NTP tomorrow so the script always pulls the last 24 hours rather than a time period I listed. 

I also want to make a dict describing the yearly goal number for every pollutant measured in the UK. I know what the numbers mean but having something to compare them against would make them more relevant. 

Anywho its on the site here. Each of the functions (with some tweaks and error handling included) have been properly described during the week so I went light on explanation today. Also I had to go back to work, I pricked about with it for an hour. 

Let me know what you think! 
Greg

Vyk

unread,
Dec 7, 2015, 11:37:50 AM12/7/15
to thebedroom...@googlegroups.com

Brilliant!

Might join you for an api guest post the week after next. I signed up for an Urethcast api key. I'll do one  on that.

Greg Jackson

unread,
Dec 7, 2015, 11:44:52 AM12/7/15
to thebedroom...@googlegroups.com
Do it Vyk... Also Urethcast looks amazing... It has photos from the international space station. SPACE STATION. 

Vyk

unread,
Dec 7, 2015, 11:53:40 AM12/7/15
to thebedroom...@googlegroups.com

Maybe we'll do a joint one Greg where you assess the air quality on the space station. :-)

Greg Jackson

unread,
Dec 7, 2015, 12:02:31 PM12/7/15
to thebedroom...@googlegroups.com
There's an open data stream to see where the space station is in real time. I wonder what would happen if you reverse geocoded the GPS coordinates once a minute over a day... 

Greg Jackson

unread,
Dec 7, 2015, 12:04:21 PM12/7/15
to thebedroom...@googlegroups.com
Some dude already made a lamp that lights up when it's overhead. 

Greg Jackson

unread,
Dec 7, 2015, 12:06:33 PM12/7/15
to thebedroom...@googlegroups.com
Maybe I should make a lamp that's 20 foot tall and shoots fire 

John Maguire

unread,
Dec 7, 2015, 12:13:36 PM12/7/15
to thebedroom...@googlegroups.com

Awesome stuff Greg, maybe we could get it deployed on aws and get an live page of results going? I could probably help with the ui if you wanted to do that

Greg Jackson

unread,
Dec 7, 2015, 12:19:55 PM12/7/15
to thebedroom...@googlegroups.com
Heya John, That would be great! I've been wanting to learn how to do exactly that. They don't update super regularly (it's hourly averages with a day delay), would that make for a pretty graph? 

Another one I've written checked my commute to work on citymapper and that changes minute by minute, I ran that over 20 minutes (piped to a file) and it did change even over that small period if that would suit better? 

John Maguire

unread,
Dec 7, 2015, 12:23:23 PM12/7/15
to thebedroom...@googlegroups.com

Is there any facility to get a notification of some kind on update? Worst case it would just be a static page that would either require a refresh or a script that makes a request after a set timeout but either could work

Greg Jackson

unread,
Dec 8, 2015, 9:01:57 AM12/8/15
to thebedroom...@googlegroups.com
Unfortunately not... A static page would be great, I literally have no idea where to start with that. I can use scipy to do some graphing stuff but its all offline! 

I made some ISS (international space station) code this morning. (sidebar I had to wait 35 minutes for my train so I put it to good use) It checks where the space station is, who's on it and when it will next pass over a chosen location (and for how long). Could be some good graphing on that! 
Here's a sample output. 

Day8 Output.png
Implemented a reverse geocache function too, checks the GPS coordinates and give back an address, kind of cool to see that the ISS is over "Unnamed Road, 100000, Kazakhstan" right now. 

Greg Jackson

unread,
Dec 8, 2015, 9:02:43 AM12/8/15
to thebedroom...@googlegroups.com
Now its over Tyva Republits, Russia, 668212... Still only 6 people on board though. 

Conor O'Quigley

unread,
Dec 8, 2015, 9:13:54 AM12/8/15
to thebedroom...@googlegroups.com
Spoiler alert Greg!
--
Kind Regards

Conor

Vyk

unread,
Dec 8, 2015, 11:12:41 AM12/8/15
to thebedroom...@googlegroups.com
Ha!
Reply all
Reply to author
Forward
0 new messages