Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9e20d62
update readme and introduction
Tina815 Oct 6, 2025
3f856ff
fix readme and modify foundation
Tina815 Nov 18, 2025
08ca2ca
update setup reticulate code
Tina815 Nov 19, 2025
39cde7d
Images for training
JosieSteele Dec 10, 2025
cd93df6
VS code section
JosieSteele Dec 10, 2025
10a02b1
Small changes
JosieSteele Dec 10, 2025
f2e04bf
Apply suggestions from code review- typos, capitals etc
JosieSteele Dec 16, 2025
1ef55c4
modify comment in rearrange column
Tina815 Jan 7, 2026
6be6b06
Changes and additions to the VS code section
JosieSteele Jan 8, 2026
bc6f6c1
make changes to delete columns
Tina815 Feb 9, 2026
2fa9eb7
Slight changes to clarify steps
JosieSteele Feb 11, 2026
ac7fcc9
Merge pull request #14 from Public-Health-Scotland/vscode
Tina815 Feb 23, 2026
593ac44
modify Explore section
Tina815 Feb 23, 2026
43ff52a
fix code for executing install_extensions.sh
Tina815 Feb 23, 2026
5108a91
fix syntax for sort values
Tina815 Mar 6, 2026
bd6cd9b
fix some wordings and feedback link
Tina815 Mar 9, 2026
4670eee
update jupyter notebook images
Tina815 Mar 9, 2026
0476065
modify data type and data structure
Tina815 Mar 16, 2026
813056d
modify contents in a few chapters
Tina815 Mar 17, 2026
0697621
modify contents for control flow and foundation
Tina815 Mar 20, 2026
292c4e6
make png file names all consistent with lowercase
Tina815 Mar 20, 2026
ce5cfc9
update the vs code image by adding numbers
Tina815 Apr 21, 2026
531e381
fix various text
Tina815 Apr 21, 2026
a46abf5
update README.md for PWB info
Tina815 Apr 24, 2026
810d7cb
fix the code in readme
Tina815 Apr 27, 2026
89d0ef0
sort value inplace argument
Tina815 May 18, 2026
0496a9a
delete iloc contents
Tina815 May 27, 2026
3302f96
add query section
Tina815 May 27, 2026
8d88298
fix text for IDE section
Tina815 May 29, 2026
b244f70
Fix contents in Foundation
Tina815 Jun 1, 2026
e9219d0
add code for running on lastest PWB
Tina815 Jun 4, 2026
14e70c7
fix control flow content
Tina815 Jun 4, 2026
1ac75f8
fix contents for function and wrangling
Tina815 Jun 9, 2026
09cfa5c
fixed env and dark
gafo25 Jun 10, 2026
0b7c789
add contents for file handling
Tina815 Jun 10, 2026
b884572
Merge branch 'readme' into fix/env_and_dark
Tina815 Jun 10, 2026
e610caf
add contents for read web files
Tina815 Jun 12, 2026
01abfeb
Merge branch 'readme' into fix/env_and_dark
Tina815 Jun 12, 2026
04a7234
fix read specific columns section
Tina815 Jun 12, 2026
4daecbf
add links in help section
Tina815 Jun 12, 2026
82fe78f
Merge branch 'readme' into fix/env_and_dark
Tina815 Jun 12, 2026
d4b9c9d
auto cleaning cache
gafo25 Jun 16, 2026
4bcd041
Merge pull request #16 from Public-Health-Scotland/fix/env_and_dark
Tina815 Jun 16, 2026
c35726a
delete gradethis and add help link
Tina815 Jun 17, 2026
cd79a5f
add comments in intro.Rmd and delete gradethis in readme
Tina815 Jun 17, 2026
18a5901
delete exercise checker and fix some wordings
Tina815 Jun 23, 2026
6f591ee
steps to use renv
gafo25 Jun 23, 2026
8843669
added folder content table
gafo25 Jun 24, 2026
98d7cb3
fix typo
Tina815 Jun 25, 2026
eba6f7e
Merge pull request #18 from Public-Health-Scotland/feature/renv
Tina815 Jun 25, 2026
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 .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ rsconnect/**

.DS_Store

*.html
*.html

# posit publisher deployment folder
.posit/

# renv
renv/library/
renv/staging/
75 changes: 74 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# python-training
An interactive, online introduction to python training for employees in Public Health Scotland.
This is an interactive, online introduction to python training for employees
in Public Health Scotland.

## Running in Posit Workbench

This project has a renv (R environment) and you can recreate the needed packages following these steps:
1. Install renv in your current R session:
``` r
install.packages("renv")
```
2. Restart your R session
3. Run this command in R console:
``` r
renv::restore()
```
4. All the required packages will be installed.
5. If the restore process fails you can install required R packages running these lines of code in your R console:
``` r
install.packages("learnr")
install.packages("reticulate")
```

### R required packages


| Package | Description |
|---------|---------|
| learnr | It is required to build the shiny app |
| reticulate | It is required for running embedded python sessions |

### Python required packages

The required Python are available in requirements.txt file. No need to install since reticulate R package manages the required virtual environment installation.

| Package | Description |
|---------|---------|
| pandas | It is required to read files (e.g. CSV) and wrangle its content |


### Troubleshooting

- If PWB has been updated it means there are new Python versions. So you have to
check if your previously created pyenv is still there. Run this command in the
terminal tab: `ls -l ~/.virtualenvs`
- If you see pyenv folder, you have to delete it using this command:
`rm -rf ~/.virtualenvs/pyenv`
- The previous pyenv gets obsolete because of a PWB update with new Python
versions.
- We will be able to run this project because it will create a new pyenv
(with the new Python version).

## Deployment
This project can be deployed in Posit connect using Posit Publisher Positron extension. Go to the following repo [vscode_prep](https://github.com/Public-Health-Scotland/vscode_prep) and go to Deployment folder. This folder contains general steps to deploy a project.

- You will need an API token to authenticate your permissions (Viewer/Publisher) in Posit Connect
- Ask for the current Posit connect project URL if it has already been deployed.
- Check Folder content table to see which files are required for deployment (if you upload everything you will waste space)

### Folder content

This project contains the following folders and files:

| Folder/File | Description | To deploy | On GitHub |
|--------------|-----------------------------|--------------|--------------|
| data/ | This folder contains all CSV files used in this project | ✅ | ✅ |
| images/ | This folder contains all required images | ✅ | ✅ |
| css/ | This folder contains CSS to style the project | ✅ | ✅ |
| .gitignore | This file contains a list of files/folders which are not uploaded to GitHub | ❌ | ✅ |
| intro.Rmd | This is the entry point file which contains the main R shiny application | ✅ | ✅ |
| README.md | This file contains the project description | ❌ | ✅ |
| requirements.txt | This file is essencial to create your Python virtual environment using Reticulate R package | ✅ | ✅ |
| .Rprofile | R project file generated by R studio | ❌ | ✅ |
| renv/ and renv.lock | R environmet to recreated needed packages | ❌ | ✅ |
| .posit | Temporary folder created when using posit publisher extension for deployment | ❌ | ❌ |
110 changes: 100 additions & 10 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,37 +1,121 @@
@import url("https://fonts.googleapis.com/css?family=Open Sans");
@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap');

body, h1, h2, h3, h4, h5, h6, p, button {
font-family: 'Open Sans';
@media (prefers-color-scheme: dark) {
:root {
--phs-logo: url("../images/phs-logo-white.svg");
--phs-color-bg: #1a1a2e;
--phs-color-fg: #e8e8e8;
--phs-h: #80BCEA;
--phs-code-bg: #252542;
--phs-btn-primary: #252542;
--phs-btn-success: #252542;
}
}

@media (prefers-color-scheme: light) {
:root {
--phs-logo: url("../images/phs-logo.svg");
--phs-color-bg: #ffffff;
--phs-color-fg: #333333;
--phs-h: #433683;
--phs-code-bg: #ffffff;
--phs-btn-primary:#0097d7;
--phs-btn-success: #80ba27;
}
}

.custom-navbar {
display: flex;
justify-content: flex-end;
align-items: center;
margin-bottom: 10px;
}

.phs-logo {
background-image: var(--phs-logo);
background-size: contain;
background-repeat: no-repeat;
background-position: right center;
width: 300px;
height: 100px;
}

h1, h2 {
color: #433683;
.tutorial-exercise-code-editor {
background-color: var(--phs-code-bg) !important;
color: var(--phs-color-fg);
}

h3, h4, h5 {
color: #bd27b9;
pre, code {
background-color: var(--phs-code-bg) !important;
color: var(--phs-color-fg);
}

.topicsList .topic .nav-link {
color: #808080;
font-weight: bold;
}

.topicsList .topic.current {
background-color: var(--phs-color-fg);
color: var(--phs-color-bg) !important;
}

body {
background-color: var(--phs-color-bg);
color: var(--phs-color-fg);
}

body, h1, h2, h3, h4, h5, h6, p, button {
font-family: 'Open Sans';
}

h1, h2, h3, h4, h5 {
color: var(--phs-h);
font-weight: bold;
}

code {
font-family: 'Source Code Pro';
}

th {
color: #433683;
color: var(--phs-h);
}

.panel-heading {
color: #bd27b9;
color: var(--phs-h);
padding-bottom: 10px;
}

.btn-primary {
background-color: #0097d7;
background-color: var(--phs-btn-primary);
color: var(--phs-color-fg);
border-color: var(--phs-color-fg);
}

.btn-success {
background-color: #80ba27;
background-color: var(--phs-btn-success);
color: var(--phs-color-fg);
border-color: var(--phs-color-fg);
}

.btn-default {
background-color: var(--phs-btn-success);
color: var(--phs-color-fg);
border-color: var(--phs-color-fg);
}

.btn-default:hover {
background-color: var(--phs-code-bg);
color: var(--phs-color-fg);
border-color: var(--phs-color-fg);
}

.btn:hover, .btn:focus, .btn.focus {
background-color: var(--phs-code-bg);
color: var(--phs-color-fg);
border-color: var(--phs-color-fg);
}

.tidyverse-logo {
Expand All @@ -56,4 +140,10 @@ img {
border-color: #bd27b9;
border-radius: 5px;
padding: 10px;
}

.supporting-image-left {
float: left;
width: 400px;
padding-top: 10px;
}
File renamed without changes
File renamed without changes
Binary file added images/foundations-buildingblocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
Loading