Beispiel #1
0
from cutlass import Subject
from cutlass import iHMPSession
from pprint import pprint

username = "******"
password = "******"

session = iHMPSession(username, password)

test_subject = Subject()

test_subject.race = "caucasian"
test_subject.rand_subject_id = "12345"
test_subject.gender = "male"
test_subject.tags = [ "male", "ihmp" ]
test_subject.add_tag("another")
test_subject.add_tag("and_another")

test_subject.links =  { "participates_in" : [ "610a4911a5ca67de12cdc1e4b4006f5d" ] }

print(test_subject.to_json())

if test_subject.is_valid():
    print("Valid!")

    success = test_subject.save()

    if success:
        subject_id = test_subject.id
        print("Succesfully saved subject. ID: %s" % subject_id)