REDCap api polyfill library for Clojure using the etaoin
webdriver library.
(require '[redcap.webdriver :as rw])
(rw/get-driver) ;; gets the current webdriver or creates a new one if it doesn't exist
(rw/end-driver) ;; terminates the current webdriver
(rw/reset-driver) ;; initialises a new webdriver
The default env would always be from the .env-site
file in a project directory
(require '[redcap.webdriver :as rw])
(rw/get-env-site) ;; reads env from `.env-site`
;; => {:site "https://redcapdemo.vanderbilt.edu/"
;; :username "[email protected]"
;; :password "Acb8642793"}
(rw/get-env-site ".env-custom") ;; reads env from `.env-custom`
(require '[redcap.webdriver-signup :as signup])
(signup/signup-trial
{:email "[email protected]"
:first-name "John"
:last-name "Smith"
:organisation-name "-"
:organisation-type :for_profit
:country "AU"
:reason :check_out_latest_features})
;; => <EMAIL FROM REDCAP PROVIDER WITH NEW ACCOUNT DETAILS>
(require '[redcap.webdriver :as rw])
(rw/login)
;; => <LOGIN WITH WEBDRIVER>
(rw/login {:site "https://redcapdemo.vanderbilt.edu/"
:username "[email protected]"
:password "Acb8642793"})
;; => <LOGIN WITH WEBDRIVER USING CUSTOM OPTIONS>
(require '[redcap.webdriver :as rw])
(rw/project-list)
;; lists currently active projects
=> [{:name "Project 001", :pid "56153"}
{:name "Project 002", :pid "56154"}]
(require '[redcap.webdriver :as rw])
(rw/project-new {:title (str "Project " (h/uuid))
:notes "Sample"})
;; => <CREATES NEW PROJECT WITH LOGIN>
The token is needed for API access
(require '[redcap.webdriver :as rw])
(rw/project-api-token "56154")
;; => <API TOKEN>
(require '[redcap.webdriver :as rw])
(rw/project-delete "56154")
;; => <DELETES SPECIFIC PROJECT>
(rw/project-delete-all)
;; => <DELETES ALL PROJECTS>
Copyright © 2024 Chris Zheng
Distributed under the MIT License.