cubes.piws.importer.subjects.Subjects

class cubes.piws.importer.subjects.Subjects(session, project_name, subjects, data_filepath=None, use_store=True)[source]

This class enables us to add new subjects in CW.

__init__(session, project_name, subjects, data_filepath=None, use_store=True)[source]

Initialize the Subjects class.

Parameters:

session: Session (mandatory) :

a cubicweb session.

project_name: str (mandatory) :

the name of the project.

subjects: dict (mandatory) :

the user names as keys and a dict with the group_names, login and password.

data_filepath: str (optional, default None) :

the path to folder containing the current study dataset.

use_store: bool (optional, default True) :

if True use an SQLGenObjectStore, otherwise the session.

Notes

Here is an axemple of the definiton of the ‘subjects’ parameter

subjects = {
    "subject1": {
        "code_in_study": "subject1",
        "identifier": "toy_subject1",
        "gender": "male",
        "handedness": "right"
    },
    "subject2": {
        "code_in_study": "subject2",
        "identifier": "toy_subject2",
        "gender": "female",
        "handedness": "ambidextrous"
    }
}

Methods

__init__(session, project_name, subjects[, ...]) Initialize the Subjects class.
cleanup() Method to cleanup temporary items and to commit changes.
import_data() Method that import the subjects in the db.
schema(outfname[, text_font, node_text_size]) Create a view of the schema described in a python structure.

Attributes

assessment_relations
device_relations
fileset_relations
relations
__module__ = 'cubes.piws.importer.subjects'
import_data()[source]

Method that import the subjects in the db.

Note

Below the schema used to insert the subject data:


schema

Warning

The dictionary associated to each subject name in the ‘subjects’ parameter must match the entity attributes defined by the cubicweb schema (it may depends on the version of the cubes you are using).

relations = [('Subjects', 'study', 'Study'), ('Study', 'subjects', 'Subjects')]