knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Red means manual steps. Green means automatic testing. Blue means automatic steps.
The external website is comprised of two parts:
The source code for the website is currently available here: https://github.com/raubreywhite/sykdomspuls_reactjs
This will be updated soon to:
The external website's API is powered by plumber. Briefly, this is an R package that can convert R data into json and serve it through http requests.
This is done through the RunAPI.R which is run by an R instance on the external webserver.
This R package is triggered via cron. The cronjob calls 0_run.sh which is the enterance point for this package.
When 0_run.sh is called, it firstly uses flock
to determine if another instance of sykdomspuls is already running - if so, 0_run.sh exits. Otherwise, RunProcess.R is run, which:
status=21
status=0
0_run.sh then checks the exit code of RunProcess.R. If it is 0 and the computer name is smhb (i.e. production computer) then all data in /data_app/sykdomspuls/*.RDS
is uploaded to the folder /data/
on sykdomspulsen.fhi.no
(i.e. uploading results to the external webserver). The file 1_delete_website_token.sh is then run, which deletes the file /data/.deleteThisToRestartR
on sykdomspulsen.fhi.no
, which triggers a script on the external webserver to restart R on the external webserver. After R is restarted, RunAPI.R is automatically run, loading in the new data for the API.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.