Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following document, copied below, is a quick guide to using RStudio as the tool to querying the APPROACH Online Reporting platform

Info

To work in RStudio on the Approach Online reporting environment the requirements are:

  1. An APPROACH Online Reporting account

  2. An APPROACH RStudio account

  3. AHS network access

One needs to access the AHS network first using the private secure network access. Connect to the AHS VPN network using your credentials. If you do not have any, contact the IT support of AHS to request access.

To work in RStudio on the Approach Online reporting, requirements are:

·         An APPROACH Online Reporting account

·         An APPROACH Online RStudio account

·         VPN network access

)

 

Step 1. Connect to AHS

...

When you want to access the Approach AHS RStudio location , first connect to AHS VPN . Or or make sure to already be within the AHS network environment.

NOTE: You cannot use AHS’s MyApps via Citrix at present.

FYI: For a VPN client: Download and install, for example FortiClient VPN client. For setup and usage:

http://vpnextranet.albertahealthservices.ca/vpnfiles/Fortigate_VPN5_Client_Architecture_and_Installation_Document.htm

...

a.      Install the Query Utility R Package for APPROACH. This package is not public, and only available on the RStudio server. To install, run the following command in the console

install.packages("/home/cru/approach_0.1.1.tar.gz", source = TRUE, repos = NULL)

If successful, the console should return the following

Installing package into ‘/home/dahul/R/x86_64-pc-linux-gnu-library/3.6’

(as ‘lib’ is unspecified)

*installing *source* package ‘approach’ ...

** using staged installation

** R

** byte-compile and prepare package for lazy loading

** help

*** installing help indices

** building package indices

** testing if installed package can be loaded from temporary location

** testing if installed package can be loaded from final location

** testing if installed package keeps a record of temporary installation path

*DONE (approach)

 

b.      Import the installed APPROACH library, running the following command in console

library(approach)

 

c.       Create an ApproachAPI instance/object as follows

api = ApproachAPI()

This api variable will be used to authenticate yourself, and send PostgreSQL queries to the database

...

Step 5. Using the ApproachAPI class

 a.       Logging In
Before submitting a query, the API must authenticate all subsequent requests. Authenticate yourself first using the ApproachAPI $login() function as below

api$login()

You will be prompted for your APPROACH reporting platform credentials.

...

See here: https://test-front.approach.org/model-explorer  (must be logged in)

e.g.,
api$query("SELECT count(*) as c, bmi FROM approach.patient WHERE bmi IS NOT NULL and bmi > 0 GROUP BY bmi ORDER BY c DESC;")

The query function will render the query’s results into a table

...

c.       Logging Out
To close off your session with the API, run the $logout function as below

api$logout()

A confirmation message will be displayed once logged out

...

  • By default, a session will timeout and close off after 45 minutes of inactivity. However, explicitly logging out is suggested for security purposes.