Using Castor in Python

Using Castor in Python

Introduction

anDREa would like to thank Reinier van Linschoten for bringing this package and description to our attention.

This is a Python package for interacting with the API of Castor Electronic Data Capture (EDC). The package contains functions to interact with all the endpoints defined on https://data.castoredc.com/api#/. Within the package are functions for easy export and import of your data through the API.

Export
Supported export formats are
  1. Pandas
  2. CSV
  3. R (using Feather)
Import
Import currently only supports .xlsx files with limited configuration.

Install the Castor EDC API package

To install software and to open internet ports, you need Owner rights in a workspace.
  1. Connect to a VM.
  2. Install and configure the appropriate tools such as Python and Anaconda (Python, Miniconda, Jupyterlab & Python Packages).
  3. Install the Castor EDC API package by following the instructions here: https://github.com/reiniervlinschoten/castoredc_api.
  4. Information on how to get your Castor client ID and secrets can be found below.
We advise to use conda install rather than pip install when working in a myDRE workspace.  VMs on myDRE do not have internet access by default. Owners of workspaces can create external access rules to access certain IP addresses, however, these are limited to static IP addresses. PIP uses PyPi which makes use of dynamic IP addresses. Conversely, Anaconda is hosting their package repositories on a static IP address.

Castor EDC API in R

The same package can also be used in R. Please visit https://github.com/reiniervlinschoten/castoredc_api-R for more information. Please refer to Python, Miniconda, Jupyterlab & Python Packages on how to install Miniconda.
    • Related Articles

    • Python, Anaconda and JupyterLab

      Within the DRE, it is currently not possible to use PIP to install packages. We recommend using Conda instead. First follow the steps below and then use for example Conda Prompt or Jupyter Lab to create and run your code. To install packages with ...
    • Castor

      Setting up for Direct Access Castor is a cloud-based clinical data platform, enabling researchers to easily capture and integrate data from clinicians, patients, devices, wearables, and EHR systems. The Castor data capture system is available through ...
    • Castor R-Package

      Prerequisites DRE: Owner access to workspace, to install R / RStudio / Rtools in a virtual machine External access to CRAN in the workspace where you want to export the data to (open up port rule) External access to Castor in the workspace where you ...
    • Domains to be whitelisted/allowlisted for known applications

      First version: 2022-11-01 Last updated: 2024-02-19 Last change: CBS Opendata instructions for using OData 4-protocol. Introduction This is a community effort, if you experience issues, see mistakes/updates, or have other applications that you do know ...
    • Using the Azure Portal

      DRE is suitable for any type of user. However, perhaps you already have lots of IT experience and you know your way around Azure. That's when it might be interesting to know that you can also access your workspace resources through the Azure Portal. ...