# Example Analyses & Notebooks

You can find analyses & notebooks here: <https://github.com/hms-dbmi/Access-to-Data-and-Compute-using-Service-Workbench> . Below are instructions for copying these notebooks in to Service Workbench.

## Available Notebooks

#### Breast Cancer Prediction  <mark style="color:blue;background-color:orange;">python</mark>&#x20;

This notebook illustrates how one can use random forest models for prediction. For this illustration, we have taken an example for breast cancer prediction using UCI'S breast cancer diagnostic data set. The purpose here is to use this data set to build a predictive model of whether a breast mass image indicates benign or malignant tumor.

#### Connecting to OCHIN DB  <mark style="color:blue;background-color:orange;">python</mark>  <mark style="color:red;background-color:blue;">R</mark>&#x20;

This notebook is for **AIM AHEAD** users who have access to the OCHIN dataset. To learn more about the OCHIN data, see the [Accessing OCHIN Data](https://pic-sure.gitbook.io/service-workbench/aim-ahead/accessing-ochin-data) and [Understanding OCHIN Data](https://pic-sure.gitbook.io/service-workbench/aim-ahead/understanding-the-ochin-data) sections of the user guide.&#x20;

This notebook will walk you through how to connect to the OCHIN DB while in a Jupyter Notebook. Before you begin, make sure that you have access to the data and check to make sure the `db-credentials.txt` file is located in your home directory.

#### Investigating EHR data from PIC-SURE  <mark style="color:blue;background-color:orange;">python</mark>  <mark style="color:red;background-color:blue;">R</mark>&#x20;

The purpose of this notebook is to help researchers get started with EHR analysis using clinical data exported from PIC-SURE.

## How to copy notebooks in to your analysis workspace in Service Workbench

#### Create a SageMaker workspace if you have not already done so. This will provide you with a Jupyter Notebook interface that you can use to run python or R code.

<details>

<summary>Create your workspace</summary>

Step 1: Navigate to the **Studies** page. The organization studies are linked to Amazon S3 secure storage. This means that anything saved in these study folders will be securely saved and accessible through any workspace the study is mounted to.&#x20;

For more information about studies, view the documentation [here](https://pic-sure.gitbook.io/service-workbench/general-user-guide/studies).&#x20;

Step 2: Select the **Organizations** tab

Step 3:Select the study with your project and user name attached

Step 4: Click **Next**

Step 5: Select the Sagemaker Notebook as shown below

Step 6: Click **Next**

Step 7: Enter a name: *Any name. Note that the Name can contain only alphanumeric characters (case sensitive) and hyphens. It must start with an alphabetic character and cannot be longer than 128 characters.*

*No change necessary for the **Restricted CIDR** field*

Step 8: Select the **Project Id** dropdown

Step 9: Select your AIM AHEAD affiliation: *For example Research-Fellowship or Consortium-Development-Project*

Step 10: Select a sagemaker-small workspace

Step 11: Enter a Description for your benefit: *Any description. Note that the Description must be at least 3 characters.*

Step 12: Click **Create Research Workspace**

<figure><img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FsAIw5tJ5M468RALd2lje%2Fsagemaker_setup.gif?alt=media&#x26;token=8719373b-16bd-4f42-8d80-15ebd8cf08cb" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Step 3: Set your workspace parameters.</summary>

Name: *Any name. Note that the Name can contain only alphanumeric characters (case sensitive) and hyphens. It must start with an alphabetic character and cannot be longer than 128 character.*

Restricted CIDR: *No change necessary*

Project ID: *Select your AIM AHEAD affiliation, for example Research-Fellowship or Consortium-Development-Project*

Configuration: sagemaker-small

Description: *Any description. Note that the Description must be at least 3 characters.*

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2F8eFRFkj0TVfqBEJa7pMj%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(11).png?alt=media&#x26;token=e6215961-469c-4192-9503-8a94c809503e" alt="" data-size="original">

</details>

<details>

<summary>Wait for your workspace to become available.</summary>

This may take 12-20 minutes.&#x20;

Once your workspace is listed as AVAILABLE, you can connect to it.&#x20;

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FyWscbvtqTgDjmNfP1ePh%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(18).png?alt=media&#x26;token=f6f9cbb3-f313-449f-bb3d-af6a18b74dd4" alt="" data-size="original">

</details>

<details>

<summary>Step 5. Connect to your SageMaker workspace.</summary>

Click "Connections" and then "Connect". A new window will open with your SageMaker workspace.

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FOda4RodWDmJ1Ooso07Kx%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(19).png?alt=media&#x26;token=ac2309e0-6b0b-4821-8726-b24ef7e6e716" alt="" data-size="original">

</details>

<details>

<summary>Step 6. Open the SageMaker Examples tab.</summary>

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2Flkf5L9JEA0PRZt78zeJS%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(12).png?alt=media&#x26;token=4f9fe1f1-1bfa-48ab-8058-c138bf98de48" alt="" data-size="original">

</details>

<details>

<summary>Step 7. Copy the Access to Data and Compute using Service Workbench folder. </summary>

Click "Use" next to any of the notebooks under "Access to Data and Compute Using Service Workbench" and then "Create copy". This will copy the entire example folder to your workspace.

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2Flnl3XmO6MsUnjoGW4F9i%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(13).png?alt=media&#x26;token=26470f69-30c8-4e0b-8fa1-7ab6ce6150d4" alt="" data-size="original">

</details>

<details>

<summary>Step 8. Move the desired example code notebooks into your study folder.</summary>

When you first copy the examples, a new window will open with the notebook you copied.&#x20;

If you see a popup that says "Kernel not found", select a kernel from the dropdown menu and click "Set Kernel".

![](https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FHRrpVGLZRosaVv9LrKIc%2FScreenshot%202024-05-28%20at%2012.57.00%20PM.png?alt=media\&token=1f633fab-15e3-4f8a-8da1-23695de8e715)

Close out of that tab and navigate back to your Home Page.

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2Fwl2pY7Fh1socBmtKdD1m%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(14).png?alt=media&#x26;token=9fb03972-4c15-48b9-b380-92fa792e656d" alt="" data-size="original">

Click on the Files tab of your Home page. You will notice the example code folder has been added.&#x20;

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FT2gQ0HLEdP0ZqR6uQhOX%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(15).png?alt=media&#x26;token=b3807e03-9b20-4178-a422-b5097cf683ae" alt="" data-size="original">

Check the box next to the Access to Data and Compute Using Service Workbench folder and click "Move".

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FPXMVXISG5bGbsgWTDhvX%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(16).png?alt=media&#x26;token=653cde8b-1857-4784-b6b6-8eda13b82428" alt="" data-size="original">

For the directory path, type `/studies/` followed by the name of the study folder you linked to your workspace. Click Move.

<img src="https://2318599880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUusNlmYiptj99Yq1UMwl%2Fuploads%2FRazGaepBt0JCm8NnYRB1%2FoCHIN%20data%20user%20journey%20-%20screenshots%20(17).png?alt=media&#x26;token=3b6e73c1-39e0-427e-81ed-035459fcafc3" alt="" data-size="original">

</details>
