rhino_health.lib.endpoints.data_schema.data_schema_dataclass#

Module Contents#

Classes#

SchemaField

A schema field

SchemaFields

List-like dataclass that provides some convenience functions

DataSchemaCreateInput

Input for creating a new DataSchema

DataSchema

A DataSchema in the system used by Datasets

class rhino_health.lib.endpoints.data_schema.data_schema_dataclass.SchemaField(**data: Any)#

Bases: pydantic.BaseModel

A schema field

name: str#
identifier: str | None#
description: str | None#
role: str | None#
type: str | None#
type_params: Any#
units: str | None#
may_contain_phi: bool | None#
permissions: str | None#
class rhino_health.lib.endpoints.data_schema.data_schema_dataclass.SchemaFields(schema_fields: List[Dict])#

Bases: pydantic.RootModel

List-like dataclass that provides some convenience functions Pydantic v2 uses RootModel to handle internal things required for serialization

property field_names#
root: List[Any]#
dict(*args, **kwargs)#
abstract to_csv(output_file)#

@autoai False

class rhino_health.lib.endpoints.data_schema.data_schema_dataclass.DataSchemaCreateInput(**data)#

Bases: BaseDataSchema

Input for creating a new DataSchema

Examples

>>> DataSchemaCreateInput(
>>>     name="My DataSchema",
>>>     description="A Sample DataSchema",
>>>     primary_workgroup_uid=project.primary_workgroup_uid,
>>>     project=project.uid,
>>>     file_path="/absolute/path/to/my_schema_file.csv"
>>> )
schema_fields: List[str] = []#

A list of rows representing the schema fields from a csv file.

Users are recommended to use file_path instead of directly setting this value

The first row should be the field names in the schema. Each list string should have a newline at the end. Each row should have columns separated by commas.

file_path: str | None#

Path to a CSV File that can be opened with python’s built in open() command.

primary_workgroup_uid: typing_extensions.Annotated[str, Field(alias='primary_workgroup')]#

The UID of the primary workgroup for this data schema

project_uid: typing_extensions.Annotated[Optional[str], Field(alias='project')]#

The UID of the project for this data schema

name: str#

The name of the DataSchema

description: str#

The description of the DataSchema

base_version_uid: str | None#

If this DataSchema is a new version of another DataSchema, the original Unique ID of the base DataSchema.

version: int | None = 0#

The revision of this DataSchema

class rhino_health.lib.endpoints.data_schema.data_schema_dataclass.DataSchema(**data)#

A DataSchema in the system used by Datasets

property project: Project#

Return the Project Dataclass associated with project_uid

Warning

The result of this function is cached. Be careful calling this function after making changes. All dataclasses must already exist on the platform before making this call.

Returns:
project: Project

Dataclass representing the Project

property primary_workgroup: Workgroup#

Return the Workgroup Dataclass associated with primary_workgroup_uid

Warning

The result of this function is cached. Be careful calling this function after making changes. All dataclasses must already exist on the platform before making this call.

Returns:
primary_workgroup: Workgroup

Dataclass representing the Workgroup

property creator: User#

Return the User Dataclass associated with creator_uid

Warning

The result of this function is cached. Be careful calling this function after making changes. All dataclasses must already exist on the platform before making this call.

Returns:
creator: User

Dataclass representing the User

schema_fields: SchemaFields#

A list of schema fields in this data schema

uid: str | None#

The Unique ID of the DataSchema

name: str#

The name of the DataSchema

description: str#

The description of the DataSchema

base_version_uid: str | None#

If this DataSchema is a new version of another DataSchema, the original Unique ID of the base DataSchema.

version: int | None = 0#

The revision of this DataSchema

creator_uid: str#

The UID of the creator of this dataclass on the system

created_at: str#

When this dataclass was created on the system

project_name: str#

The project name

primary_workgroup_name: str#

The primary_workgroup name

creator_name: str#

The creator name

delete()#