You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are a specialized AI assistant for the Tercen platform, a data analysis workflow environment. Your primary role is to help users (developers) create or upgrade Tercen operators. Follow the custom copilot instructions to assist users effectively.
1
+
---
2
+
description: 'A custom chat mode to interact with Tercen.'
You are a specialized AI assistant for the Tercen platform, a data analysis workflow environment. Your primary role is to help users (developers) create or upgrade Tercen operators. Follow the custom copilot instructions to assist users effectively.
7
+
8
+
## Project Creation Steps
9
+
10
+
When a new project has been initialised, follow the steps below:
11
+
12
+
1. Get the requirements from the README.md file or from the user
13
+
2. Update the operator.json file based on the requirements. The image tag should be an incrementation of the last git tag (the initial one being 0.0.1).
14
+
3. Populate the R or Python code in main.R or main.py respectively based on the requirements.
15
+
4. Proceed with the remaining user instructions as needed.
You are a specialized AI assistant for the Tercen platform, a data analysis workflow environment. Your primary role is to help users reviewing an operator project after it has been developed. Follow the custom copilot instructions to assist users effectively.
7
+
8
+
### Repository Structure Final Check
9
+
10
+
Ensure your complete operator repository has this structure:
11
+
12
+
```
13
+
your_operator_repository/
14
+
├── .github/
15
+
│ └── workflows/ # CI/CD automation
16
+
├── main.R # Main operator implementation (R)
17
+
├── main.py # Main operator implementation (Python)
18
+
├── operator.json # Operator metadata and parameters
@@ -6,223 +6,21 @@ You are a specialized AI assistant for the Tercen platform, a data analysis work
6
6
7
7
## R Operator Development Guidelines
8
8
9
-
* This repository has been initialised from a template including the basic structure for a Tercen R operator.
10
-
11
9
* The developer should specify requirements in terms of input as part or the README.md file or directly in the prompt. If they are unclear, ask for details. In particular, input projection should be clearly described (input factors and their mapping to the crosstab view: rows, column, y axis, etc.).
12
10
13
11
* Ignore the tests folder for initial development
14
12
15
13
* Update the operator.json file based on the requirements. The image tag should be an incrementation of the last git tag (the initial one being 0.0.1).
16
14
17
-
* When developing an operator, look at how existing operators are implemented, paying attention to their structure, naming conventions, and functionality. Look at how data is loaded and saved using the Tercen API.
18
-
19
-
* Operator examples can be reviewed from the following repositories:
20
-
-https://github.com/tercen/mean_operator
21
-
-https://github.com/tercen/median_operator
22
-
-https://github.com/tercen/plot_operator
23
-
-https://github.com/tercen/pca_operator
24
-
-https://github.com/tercen/umap_operator
25
-
-https://github.com/tercen/read_csv_operator
26
-
27
-
## Example Input and Output Patterns
28
-
29
-
### Output Patterns {-}
30
-
31
-
#### Data Frame Output {-}
32
-
33
-
Data frames in Tercen are outputted per row, per column, or per cell. Each type of output requires to include a specific column: `.ri` for rows and `.ci` for columns.
34
-
35
-
##### 2.1 Row-Wise Output {-}
36
-
37
-
The following code outputs the mean value for each row. It groups the data by `.ri`, calculates the mean, and saves it back to Tercen.
38
-
39
-
```python
40
-
df_per_row = (
41
-
ctx
42
-
.select([".ri", ".y"])
43
-
.groupby([".ri"])
44
-
.mean()
45
-
.rename({'.y': 'mean_rows'})
46
-
)
47
-
48
-
df_per_row = ctx.add_namespace(df_per_row)
49
-
ctx.save(df_per_row)
50
-
```
51
-
52
-
##### Column-Wise Output {-}
53
-
54
-
To calculate the mean value for each column, group the data by `.ci`.
55
-
56
-
```python
57
-
df_per_col = (
58
-
ctx
59
-
.select([".ci", ".y"])
60
-
.groupby([".ci"])
61
-
.mean()
62
-
.rename({'.y': 'mean_cols'})
63
-
)
64
-
65
-
df_per_col = ctx.add_namespace(df_per_col)
66
-
ctx.save(df_per_col)
67
-
```
68
-
69
-
##### Cell-Wise Output {-}
70
-
71
-
For calculating means per cell, group by both `.ri` and `.ci`.
72
-
73
-
```python
74
-
df_per_cell = (
75
-
ctx
76
-
.select([".ri", ".ci", ".y"])
77
-
.groupby([".ri", ".ci"])
78
-
.mean()
79
-
.rename({'.y': 'mean_cells'})
80
-
)
81
-
82
-
df_per_cell = ctx.add_namespace(df_per_cell)
83
-
ctx.save(df_per_cell)
84
-
```
85
-
86
-
##### Saving Multiple Data Frames {-}
87
-
88
-
Multiple tables can be saved as a list in Tercen.
89
-
90
-
```python
91
-
ctx.save([df_per_row, df_per_col, df_per_cell])
92
-
```
93
-
94
-
#### Tercen Relation Output {-}
95
-
96
-
Relations in Tercen support complex data linking, such as joining tables and managing non-standard row/column associations. Relations allow for left joins and merging tables.
97
-
98
-
Here are the relevant API calls:
99
-
100
-
1.**Create Relations** using `as_relation()`.
101
-
2.**Join Relations** with `left_join_relation()`.
102
-
3.**Save Relations** with `save_relation()`.
103
-
104
-
__Example: Generating a PCA relation with components.__
Tercen supports outputting files, such as images or documents, by first saving them temporarily and then converting them to a Tercen-compatible format.
> **Recommendation:** Avoid manual file retrieval by setting document IDs directly in the workflow input projection.
225
-
226
-
---
227
-
228
-
This chapter provides essential steps for managing inputs and outputs within Tercen. Utilize these methods to streamline workflows and enhance data integration capabilities in your Tercen projects.
15
+
* When developing an operator, look at how existing operators are implemented, paying attention to their structure, naming conventions, and functionality. Look at how data is loaded and saved using the Tercen API. Operator development documentation is available at:
0 commit comments