This article explains how to use the Rhino FCP User Interface and SDK to create a new code object. It also explains how to create a new version of the code object. A code object is a basic computational building block of a project.
Using the User Interface to Create a New Code Object
To create a new code object, follow these steps.
- Go to the main project's page and select your project.
- Select Code from the menu on the left to open the Code Objects page.
- Select the Create New Code Object button to open the Create New Code Object page. You might need to scroll down to see the entire page.
The fields that appear in the Create a New Code Object page depend on the code object you chose. To learn more about how to complete the creation of your Code Object, select one of the following links.
- Creating a new Python Code Object
- Creating a new Generalized Code Object
- Creating a new NVFlare Code Object
- Creating a new Interactive Container Code Object
Code objects usually require that you know the number of inputs and outputs your code needs. Those inputs and outputs are provided as data schemas. For example, if your code splits one dataset into two (like a train/test split), you will have to create a code object with one input schema and two output schemas.
Pro-tip: If you don't need this level of control, you can: |
|
Multiple input and output datasets are supported in Python, Generalized, and Interactive Container Code Objects. While NVFlare Code Objects do not support multiple datasets, they can still be used as before for learning and inference across multiple sites.
Creating a New Code Object Version using the Rhino FCP UI
Do the following to create a new version of a Code Object.
- Go to the page containing the original Code Object.
- In the upper right-hand corner, select the + New Version button.
Selecting this button opens a new page where you can creae a new version of your Code Object.
Creating a New Version in Every Interface within the Rhino FCP UI
Below is a GIF showing all the interfaces within the Rhino FCP application where you can create a new Version. It displays the Schemas, Cohorts, and Models pages and the + New Version button you will press to create that new version of the schema, cohort, or model you are looking to create.
Using the Rhino SDK to Create a New Code Object
Prerequisites
Before starting this process, you should have already:
- Created a Project using the Rhino SDK or UI
- Created an Input Data Schema using the Rhino SDK or UI
- [Optional] Created an Output Data Schema using the Rhino SDK or UI. If you choose not to create an output Data Schema, the system will auto-generate the Data Schema of the output for your Code
Import your Python Dependencies
import rhino_health as rh
from rhino_health.lib.endpoints.code.code_objects_dataclass import (
CodeObject,
CodeObjectCreateInput,
CodeTypes,
CodeRunType
)
import getpass
NOTE: Remember to change all lines with CHANGE_ME comments above them in all the blocks below! |
Log into the Rhino SDK Using Your FCP Credentials
Your username will be the email address you log into the Rhino FCP platform with.
print("Logging In")
# CHANGE_ME: MY_USERNAME
my_username = "MY_USERNAME"
session = rh.login(username=my_username, password=getpass.getpass())
print("Logged In")
Complete the Creation of Your Code Object Based on the Code Object Type
Now, gather the name of your project and the names of your input and output Data Schemas. The additional information needed will depend on the Code Object type you're creating. For specific instructions using the SDK, refer to the relevant sections in these articles.
- Python Code: "Creating a New Python Code Object using the Rhino SDK" in the article Creating a new Python Code Object
- Generalized Compute Code: "Creating a New Generalized Compute Code Object using the Rhino SDK" in the article Creating a new Generalized Compute Code Object
- NVFlare: "Creating a New NVFlare Model using the Rhino SDK" in the article Creating a New NVFlare Model
If you encounter any errors or issues, contact support@rhinohealth.com for further help.