Get in touch

Get in touch

Prefer using email? Say hi at hello@moveshelf.com

This example demonstrates how to retrieve subject metadata for an existing subject on Moveshelf via the Moveshelf API.
Prerequisites
Before implementing this example, ensure that your processing script includes all necessary setup steps. In particular, you should have:
Implementation
To retrieve subject metadata from an existing subject, add the following lines of code to your processing script:
## README: this example shows how we can retrieve subject metadata from an existing subject on 
# Moveshelf using the Moveshelf Python API.
# This code assumes you have implemented the 'Retrieve subject' example, and that you have found 
# the subject with a given EHR-id/MRN (my_subject_mrn) or name (my_subject_name) within a given 
# project (my_project), that you have access to the subject ID and obtained the "subject_details"


## General configuration. Set values before running the script
my_project = "<organizationName/projectName>"  # e.g. support/demoProject
my_subject_mrn = "<subjectMRN>"  # subject MRN, e.g. "1234567" or None
my_subject_name = "<subjectName>"  # subject name, e.g. Subject1 or None

## Add here the code to retrieve the project and get the "subject_details" for that subject

subject_metadata = json.loads(subject_details.get("metadata", "{}"))
print(
    f"Found subject with name: {subject_details['name']},\n"
    f"id: {subject_details['id']}, \n"
    f"and metadata: {subject_metadata}"
)