-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script templates #1
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3a6645a
draft cleaning checklist
bb84cc4
simplified checklists
6ce418b
added clean R template script
0a9586a
clean wrangle and model template scripts
2355429
Update README.md
mt-edwards 713590b
simplified data names and added exploration and description report te…
4fe339c
empty python scripts added and posthook
8ce9482
fixed the post_hook to remove .Rproj file when an R project is required
6da4e86
removed notebooks folder and changed lang_project to language in the …
b40f29c
added python template scripts
965fc1b
updated the number of imputs in the README file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ pip install cookiecutter | |
cookiecutter https://github.com/NICD-UK/project-template | ||
``` | ||
|
||
You will be prompted for nine inputs: | ||
You will be prompted for eleven inputs: | ||
|
||
1. Project Name | ||
2. Project Directory Name | ||
|
@@ -19,8 +19,9 @@ You will be prompted for nine inputs: | |
6. Project Sponsor Email | ||
7. Project Summary | ||
8. Raw Data Directory | ||
9. `venv` Project (No / Yes) | ||
10. `git` Project (No / Yes) | ||
9. Language (Python / R) | ||
10. `venv` Project (No / Yes) | ||
11. `git` Project (No / Yes) | ||
|
||
## Organization | ||
|
||
|
@@ -32,7 +33,6 @@ data/ | |
├─ model/ | ||
├─ raw/ | ||
├─ wrangle/ | ||
Comment on lines
33
to
35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be useful to re-order these in terms of the actual order of the workflow i.e. raw -> wrangle -> model ? |
||
notebooks/ | ||
reports/ | ||
├─ clean/ | ||
├─ final/ | ||
|
@@ -50,7 +50,7 @@ src/ | |
- **Determine Objectives:** | ||
- **Determine Deliverables:** | ||
- **Determine Resources:** | ||
- **Plan Project:** | ||
- **Plan Project:** | ||
|
||
### 2. Data Preparation and Understanding | ||
|
||
|
@@ -60,16 +60,16 @@ src/ | |
|
||
### 3. Prototyping | ||
|
||
- **Develop Data Product** | ||
- **Evaluate Data Product** | ||
- **Approve Data Product** | ||
- **Develop Data Product:** | ||
- **Evaluate Data Product:** | ||
- **Approve Data Product:** | ||
|
||
### 4. Production | ||
|
||
- **Deploy Data Product** | ||
- **Monitor Data Product** | ||
- **Maintain Data Product** | ||
- **Close Project** | ||
- **Deploy Data Product:** | ||
- **Monitor Data Product:** | ||
- **Maintain Data Product:** | ||
- **Close Project:** | ||
|
||
## Guide | ||
|
||
|
This file contains 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
This file contains 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
Empty file.
16 changes: 16 additions & 0 deletions
16
{{cookiecutter.project_directory_name}}/reports/clean/clean.Rmd
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Load Libraries | ||
```{r message=FALSE} | ||
library(glue) | ||
library(here) | ||
library(tidyverse) | ||
``` | ||
|
||
# Setup | ||
```{r} | ||
data_name <- "<data-name>" | ||
``` | ||
|
||
# Read Data | ||
```{r} | ||
clean_data <- read_rds(here("data", "clean", glue("{data_name}.rds"))) | ||
``` |
10 changes: 10 additions & 0 deletions
10
{{cookiecutter.project_directory_name}}/reports/clean/clean.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#%% Load Libraries | ||
import pandas | ||
from pyprojroot import here | ||
import os | ||
|
||
#%% Setup | ||
data_name = "<data-name>" | ||
|
||
#%% Read Data | ||
clean_data = pandas.read_pickle(os.path.join(here(), "data", "clean", f"{data_name}.pkl")) |
16 changes: 16 additions & 0 deletions
16
{{cookiecutter.project_directory_name}}/reports/wrangle/wrangle.Rmd
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Load Libraries | ||
```{r message=FALSE} | ||
library(glue) | ||
library(here) | ||
library(tidyverse) | ||
``` | ||
|
||
# Setup | ||
```{r} | ||
data_name <- "<data-name>" | ||
``` | ||
|
||
# Read Data | ||
```{r} | ||
wrangle_data <- read_rds(here("data", "wrangle", glue("{data_name}.rds"))) | ||
``` |
10 changes: 10 additions & 0 deletions
10
{{cookiecutter.project_directory_name}}/reports/wrangle/wrangle.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#%% Load Libraries | ||
import pandas | ||
from pyprojroot import here | ||
import os | ||
|
||
#%% Setup | ||
data_name = "<data-name>" | ||
|
||
#%% Read Data | ||
wrangle_data = pandas.read_pickle(os.path.join(here(), "data", "wrangle", f"{data_name}.pkl")) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Transformation Checklist | ||
|
||
## Motivation | ||
|
||
## Cleaning Checklist | ||
|
||
For each data source: | ||
|
||
- [ ] read data from `/data/raw/` | ||
- [ ] ... | ||
- [ ] write data to `/data/clean/` | ||
|
||
## Wrangling Checklist | ||
|
||
For each data product: | ||
|
||
- [ ] read data from `/data/clean/` | ||
- [ ] ... | ||
- [ ] write data to `/data/wrangle/` | ||
|
||
## Processing | ||
|
||
For models: | ||
|
||
|
||
|
||
|
||
|
26 changes: 26 additions & 0 deletions
26
{{cookiecutter.project_directory_name}}/src/clean/clean.Rmd
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Load Libraries | ||
```{r message=FALSE} | ||
library(glue) | ||
library(here) | ||
library(tidyverse) | ||
``` | ||
|
||
# Setup | ||
```{r} | ||
data_name <- "<data-name>" | ||
``` | ||
|
||
# Read Data | ||
```{r} | ||
raw_data <- read_csv(here("data", "raw", glue("{data_name}.csv"))) | ||
``` | ||
|
||
# Clean Data | ||
```{r} | ||
clean_data <- raw_data | ||
``` | ||
|
||
# Write Data | ||
```{r} | ||
write_rds(clean_data, here("data", "clean", glue("{data_name}.rds"))) | ||
``` |
16 changes: 16 additions & 0 deletions
16
{{cookiecutter.project_directory_name}}/src/clean/clean.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#%% Load Libraries | ||
import pandas | ||
from pyprojroot import here | ||
import os | ||
|
||
#%% Setup | ||
data_name = "<data-name>" | ||
|
||
#%% Read Data | ||
raw_data = pandas.read_csv(os.path.join(here(), "data", "raw", f"{data_name}.csv")) | ||
|
||
#%% Clean Data | ||
clean_data = raw_data | ||
|
||
#%% Write Data | ||
clean_data.to_pickle(os.path.join(here(), "data", "clean", f"{data_name}.pkl")) |
16 changes: 16 additions & 0 deletions
16
{{cookiecutter.project_directory_name}}/src/model/model.Rmd
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Load Libraries | ||
```{r message=FALSE} | ||
library(glue) | ||
library(here) | ||
library(tidyverse) | ||
``` | ||
|
||
# Setup | ||
```{r} | ||
data_name <- "<data-name>" | ||
``` | ||
|
||
# Read Data | ||
```{r} | ||
wrangle_data <- read_rds(here("data", "wrangle", glue("{data_name}.rds"))) | ||
``` |
10 changes: 10 additions & 0 deletions
10
{{cookiecutter.project_directory_name}}/src/model/model.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#%% Load Libraries | ||
import pandas | ||
from pyprojroot import here | ||
import os | ||
|
||
#%% Setup | ||
data_name = "<data-name>" | ||
|
||
#%% Read Data | ||
wrangle_data = pandas.read_pickle(os.path.join(here(), "data", "wrangle", f"{data_name}.pkl")) |
26 changes: 26 additions & 0 deletions
26
{{cookiecutter.project_directory_name}}/src/wrangle/wrangle.Rmd
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Load Libraries | ||
```{r message=FALSE} | ||
library(glue) | ||
library(here) | ||
library(tidyverse) | ||
``` | ||
|
||
# Setup | ||
```{r} | ||
data_name <- "<data-name>" | ||
``` | ||
|
||
# Read Data | ||
```{r} | ||
clean_data <- read_rds(here("data", "clean", glue("{data_name}.rds"))) | ||
``` | ||
|
||
# Wrangle Data | ||
```{r} | ||
wrangle_data <- clean_data | ||
``` | ||
|
||
# Write Data | ||
```{r} | ||
write_rds(wrangle_data, here("data", "wrangle", glue("{data_name}.rds"))) | ||
``` |
16 changes: 16 additions & 0 deletions
16
{{cookiecutter.project_directory_name}}/src/wrangle/wrangle.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#%% Load Libraries | ||
import pandas | ||
from pyprojroot import here | ||
import os | ||
|
||
#%% Setup | ||
data_name = "<data-name>" | ||
|
||
#%% Read Data | ||
clean_data = pandas.read_pickle(os.path.join(here(), "data", "clean", f"{data_name}.pkl")) | ||
|
||
#%% Clean Data | ||
wrangle_data = clean_data | ||
|
||
#%% Write Data | ||
wrangle_data.to_pickle(os.path.join(here(), "data", "wrangle", f"{data_name}.pkl")) |
13 changes: 13 additions & 0 deletions
13
{{cookiecutter.project_directory_name}}/{{cookiecutter.project_directory_name}}.Rproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: No | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider changing "eleven" to "the following"