Skip to content
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

EPIC: Plot refactor metadata #493

Merged
merged 118 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
bc286b7
refactor metadata + tests
M-Kusumgar Jan 18, 2024
9521ac7
clean up filters with same pattern
M-Kusumgar Jan 18, 2024
f0b3abb
add setup file
M-Kusumgar Jan 19, 2024
0918e17
Merge branch 'master' of github.com:mrc-ide/hintr into mrc-4959
M-Kusumgar Jan 19, 2024
04a1e0a
fix integration test
M-Kusumgar Jan 19, 2024
3f452c5
remove unnecessary function
M-Kusumgar Jan 19, 2024
4caf4ea
rob changed: version bump + news + helper functions in right file
M-Kusumgar Jan 19, 2024
b4c7302
revert mockery in testthat
M-Kusumgar Jan 19, 2024
eb29012
moved mockery to helper-aaa
M-Kusumgar Jan 19, 2024
ce610d8
add testthat file back in
M-Kusumgar Jan 19, 2024
33e43d2
add enum for plot names
M-Kusumgar Feb 7, 2024
a0a6a3b
added enum type
M-Kusumgar Feb 7, 2024
1eb2daa
finally get schema right
M-Kusumgar Feb 7, 2024
b4991fc
removed plotnames because it was a failure
M-Kusumgar Feb 7, 2024
b342497
quarter to period, should have a test for this
M-Kusumgar Feb 7, 2024
157fdc8
changed filter type from quarter to period
M-Kusumgar Feb 7, 2024
709f180
default plot control for plots
M-Kusumgar Feb 7, 2024
cb27246
effects to effect
M-Kusumgar Feb 8, 2024
ef425c0
options as an array
M-Kusumgar Feb 8, 2024
d012c7e
Use github actions for tests
r-ash Mar 6, 2024
ad6f694
Add naomi and naomi.options to remotes
r-ash Mar 6, 2024
fed0a8b
Install libssh-dev manually
r-ash Mar 6, 2024
af07543
Build test data before running any tests
r-ash Mar 6, 2024
9c055e0
Install docker and colima so we can run redis on mac runners
r-ash Mar 15, 2024
9978edb
Start tmate session on integration test failure
r-ash Mar 18, 2024
c52789a
Fix windows test failures
r-ash Mar 19, 2024
da4af89
Try increase retries for potentially slow mac ghactions runners
r-ash Mar 20, 2024
e6a6edb
Add github actions for building docker container
r-ash Mar 20, 2024
b30852a
Remove use of mockr in favour of new testthat helper, remove unused d…
r-ash Mar 20, 2024
aa37752
Remove buildkite build
r-ash Mar 20, 2024
0b2a6c5
Fix how tempdir is being set
r-ash Mar 20, 2024
4489ca5
Update status badges in README
r-ash Mar 20, 2024
e9bf476
Add detail into barchart filters
r-ash Mar 22, 2024
b0cf957
Merge branch 'gh-actions' into tmp-epic-plot-cleanup
r-ash Mar 22, 2024
db7779b
Update tests, only set area_level as a filter not a disaggregate/x-ax…
r-ash Mar 22, 2024
b860ee7
completed implementation, still need to do testing
M-Kusumgar Mar 27, 2024
e46de71
add endpoint to hintr api
M-Kusumgar Mar 27, 2024
55dadb3
empty
M-Kusumgar Mar 27, 2024
2d71cb0
add type conditions to the options in plot settings
M-Kusumgar Apr 5, 2024
5d221aa
Merge branch 'master' of github.com:mrc-ide/hintr into tmp-epic-plot-…
M-Kusumgar Apr 5, 2024
7c8c592
append lists correctly
M-Kusumgar Apr 5, 2024
673f260
return options
M-Kusumgar Apr 5, 2024
6fd3160
if art and anc not availble dont return time series
M-Kusumgar Apr 5, 2024
24b761d
update lintr and add 3rd arg
M-Kusumgar Apr 5, 2024
5027def
add base filters
M-Kusumgar Apr 5, 2024
7af6331
remove unnecessary function from output plot metadata
M-Kusumgar Apr 5, 2024
fd2c56b
c instead of list
M-Kusumgar Apr 5, 2024
878e174
add stateFilterId instead of filterId for quarter
M-Kusumgar Apr 5, 2024
376db79
correct column ids
M-Kusumgar Apr 5, 2024
0a7139b
Merge branch 'relative-path' of github.com:mrc-ide/hintr into tmp-epi…
M-Kusumgar Apr 24, 2024
26f0857
default effect instead of default plot setting
M-Kusumgar Apr 25, 2024
f26f722
update types
M-Kusumgar Apr 25, 2024
ec262d9
Add calibrate plot into output metadata
r-ash Apr 25, 2024
0513474
return plotting metadata instead of normal metadata
M-Kusumgar Apr 25, 2024
ac5a077
empty
M-Kusumgar Apr 25, 2024
9788b2c
function arg
M-Kusumgar Apr 25, 2024
9225908
Add calibrate metadata into schema
r-ash Apr 29, 2024
fcf02e2
correct column id for anc dataset
M-Kusumgar Apr 29, 2024
65a3cef
Add label for calibrate indicator
r-ash Apr 29, 2024
d1da482
Remove metadata from calibrate plot response
r-ash Apr 30, 2024
2c4a171
Temporarily build docker images for PR into plot cleanup
r-ash Apr 30, 2024
da28d75
Set default filter values for calibrate barchart
r-ash Apr 30, 2024
6de3cc8
Fix typo
r-ash Apr 30, 2024
ddd47a9
Add metadata for calibrate plot
r-ash May 1, 2024
83c3730
Move calibrate metadata back into same response as data
r-ash May 1, 2024
6bd38f2
Fix typo in default age
r-ash May 2, 2024
15b6bbc
Bump naomi version
r-ash May 2, 2024
10d69f3
Move visibility flag on a filter into an effect
r-ash May 7, 2024
afff259
Make metadata more consistent, remove unnecessary default values
r-ash May 8, 2024
e066455
Merge pull request #510 from mrc-ide/new-calibrate-metadata
r-ash May 8, 2024
ca02830
Add comparison plot metadata
r-ash May 3, 2024
5bda84a
Return indicator and detail in comparison metadata
r-ash May 3, 2024
55fdde1
Add area level to returned data
r-ash May 3, 2024
ec74a47
Add missing setFilters effect and ensure source filter is hidden
r-ash May 3, 2024
29e718d
Update effects to set source filter as hidden
r-ash May 7, 2024
64226aa
Update metadata to remove detail filter when area is not a multiselect
r-ash May 7, 2024
faecdb7
Remove unnecessary defaults, remove some unused code
r-ash May 8, 2024
3086489
Fix default filters for comparison plot
r-ash May 20, 2024
c449992
Add metadata for table
r-ash May 8, 2024
f88c109
Add custom plot effect into metadata
r-ash May 8, 2024
6e95bac
Run docker build on merge into comparison metadata
r-ash May 8, 2024
e91b0bd
Split schema up for more useful generated metadata
r-ash May 8, 2024
f51693c
Remove now unused schema
r-ash May 8, 2024
3ef17bd
Use set hidden for area filter in table metadata
r-ash May 9, 2024
08c4590
Make area a multiselect
r-ash May 9, 2024
8e8d627
Add some context for the choices of metadata
r-ash May 9, 2024
79fb3f4
Update metadata to match current prod defaults
r-ash May 20, 2024
aa7167b
Build docker image on merged into table-metadata
r-ash May 20, 2024
3c59139
Hide detail filter in barchart when area is a single select
r-ash May 20, 2024
b3968e2
Fix order of filters in comparison plot
r-ash May 20, 2024
d9fb5ac
Fix order of x-axis and disaggregate by and remove duplicate area con…
r-ash May 20, 2024
a472994
Merge pull request #513 from mrc-ide/comparison-metadata
r-ash May 20, 2024
9792203
Merge pull request #514 from mrc-ide/table-metadata
r-ash May 20, 2024
a392713
Merge pull request #516 from mrc-ide/comparison-metadata
r-ash May 20, 2024
cdacfdb
Remove branch pins
r-ash May 20, 2024
c0e38f8
Update metadata to use better defaults for age
r-ash May 31, 2024
dc04502
Merge pull request #515 from mrc-ide/metadata-defaults
r-ash Aug 23, 2024
1f41047
Set default value for detail level in input plots
r-ash Aug 27, 2024
0676fae
Use self referencing type for NestedFilterOption
r-ash Sep 4, 2024
e57b36d
Update metadata for comparison barchart
r-ash Sep 4, 2024
c807ab9
Remove self referential schema, this doesn't work with type generation
r-ash Sep 5, 2024
9a52b14
Update default filter selections for comparison plot
r-ash Sep 5, 2024
ef26cb7
Rename ChoroplethIndicatorMetadata to IndicatorMetadata
r-ash Sep 5, 2024
f3a143a
Merge pull request #522 from mrc-ide/metadata-rename
r-ash Sep 5, 2024
8566ce1
Merge pull request #501 from mrc-ide/tmp-epic-plot-cleanup-input
r-ash Sep 6, 2024
4f7b9d4
Merge branch 'master' into tmp-epic-plot-cleanup
r-ash Sep 6, 2024
6c549dc
Remove a bunch of old code and endpoints
r-ash Sep 6, 2024
eb91c31
Add tests of new metadata
r-ash Sep 9, 2024
03e85a0
Run CI on merge into temporary epic branch
r-ash Sep 9, 2024
0e7e317
Update integration tests
r-ash Sep 9, 2024
5364451
Remove macos CI builds
r-ash Sep 9, 2024
3d0a4ea
Improve testing
r-ash Sep 9, 2024
6b8bf45
Add explanatory note about test, and remove old debug
r-ash Sep 10, 2024
5582cd8
Merge pull request #523 from mrc-ide/remove-old-endpoints
r-ash Sep 10, 2024
ea9caac
Bump version number and add news item
r-ash Sep 10, 2024
b5e2c38
Update build follow moving repo org
r-ash Sep 13, 2024
61417e2
Fix test failures
r-ash Sep 16, 2024
0aa37a1
Merge pull request #525 from hivtools/org-move
r-ash Sep 16, 2024
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
13 changes: 13 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
Expand All @@ -34,6 +35,12 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- name: Install libssh
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libssh-dev

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
Expand All @@ -47,10 +54,16 @@ jobs:
needs: check

- name: Start Redis
if: runner.os != 'Windows'
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: "5.x"

- name: Start Redis (windows)
if: runner.os == 'Windows'
run: |
choco install memurai-developer

- name: Build test data
run: Rscript ./scripts/build_test_data

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/R-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
Expand All @@ -32,6 +33,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install libssh
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libssh-dev

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
Expand All @@ -46,10 +53,15 @@ jobs:
extra-packages: any::devtools

- name: Start Redis
if: runner.os != 'Windows'
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: "5.x"

- name: Start Redis (windows)
if: runner.os == 'Windows'
run: |
choco install memurai-developer
- name: Build test data
run: |
./scripts/build_test_data
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
env:
TAG_SERVER_DH: mrcide/hintr
TAG_WORKER_DH: mrcide/hintr-worker
TAG_SERVER_GHCR: mrc-ide/hintr
TAG_WORKER_GHCR: mrc-ide/hintr-worker
TAG_SERVER_GHCR: hivtools/hintr
TAG_WORKER_GHCR: hivtools/hintr-worker

jobs:
docker:
Expand All @@ -32,6 +32,9 @@ jobs:
fi
echo "CI_SHA=${LONG_SHA:0:7}" >> $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- name: Install libssh
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libssh-dev

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install libssh
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libssh-dev

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Expand All @@ -28,10 +34,16 @@ jobs:
needs: coverage

- name: Start Redis
if: runner.os != 'Windows'
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: "5.x"

- name: Start Redis (windows)
if: runner.os == 'Windows'
run: |
choco install memurai-developer

- name: Build test data
run: |
./scripts/build_test_data
Expand Down
5 changes: 2 additions & 3 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
linters: with_defaults(
linters: linters_with_defaults(
object_length_linter = NULL,
object_name_linter = NULL,
object_usage_linter = NULL,
cyclocomp_linter = NULL
)
cyclocomp_linter = NULL)
exclusions: list("tests/testthat.R")
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hintr
Title: R API for calling naomi district level HIV model
Version: 1.1.26
Version: 1.2.0
Authors@R:
person(given = "Robert",
family = "Ashton",
Expand All @@ -23,7 +23,7 @@ Imports:
glue,
ids,
jsonlite (>= 1.2.2),
naomi (>= 2.9.24),
naomi (>= 2.9.27),
naomi.options (>= 1.1.0),
porcelain (>= 0.1.8),
qs,
Expand All @@ -40,6 +40,7 @@ Suggests:
callr,
cli,
covr,
duckdb,
httr,
jsonvalidate,
mockery,
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# hintr 1.2.0

* Update plot metadata format to make it more generic and generally usable
* Add a new endpoint `/review-input/metadata` to return metadata for all input plots
* Remove `/meta/plotting` and `/meta/plotting<iso3>` endpoints as these are no longer used

# hintr 1.1.16

* Add an optional arg to API startup to turn on a health-check. If set, the interval after which the next time the redis connection is used the connection will be reset. 0 for no reconnection. This is needed for running on cloud services as they close idle tcp connections after a set time. On Azure it if 4 mins, so we need to the client to be able to reconnect if this interval has passed.
Expand Down
33 changes: 13 additions & 20 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ api_build <- function(queue, validate = FALSE, logger = NULL) {
api$handle(endpoint_baseline_combined())
api$handle(endpoint_validate_survey_programme())
api$handle(endpoint_input_time_series_plot())
api$handle(endpoint_review_input_metadata())
api$handle(endpoint_model_options())
api$handle(endpoint_model_options_validate())
api$handle(endpoint_model_submit(queue))
Expand All @@ -15,14 +16,11 @@ api_build <- function(queue, validate = FALSE, logger = NULL) {
api$handle(endpoint_model_calibrate_options())
api$handle(endpoint_model_calibrate_submit(queue))
api$handle(endpoint_model_calibrate_status(queue))
api$handle(endpoint_model_calibrate_result(queue))
api$handle(endpoint_model_calibrate_metadata(queue))
api$handle(endpoint_model_calibrate_data(queue))
api$handle(endpoint_model_calibrate_result_path(queue))
api$handle(endpoint_model_calibrate_plot(queue))
api$handle(endpoint_comparison_plot(queue))
api$handle(endpoint_plotting_metadata_iso3())
api$handle(endpoint_plotting_metadata_default())
api$handle(endpoint_download_submit(queue))
api$handle(endpoint_download_status(queue))
api$handle(endpoint_download_result(queue))
Expand Down Expand Up @@ -183,6 +181,18 @@ endpoint_input_time_series_plot <- function() {
returning = response)
}

endpoint_review_input_metadata <- function() {
input <- porcelain::porcelain_input_body_json(
"input", "ReviewInputFilterMetadataRequest.schema", schema_root())
response <- porcelain::porcelain_returning_json(
"ReviewInputFilterMetadataResponse.schema", schema_root())
porcelain::porcelain_endpoint$new("POST",
"/review-input/metadata",
review_input_filter_metadata,
input,
returning = response)
}

returning_json_version <- function(schema = NULL, root = NULL,
status_code = 200L) {
## This is the same as porcelain::porcelain_returning_json except we
Expand Down Expand Up @@ -358,23 +368,6 @@ endpoint_comparison_plot <- function(queue) {
returning = response)
}

endpoint_plotting_metadata_iso3 <- function() {
endpoint_plotting_metadata("/meta/plotting/<iso3>")
}

endpoint_plotting_metadata_default <- function() {
endpoint_plotting_metadata("/meta/plotting")
}

endpoint_plotting_metadata <- function(path) {
response <- porcelain::porcelain_returning_json(
"PlottingMetadataResponse.schema", schema_root())
porcelain::porcelain_endpoint$new("GET",
path,
plotting_metadata,
returning = response)
}

## Return same headers as binary returning but ensure no body is returned.
returning_binary_head <- function(status_code = 200L) {
porcelain::porcelain_returning("application/octet-stream",
Expand Down
2 changes: 1 addition & 1 deletion R/calibrate.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run_calibrate <- function(model_output, calibration_options, path_results,
})
}

path_results <- normalizePath(path_results, mustWork = TRUE)
path_results <- normalizePath(path_results, winslash = "/", mustWork = TRUE)
plot_data_path <- tempfile("plot_data", tmpdir = path_results,
fileext = ".duckdb")
model_output_path <- tempfile("model_output", tmpdir = path_results,
Expand Down
2 changes: 1 addition & 1 deletion R/downloads.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ download <- function(model_output, type, path_results, input, language = NULL) {
agyw = ".xlsx",
hintr_error(t_("INVALID_DOWNLOAD_TYPE", list(type = type)),
"INVALID_DOWNLOAD_TYPE"))
path_results <- normalizePath(path_results, mustWork = TRUE)
path_results <- normalizePath(path_results, winslash = "/", mustWork = TRUE)
download_path <- tempfile(type, tmpdir = path_results, fileext = file_ext)

if (type == "spectrum") {
Expand Down
Loading