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

Feilsoeking ous #44

Merged
merged 5 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 11 additions & 9 deletions R/GetRegData.R
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,17 @@ getHospitalName <- function(registryName, reshId, userRole) {
deps <- .getDeps(reshId, userRole)

query <- paste0("
SELECT
LOCATION_SHORTNAME AS ln
SELECT DISTINCT
avd.LOCATION_SHORTNAME AS ln
FROM
avdelingsoversikt
avdelingsoversikt avd
INNER JOIN
AlleVarNum var
ON
avd.DEPARTMENT_ID = var.InnlAvd
WHERE
DEPARTMENT_CENTREID IN (", deps, ") AND
DEPARTMENT_ACTIVE = 1
GROUP BY
LOCATION_SHORTNAME;")
avd.DEPARTMENT_CENTREID IN (", deps, ") AND
avd.DEPARTMENT_ACTIVE = 1;")



Expand All @@ -587,8 +589,8 @@ GROUP BY
n <- dim(df)[1]
hVec <- df[1:n, 1]
if (n > 1) {
hStr <- paste(hVec[1:n-1], sep = ", ")
hStr <- paste(hStr, hVec[n], sep = " og ")
hStr <- paste(hVec[1:n-1], collapse = ", ")
hStr <- paste0(hStr, " og ", hVec[n])
} else {
hStr <- paste(hVec)
}
Expand Down
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
version: '3.3'

services:
db:
image: mysql:5.7
image: mysql:8
command: --innodb-log-file-size=500M --innodb_strict_mode=0
restart: "no"
volumes:
- ~/softlinks/mysql_db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root

dev:
depends_on:
- db
image: rapporteket/smerte-dev:weekly
image: rapporteket/smerte-dev:main
volumes:
- ~/.ssh:/home/rstudio/.ssh
- ~/.gitconfig:/home/rstudio/.gitconfig
- .:/home/rstudio/smerte
- ~/softlinks/mydata:/home/rstudio/mydata
ports:
- "8787:8787"
- "3838:3838"
dns:
- 8.8.8.8
restart: "no"
environment:
PASSWORD: password
DISABLE_AUTH: "true"
DB_HOST: db
DB_USER: root
DB_PASS: root
Expand Down
23 changes: 17 additions & 6 deletions inst/shinyApps/smerte/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,29 @@ server <- function(input, output, session) {
shiny::hideTab(inputId = "tabs", target = "Smertekategori")
shiny::hideTab(inputId = "tabs", target = "Oppfølging ved smerteklinikk")
shiny::hideTab(inputId = "tabs", target = "Epidural (barn)")
}
}
## tools only for SC
if (!userRole %in% "SC") {
shiny::hideTab(inputId = "tabs", target = "Verktøy")
}


contentDump <- function(file, type) {
contentDump <- function(file, type, userRole = "LU") {
d <- smerte::getDataDump(registryName,input$dumpDataSet,
fromDate = input$dumpDateRange[1],
toDate = input$dumpDateRange[2],
session = session)
fromDate = input$dumpDateRange[1],
toDate = input$dumpDateRange[2],
session = session)
if (userRole == "LU") {
if (input$dumpDataSet %in% c("SmerteDiagnoser", "SmerteDiagnoserNum")) {
ForlopsOversikt <- rapbase::loadRegData(
registryName,
"SELECT ForlopsID, AvdRESH FROM ForlopsOversikt")
d <- merge(d, ForlopsOversikt, by = "ForlopsID")
}
if (input$dumpDataSet != "avdelingsoversikt") {
d <- dplyr::filter(d, AvdRESH == reshId)
}
}
if (type == "xlsx-csv") {
readr::write_excel_csv2(d, file)
} else {
Expand Down Expand Up @@ -258,7 +269,7 @@ server <- function(input, output, session) {
fileext = ".csv"))
},
content = function(file) {
contentDump(file, input$dumpFormat)
contentDump(file, input$dumpFormat, userRole = userRole)
}
)

Expand Down
Loading