new charctic - blogs | sea · 2020. 1. 6. · specs: ~290 loc js: ~450 loc. let's roll this to...

32
CHARCTIC FROM HACKATHON TO PRODUCTION Kevin Beam

Upload: others

Post on 16-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

CHARCTICFROM HACKATHON TO PRODUCTION

Kevin Beam

Page 2: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

Supports research into Earth's cryosphereManages and distributes scientific dataCreates tools for data accessSupports data usersPerforms scientific researchPerforms public education and outreachDistributes more than 500 cryospheric data sets

Page 3: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

ABOUT MESoftware Developer at NSIDCJava (that Enterprisey-stuff)Ruby on RailsJavaScriptPythonkwbeam.com

Page 4: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

NSIDC HACKATHONTwo or three day hackathonsEvery three to four monthsWork on something experimental and maybe edgy

Page 5: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

WHAT TO BUILD...?

Page 6: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

A BIT ABOUT ARCTIC SEA ICEHuge public interestDeclining sea ice extentSea ice minimum set a new record in 2012

Page 7: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing
Page 8: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing
Page 9: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

ARCTIC SEA ICE NEWS AND ANALYSISUpdated daily with near-realtime sea ice extent dataBlog from NSIDC scientists and writers about Arctic sea iceconditionsHighest traffic on the nsidc.org site~180K visitors per month

ASINA

Page 11: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

CHARCTIC IS BORNPublic data?Yep: Allright, let's roll!

Sea Ice Index

Page 12: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

SO EASY...Ruby on Rails

Page 13: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

JUST A SECOND...How do we plot the time series?

Page 14: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

LOTS OF OPTIONS...ONE WINNER:

Rich dynamic behaviorGood online documentation and examplesCommercial ProductFree to educational and non-profit institutionsHighcharts.js FTW

HIGHCHARTS.JS

Page 15: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

CODE TO USE HIGHCHARTS IS DECIDEDLY NOTINTERESTING

chart = new Highcharts.Chart({ chart: { ... }, exporting: { ... }, tooltip: { ... }, credits: { ... }, legend: { ... }, title: {

Page 16: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

BASIC DESIGN

Page 17: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

RAILS MODELSDailyExtentClimatologyExtent

Page 18: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

INITIAL PAGE LOADCurrent and record year20 and 30-year climatologiesPass data back via custom data attributes on div

Page 19: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

AJAXGet extents for a specific yearSimply exposes the model via a RESTful endpoint

Page 20: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

A LITTLE RUBY class Api::DailyExtentsController < ApplicationController respond_to :json def index year = params[:year].to_i year = Date.today.year if year == 0 respond_with DailyExtent.year_smoothed(year) end end

Page 21: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

SOME NUMBERSRails models and controllers: ~150 LOCSpecs: ~290 LOCJS: ~450 LOC

Page 22: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

LET'S ROLL THIS TO PRODUCTION!IE: NOT SO FAST, MY FRIENDS

Decent amount of time spent on IE 7, 8, 9 testingDid you know IE's JS doesn't support Array.forEach ?Neither did weAnswer: -- functional JSunderscore.js

Page 23: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

EXAMPLE UNDERSCORE WINNINGNESS _.each(_.range(12), function (i) { ticks.push(moment(new Date(currentYear, i, 1))); });

Page 24: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

READY NOW?One IE bug stymied us for a day or twoThe JS appeared to get loaded before the page was readyThought it was IENope, jQuery 1.8.0 was borked. 1.8.x to the rescue.Lesson: Be suspicious of everything, not just IE. :)

Page 25: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing
Page 26: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

A LITTLE DEMO WOULD BE NICE...CHARCTIC

Page 27: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

SO, HOW'D IT GO?Enthusiastic public responseOne of the top destinations on nsidc.org~9K hits / month on the main page100K hits / month for all requests (JSON)Visits from more than 50 countries

Page 28: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing
Page 29: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

THIS WAS NICE

Page 30: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

COOL STUFF WE LEARNEDTry your own hackathon!Highcharts.js is *very* capableUse underscore.jsThe little stuff is time consumingCross-browser testing is crucial

Page 31: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

OUR TEAMKevin BeamMatt SavoieHannah WilcoxDonna ScottWalt MeierTeri HoyerJane BeitlerOthers!

Page 32: New CHARCTIC - Blogs | SEA · 2020. 1. 6. · Specs: ~290 LOC JS: ~450 LOC. LET'S ROLL THIS TO PRODUCTION! IE: NOT SO FAST, MY FRIENDS Decent amount of time spent on IE 7, 8, 9 testing

THANKSKEVIN