コード例 #1
0
ファイル: study.py プロジェクト: ihmpdcc/cutlass
print("Required fields:")
print(Study.required_fields())

test_study = Study()

test_study.name = "Test name"
test_study.description = "Test description"
test_study.center = "Stanford University"
test_study.contact = "Test contact"
test_study.srp_id = "Test SRP ID"

test_study.tags = ["study", "ihmp"]
test_study.add_tag("another")
test_study.add_tag("and_another")
test_study.links = {"part_of": ["610a4911a5ca67de12cdc1e4b40018e1"]}

print(test_study.to_json(indent=2))

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

    success = test_study.save()

    if success:
        study_id = test_study.id
        print("Succesfully saved study. ID: %s" % study_id)

        study2 = Study.load(study_id)

        print(test_study.to_json(indent=4))
コード例 #2
0
ファイル: study.py プロジェクト: JAX-GM/cutlass
print("Required fields:")
print(Study.required_fields())

test_study = Study()

test_study.name = "Test name"
test_study.description = "Test description"
test_study.center = "Stanford University"
test_study.contact = "Test contact"
test_study.srp_id = "Test SRP ID"

test_study.tags = [ "study", "ihmp" ]
test_study.add_tag("another")
test_study.add_tag("and_another")
test_study.links = { "part_of": [ "610a4911a5ca67de12cdc1e4b40018e1" ] }

print(test_study.to_json(indent=2))

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

    success = test_study.save()

    if success:
        study_id = test_study.id
        print("Succesfully saved study. ID: %s" % study_id)

        study2 = Study.load(study_id)

        print(test_study.to_json(indent=4))