Skip to content

Commit

Permalink
feat: ability to create/delete objects (#68)
Browse files Browse the repository at this point in the history
## changes

- [x] ability to create databases, workspaces
- [x] ability to delete databases, workspaces
- [x] docs for creating objects
- [x] docs for deleting objects
- [x] completely overhauled how docs are organized. now split into data
hub/compute hub sections
- [x] docs no longer have collapsible sections because it didn't make
sense. all pages listed unfurled for visibility.
- [x] limited support for creating new columns in a database
- [x] docs for creating new columns 
- [x] docs for deleting columns in a database
- [x] CLI support for creating databases, workspaces
- [x] CLI support for deleting databases, workspaces
- [x] CLI support for deleting columns

## technical discussion

the auto-generated code is broken for add_database_column. so there's a
patch to make a request directly. this also means that not all features
are supported. once we fix the underlying auto-generated code, we'll
remove the patch and support all options for columns


## tests

tests for these methods already existed. these methods simply weren't
documented well.
  • Loading branch information
sg-s authored Aug 9, 2024
1 parent 14d6666 commit 6b67284
Show file tree
Hide file tree
Showing 17 changed files with 601 additions and 148 deletions.
7 changes: 7 additions & 0 deletions docs/compute-hub/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Compute Hub

The Deep Origin Compute Hub allows you create and use powerful workstations that come with pre-installed software packages. Deep Origin was built to help computational scientists get clean data from their labs and perform advanced analyses and simulations.

Every Deep Origin Workstation comes pre-installed and pre-configured with this python client and CLI.

Read more about the Compute Hub [here :octicons-link-external-16:](https://docs.deeporigin.io/docs/os/compute-hub).
47 changes: 47 additions & 0 deletions docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,50 @@ To run this package outside of a Deep Origin workstation (for example, on your o
```bash
deeporigin config set organization_id [org-id]
```

## View configuration

To view the configuration for this package, run:

```bash
deeporigin config show
```

This will display a table like below:

```
╭─────────────────────────────┬─────────────────────────────────────╮
│ Variable │ Value │
├─────────────────────────────┼─────────────────────────────────────┤
│ organization_id │ likely-aardvark-ewo │
│ bench_id │ average-possum-3x3 │
│ env │ us-west-1 │
│ api_endpoint │ https://os.prod.deeporigin.io/api │
│ nucleus_api_route │ nucleus-api/api/ │
│ graphql_api_route │ api/graphql/ │
│ auth_domain │ https://formicbio-dev.us.auth0.com │
│ auth_device_code_endpoint │ oauth/device/code/ │
│ auth_token_endpoint │ oauth/token/ │
│ auth_audience │ https://os.deeporigin.io/api │
│ auth_grant_type │ urn:ietf:params:device_code │
│ auth_client_id │ <secret> │
│ auth_client_secret │ <secret> │
│ api_tokens_filename │ ~/api_tokens │
│ variables_cache_filename │ ~/variables.yml │
│ feature_flags │ │
╰─────────────────────────────┴─────────────────────────────────────╯
```

## Set a configuration variable

To set a variable, run:

```bash
deeporigin config set [variable-name] [variable-value]
```

For example, to configure your organization, run:

```bash
deeporigin config set organization_id likely-aardvark-ewo
```
18 changes: 18 additions & 0 deletions docs/data-hub/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Data Hub

The Deep Origin data hub provides R&D teams a foundation for collaboratively capturing data, extracting insights, and making decisions:

- Databases for capturing rows of data, metadata, and procedures.
- Customizable columns for capturing structured information such as the age and genotype of a sample.
- Notebooks such as for common protocols and recording experiments.
- File columns and notebook attachments for capturing files such as the results of experiments.
- Reference columns and notebook mentions for capturing relationships, such as the chemical, RNA, antibody, or cell line that an assay characterized.
- Folders for hierarchically organizing data, such as by project, team, or experimental modality.
- Column and file viewers such as for visualizing the sequence of a plasmid or the structure of a chemical or protein.
- Chart studio for interactively analyzing columnar data.
- AI assistant for interactively analyze and visualize data.
- Advanced computational analysis with workflows and workstations.
- Process flows and automations for streamlining data processing, decision-making, and project management.


Read more about the Data Hub [here :octicons-link-external-16:](https://docs.deeporigin.io/docs/os/data-hub).
4 changes: 4 additions & 0 deletions docs/how-to/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ be used in subsequent interactions with Deep Origin.
!!! info "Authenticating"
In most cases, you only need to authenticate to the Deep Origin platform once.
You do not need to authenticate every time you use the client or the CLI.


!!! question "Authenticating on Deep Origin Workstations"
Automatic authentication is currently being worked on on Deep Origin Workstations. Presently, you will still have to authenticate (once) manually on Deep Origin Workstations.
48 changes: 0 additions & 48 deletions docs/how-to/config-package.md

This file was deleted.

115 changes: 115 additions & 0 deletions docs/how-to/data-hub/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
This document describes how to create databases, columns in databases, and folders in the Deep Origin Data Hub.


## Folders

Folders (or workspaces) can be created by specifying a name, and, optionally, a parent.

=== "CLI"

If no parent is specified, the folder will be created at the root level.

```bash
deeporigin data new folder --name <name>
```

To create a folder within another folder, specify the parent:


```bash
deeporigin data new folder \
--name <name> \
--parent <parent-id>
```

=== "Python"

```py
from deeporigin.data_hub import api
api.create_workspace(name="test-workspace")
```

To create a folder within another folder, specify the parent:


```py
api.create_workspace(
name="test-workspace-2",
parent_id="parent-id",
)
```

## Databases

Databases can be created by specifying a name, and, optionally, a parent.

=== "CLI"


If no parent is specified, the database will be created at the root level.

```bash
deeporigin data new --name <name> --database
```

To create a folder within another folder, specify the parent:


```bash
deeporigin data new database \
--name <name> \
--parent <parent-id>
```

=== "Python"

```py
from deeporigin.data_hub import api
api.create_database(name="test-database")
```

To create a folder within another folder, specify the parent:


```py
api.create_database(
name="test-database-2",
parent_id="parent-id",
)
```


## Database columns

!!! warning "Work in progress"
There is limited support for creating database columns from the python client and CLI at this time. Not all features are supported yet.


Create a new database column in an existing database using:

=== "CLI"


```bash
deeporigin data new column \
--name <name> \
--database <database-id> \
--type <type>
```


=== "Python"


```py
from deeporigin.data_hub import api
api.add_database_column(
database_id="existing-database-id",
key="unique-key",
type="integer",
name="unique-name",
)
```


This code creates a new column in that database. To configure the type of the column, use the `type` argument. The type must be one of [DataType](../../ref/data-hub/types.md#src.utils.DataType).
74 changes: 74 additions & 0 deletions docs/how-to/data-hub/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
This document describes how to delete

- database rows
- database columns
- databases and
- folders

in the Deep Origin Data Hub.

!!! danger "Exercise caution"
- Deleting a workspace deletes all databases inside it.
- Deleting a column destroys all data in that column, including all files assigned to cells in that column.
- Deleting a database deletes all rows inside it.

All resources will be deleted without asking for confirmation.

## Delete database rows, databases, and folders

=== "CLI"

Multiple rows, databases and folders can be deleted using:

```bash
deeporigin data delete --ids <ids>
```



=== "Python"



```py
from deeporigin.data_hub import api
api.delete_rows(row_ids=["row-1","database-1","workspace-1"])
```

!!! Info "Rows?"
Rows, workspaces and databases can all be deleted using the `delete_rows` method.





## Delete database columns

Columns in databases can be deleted using:

=== "CLI"



```bash
deeporigin data delete --ids <ids> --columns
```

!!! warning "Column IDs"
Currently, columns can only be deleted using Column IDs, which are not the same as column names. To view the column IDs of a database, use

```bash
deeporigin data describe <database-id>
```



=== "Python"



```py
from deeporigin.data_hub import api
api.delete_database_column(column_id="col-id")
```

8 changes: 4 additions & 4 deletions docs/how-to/variables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Install variables and secrets into a workstation
# Install variables and secrets

Variables and secrets specified in the Deep Orgin platform, either
[Variables and secrets](https://docs.deeporigin.io/docs/os/variables-secrets) specified in the Deep Orgin platform, either
at the organization level or the account level, can be installed into
workstations by running the following command:

Expand All @@ -18,5 +18,5 @@ No variables were deleted
EnvironmentVariable: foo
```

!!! warning "Only on Deep Origin workstations"
This functionality is only meant for use in Deep Origin workstations.
!!! info "Only on Deep Origin Workstations"
This function of the CLI only works on Deep Origin Workstations. This will not work on your local computer.
11 changes: 5 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@

<div class="grid cards" markdown>

- :fontawesome-solid-handshake-simple: **Access your DO resources**
Work with your DO data, variables, secrets, and other resources through a CLI or Python.
- :fontawesome-solid-handshake-simple: **Access Deep Origin resources** <br>Work with your Deep Origin data, variables, secrets, and other resources through a CLI or Python.
- :octicons-unlock-24: **Free and open-source**
Install onto your computer to use your data, variables, secrets, and other resources outside DO.
<br>Install onto your computer to use your data, variables, secrets, and other resources outside Deep Origin.
- :material-download: **Easy to install**
Just run `pip install deeporigin`.
<br>Just run `pip install deeporigin`.
- :fontawesome-brands-python: **Pure Python**
Lightweight, written in pure Python. Works on any system that can run Python.
<br>Lightweight, written in pure Python. Works on any system that can run Python.

</div>

## Examples

The Deep Origin CLI and Python client allow you to programmatically
interact with the [Deep Origin OS](https://os.deeporigin.io/).
interact with the [Deep Origin OS :octicons-link-external-16:](https://os.deeporigin.io/).
The example below illustrates how to use the CLI and Python library to
retrieve the database row with ID `data-1`.

Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

No installation needed!

The Deep Origin CLI and Python client are installed in each workstation.
The Deep Origin CLI and Python client are installed on every workstation.

## On your local computer

Expand Down
Loading

0 comments on commit 6b67284

Please sign in to comment.