Skip to content

Commit 981c5ba

Browse files
authored
Merge pull request #670 from The-Strategy-Unit/647-bump-v5
Bump version 5, improve docs
2 parents 4da9eca + 40c1191 commit 981c5ba

3 files changed

Lines changed: 36 additions & 14 deletions

File tree

.Renviron.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ NHP_ENCRYPT_KEY=
1212
NHP_OUTPUTS_URI=https://connect.strategyunitwm.nhs.uk/nhp/{version}/outputs/
1313
CACHE_VERSION=
1414
FEEDBACK_FORM_URL=
15+
YEAR_HORIZON_DEFAULT=2041
16+
YEAR_HORIZON_MAX=2043
17+
YEAR_BASELINE_DEFAULT=2024
18+
YEAR_BASELINE_MIN=2023

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: inputs
22
Title: NHP Model Inputs
3-
Version: 4.4.1
3+
Version: 5.0.0
44
Authors@R: c(
55
person("Tom", "Jemmett", , "thomas.jemmett@nhs.net", role = c("cre", "aut")),
66
person("Matt", "Dray", , "matt.dray@nhs.net", role = "aut"),

README.Rmd

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,20 @@ The app is built and maintained by members of [the Strategy Unit's Data Science
4040
Technically there are two apps: the main app in the `main` branch, and the inputs selection app (where users start or edit a scenario) in the `inputs_selection_app` branch.
4141
Users arrive at the selection app before being routed to the main app.
4242

43-
Both apps are built with [Shiny](https://shiny.posit.co/) and the main app uses the [the {golem} package](https://thinkr-open.github.io/golem/). Server and UI modules can be found in `R/`, configuration in `inst/golem-config.yml` and supporting data and text in `inst/app/`.
44-
45-
Packages used in the app are listed in `DESCRIPTION`, and can be installed with `devtools::install_deps(dependencies = TRUE)`.
43+
Both apps are built with [Shiny](https://shiny.posit.co/) and the main app uses the [the {golem} package](https://thinkr-open.github.io/golem/).
44+
Server and UI modules can be found in `R/`, configuration in `inst/golem-config.yml` and supporting data and text in `inst/app/`.
4645

4746
### Run locally
4847

4948
Run the app locally on your machine to test that your changes work as expected.
5049

51-
To prepare, add an `.Renviron` file to the project root that contains the required environment variables. There is an `.Renviron.example` file which describes the required variables.
52-
You can get these from a member of the Data Science team.
50+
#### Setup
51+
52+
First, install the required packages listed in the DESCRIPTION with `pak::local_install_deps(dependencies = TRUE)`.
53+
54+
Then add an `.Renviron` file to the project root that contains the required environment variables.
55+
Copy into it the required variables, which are listed in the `.Renviron.example`.
56+
You can get the values you need from a member of the Data Science team.
5357

5458
Then, from the `main` branch (or your development branch of it), use Git's `worktree` function to put the `inputs_selection_app` branch (or your development branch of it) in its own subfolder.
5559

@@ -60,21 +64,35 @@ git fetch origin inputs_selection_app
6064
git worktree add inputs_selection_app inputs_selection_app
6165
```
6266

67+
The first argument is the name of the folder in which to put the branch content.
6368
If you want a development version of the inputs selection app, you can specify the branch name as the second of the arguments to `git worktree add`.
6469

65-
To run the app from RStudio, start up the selection app by opening the `dev/watch.R` script, go to the 'Background Jobs' tab of the console pane and click the 'Start Background Job' button.
66-
In the 'Run Script as Background Job' dialog box select the project root as the 'Working Directory', then hit 'Start'.
67-
When ready, the app will tell you to visit `http://127.0.0.1:9081/` in your browser.
68-
69-
Note that your selections in the app remain local to you and the resulting json file of parameters for your scenario will live in your local `params/development/` directory.
70-
These scenarios will be selectable and editable in future from your locally-run inputs selection app.
71-
7270
If you need to remove the selection-app folder at any point, you can terminate the background job (if running) and in the terminal run:
7371

7472
```
7573
git worktree remove inputs_selection_app
7674
```
7775

76+
#### Run the app
77+
78+
Once setup, we can run the app.
79+
This is done by launching a background Shiny app and then watching the files for changes, which causes an auto-reload.
80+
The method for doing this depends on your IDE.
81+
82+
In RStudio:
83+
84+
1. Open the `dev/watch.R` script and go to the 'Background Jobs' tab of the console pane and click the 'Start Background Job' button.
85+
2. Click 'Start' after checking that the 'R Script' path is pre-populated with the path to `watch.R` (otherwise select it yourself).
86+
3. When ready, a message will tell you to visit `http://127.0.0.1:9081/` in your browser.
87+
88+
In Positron: run `source('dev/watch.R')` and click the link to the URL when complete.
89+
90+
In VS Code: open the command palette (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>), search for 'Tasks: Run Task', then select 'R: Run App (watch)' and finally click the link to the URL when complete.
91+
92+
Making selections in the app will cause values to be written to a local json file, which will live in your local `params/development/` directory.
93+
These scenarios will be selectable and editable in future from your locally-run inputs selection app.
94+
They will not be available from the deployed app.
95+
7896
### Test in dev
7997

8098
During pre-release QA we test both apps on the server.
@@ -84,7 +102,7 @@ To test the unreleased app in our development environment:
84102

85103
1. Merge any PRs you want to test into the `main` branch.
86104
2. If you've changed any dependencies, run `dev/generate_manifest.R` to update `manifest.json`.
87-
3. If you've made any changes to the inputs selection app, run the manual `deploy()` call under the 'development' heading in the `deploy.R` script in your selection app development branch.
105+
3. If you've made any changes to the inputs selection app, run the manual `deploy()` call under the 'development' heading in the `deploy.R` script in your selection-app development branch.
88106

89107
When using the dev inputs selection app on Connect, make sure to set the 'Model Version' dropdown to 'dev' in the expandable 'Advanced Options' box.
90108
That way you'll be taken to the dev inputs app when you hit 'Start'.

0 commit comments

Comments
 (0)