SlideShare a Scribd company logo
1 of 25
Download to read offline
CRUSHING DATA IN
JAVASCRIPT
MODERN DEVS CHARLOTTE
BRIAN GREIG
DIGITAL CONSULTATION / JAVASCRIPT ENGINEER
- TWITTER @IGNOREINTUITION
- GITHUB /IGNOREINTUITION
CRUSHING DATA IN JAVASCRIPT
FULL DISCLAIMER
▸ Summarizing data in the front end is not advised
▸ Boil your data down on the backend
▸ Serve up a single, minimized dataset
▸ Use the techniques described to produce analytics
CRUSHING DATA IN JAVASCRIPT
PRINCIPLES OF DATA MANAGEMENT
▸ Summarize (reduce)
▸ Subset (filter)
▸ Transform (map)
CRUSHING DATA IN JAVASCRIPT
DATA MANAGEMENT TERMINOLOGY
▸ Dimensions
▸ Metrics
▸ Hierarchies
▸ Detailed Dimensions
CRUSHING DATA IN JAVASCRIPT
DATA MANAGEMENT TERMINOLOGY
▸ Dimensions
▸ Metrics
▸ Hierarchies
▸ Detailed Dimensions
CRUSHING DATA IN JAVASCRIPT
DATA MANAGEMENT TERMINOLOGY
▸ Dimensions
▸ Metrics
▸ Hierarchies
▸ Detailed Dimensions
CRUSHING DATA IN JAVASCRIPT
VISUALIZING DATA
Quality Comparisons (Show comparisons, contrasts, differences)
Causality (Show causality, mechanism, explanation, systematic structure)
Multivariate Analysis (Show more than 1 or 2 variables)
Integration of Evidence (Completely integrate words, numbers, images, and diagrams)
Documentation (Thoroughly describe the evidence. Provide a detailed title, indicate the authors
and sponsors, document the data sources, show complete measurement scales, point out
relevant issues.)
Content Counts Most of All (Analytical presentations ultimately stand or fall depending on the
quality, relevance, and integrity of their content)
- Edward Tufte
CRUSHING DATA IN JAVASCRIPT
VISUALIZING DATA
https://d3js.org/
http://shop.oreilly.com/product/0636920026938.do
CRUSHING DATA IN JAVASCRIPT
DATA IN JAVASCRIPT
CRUSHING DATA IN JAVASCRIPT
WHAT WE ARE LOOKING AT
▸ Immutable functions
▸ Basic functions of the Array Prototype
▸ Well supported
CRUSHING DATA IN JAVASCRIPT
FILTER
▸ var newArray = arr.filter(callback[, thisArg])
▸ callback: Function is a predicate, to test each element of
the array. Takes three arguments: element, index, array
▸ array: array filter was called upon
CRUSHING DATA IN JAVASCRIPT
FILTER
var currObj = data.filter(function(a) {

return a.headline === arr[j];

}, []);
CRUSHING DATA IN JAVASCRIPT
REDUCE
‣ arr.reduce(callback, [initialValue])
‣ callbackFunction to execute on each value in the array,
taking four arguments: accumulator, currentValue,
currentIndex, array
‣ array: The array reduce was called upon.
‣ initialValue: Optional. Value to use as the first argument to
the first call of the callback.
CRUSHING DATA IN JAVASCRIPT
REDUCE
var sum = [0, 1, 2, 3].reduce(function (a, b) {

return a + b;

}, 0);
// sum is 6
CRUSHING DATA IN JAVASCRIPT
REDUCE
‣ Works for a single measure, dimension
‣ We want our dataset to have
‣ Several measures, Multi-dimensional
CRUSHING DATA IN JAVASCRIPT
REDUCE
data.reduce(function(a, b){

a.count++;

if (b.age > 50) { a.over50 += b.males; }

if (b.age <= 50) { a.under50 += b.males; }

return a;

}, {"count": 0,"under50": 0,"over50": 0})


CRUSHING DATA IN JAVASCRIPT
REDUCE
CRUSHING DATA IN JAVASCRIPT
MAP
‣ var new_array = arr.map(callback[, thisArg])
‣ callback: Function that produces an element of the new
Array, taking three arguments: currentValue, index, array,
thisArg
CRUSHING DATA IN JAVASCRIPT
MAP
data.map(function(a){

if (a.age > 50){

return {"age": "over50", "males": a.males}

} else {

return {"age": "under50", "males": a.males}

};});
CRUSHING DATA IN JAVASCRIPT
MAP
CRUSHING DATA IN JAVASCRIPT
USING D3
▸ D3 offers grouping / rollup capabilities
▸ d3.nest
▸ key
▸ rollup
▸ sum, average, mean, etc
CRUSHING DATA IN JAVASCRIPT
USING D3
d3.nest()

.key(function(d){return d.age})

.rollup(function(v){return d3.sum(v, function(d) {return
d.males;})})

.entries(data2);
CRUSHING DATA IN JAVASCRIPT
MORE
https://medium.com/@IgnoreIntuition/crushing-data-in-javascript-9d728b94c051#.xzef0qutd
https://github.com/ignoreintuition/Crushing-Data
CRUSHING DATA IN JAVASCRIPT
QUESTIONS?

More Related Content

Viewers also liked

Actividad 6 de adonis alberto mendoza conde
Actividad 6 de adonis alberto mendoza condeActividad 6 de adonis alberto mendoza conde
Actividad 6 de adonis alberto mendoza condeAdonis Mendoza
 
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...Gen Furukawa
 
Taklimat dan Arahan Tugasan Individu
Taklimat dan Arahan Tugasan IndividuTaklimat dan Arahan Tugasan Individu
Taklimat dan Arahan Tugasan IndividuZulkifli Mohd
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 
Actividad13 adonis albrto mendoza conde
Actividad13 adonis albrto mendoza condeActividad13 adonis albrto mendoza conde
Actividad13 adonis albrto mendoza condeAdonis Mendoza
 
3Com 299AT ACTIVE HUB
3Com 299AT ACTIVE HUB3Com 299AT ACTIVE HUB
3Com 299AT ACTIVE HUBsavomir
 
L210 manual del usuario español
L210 manual del usuario   españolL210 manual del usuario   español
L210 manual del usuario españolaegis
 
Proceso documentar y controlar entregable (correccion final)
Proceso documentar y controlar entregable (correccion final)Proceso documentar y controlar entregable (correccion final)
Proceso documentar y controlar entregable (correccion final)Nicolas Mesa Hernandez
 
Guia para-la-formulacion-del-plan-de-monitoreo[1]
Guia para-la-formulacion-del-plan-de-monitoreo[1]Guia para-la-formulacion-del-plan-de-monitoreo[1]
Guia para-la-formulacion-del-plan-de-monitoreo[1]julio261272
 
Trabajo de slideshare 1
Trabajo de slideshare 1Trabajo de slideshare 1
Trabajo de slideshare 1majo marlin
 
El Impacto de mi Liderazgo
El Impacto de mi LiderazgoEl Impacto de mi Liderazgo
El Impacto de mi LiderazgoDavid Alocen
 
3Com 3C13634A
3Com 3C13634A3Com 3C13634A
3Com 3C13634Asavomir
 

Viewers also liked (17)

Tecnologias (1)
Tecnologias (1)Tecnologias (1)
Tecnologias (1)
 
Actividad 6 de adonis alberto mendoza conde
Actividad 6 de adonis alberto mendoza condeActividad 6 de adonis alberto mendoza conde
Actividad 6 de adonis alberto mendoza conde
 
POLITICA006
POLITICA006POLITICA006
POLITICA006
 
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
Jungle Scout's Million Dollar Case Study: Intellectual Property and Protectin...
 
Taklimat dan Arahan Tugasan Individu
Taklimat dan Arahan Tugasan IndividuTaklimat dan Arahan Tugasan Individu
Taklimat dan Arahan Tugasan Individu
 
Generalidades sobre articulações
Generalidades sobre articulaçõesGeneralidades sobre articulações
Generalidades sobre articulações
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 
Actividad13 adonis albrto mendoza conde
Actividad13 adonis albrto mendoza condeActividad13 adonis albrto mendoza conde
Actividad13 adonis albrto mendoza conde
 
3Com 299AT ACTIVE HUB
3Com 299AT ACTIVE HUB3Com 299AT ACTIVE HUB
3Com 299AT ACTIVE HUB
 
Herramientas de word
Herramientas de wordHerramientas de word
Herramientas de word
 
L210 manual del usuario español
L210 manual del usuario   españolL210 manual del usuario   español
L210 manual del usuario español
 
Proceso documentar y controlar entregable (correccion final)
Proceso documentar y controlar entregable (correccion final)Proceso documentar y controlar entregable (correccion final)
Proceso documentar y controlar entregable (correccion final)
 
Guia para-la-formulacion-del-plan-de-monitoreo[1]
Guia para-la-formulacion-del-plan-de-monitoreo[1]Guia para-la-formulacion-del-plan-de-monitoreo[1]
Guia para-la-formulacion-del-plan-de-monitoreo[1]
 
Trabajo de slideshare 1
Trabajo de slideshare 1Trabajo de slideshare 1
Trabajo de slideshare 1
 
El Impacto de mi Liderazgo
El Impacto de mi LiderazgoEl Impacto de mi Liderazgo
El Impacto de mi Liderazgo
 
Views of the HS-BCP Credential
Views of the HS-BCP CredentialViews of the HS-BCP Credential
Views of the HS-BCP Credential
 
3Com 3C13634A
3Com 3C13634A3Com 3C13634A
3Com 3C13634A
 

Similar to Crushing Data with JavaScript

PerlApp2Postgresql (2)
PerlApp2Postgresql (2)PerlApp2Postgresql (2)
PerlApp2Postgresql (2)Jerome Eteve
 
Reactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz KhambatiReactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz KhambatiAziz Khambati
 
Data mining with caret package
Data mining with caret packageData mining with caret package
Data mining with caret packageVivian S. Zhang
 
Javascript & SQL within database management system
Javascript & SQL within database management systemJavascript & SQL within database management system
Javascript & SQL within database management systemClusterpoint
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres MonitoringDenish Patel
 
Scaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLScaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLJim Mlodgenski
 
R Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RR Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RRsquared Academy
 
Honey I Shrunk the Database
Honey I Shrunk the DatabaseHoney I Shrunk the Database
Honey I Shrunk the DatabaseVanessa Hurst
 
INTRODUCTION TO DATA STRUCTURE - CS SIMPLE
INTRODUCTION TO DATA STRUCTURE - CS SIMPLEINTRODUCTION TO DATA STRUCTURE - CS SIMPLE
INTRODUCTION TO DATA STRUCTURE - CS SIMPLECS Simple education
 
No More Promises! Let's RxJS!
No More Promises! Let's RxJS!No More Promises! Let's RxJS!
No More Promises! Let's RxJS!Ilia Idakiev
 
Advanced SQL For Data Scientists
Advanced SQL For Data ScientistsAdvanced SQL For Data Scientists
Advanced SQL For Data ScientistsDatabricks
 
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Yao Yao
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay ModernBrad Pillow
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay ModernBrad Pillow
 
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...Ben Teese
 
Oracle Rac Performance Tunning Tips&Tricks
Oracle Rac Performance Tunning Tips&TricksOracle Rac Performance Tunning Tips&Tricks
Oracle Rac Performance Tunning Tips&TricksZekeriya Besiroglu
 
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016DataStax
 

Similar to Crushing Data with JavaScript (20)

PerlApp2Postgresql (2)
PerlApp2Postgresql (2)PerlApp2Postgresql (2)
PerlApp2Postgresql (2)
 
Reactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz KhambatiReactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz Khambati
 
Data mining with caret package
Data mining with caret packageData mining with caret package
Data mining with caret package
 
Javascript & SQL within database management system
Javascript & SQL within database management systemJavascript & SQL within database management system
Javascript & SQL within database management system
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
 
R console
R consoleR console
R console
 
Scaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLScaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQL
 
R Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RR Programming: Mathematical Functions In R
R Programming: Mathematical Functions In R
 
Honey I Shrunk the Database
Honey I Shrunk the DatabaseHoney I Shrunk the Database
Honey I Shrunk the Database
 
INTRODUCTION TO DATA STRUCTURE - CS SIMPLE
INTRODUCTION TO DATA STRUCTURE - CS SIMPLEINTRODUCTION TO DATA STRUCTURE - CS SIMPLE
INTRODUCTION TO DATA STRUCTURE - CS SIMPLE
 
No More Promises! Let's RxJS!
No More Promises! Let's RxJS!No More Promises! Let's RxJS!
No More Promises! Let's RxJS!
 
Advanced SQL For Data Scientists
Advanced SQL For Data ScientistsAdvanced SQL For Data Scientists
Advanced SQL For Data Scientists
 
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
 
Xgboost
XgboostXgboost
Xgboost
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay Modern
 
GraphQL and Relay Modern
GraphQL and Relay ModernGraphQL and Relay Modern
GraphQL and Relay Modern
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay Modern
 
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
 
Oracle Rac Performance Tunning Tips&Tricks
Oracle Rac Performance Tunning Tips&TricksOracle Rac Performance Tunning Tips&Tricks
Oracle Rac Performance Tunning Tips&Tricks
 
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
 

Recently uploaded

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Crushing Data with JavaScript

  • 2. BRIAN GREIG DIGITAL CONSULTATION / JAVASCRIPT ENGINEER - TWITTER @IGNOREINTUITION - GITHUB /IGNOREINTUITION
  • 3. CRUSHING DATA IN JAVASCRIPT FULL DISCLAIMER ▸ Summarizing data in the front end is not advised ▸ Boil your data down on the backend ▸ Serve up a single, minimized dataset ▸ Use the techniques described to produce analytics
  • 4. CRUSHING DATA IN JAVASCRIPT PRINCIPLES OF DATA MANAGEMENT ▸ Summarize (reduce) ▸ Subset (filter) ▸ Transform (map)
  • 5. CRUSHING DATA IN JAVASCRIPT DATA MANAGEMENT TERMINOLOGY ▸ Dimensions ▸ Metrics ▸ Hierarchies ▸ Detailed Dimensions
  • 6. CRUSHING DATA IN JAVASCRIPT DATA MANAGEMENT TERMINOLOGY ▸ Dimensions ▸ Metrics ▸ Hierarchies ▸ Detailed Dimensions
  • 7. CRUSHING DATA IN JAVASCRIPT DATA MANAGEMENT TERMINOLOGY ▸ Dimensions ▸ Metrics ▸ Hierarchies ▸ Detailed Dimensions
  • 8. CRUSHING DATA IN JAVASCRIPT VISUALIZING DATA Quality Comparisons (Show comparisons, contrasts, differences) Causality (Show causality, mechanism, explanation, systematic structure) Multivariate Analysis (Show more than 1 or 2 variables) Integration of Evidence (Completely integrate words, numbers, images, and diagrams) Documentation (Thoroughly describe the evidence. Provide a detailed title, indicate the authors and sponsors, document the data sources, show complete measurement scales, point out relevant issues.) Content Counts Most of All (Analytical presentations ultimately stand or fall depending on the quality, relevance, and integrity of their content) - Edward Tufte
  • 9. CRUSHING DATA IN JAVASCRIPT VISUALIZING DATA https://d3js.org/ http://shop.oreilly.com/product/0636920026938.do
  • 10. CRUSHING DATA IN JAVASCRIPT DATA IN JAVASCRIPT
  • 11. CRUSHING DATA IN JAVASCRIPT WHAT WE ARE LOOKING AT ▸ Immutable functions ▸ Basic functions of the Array Prototype ▸ Well supported
  • 12. CRUSHING DATA IN JAVASCRIPT FILTER ▸ var newArray = arr.filter(callback[, thisArg]) ▸ callback: Function is a predicate, to test each element of the array. Takes three arguments: element, index, array ▸ array: array filter was called upon
  • 13. CRUSHING DATA IN JAVASCRIPT FILTER var currObj = data.filter(function(a) {
 return a.headline === arr[j];
 }, []);
  • 14. CRUSHING DATA IN JAVASCRIPT REDUCE ‣ arr.reduce(callback, [initialValue]) ‣ callbackFunction to execute on each value in the array, taking four arguments: accumulator, currentValue, currentIndex, array ‣ array: The array reduce was called upon. ‣ initialValue: Optional. Value to use as the first argument to the first call of the callback.
  • 15. CRUSHING DATA IN JAVASCRIPT REDUCE var sum = [0, 1, 2, 3].reduce(function (a, b) {
 return a + b;
 }, 0); // sum is 6
  • 16. CRUSHING DATA IN JAVASCRIPT REDUCE ‣ Works for a single measure, dimension ‣ We want our dataset to have ‣ Several measures, Multi-dimensional
  • 17. CRUSHING DATA IN JAVASCRIPT REDUCE data.reduce(function(a, b){
 a.count++;
 if (b.age > 50) { a.over50 += b.males; }
 if (b.age <= 50) { a.under50 += b.males; }
 return a;
 }, {"count": 0,"under50": 0,"over50": 0}) 

  • 18. CRUSHING DATA IN JAVASCRIPT REDUCE
  • 19. CRUSHING DATA IN JAVASCRIPT MAP ‣ var new_array = arr.map(callback[, thisArg]) ‣ callback: Function that produces an element of the new Array, taking three arguments: currentValue, index, array, thisArg
  • 20. CRUSHING DATA IN JAVASCRIPT MAP data.map(function(a){
 if (a.age > 50){
 return {"age": "over50", "males": a.males}
 } else {
 return {"age": "under50", "males": a.males}
 };});
  • 21. CRUSHING DATA IN JAVASCRIPT MAP
  • 22. CRUSHING DATA IN JAVASCRIPT USING D3 ▸ D3 offers grouping / rollup capabilities ▸ d3.nest ▸ key ▸ rollup ▸ sum, average, mean, etc
  • 23. CRUSHING DATA IN JAVASCRIPT USING D3 d3.nest()
 .key(function(d){return d.age})
 .rollup(function(v){return d3.sum(v, function(d) {return d.males;})})
 .entries(data2);
  • 24. CRUSHING DATA IN JAVASCRIPT MORE https://medium.com/@IgnoreIntuition/crushing-data-in-javascript-9d728b94c051#.xzef0qutd https://github.com/ignoreintuition/Crushing-Data
  • 25. CRUSHING DATA IN JAVASCRIPT QUESTIONS?