API Tutorials

API Tutorials

Before You Start

Sample Data

Most of the following tutorials use Example-Template.opf as their basic data file.

The example template contains two columns: “id”, whose codes describe basic information such as subject number, test date, birth date, and condition, and “trial”, which has two codes: trialnum and outcome.

The example has one cell in the “id” column and no cells in the “trial” column. Most of the Datavyu tutorials use the example template as their basis, so if you want to follow along directly, you can download it, and then open it with Datavyu (using File > Open and selecting the file from your hard drive).

Most Datavyu scripts begin by loading a column from Datavyu using the getColumn() method. Before moving on to the larger tutorial list, you should familiarize yourself with loading Datavyu columns.

Load Datavyu Columns

To load columns, Datavyu provides the getColumn() method. getColumn() takes one argument, the name of the column in Datavyu, and returns the Ruby representation of the column, which you can work with.

The following script retrieves the “trial” column from the Datavyu spreadsheet and assigns it to an RColumn object called trial.

require 'Datavyu_API.rb'
   # Assign the Datavyu column "trial" data to a new Ruby object called trial.

   trial = getColumn("trial")

The left side of the method is the name of the Ruby object; the “trial” in the parentheses is the argument passed to getColumn() (the name of the Datavyu column).

mapping of trial = getColumn("trial") to its components

Now that you’re familiar with the sample data and know how to acquire data from Datavyu, you’re ready to start scripting. The following tutorials will guide you through common tasks.


Add a New Column

Add a column to create a new coding pass or a new set of codes.

Add Codes to a Column

Add codes to a column to prompt coders which behaviors to score.

Add Cells to a Column

Add cells to a column while coding or annotating a video file.

Check for Coding Errors

Check for coding errors such as typos, impossible vlaues, unlikely values, etc.

Use Reliability Coding to Check Data Accuracy

Check Inter-rater Reliability to Improve Data Accuracy to determine whether more than one coder would score the data the same way.

Export Data Using Scripts

Use scripts to export data from Datavyu into a text file or a spreadsheet. for statistical analyses.

Convert an OpenShapa Script to Datavyu

Convert an OpenSHAPA script to the Datavyu format to update an old file.

Perform Operations on Multiple Files

Batch operations on multiple files to do the same operation on more than one file.

Convert a MacShapa file to Datavyu

Convert MacSHAPA files to work in Datavyu so that you can use the new, supported software.