Ejemplo n.º 1
0
def test_GetParticipantIDs():

    kwargs = {
        Constants.NIDM_PROJECT_NAME: "FBIRN_PhaseII",
        Constants.NIDM_PROJECT_IDENTIFIER: 9610,
        Constants.NIDM_PROJECT_DESCRIPTION: "Test investigation"
    }
    project = Project(uuid="_123456", attributes=kwargs)
    session = Session(uuid="_13579", project=project)
    acq = Acquisition(uuid="_15793", session=session)
    acq2 = Acquisition(uuid="_15795", session=session)

    person = acq.add_person(attributes=({Constants.NIDM_SUBJECTID: "9999"}))
    acq.add_qualified_association(person=person,
                                  role=Constants.NIDM_PARTICIPANT)

    person2 = acq2.add_person(attributes=({Constants.NIDM_SUBJECTID: "8888"}))
    acq2.add_qualified_association(person=person2,
                                   role=Constants.NIDM_PARTICIPANT)

    #save a turtle file
    with open("test.ttl", 'w') as f:
        f.write(project.serializeTurtle())

    participant_list = Query.GetParticipantIDs(["test.ttl"])

    remove("test.ttl")
    assert (participant_list['ID'].str.contains('9999').any())
    assert (participant_list['ID'].str.contains('8888').any())
Ejemplo n.º 2
0
def setup():
    global cmu_test_project_uuid, cmu_test_subject_uuid

    projects = Query.GetProjectsUUID(ABIDE_FILES)
    for p in projects:
        proj_info = nidm.experiment.Navigate.GetProjectAttributes(
            ABIDE_FILES, p)
        if 'dctypes:title' in proj_info.keys(
        ) and proj_info['dctypes:title'] == 'ABIDE CMU_a Site':
            cmu_test_project_uuid = p
            break
    subjects = Query.GetParticipantIDs(ABIDE_FILES)
    cmu_test_subject_uuid = subjects['uuid'][0]