Skip to content

Group

Group

Bases: BaseClassWithFieldData

Attributes:

Name Type Description
id str

id of the group

name str

name of the group

shortid str

shortid of the group

files List[File]

List of files belonging to this group. See File for more information.

fielddata List[FieldData]

List of field data belonging to this group. See FieldData for more information.

samples List[Sample]

This list contains 'sample' objects belonging to this group. These objects are partially fetched, providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'sample'. Refer to nested objects in Getting Started for further details. For a comprehensive understanding of 'sample' objects, see the provided Sample.

experiments List[Experiment]

This list contains 'experiment' objects belonging to this group. These objects are partially fetched, providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'experiment'. Refer to nested objects in Getting Started for further details. For a comprehensive understanding of 'experiment' objects, see the provided Experiment.

researchitems Dict[str, List[ResearchItem]]

This is a dictionary with category name as keys and lists with the corresponding researchitem objects belonging to this group as values. The researchitem objects are partially fetched, providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'researchitem'. Refer to nested objects in Getting Started for further details. For a comprehensive understanding of 'researchitem' objects, see the provided ResearchItem.

sub_groups List[Group]

This list contains 'group' objects that are subgroups of this group. These objects are partially fetched, providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'group'. Refer to nested objects in Getting Started for further details. For a comprehensive understanding of 'group' objects, see the provided Group.

parent_group Group

If the group is a subgroup, the attribute holds its parent group. This object is partially fetched, providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'group'. Refer to nested objects in Getting Started for further details. For a comprehensive understanding of 'group' objects, see the provided Group.

_fetched bool

This is a Boolean attribute indicating whether all attributes have been retrieved from the server or only the name and ID are present.

Source code in furthrmind\collection\group.py
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
class Group(BaseClassWithFieldData):
    """
    Attributes
    ----------
    id : str
        id of the group
    name : str
        name of the group
    shortid : str
        shortid of the group
    files : List[File]
        List of files belonging to this group. See [File](file.md) for more information.
    fielddata : List[FieldData]
        List of field data belonging to this group. See [FieldData](fielddata.md) for more information.
    samples : List[Sample]
        This list contains 'sample' objects belonging to this group. These objects are partially fetched,
        providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'sample'.
        Refer to nested objects in [Getting Started](index.md) for further details. For a comprehensive understanding of
        'sample' objects, see the provided [Sample](sample.md).
    experiments : List[Experiment]
        This list contains 'experiment' objects belonging to this group. These objects are partially fetched,
        providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'experiment'.
        Refer to nested objects in [Getting Started](index.md) for further details. For a comprehensive understanding of
        'experiment' objects, see the provided [Experiment](experiment.md).
    researchitems : Dict[str, List[ResearchItem]]
        This is a dictionary with category name as keys and lists with the corresponding `researchitem` objects belonging
         to this group as values. The `researchitem` objects are partially fetched,
        providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'researchitem'.
        Refer to nested objects in [Getting Started](index.md) for further details. For a comprehensive understanding of
        'researchitem' objects, see the provided [ResearchItem](researchitem.md).
    sub_groups : List[Group]
        This list contains 'group' objects that are subgroups of this group. These objects are partially fetched,
        providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'group'.
        Refer to nested objects in [Getting Started](index.md) for further details. For a comprehensive understanding of
        'group' objects, see the provided [Group](group.md).
    parent_group : Group
        If the group is a subgroup, the attribute holds its parent group. This object is partially fetched,
        providing only the name and ID. To retrieve the entire object, invoke the 'get()' method on the 'group'.
        Refer to nested objects in [Getting Started](index.md) for further details. For a comprehensive understanding of
        'group' objects, see the provided [Group](group.md).
    _fetched : bool
        This is a Boolean attribute indicating whether all attributes have been retrieved from the server or only
        the name and ID are present.
    """

    id = ""
    name = ""
    neglect = False
    shortid = ""
    files: List["File"] = []
    fielddata: List["FieldData"] = []
    experiments: List["Experiment"] = []
    samples: List["Sample"] = []
    researchitems: Dict[str, List["ResearchItem"]] = {}
    sub_groups: List[Self] = []
    parent_group: Self = None

    _attr_definition = {
        "files": {"class": "File"},
        "fielddata": {"class": "FieldData"},
        "samples": {"class": "Sample"},
        "experiments": {"class": "Experiment"},
        "researchitems": {"class": "ResearchItem", "nested_dict": True},
        "sub_groups": {"class": "Group"},
        "parent_group": {"class": "Group"}
    }

    def __init__(self, id=None, data=None):
        super().__init__(id, data)

    def _get_url_instance(self, project_id=None):
        project_url = Group.fm.get_project_url(project_id)
        url = f"{project_url}/groups/{self.id}"
        return url

    @classmethod
    def _get_url_class(cls, id, project_id=None):
        project_url = cls.fm.get_project_url(project_id)
        url = f"{project_url}/groups/{id}"
        return url

    @classmethod
    def _get_all_url(cls, project_id=None):
        project_url = cls.fm.get_project_url(project_id)
        url = f"{project_url}/groups"
        return url

    @classmethod
    def _post_url(cls, project_id=None):
        project_url = cls.fm.get_project_url(project_id)
        url = f"{project_url}/groups"
        return url

    @classmethod
    def get(cls, id: str = "", name: str = "", shortid: str = "", parent_group_id: str = "", project_id: str = "") -> Self:
        """
        Method to get one group by its id, name, or shortid.
        If called on an instance of the class, the id of the class is used.

        Parameters
        ----------
        id : str
            id or short_id of requested group
        name : str
            name of requested group. For subgroups, see parent_group_id parameter
        shortid : str
            shortid of requested group
        parent_group_id : str
            id of parent group.
            If a subgroup is requested, the name and the parent_group_id is required
        project_id : str, optional
            Optionally to get a group from another project as the furthrmind sdk was initiated with.
            Defaults to None

        Returns
        -------
        Self
            Instance of group class

        Raises
        ------
        AssertionError
            When used as a class method, id, name, or shortid must be specified.

        """

        if isclass(cls):
            assert id or name or shortid, "Either id or name must be specified"

        return cls._get(id, shortid, name, parent_group_id=parent_group_id, project_id=project_id)

    @classmethod
    def get_many(cls, ids: List[str] = (), shortids: List[str] = (), names: List[str] = (),
                 project_id: str = "") -> List[Self]:
        """
        Method to get many groups

        Parameters
        ----------
        ids : List[str]
            List of ids to filter the groups.
        shortids : List[str]
            List of short_ids to filter the groups.
        names : List[str]
            List of names to filter the groups.
        project_id : str, optional
            Optionally to get groups from another project as the furthrmind sdk was initiated with

        Returns
        -------
        List[Self]
            List of instances of the Group class.

        Raises
        ------
        AssertionError
            If none of the parameters (ids, shortids, or names) are specified.

        """

        assert ids or names or shortids, "Either ids, shortids, or names must be specified"
        return cls._get_many(ids, shortids, names, project_id=project_id)

    @classmethod
    def get_all(cls, project_id: str = "") -> List[Self]:
        """
        Method to get all groups belonging to one project

        Parameters
        ----------
        project_id : str, optional
            Optionally to get groups from another project as the furthrmind sdk was initiated with

        Returns
        -------
        List[Self]
            A list of instances of the group class.

        """

        return super()._get_all(project_id)

    @classmethod
    @BaseClass._create_instances_decorator(_fetched=False)
    def create(cls, name: str, parent_group_id: str = "", project_id: str = "") -> Self:
        """
        Method to create a new group.

        Parameters
        ----------
        name: str
            The name of the item to be created.
        parent_group_id: str, optional
            The ID of the parent group where the new group should belong to. Defaults to an empty string.
        project_id: str, optional
            Optionally, create a group in another project as the furthrmind SDK was initiated with

        Returns
        -------
        instance of the group class
        """

        data = {"name": name}
        if parent_group_id:
            data["parent_group"] = {"id": parent_group_id}
        id = cls._post(data, project_id)
        data["id"] = id
        return data

    @classmethod
    @BaseClass._create_instances_decorator(_fetched=False)
    def create_many(cls, name_list: List[str], project_id: str = "") -> List[Self]:
        """
        Method to create multiple groups

        Parameters
        ----------
        name_list: List[str]
            A list containing names of the groups to be created.
        project_id: str, optional
            Optionally to create groups in another project as the furthrmind sdk was initiated with

        Returns
        -------
        List[Self]
            A list containing instances of the group class corresponding to the groups created.

        """

        data_list = [{"name": name} for name in name_list]

        id_list = cls._post(data_list, project_id, force_list=True)

        for data, id in zip(data_list, id_list):
            data["id"] = id

        return data_list

add_field(field_name='', field_type='', field_id='', value=None, unit=None, position=None)

Method to add a field to the current item

Parameters:

Name Type Description Default
field_name str

Name of field that should be added. If fieldname provided, also fieldtype must be specified. Either fieldname and fieldtype or field_id must be specified.

''
field_type str

Type of field. Must be one of:

  • Numeric fields: numeric, numeric-field, numeric_field
  • Date fields: date, date_field, date-field, datefield
  • Text fields: singleline, singlelinefield, text, text-field, text_field, textfield
  • List fields: combobox, comboboxfield, list, list-field, list_field, listfield
  • Notebook fields: multiline, notebook, notebookfield, notebook-field, notebook_field
  • Checkbox fields: checkbox, checkbox-field, checkbox_field, checkboxfield
  • Calculation fields: calculation, calculation-field, calculation_field, calculationfield
''
field_id str

Id of field that should be added.

''
value Any

Value of the field. The data type of the value depends on the field_type:

  • Numeric fields: float or int, or a string convertible to a float
  • Date fields: datetime, date object, unix timestamp, or string with iso format
  • Text fields: string
  • List fields: dictionary with id or name as key, or string with name, or string with id
  • Notebook fields: dictionary with content as key, or string
  • Checkbox fields: boolean
None
unit Union[Dict, str]

Dictionary with id or name, or string representing the name, or string representing the id.

None
position int

The position where the field should be added in the card. Starting at "0". Optionally.

None

Returns:

Type Description
FieldData

The new FieldData object that was created.

Source code in furthrmind\collection\baseclass.py
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
def add_field(
    self,
    field_name: str = "",
    field_type: str = "",
    field_id: str = "",
    value: Any = None,
    unit: Union[Dict, str] = None,
    position: int = None,
) -> "FieldData":
    """
    Method to add a field to the current item

    Parameters
    ----------
    field_name : str
        Name of field that should be added. If fieldname provided, also fieldtype must be specified.
        Either fieldname and fieldtype or field_id must be specified.
    field_type : str
        Type of field. Must be one of:

        - Numeric fields: numeric, numeric-field, numeric_field
        - Date fields: date, date_field, date-field, datefield
        - Text fields: singleline, singlelinefield, text, text-field, text_field, textfield
        - List fields: combobox, comboboxfield, list, list-field, list_field, listfield
        - Notebook fields: multiline, notebook, notebookfield, notebook-field, notebook_field
        - Checkbox fields: checkbox, checkbox-field, checkbox_field, checkboxfield
        - Calculation fields: calculation, calculation-field, calculation_field, calculationfield
    field_id : str
        Id of field that should be added.
    value : Any
        Value of the field. The data type of the value depends on the field_type:

        - Numeric fields: float or int, or a string convertible to a float
        - Date fields: datetime, date object, unix timestamp, or string with iso format
        - Text fields: string
        - List fields: dictionary with id or name as key, or string with name, or string with id
        - Notebook fields: dictionary with content as key, or string
        - Checkbox fields: boolean

    unit : Union[Dict, str]
        Dictionary with id or name, or string representing the name, or string representing the id.

    position: int
        The position where the field should be added in the card. Starting at "0". Optionally.

    Returns
    -------
    FieldData
        The new FieldData object that was created.

    """

    from .fielddata import FieldData

    if not self._fetched:
        self._get()

    fielddata = FieldData.create(field_name, field_type, field_id, value, unit)

    new_field_data_list = list(self.fielddata)
    if position is not None:
        assert type(position) is int, "Position must be an integer"
        new_field_data_list.insert(position, fielddata)
    else:
        new_field_data_list.append(fielddata)

    self.fielddata = new_field_data_list

    data = {"id": self.id, "fielddata": [{"id": f.id} for f in self.fielddata]}
    self._post(data)
    return fielddata

add_many_fields(data_list)

Method to add many fields to the current item

Parameters:

Name Type Description Default
data_list List[Dict]

List of dictionaries containing the information about the fields to be added. Each dictionary should have the following keys:

  • field_name: Name of the field to be added. Either field_name and field_type or field_id must be specified.
  • field_type: Type of the field. Must be one of the following:

    • Numeric fields: numeric, numeric-field, numeric_field
    • Date fields: date, date_field, date-field, datefield
    • Text fields: singleline, singlelinefield, text, text-field, text_field, textfield
    • List fields: combobox, comboboxfield, list, list-field, list_field, listfield
    • Notebook fields: multiline, notebook, notebookfield, notebook-field, notebook_field
    • Checkbox fields: checkbox, checkbox-field, checkbox_field, checkboxfield
    • Calculation fields: calculation, calculation-field, calculation_field, calculationfield
  • field_id: ID of the field to be added.

  • value: Value of the field. The required format depends on the field_type:

    • Numeric: float or int, or a string convertible to a float.
    • Date: datetime, date object, Unix timestamp, or string in ISO format.
    • SingleLine: string.
    • ComboBoxEntry: Dictionary with ID or name as key, or string with name, or string with ID.
    • MultiLine: Dictionary with content as key, or string.
    • CheckBox: Boolean.
  • unit: Dictionary with ID or name as key, or string with name, or string with ID.

  • position: int, The position where the field should be added in the card. Starting at "0". Optionally.
required

Returns:

Type Description
List[FieldData]

List of FieldData objects representing the added fields.

Source code in furthrmind\collection\baseclass.py
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
def add_many_fields(self, data_list: List[Dict]) -> List["FieldData"]:
    """
    Method to add many fields to the current item

    Parameters
    ----------
    data_list: List[Dict]
        List of dictionaries containing the information about the fields to be added. Each dictionary should have the following keys:

        - field_name: Name of the field to be added. Either field_name and field_type or field_id must be specified.
        - field_type:
            Type of the field. Must be one of the following:

            - Numeric fields: numeric, numeric-field, numeric_field
            - Date fields: date, date_field, date-field, datefield
            - Text fields: singleline, singlelinefield, text, text-field, text_field, textfield
            - List fields: combobox, comboboxfield, list, list-field, list_field, listfield
            - Notebook fields: multiline, notebook, notebookfield, notebook-field, notebook_field
            - Checkbox fields: checkbox, checkbox-field, checkbox_field, checkboxfield
            - Calculation fields: calculation, calculation-field, calculation_field, calculationfield

        - field_id: ID of the field to be added.
        - value: Value of the field. The required format depends on the field_type:

            - Numeric: float or int, or a string convertible to a float.
            - Date: datetime, date object, Unix timestamp, or string in ISO format.
            - SingleLine: string.
            - ComboBoxEntry: Dictionary with ID or name as key, or string with name, or string with ID.
            - MultiLine: Dictionary with content as key, or string.
            - CheckBox: Boolean.

        - unit: Dictionary with ID or name as key, or string with name, or string with ID.
        - position: int, The position where the field should be added in the card. Starting at "0". Optionally.

    Returns
    -------
    List["FieldData"]
        List of FieldData objects representing the added fields.

    """

    from .fielddata import FieldData

    if not self._fetched:
        self._get()

    fielddata_list = FieldData.create_many(data_list)

    new_field_data_list = list(self.fielddata)
    for fielddata, data in zip(fielddata_list, data_list):
        if "position" in data:
            assert type(data["position"]) is int, "Position must be an integer"
            new_field_data_list.insert(data["position"], fielddata)
        else:
            new_field_data_list.append(fielddata)

    self.fielddata = new_field_data_list

    data = {"id": self.id, "fielddata": [{"id": f.id} for f in self.fielddata]}
    self._post(data)
    return fielddata_list

create(name, parent_group_id='', project_id='') classmethod

Method to create a new group.

Parameters:

Name Type Description Default
name str

The name of the item to be created.

required
parent_group_id str

The ID of the parent group where the new group should belong to. Defaults to an empty string.

''
project_id str

Optionally, create a group in another project as the furthrmind SDK was initiated with

''

Returns:

Type Description
instance of the group class
Source code in furthrmind\collection\group.py
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
@classmethod
@BaseClass._create_instances_decorator(_fetched=False)
def create(cls, name: str, parent_group_id: str = "", project_id: str = "") -> Self:
    """
    Method to create a new group.

    Parameters
    ----------
    name: str
        The name of the item to be created.
    parent_group_id: str, optional
        The ID of the parent group where the new group should belong to. Defaults to an empty string.
    project_id: str, optional
        Optionally, create a group in another project as the furthrmind SDK was initiated with

    Returns
    -------
    instance of the group class
    """

    data = {"name": name}
    if parent_group_id:
        data["parent_group"] = {"id": parent_group_id}
    id = cls._post(data, project_id)
    data["id"] = id
    return data

create_many(name_list, project_id='') classmethod

Method to create multiple groups

Parameters:

Name Type Description Default
name_list List[str]

A list containing names of the groups to be created.

required
project_id str

Optionally to create groups in another project as the furthrmind sdk was initiated with

''

Returns:

Type Description
List[Self]

A list containing instances of the group class corresponding to the groups created.

Source code in furthrmind\collection\group.py
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
@classmethod
@BaseClass._create_instances_decorator(_fetched=False)
def create_many(cls, name_list: List[str], project_id: str = "") -> List[Self]:
    """
    Method to create multiple groups

    Parameters
    ----------
    name_list: List[str]
        A list containing names of the groups to be created.
    project_id: str, optional
        Optionally to create groups in another project as the furthrmind sdk was initiated with

    Returns
    -------
    List[Self]
        A list containing instances of the group class corresponding to the groups created.

    """

    data_list = [{"name": name} for name in name_list]

    id_list = cls._post(data_list, project_id, force_list=True)

    for data, id in zip(data_list, id_list):
        data["id"] = id

    return data_list

delete(id='', project_id='') classmethod

Method to delete an item. Can be called as a classmethod with providing the id to be deleted or on the instance of a class

Parameters:

Name Type Description Default
id str

The id of the resource to delete

''
project_id str

Optionally to delete an item in another project as the furthrmind sdk was initiated with

''

Returns:

Type Description
str

The id of the item

Source code in furthrmind\collection\baseclass.py
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
@classmethod
def delete(cls, id: str = "", project_id: str = "") -> str:
    """
    Method to delete an item. Can be called as a classmethod with providing the id to be deleted or on the instance
    of a class

    Parameters
    ----------
    id : str
        The id of the resource to delete
    project_id : str, optional
        Optionally to delete an item in another project as the furthrmind sdk was initiated with

    Returns
    -------
    str
        The id of the item
    """

    if isclass(cls):
        return cls._delete_class_method(id, project_id)
    else:
        self = cls
        return self._delete_instance_method(project_id)

get(id='', name='', shortid='', parent_group_id='', project_id='') classmethod

Method to get one group by its id, name, or shortid. If called on an instance of the class, the id of the class is used.

Parameters:

Name Type Description Default
id str

id or short_id of requested group

''
name str

name of requested group. For subgroups, see parent_group_id parameter

''
shortid str

shortid of requested group

''
parent_group_id str

id of parent group. If a subgroup is requested, the name and the parent_group_id is required

''
project_id str

Optionally to get a group from another project as the furthrmind sdk was initiated with. Defaults to None

''

Returns:

Type Description
Self

Instance of group class

Raises:

Type Description
AssertionError

When used as a class method, id, name, or shortid must be specified.

Source code in furthrmind\collection\group.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@classmethod
def get(cls, id: str = "", name: str = "", shortid: str = "", parent_group_id: str = "", project_id: str = "") -> Self:
    """
    Method to get one group by its id, name, or shortid.
    If called on an instance of the class, the id of the class is used.

    Parameters
    ----------
    id : str
        id or short_id of requested group
    name : str
        name of requested group. For subgroups, see parent_group_id parameter
    shortid : str
        shortid of requested group
    parent_group_id : str
        id of parent group.
        If a subgroup is requested, the name and the parent_group_id is required
    project_id : str, optional
        Optionally to get a group from another project as the furthrmind sdk was initiated with.
        Defaults to None

    Returns
    -------
    Self
        Instance of group class

    Raises
    ------
    AssertionError
        When used as a class method, id, name, or shortid must be specified.

    """

    if isclass(cls):
        assert id or name or shortid, "Either id or name must be specified"

    return cls._get(id, shortid, name, parent_group_id=parent_group_id, project_id=project_id)

get_all(project_id='') classmethod

Method to get all groups belonging to one project

Parameters:

Name Type Description Default
project_id str

Optionally to get groups from another project as the furthrmind sdk was initiated with

''

Returns:

Type Description
List[Self]

A list of instances of the group class.

Source code in furthrmind\collection\group.py
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
@classmethod
def get_all(cls, project_id: str = "") -> List[Self]:
    """
    Method to get all groups belonging to one project

    Parameters
    ----------
    project_id : str, optional
        Optionally to get groups from another project as the furthrmind sdk was initiated with

    Returns
    -------
    List[Self]
        A list of instances of the group class.

    """

    return super()._get_all(project_id)

get_many(ids=(), shortids=(), names=(), project_id='') classmethod

Method to get many groups

Parameters:

Name Type Description Default
ids List[str]

List of ids to filter the groups.

()
shortids List[str]

List of short_ids to filter the groups.

()
names List[str]

List of names to filter the groups.

()
project_id str

Optionally to get groups from another project as the furthrmind sdk was initiated with

''

Returns:

Type Description
List[Self]

List of instances of the Group class.

Raises:

Type Description
AssertionError

If none of the parameters (ids, shortids, or names) are specified.

Source code in furthrmind\collection\group.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@classmethod
def get_many(cls, ids: List[str] = (), shortids: List[str] = (), names: List[str] = (),
             project_id: str = "") -> List[Self]:
    """
    Method to get many groups

    Parameters
    ----------
    ids : List[str]
        List of ids to filter the groups.
    shortids : List[str]
        List of short_ids to filter the groups.
    names : List[str]
        List of names to filter the groups.
    project_id : str, optional
        Optionally to get groups from another project as the furthrmind sdk was initiated with

    Returns
    -------
    List[Self]
        List of instances of the Group class.

    Raises
    ------
    AssertionError
        If none of the parameters (ids, shortids, or names) are specified.

    """

    assert ids or names or shortids, "Either ids, shortids, or names must be specified"
    return cls._get_many(ids, shortids, names, project_id=project_id)

remove_field(field_name='', field_id='')

Removes a field from the current item.

Parameters:

Name Type Description Default
field_name str

Name of the field that should be removed. Either the field_name or field_id must be specified.

''
field_id str

ID of the field that should be removed.Either the field_name or field_id must be specified.

''

Returns:

Type Description
str

ID of the item after the field is removed.

Raises:

Type Description
ValueError

If no field is found with the given field_name or field_id.

Source code in furthrmind\collection\baseclass.py
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
def remove_field(self, field_name: str = "", field_id: str = ""):
    """
    Removes a field from the current item.

    Parameters
    ----------
    field_name : str, optional
        Name of the field that should be removed. Either the `field_name` or `field_id` must be specified.
    field_id : str, optional
        ID of the field that should be removed.Either the `field_name` or `field_id` must be specified.

    Returns
    -------
    str
        ID of the item after the field is removed.

    Raises
    ------
    ValueError
        If no field is found with the given `field_name` or `field_id`.
    """

    if not self._fetched:
        self._get()

    new_fielddata_list = []
    fielddata_to_be_removed = None
    for fielddata in self.fielddata:
        found = False
        if field_id:
            if fielddata.field_id == field_id:
                fielddata_to_be_removed = fielddata
                found = True
        elif field_name:
            if fielddata.field_name == field_name:
                fielddata_to_be_removed = fielddata
                found = True
        if not found:
            new_fielddata_list.append(fielddata)

    if not fielddata_to_be_removed:
        raise ValueError("No field found with the given fieldid or fieldname")

    self.fielddata = new_fielddata_list
    fielddata_list = [{"id": fd.id} for fd in new_fielddata_list]
    post_data = {"id": self.id, "fielddata": fielddata_list}
    id = self._post(post_data)
    return id

set_calculation_result(value, field_name='', field_id='', fielddata_id='')

Method to update a calculation result

Parameters:

Name Type Description Default
value dict

Dictionary containing the calculation result to be set for the field.

required
field_name str

Name of the field that should be updated. Either field_name, field_id, or fielddata_id must be specified.

''
field_id str

ID of the field that should be updated. Either field_name, field_id, or fielddata_id must be specified.

''
fielddata_id str

ID of the fielddata that should be updated. Either field_name, field_id, or fielddata_id must be specified.

''

Returns:

Type Description
id

The ID of the fielddata that was updated.

Raises:

Type Description
ValueError

If no field is found with the given field_id or field_name.

Source code in furthrmind\collection\baseclass.py
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
def set_calculation_result(
    self,
    value: dict,
    field_name: str = "",
    field_id: str = "",
    fielddata_id: str = "",
):
    """
    Method to update a calculation result

    Parameters
    ----------
    value : dict
        Dictionary containing the calculation result to be set for the field.
    field_name : str, optional
        Name of the field that should be updated. Either `field_name`, `field_id`, or `fielddata_id` must be specified.
    field_id : str, optional
        ID of the field that should be updated. Either `field_name`, `field_id`, or `fielddata_id` must be specified.
    fielddata_id : str, optional
        ID of the fielddata that should be updated. Either `field_name`, `field_id`, or `fielddata_id` must be specified.

    Returns
    -------
    id
        The ID of the fielddata that was updated.

    Raises
    ------
    ValueError
        If no field is found with the given `field_id` or `field_name`.
    """

    if not self._fetched:
        self._get()

    fielddata = None
    for item in self.fielddata:
        if fielddata:
            break
        if fielddata_id:
            if item.id == fielddata_id:
                fielddata = item
        if field_id:
            if item.field_id == field_id:
                fielddata = item
        elif field_name:
            if item.field_name.lower() == field_name.lower():
                fielddata = item

    if not fielddata:
        raise ValueError("No field found with the given field_id or field_name")

    return fielddata.set_calculation_result(value)

to_dict()

Converts the object's attributes to a dictionary representation.

Returns:

Type Description
dict

Dictionary containing the object's attributes (excluding private attributes, callable attributes, and attributes of type Furthrmind).

Source code in furthrmind\collection\baseclass.py
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
def to_dict(self):
    """
    Converts the object's attributes to a dictionary representation.

    Returns
    -------
    dict
        Dictionary containing the object's attributes (excluding private attributes, callable attributes, and attributes of type Furthrmind).
    """

    from furthrmind import Furthrmind

    data = {}
    for attr in dir(self):
        if attr.startswith("_"):
            continue
        value = getattr(self, attr)
        if callable(value):
            continue
        if isinstance(value, Furthrmind):
            continue
        data[attr] = self._convert(value)
    return data

update_field_unit(unit, field_name='', field_id='')

Method to update the unit of a field.

Parameters:

Name Type Description Default
unit Union[Dict, str]

Dictionary with id or name, or string representing the name, or string representing the id.

required
field_name str

The name of the field that should be updated. Either field_name or field_id must be specified.

''
field_id str

The ID of the field that should be updated. Either field_name or field_id must be specified.

''

Returns:

Type Description
id

The ID of the updated field.

Raises:

Type Description
ValueError

If no field is found with the given field_id or field_name.

Source code in furthrmind\collection\baseclass.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
def update_field_unit(
    self, unit: Union[Dict, str], field_name: str = "", field_id: str = ""
):
    """
    Method to update the unit of a field.

    Parameters
    ----------
    unit : Union[Dict, str]
        Dictionary with id or name, or string representing the name, or string representing the id.
    field_name : str, optional
        The name of the field that should be updated. Either `field_name` or `field_id` must be specified.
    field_id : str, optional
        The ID of the field that should be updated. Either `field_name` or `field_id` must be specified.

    Returns
    -------
    id
        The ID of the updated field.

    Raises
    ------
    ValueError
        If no field is found with the given `field_id` or `field_name`.

    """

    if not self._fetched:
        self._get()

    fielddata = None
    for item in self.fielddata:
        if fielddata is not None:
            break
        if field_id:
            if item.field_id == field_id:
                fielddata = item
        elif field_name:
            if item.field_name.lower() == field_name.lower():
                fielddata = item

    if not fielddata:
        raise ValueError("No field found with the given field_id or field_name")

    return fielddata.update_unit(unit)

update_field_value(value, field_name='', field_id='')

Parameters:

Name Type Description Default
value various data types

The value to be updated in the field.

  • Numeric fields: float or int, or a string convertible to a float
  • Date fields: datetime, date object, unix timestamp, or string with iso format
  • Text fields: string
  • List fields: dictionary with id or name as key, or string with name, or string with id
  • Notebook fields: dictionary with content as key, or string
  • Checkbox fields: boolean
required
field_name str

Name of the field that should be updated. Either field_name or field_id must be specified.

''
field_id str

ID of the field that should be updated. Either field_name or field_id must be specified.

''

Returns:

Type Description
int

The ID of the field that was updated.

Raises:

Type Description
ValueError

If no field is found with the given field_id or field_name.

Source code in furthrmind\collection\baseclass.py
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
def update_field_value(self, value, field_name: str = "", field_id: str = ""):
    """
    Parameters
    ----------
    value : various data types
        The value to be updated in the field.

        - Numeric fields: float or int, or a string convertible to a float
        - Date fields: datetime, date object, unix timestamp, or string with iso format
        - Text fields: string
        - List fields: dictionary with id or name as key, or string with name, or string with id
        - Notebook fields: dictionary with content as key, or string
        - Checkbox fields: boolean
    field_name : str, optional
        Name of the field that should be updated. Either `field_name` or `field_id` must be specified.
    field_id : str, optional
        ID of the field that should be updated. Either `field_name` or `field_id` must be specified.

    Returns
    -------
    int
        The ID of the field that was updated.

    Raises
    ------
    ValueError
        If no field is found with the given `field_id` or `field_name`.
    """

    if not self._fetched:
        self._get()

    fielddata = None
    for item in self.fielddata:
        if fielddata:
            break
        if field_id:
            if item.field_id == field_id:
                fielddata = item
        elif field_name:
            if item.field_name.lower() == field_name.lower():
                fielddata = item

    if not fielddata:
        raise ValueError("No field found with the given field_id or field_name")

    return fielddata.update_value(value)