1. Connecting with the SDK to DSMS

1. Connecting with the SDK to DSMS#

In this tutorial we see the overview on how to setup and basic use DSMS-SDK

1.1. Setting up#

Before you run this tutorial: make sure to have access to a DSMS-instance of your interest, alongwith with installation of this package and have establised access to the DSMS through DSMS-SDK (refer to Connecting to DSMS)

Now let us import the needed classes and functions for this tutorial.

[4]:
from dsms import DSMS, KItem

Now source the environmental variables from an .env file and start the DSMS-session.

[5]:
dsms = DSMS(env=".env")

1.2. Introduction to KItems#

We can see which kind of DSMS-object we own as a user (in the beginning, we own none):

[6]:
dsms.kitems
[6]:
[]

We can investigate what a KItem needs in order to be created. KItems are entirely based on Pydantic-Models (v2), hence the properties (in Pydantic called Fields) are automatically validated once we set them.

The schema of the KItem itself is a JSON schema which is machine-readable and can be directly incorporated into Swagger-supported APIs like e.g. FastAPI.

We can investigate the KTypes defined in the remote instance:

[8]:
for ktype in dsms.ktypes:
    print(ktype)
KTypes.Organization
KTypes.App
KTypes.Dataset
KTypes.DatasetCatalog
KTypes.Expert
KTypes.Test
KTypes.Specimen
KTypes.Batch
KTypes.Resource
KTypes.TestingMachine