This is a R package to produce dynamisk tabellverk web pages. The web page is hosted on www.shinyapps.io and can be found here: https://skde.shinyapps.io/tabellverk/ The data in itself is not included in this package.
remotes::install_github("mong/tmongr")
Include the following in your ~/.Renviron
file before you install the package:
http_proxy=<proxy-url>:<port>
https_proxy=<proxy-url>:<port>
Functions from the shiny
package that is not on cran are used when running tests. Thus, the github version of shiny
has to be installed to be able to run the tests locally:
remotes::install_github("rstudio/shiny")
This R package can be added to a docker image together with all R and system dependencies needed to run the the tmongr web application from any docker host.
Since the tmongr R package is to be installed into the image please make sure to build the source tarball first. From a system command terminal navigate into the tmongr-directory and run:
R CMD build .
Then, build the docker image:
docker build -t tmongr .
To run the docker container from a system command terminal do:
docker run -p 80:80 tmongr
Then, open a web browser window and navigate to your localhost at port 80 to use the tmongr web application.
To stop the docker container hit Ctrl + c
in the system comman terminal.
Running the following SAS code will produce the aggregated data used by the shiny app:
%let sasfolder = <folder>\tmongr\sas;
%include "&sasfolder\formater.sas";
%include "&sasfolder\macroer.sas";
%include "&sasfolder\rater_og_aggr.sas";
%include "&sasfolder\tilrettelegging.sas";
%include "&sasfolder\tilretteleggInnbyggerfil.sas";
%include "&sasfolder\avd_tabell.sas";
The following data files will be produced:
<folder>\csv_filer\avd_behandlert19.csv
<folder>\csv_filer\avd_justoverft18.csv
<folder>\csv_filer\avd_fagt18.csv
<folder>\csv_filer\avd_icd10t18.csv
The csv files produced by SAS have to be converted to utf-8
and unix
file ending format by git bash:
iconv.exe -f CP1252 -t UTF-8 <filename> | dos2unix.exe > unix_<filename>
Then saved as RDS
files, as follows:
data <- read.table('../csv_filer/unix_avd_behandlert18.csv',
sep = ",",
header=T,
encoding = 'UTF-8',
stringsAsFactors = FALSE)
names(data) <- tolower(names(data))
saveRDS(data, "data/behandler.rds")
# read the data
uten_overf <- readRDS("../tabellverk/data/behandler.rds")
med_overf <- readRDS("../tabellverk/data/justertoverf.rds")
# define `niva`
uten_overf$niva <- "Uten overf"
med_overf$niva <- "Med overf"
# bind the data together
datasett <- rbind(uten_overf, med_overf)
# run the app
run_app()