Skip to content

Commit

Permalink
Remove mean_records_per_person column as it's not used
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmlft committed Nov 27, 2024
1 parent b3284bb commit 0c3d54c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion app/R/mod_datatable.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ join_counts_to_concepts <- function(concepts, monthly_counts, selected_dates) {
# round to avoid decimal values in in total_records because of low-req replacement
total_records = sum(round(.data$record_count)),
mean_persons = round(mean(.data$person_count, na.rm = TRUE), 2),
mean_records_per_person = round(mean(.data$records_per_person, na.rm = TRUE), 2)
)
# Use inner_join so we only keep concepts for which we have counts in the selected dates
dplyr::inner_join(concepts, summarised_counts, by = "concept_id")
Expand Down
4 changes: 1 addition & 3 deletions app/tests/testthat/test-mod_datatable.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ test_that("Adding records and patients counts to concepts table works", {
concepts_with_counts <- join_counts_to_concepts(mock_selection_data, mock_monthly_counts, selected_dates)

expect_in(
c("concept_id", "concept_name", "total_records", "mean_persons", "mean_records_per_person"),
c("concept_id", "concept_name", "total_records", "mean_persons"),
names(concepts_with_counts)
)
expect_equal(nrow(concepts_with_counts), 3)
expect_equal(concepts_with_counts$total_records, c(100, 200, 300))
expect_equal(concepts_with_counts$mean_persons, c(10, 10, 10))
expect_equal(concepts_with_counts$mean_records_per_person, c(10, 10, 10))
})

test_that("Added counts depends on selected dates", {
Expand All @@ -81,7 +80,6 @@ test_that("Added counts depends on selected dates", {

expect_equal(concepts_with_counts$total_records, c(100, 100, 100))
expect_equal(concepts_with_counts$mean_persons, c(10, 10, 10))
expect_equal(concepts_with_counts$mean_records_per_person, c(10, 10, 10))
})

test_that("Only concepts with data for the selected date range are kept", {
Expand Down

0 comments on commit 0c3d54c

Please sign in to comment.