This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## For Session Hours Per Day Per Profile | |
### For profiles on 56 | |
with a as ( | |
select client_id, submission_date_s3, sum(subsession_length)/3600 as hours | |
from main_summary | |
where app_name='Firefox' | |
and substring(app_version,1,2)='56' | |
and submission_date_s3 >= '2017-09-25' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## For Session Hours Per Day Per Profile | |
### For profiles on 56 | |
with a as ( | |
select client_id, submission_date_s3, sum(subsession_length)/3600 as hours | |
from main_summary | |
where app_name='Firefox' | |
and substring(app_version,1,2)='56' | |
and submission_date_s3 >= '2017-09-25' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r eval=FALSE} | |
getADIAllAndV <- function(sdate,edate, version,col1) | |
{ | |
ff <- data.table(d$q(i <- sprintf( | |
"select | |
bl_date as date, | |
sum(tot_requests_on_date) as %s | |
from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Data Extraction | |
#### Python Extraction Code | |
To keep it analysis for existing users comparable to the new profile analysis, | |
if a profile | |
- updated to Firefox Beta 56 between August 8th, 2017 and 14 days thereafter, | |
- they were on some version before 56 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "R Notebook" | |
output: | |
html_document: | |
highlight: pygments | |
--- | |
```{r} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{python} | |
from pyspark.sql import SparkSession | |
import subprocess | |
import json | |
import datetime | |
import pandas as pd | |
spark = SparkSession.builder.getOrCreate() | |
sys.path.append("/home/hadoop/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
## Get the JSON file of releases | |
library(rjson) | |
library(data.table) | |
library(infuser) | |
download.file('https://product-details.mozilla.org/1.0/firefox_history_major_releases.json',dest='/tmp/x.json') | |
releases <- local({ | |
x <- fromJSON(file='/tmp/x.json') | |
data.table(version=names(x), date=as.Date(unlist(x))) | |
})[date>='2016-07-01',] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
## Get the JSON file of releases | |
library(rjson) | |
library(data.table) | |
library(infuser) | |
download.file('https://product-details.mozilla.org/1.0/firefox_history_major_releases.json',dest='/tmp/x.json') | |
releases <- local({ | |
x <- fromJSON(file='/tmp/x.json') | |
data.table(version=names(x), date=as.Date(unlist(x))) | |
})[date>='2016-07-01',] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: Flash Engagement for **Existing Profiles** | |
<br/>( Click to Activate ) | |
author: Saptarshi Guha <[email protected]> | |
date: "`r format(Sys.time(), '%B %d, %Y')`" | |
output: | |
html_document: | |
mathjax: default | |
self_contained: true | |
theme: readable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(infuser) | |
## See https://docs.databricks.com/api/1.2/index.html#execution-context | |
ctxMake <- function(instance,clusterId,user,password){ | |
url <- infuse("https://{{instance}}.cloud.databricks.com/api/1.2/contexts/create",instance=instance) | |
pyctx<-POST(url,body=list(language='python', clusterId=clusterId) | |
,encode='form' | |
,authenticate(user,password)) |