Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ articles:
contents:
- project_structure
- using_github
- github_branches
- package_development
- data_table

Expand Down
4 changes: 2 additions & 2 deletions vignettes/data_table.Rmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: "04 Improve efficiency with `data.table`"
title: "05 Improve efficiency with `data.table`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{04 Improve efficiency with `data.table`}
%\VignetteIndexEntry{05 Improve efficiency with `data.table`}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down Expand Up @@ -161,8 +161,8 @@
height = c(180, 165, 175, 160, 185, 170)
)
# dplyr
max_height_df <- height %>%

Check warning on line 164 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=164,col=25,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
group_by(gender) %>%

Check warning on line 165 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=165,col=20,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
dplyr::summarise(max_height = max(height))

# first transform data to data.table class
Expand Down Expand Up @@ -203,12 +203,12 @@
# Creating second dataset
df2 <- data.frame(
customer_id = sample(1:(n_rows * 10), n_rows, replace = FALSE),
customer_name = paste0("Customer_", sample(1:(n_rows * 10), n_rows, replace = FALSE))

Check warning on line 206 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=206,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 87 characters.
)

# Joining with dplyr
joined_df <- left_join(df1, df2, by = "customer_id") %>%

Check warning on line 210 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=210,col=54,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
select(customer_id, transaction_amount, customer_name) %>%

Check warning on line 211 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=211,col=58,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
arrange(customer_id)

# Converting to data.table
Expand All @@ -216,9 +216,9 @@
dt2 <- data.table::as.data.table(df2)

# Joining with data.table
joined_dt <- dt2[dt1, on = "customer_id"] %>%

Check warning on line 219 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=219,col=43,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
as.data.frame() %>%

Check warning on line 220 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=220,col=19,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
select(customer_id, transaction_amount, customer_name) %>%

Check warning on line 221 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=221,col=58,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
arrange(customer_id)

identical(joined_df, joined_dt)
Expand Down Expand Up @@ -299,7 +299,7 @@
)

# Convert to wide format using dplyr
wide_df <- long_df %>%

Check warning on line 302 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=302,col=20,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
pivot_wider(
names_from = variable,
values_from = value
Expand Down Expand Up @@ -330,7 +330,7 @@
)

# Convert to long format using dplyr
long_df <- wide_df %>%

Check warning on line 333 in vignettes/data_table.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/data_table.Rmd,line=333,col=20,[pipe_consistency_linter] Use the |> pipe operator instead of the %>% pipe operator.
pivot_longer(
cols = starts_with("value"),
names_to = "variable",
Expand Down
72 changes: 72 additions & 0 deletions vignettes/github_branches.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "03 Github Branches"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{03 Github Branches}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```

## Overview
This article provides a description of the Git branching workflow used to maintain the `createslf` package in line with NSS BI BYOC infrastructure. It explains how branches are structured, how code moves from one environment to another, and what protection rules apply. It is intended for all PHS analysts contributing to this project and serves as a reference for day‑to‑day Git usage.

## Acronyms Reference
* BI – Business Intelligence (NSS)
* BYOC – Bring Your Own Code
* PR – Pull Request
* SLF – Source Linkage Files
* UAT – User Acceptance Testing

## Branching Structure
The project uses a three‑tier protected branching model:

`master` → `main-byoc` → `UAT` → `development`

### Branching Workflow:
**master (production)** – Represents the code currently deployed in production

* Must be protected: No direct pushes and PRs must be approved by 1 SLF team member + 1 NSS BI member.
* Ensures: A stable, production environment and that all production code has been peer‑reviewed.

**main-byoc (infrastructure integration)** – Acts as the integration layer between SLF R code and NSS BI BYOC-specific configurations

* Holds the BYOC artefacts including the wrapper and utility scripts.
* Owned primarily by NSS BI.

**UAT (User Acceptance Testing)** – Used for end‑user testing after changes are validated in development

* PRs must be reviewed by one PHS member and one NSS BI member.
* Code here is deployed into the UAT environment.
* When UAT is successful, code moves to main-byoc → then to master.

**development** – Represents the current state of code under active development

* PRs must be reviewed by one PHS member.
* All feature branches must be created from this branch.

**Feature branches (working branches)** – Created when working on issues

* Always created from development
* After testing locally, raise a PR → merge into development

### Merge Visual Workflow:

```{r, echo=FALSE, out.width="85%"}
knitr::include_graphics("images/git_flow.png")
```

### Workflow Summary
| Branch | Purpose | Approval Required |
|----------------------|--------------------------|-----------------------|
| `master` | Production Code | PHS + NSS BI |
| `main-byoc` | BYOC Integration | PHS + NSS BI |
| `UAT` | User Testing | PHS + NSS BI |
| `development` | Integration of Features | PHS |
| `feature` | Individual Work | N/A (Local Testing) |
Binary file added vignettes/images/git_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions vignettes/package_development.Rmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: "03 Package Development"
title: "04 Package Development"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{03 Package Development}
%\VignetteIndexEntry{04 Package Development}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down
Loading