VHK/vhk.Rmd

275 lines
9.0 KiB
Plaintext
Raw Normal View History

2018-12-28 13:10:19 +00:00
---
title: "Vorhofkatheter-Statistik"
author: "Daniel Kraus"
2018-12-28 16:09:26 +00:00
date: '2018-12-29'
2018-12-28 13:10:19 +00:00
output:
2018-12-28 16:09:26 +00:00
slidy_presentation: default
2018-12-29 08:54:29 +00:00
ioslides_presentation: default
2018-12-28 13:10:19 +00:00
beamer_presentation: default
---
```{r setup, include=FALSE}
2018-12-28 16:09:26 +00:00
knitr::opts_chunk$set(echo = FALSE, warning = FALSE)
2018-12-28 13:10:19 +00:00
library(tidyverse)
library(lubridate)
2018-12-28 13:10:19 +00:00
2019-01-01 19:10:05 +00:00
raw_data = read_csv('vhk.csv') %>% mutate(ImplYear = year(Date)) %>% mutate(ExplYear = year(RemovalDate))
2018-12-28 13:10:19 +00:00
2019-01-01 19:10:05 +00:00
first_year = min(raw_data$ImplYear)
last_year = max(raw_data$ImplYear)
max_y_break = ((max((raw_data %>% count(ImplYear))$n) %/% 10) + 1) * 10
2018-12-28 13:10:19 +00:00
reference_year = year(today()) - (today() < make_date(year(today()), 1, 31))
2018-12-28 13:10:19 +00:00
```
## Katheterimplantationen pro Jahr
```{r cath_by_year }
2019-01-01 19:10:05 +00:00
raw_data %>%
count(ImplYear) %>%
ggplot(aes(x = ImplYear, y = n)) +
2018-12-28 13:10:19 +00:00
geom_col() +
scale_y_continuous(breaks = seq(from = 0, to = max_y_break, by = 10)) +
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
2018-12-28 16:09:26 +00:00
labs(x = NULL, y = "Anzahl Katheter")
2018-12-28 13:10:19 +00:00
```
## Katheterimplantationen pro Operateur im Jahr `r reference_year`
```{r}
2019-01-01 19:10:05 +00:00
raw_data %>% filter(Year == reference_year) %>%
count(Surgeon) %>%
arrange(n) %>%
mutate(Surgeon = factor(Surgeon, levels = Surgeon)) %>%
ggplot(aes(x = Surgeon, y = n)) +
geom_col() +
coord_flip() +
labs(x = NULL, y = stringr::str_c("Anzahl Katheter im Jahr ", reference_year))
```
2018-12-31 07:37:50 +00:00
<!--
## Katheterimplantationen im Jahresverlauf
```{r cath_by_month}
raw_data %>% mutate(Month = month(Date)) %>%
2018-12-31 07:37:50 +00:00
group_by(Year) %>%
count(Month) %>%
ggplot(aes(x = Month, y = n, group = Year, alpha = Year)) +
geom_point() +
geom_line()
```
-->
## Katheterexplantationen pro Jahr
```{r expl_by_year}
2019-01-01 19:10:05 +00:00
raw_data %>%
2018-12-31 07:37:50 +00:00
# group_by(InsertionSite, Side) %>%
count(ExplYear) %>%
ggplot(aes(x = ExplYear, y = n)) +
geom_col() +
# facet_grid(rows = vars(InsertionSite), cols = vars(Side)) +
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
labs(x = NULL, y = "Explantationen")
```
## Explantationen pro Implantation pro Jahr
```{r expl_by_cath_by_year}
2019-01-01 19:10:05 +00:00
raw_data %>%
2018-12-31 07:37:50 +00:00
group_by(ImplYear) %>%
summarise(ExplByImpl = sum(!is.na(ExplYear)) / n()) %>%
ggplot(aes(x = ImplYear, y = ExplByImpl)) +
geom_col() +
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
labs(x = NULL, y = "Explantationen pro Implantation")
```
## Verweildauern der Katheter
```{r durations, message=FALSE}
2019-01-01 19:10:05 +00:00
raw_data %>% mutate(Duration = RemovalDate - Date) %>%
group_by(ImplYear) %>%
2018-12-31 07:37:50 +00:00
summarize(MedianDuration = median(Duration, na.rm = TRUE)) %>%
2019-01-01 19:10:05 +00:00
ggplot(aes(x = ImplYear, y = MedianDuration)) +
2018-12-31 07:37:50 +00:00
geom_col() +
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
labs(x = NULL, y = "Mediane Katheter-Verweildauer [Tage]")
```
## Gründe der Katheterexplantation
### Variante A: Absolute Zahlen
```{r removal_reasons, message=FALSE}
raw_data %>% filter(!is.na(RemovalDate), !is.na(RemovalReason)) %>%
2019-01-02 06:37:05 +00:00
mutate(ImplYear = ImplYear %% 100) %>%
group_by(ImplYear) %>%
2018-12-31 07:37:50 +00:00
count(RemovalReason) %>%
2019-01-02 06:37:05 +00:00
ggplot(aes(x = ImplYear, y = n)) +
2018-12-31 07:37:50 +00:00
geom_point() + geom_line() +
scale_x_continuous(breaks = scales::pretty_breaks()) +
scale_y_continuous(breaks = scales::pretty_breaks()) +
facet_wrap(vars(RemovalReason)) +
2019-01-02 06:37:05 +00:00
labs(x = "Implantationsjahr", y = "Anzahl entfernter Katheter")
2018-12-31 07:37:50 +00:00
```
### Variante B: auf die Zahl der in dem Jahr gelegten Katheter bezogen
```{r removal_reasons_normalized, message=FALSE}
raw_data %>%
2019-01-02 06:37:05 +00:00
select(ImplYear, RemovalDate, RemovalReason) %>%
2019-01-01 19:10:05 +00:00
mutate(ImplYear = ImplYear %% 100) %>%
2019-01-02 06:37:05 +00:00
group_by(ImplYear) %>%
add_count(ImplYear) %>%
add_count(RemovalReason) %>%
2018-12-31 07:37:50 +00:00
mutate(i = nn/n) %>%
2019-01-02 06:37:05 +00:00
filter(!is.na(RemovalDate), !is.na(RemovalReason)) %>%
ggplot(aes(x = ImplYear, y = i)) +
2018-12-31 07:37:50 +00:00
geom_point() + geom_line() +
scale_x_continuous(breaks = scales::pretty_breaks()) +
scale_y_continuous(breaks = scales::pretty_breaks()) +
facet_wrap(vars(RemovalReason)) +
2019-01-02 06:37:05 +00:00
labs(x = "Implantationsjahr", y = "Anzahl entfernter Katheter / gelegter Katheter")
2018-12-31 07:37:50 +00:00
```
2019-01-01 19:10:05 +00:00
## Wann treten Infektionen auf?
```{r infections, message=FALSE}
raw_data %>% filter(!is.na(RemovalDate), RemovalReason == "Infektion") %>%
2019-01-02 06:37:05 +00:00
mutate(Duration = RemovalDate - Date, Week = as.integer(Duration) %/% 7 + 1) %>%
filter(Week <= 56) %>%
ggplot(aes(x = Week)) +
2019-01-01 19:10:05 +00:00
geom_bar(width = 0.9) +
# raw_data %>% filter(!is.na(RemovalDate), RemovalReason == "Infektion") %>%
scale_x_continuous(breaks = seq(from = 0, to = 56, by = 4)) +
scale_y_continuous(breaks = seq(from = 0, to = 10, by = 1)) +
facet_grid(rows = vars(ImplYear)) +
labs(x = "Woche nach Implantation", y = "Anzahl wg. Infektion entfernter Katheter",
2019-01-02 06:37:05 +00:00
title = "Liegedauer infizierter Katheter nach Implantationsjahr",
subtitle = "Die Graphik berücksichtigt nur Infektionen im ersten Jahr")
2019-01-01 19:10:05 +00:00
```
<!--
## Explantationsgründe je Implanteur
```{r removal_reasons_by_surgeon, message=FALSE}
raw_data %>% filter(!is.na(RemovalDate)) %>%
mutate(ExplYear = year(RemovalDate)) %>%
filter(ExplYear > year(today()) - 4) %>%
group_by(ExplYear, Surgeon) %>%
count(RemovalReason) %>%
ggplot(aes(x = ExplYear, y = n)) +
geom_point() + geom_line() +
facet_grid(rows = vars(Surgeon), cols = vars(RemovalReason)) +
labs(x = NULL, y = "Anzahl expl. Katheter")
```
-->
2018-12-31 07:37:50 +00:00
2019-01-01 17:06:11 +00:00
## Alter der Patienten bei Implantation
2018-12-28 13:10:19 +00:00
```{r patient_age}
raw_data %>%
2019-01-01 19:10:05 +00:00
ggplot(aes(group = ImplYear, x = ImplYear, y = Age)) +
2018-12-28 13:10:19 +00:00
geom_boxplot() +
coord_cartesian(ylim = c(20, 100)) +
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
scale_y_continuous(breaks = seq(from = 20, to = 100, by = 10)) +
2018-12-28 16:09:26 +00:00
labs(x = NULL, y = "Jahre")
2018-12-28 13:10:19 +00:00
```
2019-01-01 17:06:11 +00:00
## Geschlecht der Patienten bei Implantation
2018-12-28 13:10:19 +00:00
```{r patient_sex}
2019-01-01 19:10:05 +00:00
raw_data %>% group_by(ImplYear) %>%
summarise(PercentFemale = sum(Sex == "weiblich") / n()) %>%
ggplot(aes(x = ImplYear, y = PercentFemale)) +
2018-12-28 13:10:19 +00:00
geom_col() +
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
2018-12-31 07:37:50 +00:00
coord_cartesian(ylim = c(0, 1)) +
2018-12-28 13:10:19 +00:00
scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
labs(x = NULL, y = "Anteil Frauen")
```
2018-12-28 16:09:26 +00:00
## Katheterlokalisation
Ist da ein Trend hin zu immer mehr Kathetern von links?!
2018-12-29 08:54:29 +00:00
2018-12-28 16:09:26 +00:00
```{r insertion_site}
raw_data %>% mutate(Side = factor(Side, levels = c("rechts", "links"))) %>%
2019-01-01 19:10:05 +00:00
ggplot(aes(x = ImplYear)) +
2018-12-28 16:09:26 +00:00
facet_grid(InsertionSite ~ Side) +
geom_bar() +
labs(x = NULL, y = "Anzahl Katheter")
```
## Anteil der Arztrollen
Um 2014 herum haben einige die Facharztprüfung abgelegt, ist das der Grund für die Auffälligkeit 2015/2016?
2018-12-29 08:54:29 +00:00
2018-12-28 16:09:26 +00:00
```{r percent_residents}
2019-01-01 19:10:05 +00:00
raw_data %>% group_by(ImplYear) %>%
2018-12-28 16:09:26 +00:00
summarize(Assistenzarzt = sum(SurgeonRole == "Assistenzarzt") / n(),
Facharzt = sum(SurgeonRole == "Facharzt") / n(),
Oberarzt = sum(SurgeonRole == "Oberarzt") / n()) %>%
gather(key = Role, value = Percent, Assistenzarzt, Facharzt, Oberarzt) %>%
2019-01-01 19:10:05 +00:00
ggplot(aes(x = ImplYear, y = Percent)) +
2018-12-28 16:09:26 +00:00
scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) +
scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
facet_grid(Role ~ .) +
geom_col() +
labs(x = NULL, y = "Anteil in den gelegten Kathetern")
```
## Hitparade der Durchleuchtungsdauern
```{r greatest_fluoroscopy}
raw_data %>%
group_by(Surgeon) %>%
summarize(FluoroscopyIndex = median(InsertionFluoroscopyDuration, na.rm = TRUE)) %>%
arrange(desc(FluoroscopyIndex)) %>%
top_n(-10, FluoroscopyIndex) %>%
mutate(Surgeon = factor(Surgeon, levels = Surgeon)) %>%
ggplot(aes(x = Surgeon, y = FluoroscopyIndex)) +
geom_col() +
coord_flip() +
labs(x = NULL, y = "Median der Durchleuchtungsdauer [s]")
```
2018-12-31 07:37:50 +00:00
## Individuelle Durchleuchtungsdauern
Nur Operateure der letzten 4 Jahre
```{r individual_fluoroscopy, message=FALSE}
to_year = year(today()) %% 100
from_year = to_year - 3
raw_data %>%
2019-01-01 19:10:05 +00:00
mutate(ImplYear = ImplYear %% 100) %>%
filter(ImplYear >= from_year, !is.na(InsertionFluoroscopyDuration)) %>%
group_by(Surgeon, ImplYear) %>%
2018-12-31 07:37:50 +00:00
summarize(FluoroscopyIndex = median(InsertionFluoroscopyDuration, na.rm = TRUE)) %>%
ungroup() %>%
# mutate(Surgeon = factor(Surgeon, levels = Surgeon)) %>%
2019-01-01 19:10:05 +00:00
ggplot(aes(x = ImplYear, y = FluoroscopyIndex)) +
2018-12-31 07:37:50 +00:00
geom_point() +
geom_line() +
scale_x_continuous(breaks = seq(from = from_year, to = to_year, by = 1 )) +
2018-12-31 07:37:50 +00:00
facet_wrap(vars(Surgeon)) +
labs(x = NULL, y = "Median der Durchleuchtungsdauer [s]")
```
2018-12-28 13:10:19 +00:00
## Hitparade der Implanteure
```{r greatest_surgeons}
raw_data %>% count(Surgeon) %>% arrange(n) %>% top_n(10, n) %>% mutate(Surgeon = factor(Surgeon, levels = Surgeon)) %>%
ggplot(aes(x = Surgeon, y = n)) +
geom_col() +
coord_flip() +
2018-12-28 16:09:26 +00:00
labs(x = NULL, y = "Gesamtzahl Katheter")
2018-12-28 13:10:19 +00:00
```
## Hitparade der Assistenten
2018-12-29 08:54:29 +00:00
Einsame Spitze... Romana Ziegler!
2018-12-28 13:10:19 +00:00
```{r greatest_assistants}
raw_data %>% count(Assistant) %>% arrange(n) %>% top_n(10, n) %>% mutate(Assistant = factor(Assistant, levels = Assistant)) %>%
ggplot(aes(x = Assistant, y = n)) +
geom_col() +
coord_flip() +
2018-12-28 16:09:26 +00:00
labs(x = NULL, y = "Gesamtzahl Katheter")
2018-12-28 13:10:19 +00:00
```
## Ende
Das R-Skript, mit dem diese Präsentation erstellt wurde, befindet sich hier:
<https://git.bovender.de/daniel/VHK>