Skip to content

psych-ds/pds-2020-validator-prototype

Repository files navigation

Psych-DS validator 📦➞💚

Netlify Status

This validator checks whether a data repository is documented according to the psych-ds metadata standard. It's built to work as a website, a command-line application, or an R package.

Using the validator

Online 🌍

Running the validator from your browser is the easiest way to get started. Please head over to our online validator and drag your data folder onto the blue zone.

In R 🖥

Installation

The R package is presently under development and therefore not currently listed on CRAN. For the meantime, please download the R package file associated with the latest release.

In RStudio, please then select Install Packages ... from the Tools menu. Next, please choose Package Archive File in the Install from dropdown, and select the file you downloaded in the last step. After confirming your selection, the installation should proceed automatically.

Alternatively, you can install the package directly from the R command line by running the command install.packages("https://github.com/psych-ds/validator-prototype/releases/download/v0.1.0-alpha/psychds_0.1.0.tar.gz", repos=NULL, method="libcurl").

Usage

After installing the psychds package, you can then validate a data folder:

psychds::validate('data_folder_path')

For example, you might want to validate your project directory with the following command:

psychds::validate('.')

Development 🚀

Repository overview

The project consists of several different parts that work together.

  • The validator-core directory contains the main validation logic that is used throughout the project.
  • You'll find the web validator interface in the validator-web folder
  • The validator-r directory holds the project R package
  • The validator-node folder is for the node-based command-line interface

Build instructions

To build the project, you'll need a local installation of the node JavaScript runtime and the yarn package manager. With both of these in place, please run the yarn command in the project directory to download and install all dependencies (there will be a few warnings about unmet peer dependencies, you can safely ignore these).

NOTE: yarn v2 does not play nicely with the code; as of March 10 2020 please make sure to install/downgrade to yarn v1 before attempting build.

Validator core

After setting up the project, the next step is to build the JavaScript validator core by running yarn build:core.

Web interface

If you would like to build the web interface, you can run the command yarn build:web, which will collect all files necessary to host the web interface in the validator-web/build directory. You can upload these to a web server of your choice, from which you will then be able to access the validator interface.

For development, it can be convenient to start a local server with the interface running on it. The command (cd validator-web && yarn start) will accomplish this.

R package

To build the R package, you will need an R installation as well as the devtools package. You can then build and develop the package in either of the following ways:

  • For package development, we recommend using RStudio and its built-in package management tools. To do so, please first run yarn build:core and yarn setup:r in the repository root directory to build and copy the validator core into the R package folder. You can then open the psychds.Rproj project file from the validator-r directory in RStudio, and use its package development features.
  • Alternatively, you can run yarn build:core and any the following commands from the root directory to check, build and install the package directly:
    • yarn check:r
    • yarn build:r
    • yarn install:r