Skip to content

Commit

Permalink
bugfix prod
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthon committed Nov 7, 2022
2 parents 6e2307c + 5ea8034 commit 5b41528
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: norgast
Type: Package
Title: Resultatrapporter for NoRGast
Version: 2.2.0
Version: 2.3.0
Date: 2015-12-17
Author: Kevin Thon
Maintainer: Kevin Thon <kevin.thon@skde.no>
Expand Down
5 changes: 3 additions & 2 deletions R/NorgastFigAndeler.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ FigAndeler <- function(RegData=0, valgtVar='Alder', datoFra='2014-01-01', datoT
elektiv=99, BMI='', tilgang='', valgtShus='', minPRS=0,
maxPRS=2.2, ASA='', whoEcog= '', forbehandling='', hentData=F,
op_gruppe='', ncsp='', modGlasgow = '', hastegrad_hybrid=99,
robotassiastanse=99, kun_ferdigstilte=TRUE, tilgang_utvidet='')
robotassiastanse=99, kun_ferdigstilte=TRUE, tilgang_utvidet='',
ny_stomi=99)
{

# print(datoFra)
Expand All @@ -125,7 +126,7 @@ FigAndeler <- function(RegData=0, valgtVar='Alder', datoFra='2014-01-01', datoT
ASA=ASA, whoEcog=whoEcog, forbehandling=forbehandling, malign=malign,
op_gruppe=op_gruppe, ncsp=ncsp, modGlasgow=modGlasgow, hastegrad_hybrid=hastegrad_hybrid,
robotassiastanse=robotassiastanse, kun_ferdigstilte=kun_ferdigstilte,
tilgang_utvidet=tilgang_utvidet)
tilgang_utvidet=tilgang_utvidet, ny_stomi=ny_stomi)
RegData <- NorgastUtvalg$RegData
utvalgTxt <- NorgastUtvalg$utvalgTxt

Expand Down
4 changes: 2 additions & 2 deletions R/NorgastPrepVar.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ NorgastPrepVar <- function(RegData, valgtVar, enhetsUtvalg=1)

if (valgtVar=='Op_gr') {
tittel <- 'Operasjonsgrupper'
gr <- c(1:12,99)
gr <- c(1:13,99)
grtxt <- c('Kolonreseksjoner','Rektumreseksjoner','Øsofagusreseksjoner','Ventrikkelreseksjoner',
'Leverreseksjoner',"Whipples operasjon", "Andre pankreasreseksjoner", 'Cholecystektomi', 'Appendektomi', 'Tynntarmsreseksjon',
'Leverreseksjoner',"Whipples operasjon", "Distale pankreasreseksjoner", "Andre pankreasreseksjoner", 'Cholecystektomi', 'Appendektomi', 'Tynntarmsreseksjon',
'Gastric bypass', 'Gastric sleeve', 'Annet')
RegData$VariabelGr <- factor(RegData$Variabel, levels=gr, labels = grtxt)
subtxt <- 'Operasjonsgrupper'
Expand Down
7 changes: 5 additions & 2 deletions R/NorgastUtvalg.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NorgastUtvalg <- function(RegData, datoFra='2014-01-01', datoTil="2100-01-01",
forbehandling='', malign=99, fargepalett='BlaaRapp',
op_gruppe='', ncsp='', icd='', hastegrad_hybrid=99,
dagtid=99, robotassiastanse=99, kun_ferdigstilte=TRUE,
tilgang_utvidet='')
tilgang_utvidet='', ny_stomi=99)
{
# Definerer intersect-operator
"%i%" <- intersect
Expand Down Expand Up @@ -42,10 +42,12 @@ NorgastUtvalg <- function(RegData, datoFra='2014-01-01', datoTil="2100-01-01",
indICD <- if (icd[1] != '') {which(RegData$Hoveddiagnose2 %in% icd)} else {indICD <- 1:Ninn}
indRobot <- if (robotassiastanse %in% c(0,1)){which(RegData$Robotassistanse == robotassiastanse)} else {indRobot <- 1:Ninn}
indFerdig <- if (kun_ferdigstilte) {which(RegData$OppfStatus == 1)} else {indFerdig <- 1:Ninn}
indStomi <- if (ny_stomi %in% c(0,1)) {which(RegData$NyStomi == ny_stomi)} else {1:Ninn}

indMed <- indAld %i% indDato %i% indKj %i% indVarMed %i% indOp_gr %i% indElekt %i% indBMI %i%
indTilgang %i% indPRS %i% indASA %i% indWHO %i% indForb %i% indMalign %i% indNCSP %i% indHast %i%
indICD %i% indGlasgow %i% indHast2 %i% indDag %i% indRobot %i% indFerdig %i% indTilgangUtvidet
indICD %i% indGlasgow %i% indHast2 %i% indDag %i% indRobot %i% indFerdig %i% indTilgangUtvidet %i%
indStomi
RegData <- RegData[indMed,]
if (ncsp[1] != '') {ncsp <- sort(unique(substr(RegData$Hovedoperasjon, 1, 5)))}

Expand Down Expand Up @@ -81,6 +83,7 @@ NorgastUtvalg <- function(RegData, datoFra='2014-01-01', datoTil="2100-01-01",
if (malign %in% c(0,1)){paste0('Diagnose: ', c('Benign', 'Malign')[malign+1])},
if (icd[1] != '') {paste0('ICD-10-kode(r): ', paste(sub("(\\w+).*", "\\1", icd), collapse=', '))},
if (robotassiastanse %in% c(0,1)){paste0('Minimalinvasiv: ', c('Konv. laparoskopi', 'Robotassistert')[robotassiastanse+1])},
if (ny_stomi %in% c(0,1)){paste0('Ny stomi: ', c('Nei', 'Ja')[ny_stomi+1])},
if (!kun_ferdigstilte){'Ikke-ferdigstilte oppfølginger inkludert: Ja'}
)

Expand Down
33 changes: 33 additions & 0 deletions doc/BestillingerOgUtleveringer.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@ library(norgast)
library(tidyverse)
rm(list=ls())


### Leveranse Lassen 2022-10-21 #####################################


RegData <- rapbase::loadStagingData("norgast", "RegData")

RegData <- RegData %>% filter(HovedDato >= "2017-01-01" &
HovedDato < "2022-07-01") %>%
filter(Op_gr == 1) %>%
filter(NyAnastomose == 1) %>%
filter(NyStomi == 0) %>%
filter(Hastegrad_hybrid == 1) %>%
filter(Malign == 1) %>%
filter(WHOECOG %in% 0:1) %>%
filter(OppfStatus==1)

RegData$Tilgang_utvidet[RegData$Tilgang_utvidet==5] <- 4
RegData$Tilgang_utvidet <- factor(RegData$Tilgang_utvidet, levels = 1:4,
labels = c("Åpen", "Laparoskopisk", "Laparoskopi med robotassistanse", "Konvertert"))

rater <- RegData %>% group_by(Tilgang_utvidet) %>%
summarise(n_lekkasje = sum(Anastomoselekkasje),
N = n()) %>%
janitor::adorn_totals() %>%
mutate(Andel = n_lekkasje/N*100)

konf <- binomkonf(rater$n_lekkasje, rater$N)

rater$konf95_lav <- konf[1, ]*100
rater$konf95_hoy <- konf[2, ]*100

write.csv2(rater, "~/.ssh/norgast/rater_norgast_oktober2022_kunferdige.csv", row.names = F, fileEncoding = "Latin1")

##### Stig Norderval, andel malign kolon med robotassistanse 19.04.2022 ########

RegData <- norgast::NorgastHentRegData()
Expand Down
5 changes: 4 additions & 1 deletion inst/shinyApps/norgast/R/modul_fordelingsfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ fordelingsfig_UI <- function(id, BrValg){
selectInput(inputId = ns("forbehandling"), label = "Onkologisk forbehandling", multiple = TRUE,
choices = c('Cytostatika'=1, 'Stråleterapi'=2, 'Komb. kjemo/radioterapi'=3, 'Ingen'=4)),
selectInput(inputId = ns("malign"), label = "Diagnose", choices = c('Ikke valgt'=99, 'Malign'=1, 'Benign'=0)),
selectInput(inputId = ns("ny_stomi"), label = "Ny stomi",
choices = c('--'=99, 'Nei'=0, 'Ja'=1)),
# )
# ),
selectInput(inputId = ns("bildeformat"), label = "Velg bildeformat",
Expand Down Expand Up @@ -131,7 +133,8 @@ fordelingsfig <- function(input, output, session, reshID, RegData, userRole, hvd
reshID = reshID, enhetsUtvalg = input$enhetsUtvalg, erMann = as.numeric(input$erMann),
elektiv = as.numeric(input$elektiv), hastegrad = as.numeric(input$hastegrad),
hastegrad_hybrid = as.numeric(input$hastegrad_hybrid),
kun_ferdigstilte = input$kun_ferdigstilte)
kun_ferdigstilte = input$kun_ferdigstilte,
ny_stomi = as.numeric(input$ny_stomi))
}, width = 700, height = 700)


Expand Down

0 comments on commit 5b41528

Please sign in to comment.