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

      With domain allowlisting now being a self-service feature, this is the preferred option. For proxy settings in Anaconda in combination with domain allowlisting, please follow this article: ...
    • Castor

      Setting up for Direct Access The method for accessing websites and internet-dependent services detailed on this page is outdated. We recommend to use domain-allowlisting, which is a self-service feature in the myDRE portal. Please see Domains to be ...
    • 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 ...
    • 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. ...
    • CEDAR

      CEDAR Home page CEDAR https://more.metadatacenter.org/tools-training/orientation CEDAR APIs https://more.metadatacenter.org/tools-training/cedar-api CEDAR API and Python Prerequisites: Create file called: secret.py Add the following line of ...