Skip to content

Commit

Permalink
fix extract date
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewscolm committed Feb 28, 2024
1 parent f0b3392 commit 480a71e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions notebooks_r/report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ library("ggsci")
library("glue")
library("ggalluvial")
library("ggrepel")
library("lubridate")
library("scales")
label_number_n <- label_number(1, 1, big.mark = ",")
Expand Down Expand Up @@ -268,12 +269,12 @@ new_ctv3_prop_table <- read_csv(here::here("output", "report_tables", "report_pa
### combine tables
combined_prop_table <- new_sus_prop_table %>%
left_join(ctv3_sus_prop_table, by = c("group", "subgroup", "population")) %>%
left_join(new_ctv3_prop_table, by = c("group", "subgroup", "population")) %>%
left_join(new_ctv3_prop_table, by = c("group", "subgroup", "population")) %>%
relocate(population, .after = last_col())
table_cols <- setNames(c("group", "", "SNOMED 2022", "SNOMED 2022 with SUS data", "SNOMED 2022 Percentage point increase\n with SUS data", "CTV3 2020", "CTV3 2020 with SUS data", "CTV3 2020 Percentage point increase\n with SUS data", "In both SNOMED and CTV3","Population"), names(combined_prop_table))
table_cols <- setNames(c("group", "", "SNOMED 2022", "SNOMED 2022 with SUS data", "SNOMED 2022 Percentage point increase\n with SUS data", "CTV3 2020", "CTV3 2020 with SUS data", "CTV3 2020 Percentage point increase\n with SUS data", "In both SNOMED and CTV3", "Population"), names(combined_prop_table))
SUS_gt <- combined_prop_table %>%
Expand Down Expand Up @@ -302,7 +303,7 @@ SUS_gt <- combined_prop_table %>%
) %>%
tab_header(
title = md("Table 1: Count of patients with a recorded ethnicity in OpenSAFELY-TPP (proportion of registered TPP population) by clinical and demographic subgroups. All counts are rounded to the nearest 5."),
)
)
SUS_gt
```
Expand Down Expand Up @@ -504,10 +505,10 @@ combined_prop_5_table <- ctv3_SUS5 %>%
left_join(new_SUS5, by = c("group", "subgroup")) %>%
rename_with(~ gsub(" 5", "", .)) %>% # remove extra 5
rename_with(~ gsub("CTV3 ", "CTV3:2020 ", .)) %>% # remove extra 5
select("group", "subgroup", sort(names(.))) %>%
select("group", "subgroup", sort(names(.))) %>%
relocate(contains("Other"), .after = last_col())
my_cols <- setNames(c("group", "", rep(c("CTV3 2020", "CTV3 2020 with SUS", "SNOMED 2022", "SNOMED 2022 with SUS"), 5)), names(combined_prop_5_table))
SUS5 <- combined_prop_5_table %>%
Expand Down Expand Up @@ -1676,7 +1677,10 @@ This report describes existing methods to derive primary care ethnicity in OpenS

# Technical details

This notebook was run on `r Sys.Date()`. The information is based on data extracted from the OpenSAFELY-TPP database on `r date(file.info(here::here("output","extract_5","input_5.feather"))$ctime)`.
```{r}
extract_date <- file.info(here::here("output", "extract_5", "input_5.feather"))$ctime
```
This notebook was run on `r Sys.Date()`. The information is based on data extracted from the OpenSAFELY-TPP database on `r date(extract_date)`.

If a clinical code appears in the primary care record on multiple dates, the latest date is used.

Expand Down

0 comments on commit 480a71e

Please sign in to comment.