> For the complete documentation index, see [llms.txt](https://docs.rhinofcp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rhinofcp.com/creating-and-running-code-objects/what-is-a-code-object.md).

# What is a Code Object?

## Code Objects Overview

In the Rhino FCP, a **Code Object** is the basic computational building block of a project. A Code Object can be as simple as a single line of Python code intended to run on a single input dataset, or as arbitrarily complex as a fully custom pipeline for federated training across multiple sites.

![](/files/88bddbfeb7009529b9f0fad5f6e1486937147f2a)

## Key Use-Cases for Code Objects on the FCP

* **Data Transformation:** This is the most common use for Code Objects in the FCP—as a tool for pre-processing and harmonization of distributed datasets.
* **Federated Training:** Once your data is harmonized, you can use NVIDIA's FLARE framework to train ML *models* with federated training across the distributed data in your project.
* **Application of 3rd-Party software:** Open- *source* tools that can be containerized can be run securely on the FCP as a Code Object, which can be especially useful for very specific uses (e.g., image annotation with 3D Slicer or QuPath, direct interaction with data via Jupyter Notebook, and others).

**Note**: This capability requires permission to directly access case-level data. This is only possible for data belonging to your workgroup and Secure Access Lists shared with you by your collaborators.

## What are the different Code Object types, and which should I use?

When defining your Code Object, you will need to select a Code Object type based on the code you will be running:

* For running Python code, use the **Python Code** option ([See more details here](/creating-and-running-code-objects/creating-and-running-a-python-code-object.md)).
* For code that utilizes a pre-built container image with non-interactive code, use the **Generalized Compute** Code Object type ([See more details here](/creating-and-running-code-objects/creating-and-running-a-new-generalized-compute-code-object.md))
* To run a pre-built container image that provides an interactive interface, use the **Interactive Container** option ([See more details here](/creating-and-running-code-objects/creating-and-running-interactive-container-code.md)).
* For federated training, use the **NVIDIA FLARE** option ([See more details here](/creating-and-running-code-objects/creating-and-running-nvflare-code-and-running-inference.md)).
* If you have created semantic and syntactic mappings using FCP's Rhino Data Harmonization Engine feature, use the **Data Harmonization** option.

### Python Code Objects

#### Elevating Your Workflow with Python Code Objects on FCP

In Rhino Federated Computing Platform (FCP), Python Code Objects offer a powerful way to execute Python code scripts effortlessly, eliminating the need to locally containerize your code. Building and deploying code becomes a seamless process, with FCP handling container image creation and storage on your workgroup's ECR (Elastic Container Registry).

#### Seamless Code Execution

With Python Code Objects, FCP streamlines code deployment process, allowing you to concentrate on code development and analysis. Whether you're performing sophisticated data manipulations or running custom algorithms, Python Code Objects empower you to leverage the full capabilities of Python while benefiting from FCP's containerization and deployment efficiency.

#### Summary

Python Code Objects on FCP bring simplicity and power to your code development endeavors. By offering options for both code snippets and standalone files, FCP adapts to your needs, allowing you to focus on creating impactful software. Embrace the convenience of executing Python code directly within the platform, while FCP takes care of the intricate details of containerization, image creation, and deployment. Elevate your workflow and unlock new dimensions of development possibilities with Rhino FCP.

### Generalized Compute Code Objects

In the Rhino Federated Computing Platform (FCP), the Generalized Compute (GC) Code Object represents a versatile and powerful way to execute pre-built container images within the FCP environment. This Code type enables you to run custom code, computations, or processes that are encapsulated within container images. With GC, you can harness the full potential of distributed computing while tailoring your computations to suit your specific needs.

#### **Key Aspects and Advantages**

* **Flexible Container Execution:** GC empowers you to execute container images containing diverse computational tasks, irrespective of programming language or complexity. This allows you to leverage existing tools, libraries, and applications within the FCP ecosystem.
* **Batch Processing:** Ideal for tasks that do not require real-time interactivity, GC excels at batch processing scenarios. You can execute computationally intensive tasks, data transformations, or complex analyses efficiently across distributed datasets.
* **Secure Data Access:** GC can only access data provided via the FCP, with no external internet connectivity. GC accesses input Datasets located under the `/input` directory and generates output Datasets under the `/output` directory. This ensures secure data access and maintains the privacy of sensitive healthcare information.

#### **Use Cases**

* **Data Transformation:** Execute data transformation and normalization tasks across distributed healthcare datasets.
* **Custom Analytics:** Run complex statistical analyses, machine learning processes, or custom algorithms on distributed data.
* **Scientific Simulations:** Perform large-scale scientific simulations or simulations requiring substantial computational resources.
* **Resource-Intensive Tasks:** Process resource-intensive tasks, such as image processing, signal analysis, or simulations.

Some benefits of Generalized Compute are:

* **Adaptability:** Leverage various programming languages and tools within your container, ensuring flexibility in your computational tasks.
* **Distributed Processing:** Distribute computation tasks across multiple sites, enhancing efficiency and reducing processing time.
* **Customization:** Craft computations tailored to your project's unique requirements, enhancing the depth of insights you can derive.

Generalized Compute empowers you to harness the versatility and power of containerized computations within the Rhino FCP. By executing custom code across distributed datasets, you can streamline tasks, gain valuable insights, and contribute to advanced healthcare research in a secure and privacy-preserving manner

### NVFlare Code Objects

#### **NVFlare: Redefining Collaborative Federated Training**

The FCP includes a seamless integration of [NVIDIA's Federated Learning framework (NVFlare)](https://developer.nvidia.com/flare), enabling you to train machine learning models collaboratively across distributed health data sources. This revolutionary approach brings privacy-preserving training to the forefront, allowing healthcare organizations to pool their insights without compromising the security of sensitive data.

#### **Key Aspects and Advantages**

* **Secure Distributed Training:** NVFlare empowers users to conduct Federated Training across a network of healthcare institutions, each contributing their data insights without sharing raw data. This distributed approach ensures that sensitive patient information remains secure behind institutional firewalls.
* **NVIDIA GPU Acceleration:** NVFlare taps into the computational prowess of NVIDIA GPUs, expediting model training and optimization. This acceleration is a game-changer, reducing training time and enhancing the accuracy of models trained on massive healthcare datasets.
* **Versatility Across ML Frameworks:** NVFlare's framework compatibility extends to major machine learning frameworks such as PyTorch and TensorFlow. Adapt your existing machine learning code to NVFlare, ensuring seamless integration into the Federated Learning ecosystem.

#### **Unlocking Secure Federated Training**

To harness the capabilities of NVFlare Code Objects within Rhino FCP, follow these steps:

* **Adaptation to NVFlare Framework:** Align your machine learning code with NVFlare's Federated Learning framework. This step ensures your models are primed to operate collaboratively across distributed data. (see our [Rhino "user resources" GitHub repository](https://github.com/RhinoHealth/user-resources) for examples)
* **Container Image Integration:** Build a container image that encapsulates your adapted NVFlare code, along with the required dependencies. These images are the vessels for efficient, privacy-preserving training across distributed health data.
* **ECR Repository Integration:** Push your container images to your workgroup's Elastic Container Registry (ECR) repository. This makes the NVFlare images available within the FCP ecosystem for execution via NVFlare Code Objects.
* **Create and Collaborate:** Access the Code Objects view within your project on the FCP Dashboard. Create an NVFlare Code Object, specifying your container image and configurations. Collaborate securely across institutions to train ML models and/or run model inference.
* **Elevate Federated Training:** Launch Federated Training using NVFlare Code Objects, and the FCP takes care of orchestrating the federated network and communication aspects. You can even simulate federated training using multiple datasets from your workgroup.

#### **Championing Secure Insights and Collaborative Progress**

NVFlare Code Objects redefine the paradigm of Federated Training, emphasizing secure and collaborative healthcare insights. By utilizing the power of NVIDIA GPUs and preserving data privacy, NVFlare empowers healthcare organizations to collaborate, innovate, and drive transformative advancements in predictive modeling.

#### **Summary**

NVFlare Code Objects within Rhino FCP signify a groundbreaking approach to Federated Training. Embrace the synergy of distributed health data, NVIDIA GPU acceleration, and Federated Learning framework compatibility to unlock secure, efficient, and impactful insights. Experience the future of collaborative healthcare research with NVFlare Objects, as you safeguard sensitive data while unlocking the full potential of Federated Training in the digital health landscape.

### Interactive Container Code Objects

#### **Exploring Interactive Container Code**

In the realm of the Rhino Federated Computing Platform (FCP), Interactive Container Code opens the door to a unique dimension of computation. This Code Object type empowers you to run pre-built container images that include interactive graphical user interfaces (GUIs) or applications. With Interactive Containers, you can execute visualization and third-party tools including Jupyter Notebooks directly on your on-premises data, enhancing interactivity while preserving data security.

#### **Key Aspects and Advantages**

* **Interactive GUIs:** Unlike other Code Objects, Interactive Containers enable you to execute containers with interactive graphical user interfaces. This facilitates real-time interaction and data visualization within the FCP environment.
* **On-Premises Interaction:** Interactive Containers offer the capability to interact with on-premises data while leveraging the computational power of the FCP. This integration is particularly useful for scenarios where data remains within internal networks.
* **Third-Party Applications:** With Interactive Container Code Objects, you can run third-party applications that are containerized and can be executed within the FCP ecosystem, with no need to install them at each site.

{% hint style="info" %}
NOTE: This capability is limited to third-party applications that can run within a single Linux-based container with no internet connectivity.
{% endhint %}

#### **Use Cases**

* **Real-Time Data Exploration:** Utilize interactive visualizations and tools to explore and analyze on-premises healthcare data within the FCP ecosystem.
* **Third-Party Applications:** Run containerized third-party applications such as medical image annotation tools or specialized analysis software.
* **Collaborative Workshops:** Conduct collaborative workshops or training sessions that involve hands-on exercises and interactive activities.

#### **Benefits**

* **Interactive Experience:** Gain the ability to interact with GUIs and applications in real-time, fostering dynamic exploration of your data.
* **On-Premises Compatibility:** Execute containerized applications on your on-premises data while utilizing the computational resources of the FCP.
* **Secure Collaboration:** Enable secure collaboration by running third-party tools and applications within the FCP environment, ensuring data privacy.

#### Summary

Interactive Containers offer an innovative pathway to engage with interactive graphical interfaces and applications within the Rhino FCP. By merging on-premises data with containerized interactivity, you can delve deeper into data exploration, collaboration, and visualization while maintaining the highest levels of security and privacy.
