From 1633b1cca092fb1985aa3933c4e913057b5b5211 Mon Sep 17 00:00:00 2001 From: jack leene Date: Tue, 2 Jan 2024 10:53:39 +0100 Subject: [PATCH] initial commit --- data/.Rhistory | 290 +++++++++++++++++++++++++++++++++++++++++ poetry.lock | 16 ++- pyproject.toml | 1 + src/data/spc_loader.py | 11 +- test | 1 + 5 files changed, 308 insertions(+), 11 deletions(-) create mode 100644 data/.Rhistory diff --git a/data/.Rhistory b/data/.Rhistory new file mode 100644 index 0000000..38302a0 --- /dev/null +++ b/data/.Rhistory @@ -0,0 +1,290 @@ +install.packages("tidyverse") +install.packages("qcc") +install.packages("skimr") +install.packages("rmarkdown") +x=seq(1,10) +y=seq(sapply(1:10,random(1,1))) +?Random +install.packages(DT) +install.packages("DT") +if (!require("DT")) install.packages('DT') +library(DT) +?DT +class(datatable(iris)) +?htmlwidget +??htmlwidget +install.packages("palletteer") +install.packages("paletteer") +install.packages("gapminder") +install.packages("ggthemes") +install.packages("collapsebleTree") +devtools::install_github("AdeelK93/collapsibleTree") +install.packages("devtools") +devtools::install_github("AdeelK93/collapsibleTree") +install.packages("ggthemes") +names(iris) +?theme_tufte() +names(iris) +library(gapminder) +attach(gapminder) +gapminder<-gapminder %>% +filter(year) %>% +arrange(-pop) %>% +slice(1:50) %>% +mutate(GDP=gdpPercap*Pop) +library(dplyr) +gapminder<-gapminder %>% +filter(year) %>% +arrange(-pop) %>% +slice(1:50) %>% +mutate(GDP=gdpPercap*Pop) +rlang::last_error +rlang::last_error() +names(gapminder) +table(gapminder$year) +class(gapminder$year) +library(usethis) +library(ggplot2) +install.packages(c("bit", "boot", "brew", "broom", "bslib", "cachem", "callr", "class", "cli", "cluster", "codetools", "colorspace", "commonmark", "cpp11", "crayon", "curl", "data.table", "dbplyr", "devtools", "digest", "dplyr", "DT", "dtplyr", "evaluate", "fansi", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreign", "fs", "gapminder", "gargle", "gert", "ggplot2", "gh", "gtable", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "isoband", "jsonlite", "knitr", "lifecycle", "lubridate", "markdown", "MASS", "Matrix", "mgcv", "modelr", "nlme", "nnet", "openssl", "paletteer", "pillar", "pkgbuild", "pkgdown", "pkgload", "processx", "ps", "purrr", "ragg", "Rcpp", "readr", "readxl", "repr", "reprex", "rlang", "rmarkdown", "roxygen2", "rpart", "rstudioapi", "rvest", "sass", "scales", "shiny", "skimr", "sourcetools", "spatial", "stringi", "stringr", "survival", "sys", "testthat", "tibble", "tidyr", "tidyselect", "tidyverse", "tinytex", "utf8", "vctrs", "viridisLite", "vroom", "whisker", "xfun", "yaml", "zip")) +install.packages(c("bit", "boot", "brew", "broom", "bslib", "cachem", "callr", "class", "cli", "cluster", "codetools", "colorspace", "commonmark", "cpp11", "crayon", "curl", "data.table", "dbplyr", "devtools", "digest", "dplyr", "DT", "dtplyr", "evaluate", "fansi", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreign", "fs", "gapminder", "gargle", "gert", "ggplot2", "gh", "gtable", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "isoband", "jsonlite", "knitr", "lifecycle", "lubridate", "markdown", "MASS", "Matrix", "mgcv", "modelr", "nlme", "nnet", "openssl", "paletteer", "pillar", "pkgbuild", "pkgdown", "pkgload", "processx", "ps", "purrr", "ragg", "Rcpp", "readr", "readxl", "repr", "reprex", "rlang", "rmarkdown", "roxygen2", "rpart", "rstudioapi", "rvest", "sass", "scales", "shiny", "skimr", "sourcetools", "spatial", "stringi", "stringr", "survival", "sys", "testthat", "tibble", "tidyr", "tidyselect", "tidyverse", "tinytex", "utf8", "vctrs", "viridisLite", "vroom", "whisker", "xfun", "yaml", "zip")) +install.packages(c("bit", "boot", "brew", "broom", "bslib", "cachem", "callr", "class", "cli", "cluster", "codetools", "colorspace", "commonmark", "cpp11", "crayon", "curl", "data.table", "dbplyr", "devtools", "digest", "dplyr", "DT", "dtplyr", "evaluate", "fansi", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreign", "fs", "gapminder", "gargle", "gert", "ggplot2", "gh", "gtable", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "isoband", "jsonlite", "knitr", "lifecycle", "lubridate", "markdown", "MASS", "Matrix", "mgcv", "modelr", "nlme", "nnet", "openssl", "paletteer", "pillar", "pkgbuild", "pkgdown", "pkgload", "processx", "ps", "purrr", "ragg", "Rcpp", "readr", "readxl", "repr", "reprex", "rlang", "rmarkdown", "roxygen2", "rpart", "rstudioapi", "rvest", "sass", "scales", "shiny", "skimr", "sourcetools", "spatial", "stringi", "stringr", "survival", "sys", "testthat", "tibble", "tidyr", "tidyselect", "tidyverse", "tinytex", "utf8", "vctrs", "viridisLite", "vroom", "whisker", "xfun", "yaml", "zip")) +yes +library(ggplot2) +install.packages("usethis") +usethis:edit_r_profile() +library(usethis) +usethis:edit_r_profile() +usethis::edit_r_profile() +options( +usethis.description = list( +`Authors@R` = 'person("jack", "leene", email = "jack@leene.dev", role = c("aut", "cre"))', +License = "MIT + file LICENSE", +Version = "0.0.0.9000" +), +usethis.full_name = "First Last", +usethis.protocol = "https", +vsc.rstudioapi = TRUE, +warnPartialMatchArgs = TRUE, +warnPartialMatchDollar = TRUE, +warnPartialMatchAttr = TRUE +) +if (interactive()) { +suppressMessages(require(devtools)) +suppressMessages(require(usethis)) +} +p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line() +p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line() +p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line() +library(ggplot2) +library(DT) +library(ggthemes) +library(gapminder) +p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line() +q<-ggplot(iris,aes(Sepel.Width,Sepal.Length))+geom_line()+theme_tufte() +(p) +theme_tufte() +data(gapminder) +q +theme_tufte() +#gapminder<-gapminder %>% +# filter(year) %>% +# arrange(-pop) %>% +# slice(1:50) %>% +# mutate(GDP=gdpPercap*Pop) +#Column {data-width=450} +p=datatable((iris)) +print(p) +library(ggplot2) +library(DT) +library(ggthemes) +library(gapminder) +p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line() +q<-ggplot(iris,aes(Sepel.Width,Sepal.Length))+geom_line()+theme_tufte() +p=datatable((iris)) +print(p) +(p) +theme_tufte() +#gapminder<-gapminder %>% +# filter(year) %>% +# arrange(-pop) %>% +# slice(1:50) %>% +# mutate(GDP=gdpPercap*Pop) +#Column {data-width=450} +theme_tufte() +library(ggplot2) +library(DT) +library(ggthemes) +library(gapminder) +p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line() +q<-ggplot(iris,aes(Sepel.Width,Sepal.Length))+geom_line()+theme_tufte() +p=datatable((iris)) +print(p) +(p) +#theme_tufte() +#gapminder<-gapminder %>% +# filter(year) %>% +# arrange(-pop) %>% +# slice(1:50) %>% +# mutate(GDP=gdpPercap*Pop) +#Column {data-width=450} +table(iris$Species) +usethis::edit_rstudio_snippets("r") +usethis::edit_rstudio_prefs() +usethis::edit_r_profile() +install.packages(c("class", "KernSmooth", "MASS", "nnet")) +mtcars +a<-mtcars +a +nrow(mtcars) +floor(12/4-2) +floor(2:32/4-2) +floor(2:32/4-1) +floor((1:32)/4-1) +floor((1:32)/4) +floor((1:32-1)/4) +a$group=floor((1:32-1)/4) +a +a$group1=mod((1:32-1),4) +((1:32-1)//4) +((1:32-1)\\4) +1\\4 +1//4 +mod(1,4() +mod(1,4 +mod(1,4) +mod(1 %%4) +(1 %% 4) +a$group1=(1:32 %% 4) +a +a$group1=(1:32 %% 4)+1 +a$group1=(0:31 %% 4)+1 +a$group1=(0:31 %% 4) +a$group1=(1:32 %% 4) +a<-mtcars +floor(12/4-2) +a$group=floor((1:32-1)/4) +a +a$group=floor((1:32-1) %% 4) +a$group=floor((1:32-1)/4) +a$group=floor((1:32-1)/4) +a +a$group2=((1:32-1)%% 4) +a +names(a) +head(a) +ddply(a,.(group,group2),sumc=sum(cyl)) +library(tidyverse) +installed.packages("tidyverse") +install.package("tidyverse") +install.packages("tidyverse") +library(tidyverse) +head(a) +ddply(a,.(group,group2),sumc=sum(cyl)) +library(dplyr) +ddply(a,.(group,group2),sumc=sum(cyl)) +library(dplyr) +ddply(a,.(group,group2),sumc=sum(cyl)) +ddplyr(a,.(group,group2),sumc=sum(cyl)) +ddply +library(dplyr) +library(plyr) +install.packages("plyr") +library(plyr) +names(a) +ddply(a,.(group,group2),summarize,sumc=sum(cyl),paste(.group,.group2,col="",sep="_")=sum(cyl)) +ddply(a,.(group,group2),summarize,sumc=sum(cyl),paste(.group,.group2,col="",sep="_")=sum(cyl)) +starwars %>% +select(name, mass, species) %>% +mutate(mass_norm = mass / mean(mass, na.rm = TRUE)) +head(a) +a %>% pivot_wider() +?pivot_wider +map(a$group,function(x){sprinft(x)}) +map(a$group,function(x){sprinf(x)}) +map(a$group,function(x){prinf(x)}) +sprintf +map(a$group,prinf(x)) +map(a$group,sprinf(x)) +map(a$group,sprinfs(x)) +help("paste") +map(a$group,paste(x)) +map(a$group,paste(.x)) +map(a$group,paste(x)) +?map +map(a$group,x) +map(a$group,.x) +set_names(c("foo", "bar")) |> map_chr(paste0, ":suffix") +l1 <- list(list(a = 1L), list(a = NULL, b = 2L), list(b = 3L)) +ll +l1 +l1 |> map("a", .default = "???") +list(num = 1:3, letters[1:3]) +1:10 |> +map(rnorm, n = 10) +1:10 |> +map(\(x) rnorm(10, x)) +letters[1:10] |> +map(\(x) sprintf("wafer_%03d",x)) +letters[1:10] |> +map(\(int(x)) sprintf("wafer_%03d",x)) +letters[1:10] |> +map(int(x) sprintf("wafer_%03d",x)) +letters[1:10] |> +map(.x, sprintf("wafer_%03d",x)) +letters[1:10] |> +map(x, sprintf("wafer_%03d",x)) +letters +letters[1:10] +letters[1:10] |> +map(\x, sprintf("wafer_%03d",x)) +letters[1:10] |> +map(\(x), sprintf("wafer_%03d",x)) +letters[1:10] |> +map(\x, sprintf("wafer_%03d",x)) +letters[1:10] |> +map(x, sprintf("wafer_%03d",x)) +[1:10] |> +1:10 |> map(x, sprintf("wafer_%03d",x)) +1:10 |> map(x, sprintf("wafer_%03d", x)) +1:10 |> map_chr(x, sprintf("wafer_%03d", x)) +1:10 |> map_in5(x, sprintf("wafer_%03d", x)) +1:10 |> map_int(x, sprintf("wafer_%03d", x)) +1:10 |> map(x, sprintf("wafer_%03d", x)) +l2 <- list( +list(num = 1:3, letters[1:3]), +list(num = 101:103, letters[4:6]), +list() +) +l2 |> map(c(2, 2)) +l2 |> map(list("num", 3)) +l2 |> map_int(list("num", 3), .default = NA) +paste(sprintf("wafer_%03d",1:10)) +seq(paste(sprintf("wafer_%03d",1:10)),3) +paste(sprintf("wafer_%03d",seq(1:10,3)) +) +paste(sprintf("wafer_%03d",seq(1:10,3)) +) +seq(3,1:2) +seq(1:2,2) +seq(1:2,a:b) +seq(a,b) +seq(1,3) +R +which R +setwd("/Users/jackleene/2024-dash_v1") +setwd("/Users/jackleene/2024-dash_v1/data") +a=read_csv("spc_mod.csv") +library(readr) +a=read_csv("spc_mod.csv") +library(arrow) +install.packages("arrow") +install.packages("arrow") +install.packages("sparklyr") +install.packages("sparklyr") +install.packages("arrow") +table(a$timestamp) +install.packages("arrow") +names(a) +class(a) +lapply(a,class) +lapply(a,class) diff --git a/poetry.lock b/poetry.lock index ab73882..a4a7daa 100644 --- a/poetry.lock +++ b/poetry.lock @@ -244,6 +244,20 @@ files = [ {file = "dash_core_components-2.0.0.tar.gz", hash = "sha256:c6733874af975e552f95a1398a16c2ee7df14ce43fa60bb3718a3c6e0b63ffee"}, ] +[[package]] +name = "dash-daq" +version = "0.5.0" +description = "DAQ components for Dash" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "dash_daq-0.5.0.tar.gz", hash = "sha256:a1d85b6799f7b885652fbc44aebdb58c41254616a8d350b943beeb42ade4256a"}, +] + +[package.dependencies] +dash = ">=1.6.1" + [[package]] name = "dash-html-components" version = "2.0.0" @@ -901,4 +915,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "209b9534df1cea182a044844896ee039f12a6dccb440af3c4e1f498ba15325ec" +content-hash = "aec3b7eae4106cf6a3129ef080da73c29c6c87cdce2ad8daa07863e6530a583b" diff --git a/pyproject.toml b/pyproject.toml index 8ab29fa..507672b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ dash = "^2.14.2" pydantic = "^2.5.3" dash-bootstrap-components = "^1.5.0" pandas = "^2.1.4" +dash-daq = "^0.5.0" [build-system] diff --git a/src/data/spc_loader.py b/src/data/spc_loader.py index af66824..ad1d184 100644 --- a/src/data/spc_loader.py +++ b/src/data/spc_loader.py @@ -28,18 +28,9 @@ class spc_DataSchema: PARA22 ="character", PARA23 ="numeric", timestamp ="date" - - -class DataSchema: - AMOUNT = "amount" - CATEGORY = "category" - DATE = "date" - MONTH = "month" - YEAR = "year" - -def load_spc_data(path: str) -> pd.DataFrame: +def load_eventlog_data(path: str) -> pd.DataFrame: # load the data from the CSV file data = pd.read_csv( path, diff --git a/test b/test index e69de29..0ddf2ba 100644 --- a/test +++ b/test @@ -0,0 +1 @@ +i