Skip to content
Dwayne Jeng edited this page Jan 17, 2018 · 4 revisions

This doc assumes you have Bridge Server up and running locally, know how to create and manage Bridge accounts, and know how to run Bridge Integration Tests.

Create a Synapse Project

You need to create a Synapse project to export data to.

  1. From your Synapse profile page, click on "Create a New Project" and fill out a unique and descriptive project name. Note the Synapse project ID, which should be in the URL and near the top-left of the page. It should look like "syn4727563".
  2. Optionally, create a Synapse team. Also from your Synapse profile page, click on the "Teams" tab, click on "Create a New Team", and fill out a unique and descriptive team name. Note the Team ID, which is in the URL (but not anywhere on the page). It should look like 3325691.

Configure your Bridge Study

You'll need to configure your Bridge Study to enable exports.

  1. If you don't already have a Developer account in your Bridge Server env, create one now.
  2. Using an HTTP tool such as Postman, make a GET /v3/studies/self to Bridge Server.
  3. Copy-paste the JSON from the response field to the request field and add (or replace) the following attributes: "synapseProjectId":"syn4727563" and "synapseDataAccessTeamId":3325691, replacing the project ID and team ID with the ones you noted in the previous step. If you opted out of creating a Synapse team, you can use the Bridge Dev team instead, using ID 3330891. Note that Synapse Table ID is a string, while Data Access Team ID is a long.
  4. Ensure that disableExport is either not present or set to false.
  5. Post this JSON back to Bridge server using POST /v3/studies/self.

Your Bridge study is now configured to export data to Synapse.

Upload Test Data to Bridge

For general purpose upload and health data documentation, see Bridge docs. The rest of this section will provide an easy to follow quick start guide demonstrating the simplest and fastest way to test Bridge Server.

  1. Make sure Bridge Server is running locally, as well as any pre-reqs such as MySQL and Redis.

  2. Create schemas. The fastest way to do this is to run the Bridge Integration Tests. To save time, running just mvn test -Dtest=org.sagebionetworks.bridge.sdk.integration.HealthDataTest.

  3. If you don't already have a consented user account in your Bridge Server env, create one now.

  4. Using an HTTP tool such as Postman, send the following request to Bridge, POST http://localhost:9000/v3/healthdata:

     {
       "appVersion" : "version 1.0.0, build 1",
       "createdOn":"2018-01-16T16:22:04.656-0800",
       "phoneInfo" : "Postman",
       "schemaId":"health-data-integ-test-schema",
       "schemaRevision":1,
       "data":{
         "foo":"any short string",
         "bar":"This will become an attachment"
       }
     }
    

Assuming this request is successful, this will create test data in your Bridge Server env.

Running the Exporter

  1. Ensure that Bridge Server (and its pre-reqs such as MySQL and Redis) are running.

  2. In your Bridge-Exporter project root, run mvn spring-boot:run. This will start the Bridge Exporter. When you see Started AppInitializer in 5.431 seconds (or something similar), your Bridge Exporter is ready to run.

  3. In the AWS console, go to Simple Queue Service (SQS), select the queue your Bridge Exporter reads from, and send the following message:

     {
       "endDateTime":"2018-01-17T17:00:00-0800",
       "useLastExportTime":true,
       "studyWhitelist":["api"],
       "tag":"some description about the Export job you're running"
     }
    

where endDateTime is some time after when you uploaded data to Bridge. This will export all data from the last time you exported data in this study until the specified endDateTime. If you have never exported data from this study before, the default start will be the beginning of the previous day.

The studyWhitelist is optional, but specifying it allows you to target just the study you want to export rather than exporting all studies in your local Bridge env. This is useful if you have a lot of studies. If you forgo the studyWhitelist, make sure the study you want to export doesn't have usesCustomExportSchedule set to true.

If you want to specify your own start and end, send this request instead:

{
  "startDateTime":"2018-01-16T14:00:00-0800",
  "endDateTime":"2018-01-16T14:30:00-0800",
  "useLastExportTime":false,
  "studyWhitelist":["api"],
  "tag":"some description"
}

Once this request is sent, Bridge Exporter will run and will export your data to Synapse, creating tables as necessary.