diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/404.html b/404.html new file mode 100644 index 000000000..1c7e433fc --- /dev/null +++ b/404.html @@ -0,0 +1,1064 @@ + + + + + + + + + + + + + + + + + + CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ +

404 - Not found

+ +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/api/index.html b/api/api/index.html new file mode 100644 index 000000000..ad7ecae74 --- /dev/null +++ b/api/api/index.html @@ -0,0 +1,5049 @@ + + + + + + + + + + + + + + + + + + + + + + API - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + + + + + +
+
+ + + + + + + +

API

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ API + + +

+ + +
+ + +
Definition
+

API Client class to communicate with the CRIPT API

+ + + +

Attributes:

+ + + + + + + + + + + + + + + +
NameTypeDescription
verbose + bool + +
+

A boolean flag that controls whether verbose logging is enabled or not.

+

When verbose is set to True, the class will provide additional detailed logging +to the terminal. This can be useful for debugging and understanding the internal +workings of the class.

+

When verbose is set to False, the class will only provide essential and concise +logging information, making the terminal output less cluttered and more user-friendly.

+
# turn off the terminal logs
+api.verbose = False
+
+
+
+ +
+ Source code in src/cript/api/api.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+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
+515
+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
+561
+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
+615
+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
+687
+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
+749
+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
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
class API:
+    """
+    ## Definition
+    API Client class to communicate with the CRIPT API
+
+    Attributes
+    ----------
+    verbose : bool
+        A boolean flag that controls whether verbose logging is enabled or not.
+
+        When `verbose` is set to `True`, the class will provide additional detailed logging
+        to the terminal. This can be useful for debugging and understanding the internal
+        workings of the class.
+
+        When `verbose` is set to `False`, the class will only provide essential and concise
+        logging information, making the terminal output less cluttered and more user-friendly.
+
+        ```python
+        # turn off the terminal logs
+        api.verbose = False
+        ```
+    """
+
+    # dictates whether the user wants to see terminal log statements or not
+    verbose: bool = True
+
+    _host: str = ""
+    _api_token: str = ""
+    _storage_token: str = ""
+    _http_headers: dict = {}
+    _vocabulary: dict = {}
+    _db_schema: dict = {}
+    _api_handle: str = "api"
+    _api_version: str = "v1"
+
+    # trunk-ignore-begin(cspell)
+    # AWS S3 constants
+    _REGION_NAME: str = "us-east-1"
+    _IDENTITY_POOL_ID: str = "us-east-1:555e15fe-05c1-4f63-9f58-c84d8fd6dc99"
+    _COGNITO_LOGIN_PROVIDER: str = "cognito-idp.us-east-1.amazonaws.com/us-east-1_VinmyZ0zW"
+    _BUCKET_NAME: str = "cript-development-user-data"
+    _BUCKET_DIRECTORY_NAME: str = "python_sdk_files"
+    _internal_s3_client: Any = None  # type: ignore
+    # trunk-ignore-end(cspell)
+
+    @beartype
+    def __init__(self, host: Union[str, None] = None, api_token: Union[str, None] = None, storage_token: Union[str, None] = None, config_file_path: Union[str, Path] = ""):
+        """
+        Initialize CRIPT API client with host and token.
+        Additionally, you can  use a config.json file and specify the file path.
+
+        !!! note "api client context manager"
+            It is necessary to use a `with` context manager for the API
+
+        Examples
+        --------
+        ### Create API client with host and token
+        ```Python
+        with cript.API('https://criptapp.org', 'secret_token') as api:
+           # node creation, api.save(), etc.
+        ```
+
+        ---
+
+        ### Creating API Client
+        !!! Warning "Token Security"
+            It is **highly** recommended that you store your API tokens in a safe location and read it into your code
+            Hard-coding API tokens directly into the code can pose security risks,
+            as the token might be exposed if the code is shared or stored in a version control system.
+            Anyone that has access to your tokens can impersonate you on the CRIPT platform
+
+        ### Create API Client with [Environment Variables](https://www.atatus.com/blog/python-environment-variables/)
+        Another great way to keep sensitive information secure is by using
+        [environment variables](https://www.atatus.com/blog/python-environment-variables/).
+        Sensitive information can be securely stored in environment variables and loaded into the code using
+        [os.getenv()](https://docs.python.org/3/library/os.html#os.getenv).
+
+        #### Example
+
+        ```python
+        import os
+
+        # securely load sensitive data into the script
+        cript_host = os.getenv("cript_host")
+        cript_api_token = os.getenv("cript_api_token")
+        cript_storage_token = os.getenv("cript_storage_token")
+
+        with cript.API(host=cript_host, api_token=cript_api_token, storage_token=cript_storage_token) as api:
+            # write your script
+            pass
+        ```
+
+        ### Create API Client with `None`
+        Alternatively you can configure your system to have an environment variable of
+        `CRIPT_TOKEN` for the API token and `CRIPT_STORAGE_TOKEN` for the storage token, then
+        initialize `cript.API` `api_token` and `storage_token` with `None`.
+
+        The CRIPT Python SDK will try to read the API Token and Storage token from your system's environment variables.
+
+        ```python
+        with cript.API(host=cript_host, api_token=None, storage_token=None) as api:
+            # write your script
+            pass
+        ```
+
+        ### Create API client with config.json
+        `config.json`
+        ```json
+        {
+            "host": "https://criptapp.org",
+            "token": "I am token"
+        }
+        ```
+
+        `my_script.py`
+        ```python
+        from pathlib import Path
+
+        # create a file path object of where the config file is
+        config_file_path = Path(__file__) / Path('./config.json')
+
+        with cript.API(config_file_path=config_file_path) as api:
+            # node creation, api.save(), etc.
+        ```
+
+        Parameters
+        ----------
+        host : str, None
+            CRIPT host for the Python SDK to connect to such as `https://criptapp.org`
+            This host address is the same address used to login to cript website.
+            If `None` is specified, the host is inferred from the environment variable `CRIPT_HOST`.
+        api_token : str, None
+            CRIPT API Token used to connect to CRIPT and upload all data with the exception to file upload that needs
+            a different token.
+            You can find your personal token on the cript website at User > Security Settings.
+            The user icon is in the top right.
+            If `None` is specified, the token is inferred from the environment variable `CRIPT_TOKEN`.
+        storage_token: str
+            This token is used to upload local files to CRIPT cloud storage when needed
+        config_file_path: str
+            the file path to the config.json file where the token and host can be found
+
+
+        Notes
+        -----
+        * if `host=None` and `token=None`
+            then the Python SDK will grab the host from the users environment variable of `"CRIPT_HOST"`
+            and `"CRIPT_TOKEN"`
+
+        Warns
+        -----
+        UserWarning
+            If `host` is using "http" it gives the user a warning that HTTP is insecure and the user should use HTTPS
+
+        Raises
+        ------
+        CRIPTConnectionError
+            If it cannot connect to CRIPT with the provided host and token a CRIPTConnectionError is thrown.
+
+        Returns
+        -------
+        None
+            Instantiate a new CRIPT API object
+        """
+
+        # if there is a config.json file or any of the parameters are None, then get the variables from file or env vars
+        if config_file_path or (host is None or api_token is None or storage_token is None):
+            authentication_dict: Dict[str, str] = resolve_host_and_token(host, api_token=api_token, storage_token=storage_token, config_file_path=config_file_path)
+
+            host = authentication_dict["host"]
+            api_token = authentication_dict["api_token"]
+            storage_token = authentication_dict["storage_token"]
+
+        self._host = self._prepare_host(host=host)  # type: ignore
+        self._api_token = api_token  # type: ignore
+        self._storage_token = storage_token  # type: ignore
+
+        # add Bearer to token for HTTP requests
+        self._http_headers = {"Authorization": f"Bearer {self._api_token}", "Content-Type": "application/json"}
+
+        # check that api can connect to CRIPT with host and token
+        self._check_initial_host_connection()
+
+        self._get_db_schema()
+
+    @beartype
+    def _prepare_host(self, host: str) -> str:
+        # strip ending slash to make host always uniform
+        host = host.rstrip("/")
+        host = f"{host}/{self._api_handle}/{self._api_version}"
+
+        # if host is using unsafe "http://" then give a warning
+        if host.startswith("http://"):
+            warnings.warn("HTTP is an unsafe protocol please consider using HTTPS.")
+
+        if not host.startswith("http"):
+            raise InvalidHostError()
+
+        return host
+
+    # Use a property to ensure delayed init of s3_client
+    @property
+    def _s3_client(self) -> boto3.client:  # type: ignore
+        """
+        creates or returns a fully authenticated and ready s3 client
+
+        Returns
+        -------
+        s3_client: boto3.client
+            fully prepared and authenticated s3 client ready to be used throughout the script
+        """
+
+        if self._internal_s3_client is None:
+            auth = boto3.client("cognito-identity", region_name=self._REGION_NAME)
+            identity_id = auth.get_id(IdentityPoolId=self._IDENTITY_POOL_ID, Logins={self._COGNITO_LOGIN_PROVIDER: self._storage_token})
+            # TODO remove this temporary fix to the token, by getting is from back end.
+            aws_token = self._storage_token
+
+            aws_credentials = auth.get_credentials_for_identity(IdentityId=identity_id["IdentityId"], Logins={self._COGNITO_LOGIN_PROVIDER: aws_token})
+            aws_credentials = aws_credentials["Credentials"]
+            s3_client = boto3.client(
+                "s3",
+                aws_access_key_id=aws_credentials["AccessKeyId"],
+                aws_secret_access_key=aws_credentials["SecretKey"],
+                aws_session_token=aws_credentials["SessionToken"],
+            )
+            self._internal_s3_client = s3_client
+        return self._internal_s3_client
+
+    def __enter__(self):
+        self.connect()
+        return self
+
+    @beartype
+    def __exit__(self, type, value, traceback):
+        self.disconnect()
+
+    def connect(self):
+        """
+        Connect this API globally as the current active access point.
+        It is not necessary to call this function manually if a context manager is used.
+        A context manager is preferred where possible.
+        Jupyter notebooks are a use case where this connection can be handled manually.
+        If this function is called manually, the `API.disconnect` function has to be called later.
+
+        For manual connection: nested API object are discouraged.
+        """
+        # Store the last active global API (might be None)
+        global _global_cached_api
+        self._previous_global_cached_api = copy.copy(_global_cached_api)
+        _global_cached_api = self
+        return self
+
+    def disconnect(self):
+        """
+        Disconnect this API from the active access point.
+        It is not necessary to call this function manually if a context manager is used.
+        A context manager is preferred where possible.
+        Jupyter notebooks are a use case where this connection can be handled manually.
+        This function has to be called manually if  the `API.connect` function has to be called before.
+
+        For manual connection: nested API object are discouraged.
+        """
+        # Restore the previously active global API (might be None)
+        global _global_cached_api
+        _global_cached_api = self._previous_global_cached_api
+
+    @property
+    def schema(self):
+        """
+        Access the CRIPT Database Schema that is associated with this API connection.
+        The CRIPT Database Schema is used  to validate a node's JSON so that it is compatible with the CRIPT API.
+        """
+        return self._db_schema
+
+    @property
+    def host(self):
+        """
+        Read only access to the currently connected host.
+
+        Examples
+        --------
+        ```python
+        print(cript_api.host)
+        ```
+        Output
+        ```Python
+        https://criptapp.org/api/v1
+        ```
+        """
+        return self._host
+
+    def _check_initial_host_connection(self) -> None:
+        """
+        tries to create a connection with host and if the host does not respond or is invalid it raises an error
+
+        Raises
+        -------
+        CRIPTConnectionError
+            raised when the host does not give the expected response
+
+        Returns
+        -------
+        None
+        """
+        try:
+            pass
+        except Exception as exc:
+            raise CRIPTConnectionError(self.host, self._api_token) from exc
+
+    def _get_vocab(self) -> dict:
+        """
+        gets the entire CRIPT controlled vocabulary and stores it in _vocabulary
+
+        1. loops through all controlled vocabulary categories
+            1. if the category already exists in the controlled vocabulary then skip that category and continue
+            1. if the category does not exist in the `_vocabulary` dict,
+            then request it from the API and append it to the `_vocabulary` dict
+        1. at the end the `_vocabulary` should have all the controlled vocabulary and that will be returned
+
+           Examples
+           --------
+           The vocabulary looks like this
+           ```json
+           {'algorithm_key':
+                [
+                    {
+                    'description': "Velocity-Verlet integration algorithm. Parameters: 'integration_timestep'.",
+                    'name': 'velocity_verlet'
+                    },
+            }
+           ```
+        """
+
+        # loop through all vocabulary categories and make a request to each vocabulary category
+        # and put them all inside of self._vocab with the keys being the vocab category name
+        for category in ControlledVocabularyCategories:
+            if category in self._vocabulary:
+                continue
+
+            self._vocabulary[category.value] = self.get_vocab_by_category(category)
+
+        return self._vocabulary
+
+    @beartype
+    def get_vocab_by_category(self, category: ControlledVocabularyCategories) -> List[dict]:
+        """
+        get the CRIPT controlled vocabulary by category
+
+        Parameters
+        ----------
+        category: str
+            category of
+
+        Returns
+        -------
+        List[dict]
+            list of JSON containing the controlled vocabulary
+        """
+
+        # check if the vocabulary category is already cached
+        if category.value in self._vocabulary:
+            return self._vocabulary[category.value]
+
+        # if vocabulary category is not in cache, then get it from API and cache it
+        response = requests.get(f"{self.host}/cv/{category.value}").json()
+
+        if response["code"] != 200:
+            # TODO give a better CRIPT custom Exception
+            raise Exception(f"while getting controlled vocabulary from CRIPT for {category}, " f"the API responded with http {response} ")
+
+        # add to cache
+        self._vocabulary[category.value] = response["data"]
+
+        return self._vocabulary[category.value]
+
+    @beartype
+    def _is_vocab_valid(self, vocab_category: ControlledVocabularyCategories, vocab_word: str) -> bool:
+        """
+        checks if the vocabulary is valid within the CRIPT controlled vocabulary.
+        Either returns True or InvalidVocabulary Exception
+
+        1. if the vocabulary is custom (starts with "+")
+            then it is automatically valid
+        2. if vocabulary is not custom, then it is checked against its category
+            if the word cannot be found in the category then it returns False
+
+        Parameters
+        ----------
+        vocab_category: ControlledVocabularyCategories
+            ControlledVocabularyCategories enums
+        vocab_word: str
+            the vocabulary word e.g. "CAS", "SMILES", "BigSmiles", "+my_custom_key"
+
+        Returns
+        -------
+        a boolean of if the vocabulary is valid
+
+        Raises
+        ------
+        InvalidVocabulary
+            If the vocabulary is invalid then the error gets raised
+        """
+
+        # check if vocab is custom
+        # This is deactivated currently, no custom vocab allowed.
+        if vocab_word.startswith("+"):
+            return True
+
+        # get the entire vocabulary
+        controlled_vocabulary = self._get_vocab()
+        # get just the category needed
+        controlled_vocabulary = controlled_vocabulary[vocab_category.value]
+
+        # TODO this can be faster with a dict of dicts that can do o(1) look up
+        #  looping through an unsorted list is an O(n) look up which is slow
+        # loop through the list
+        for vocab_dict in controlled_vocabulary:
+            # check the name exists within the dict
+            if vocab_dict.get("name") == vocab_word:
+                return True
+
+        raise InvalidVocabulary(vocab=vocab_word, possible_vocab=list(controlled_vocabulary))
+
+    def _get_db_schema(self) -> dict:
+        """
+        Sends a GET request to CRIPT to get the database schema and returns it.
+        The database schema can be used for validating the JSON request
+        before submitting it to CRIPT.
+
+        1. checks if the db schema is already set
+            * if already exists then it skips fetching it from the API and just returns what it already has
+        2. if db schema has not been set yet, then it fetches it from the API
+            * after getting it from the API it saves it in the `_schema` class variable,
+            so it can be easily and efficiently gotten next time
+        """
+
+        # check if db schema is already saved
+        if bool(self._db_schema):
+            return self._db_schema
+
+        # fetch db_schema from API
+        else:
+            # fetch db schema, get the JSON body of it, and get the data of that JSON
+            response = requests.get(url=f"{self.host}/schema/").json()
+
+            if response["code"] != 200:
+                raise APIError(api_error=response.json())
+
+            # get the data from the API JSON response
+            self._db_schema = response["data"]
+            return self._db_schema
+
+    @beartype
+    def _is_node_schema_valid(self, node_json: str, is_patch: bool = False) -> bool:
+        """
+        checks a node JSON schema against the db schema to return if it is valid or not.
+
+        1. get db schema
+        1. convert node_json str to dict
+        1. take out the node type from the dict
+            1. "node": ["material"]
+        1. use the node type from dict to tell the db schema which node schema to validate against
+            1. Manipulates the string to be title case to work with db schema
+
+        Parameters
+        ----------
+        node_json: str
+            a node in JSON form string
+        is_patch: bool
+            a boolean flag checking if it needs to validate against `NodePost` or `NodePatch`
+
+        Notes
+        -----
+        This function does not take into consideration vocabulary validation.
+            For vocabulary validation please check `is_vocab_valid`
+
+        Raises
+        ------
+        CRIPTNodeSchemaError
+            in case a node is invalid
+
+        Returns
+        -------
+        bool
+            whether the node JSON is valid or not
+        """
+
+        db_schema = self._get_db_schema()
+
+        node_type: str = _get_node_type_from_json(node_json=node_json)
+
+        node_dict = json.loads(node_json)
+
+        if self.verbose:
+            # logging out info to the terminal for the user feedback
+            # (improve UX because the program is currently slow)
+            logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
+            logging.info(f"Validating {node_type} graph...")
+
+        # set the schema to test against http POST or PATCH of DB Schema
+        schema_http_method: str
+
+        if is_patch:
+            schema_http_method = "Patch"
+        else:
+            schema_http_method = "Post"
+
+        # set which node you are using schema validation for
+        db_schema["$ref"] = f"#/$defs/{node_type}{schema_http_method}"
+
+        try:
+            jsonschema.validate(instance=node_dict, schema=db_schema)
+        except jsonschema.exceptions.ValidationError as error:
+            raise CRIPTNodeSchemaError(node_type=node_dict["node"], json_schema_validation_error=str(error)) from error
+
+        # if validation goes through without any problems return True
+        return True
+
+    def save(self, project: Project) -> None:
+        """
+        This method takes a project node, serializes the class into JSON
+        and then sends the JSON to be saved to the API.
+        It takes Project node because everything is connected to the Project node,
+        and it can be used to send either a POST or PATCH request to API
+
+        Parameters
+        ----------
+        project: Project
+            the Project Node that the user wants to save
+
+        Raises
+        ------
+        CRIPTAPISaveError
+            If the API responds with anything other than an HTTP of `200`, the API error is displayed to the user
+
+        Returns
+        -------
+        A set of extra saved node UUIDs.
+            Just sends a `POST` or `Patch` request to the API
+        """
+        try:
+            self._internal_save(project)
+        except CRIPTAPISaveError as exc:
+            if exc.pre_saved_nodes:
+                for node_uuid in exc.pre_saved_nodes:
+                    # TODO remove all pre-saved nodes by their uuid.
+                    pass
+            raise exc from exc
+
+    def _internal_save(self, node, save_values: Optional[_InternalSaveValues] = None) -> _InternalSaveValues:
+        """
+        Internal helper function that handles the saving of different nodes (not just project).
+
+        If a "Bad UUID" error happens, we find that node with the UUID and save it first.
+        Then we recursively call the _internal_save again.
+        Because it is recursive, this repeats until no "Bad UUID" error happen anymore.
+        This works, because we keep track of "Bad UUID" handled nodes, and represent them in the JSON only as the UUID.
+        """
+
+        if save_values is None:
+            save_values = _InternalSaveValues()
+
+        # saves all the local files to cloud storage right before saving the Project node
+        # Ensure that all file nodes have uploaded there payload before actual save.
+        for file_node in node.find_children({"node": ["File"]}):
+            file_node.ensure_uploaded(api=self)
+
+        node.validate()
+
+        # Dummy response to have a virtual do-while loop, instead of while loop.
+        response = {"code": -1}
+        # TODO remove once get works properly
+        force_patch = False
+
+        while response["code"] != 200:
+            # Keep a record of how the state was before the loop
+            old_save_values = copy.deepcopy(save_values)
+            # We assemble the JSON to be saved to back end.
+            # Note how we exclude pre-saved uuid nodes.
+            json_data = node.get_json(known_uuid=save_values.saved_uuid, suppress_attributes=save_values.suppress_attributes).json
+
+            # This checks if the current node exists on the back end.
+            # if it does exist we use `patch` if it doesn't `post`.
+            test_get_response: Dict = requests.get(url=f"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}", headers=self._http_headers).json()
+            patch_request = test_get_response["code"] == 200
+
+            # TODO remove once get works properly
+            if not patch_request and force_patch:
+                patch_request = True
+                force_patch = False
+            # TODO activate patch validation
+            # node.validate(is_patch=patch_request)
+
+            # If all that is left is a UUID, we don't need to save it, we can just exit the loop.
+            if patch_request and len(json.loads(json_data)) == 1:
+                response = {"code": 200}
+                break
+
+            if patch_request:
+                response: Dict = requests.patch(url=f"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}", headers=self._http_headers, data=json_data).json()  # type: ignore
+            else:
+                response: Dict = requests.post(url=f"{self._host}/{node.node_type_snake_case}", headers=self._http_headers, data=json_data).json()  # type: ignore
+
+            # If we get an error we may be able to fix, we to handle this extra and save the bad node first.
+            # Errors with this code, may be fixable
+            if response["code"] in (400, 409):
+                returned_save_values = _fix_node_save(self, node, response, save_values)
+                save_values += returned_save_values
+
+            # Handle errors from patching with too many attributes
+            if patch_request and response["code"] in (400,):
+                suppress_attributes = _identify_suppress_attributes(node, response)
+                new_save_values = _InternalSaveValues(save_values.saved_uuid, suppress_attributes)
+                save_values += new_save_values
+
+            # It is only worthwhile repeating the attempted save loop if our state has improved.
+            # Aka we did something to fix the occurring error
+            if not save_values > old_save_values:
+                # TODO remove once get works properly
+                if not patch_request and response["code"] == 409 and response["error"].strip().startswith("Duplicate uuid:"):  # type: ignore
+                    duplicate_uuid = _get_uuid_from_error_message(response["error"])  # type: ignore
+                    if str(node.uuid) == duplicate_uuid:
+                        print("force_patch", node.uuid)
+                        force_patch = True
+                        continue
+
+                break
+
+        if response["code"] != 200:
+            raise CRIPTAPISaveError(api_host_domain=self._host, http_code=response["code"], api_response=response["error"], patch_request=patch_request, pre_saved_nodes=save_values.saved_uuid, json_data=json_data)  # type: ignore
+
+        save_values.saved_uuid.add(str(node.uuid))
+        return save_values
+
+    def upload_file(self, file_path: Union[Path, str]) -> str:
+        # trunk-ignore-begin(cspell)
+        """
+        uploads a file to AWS S3 bucket and returns a URL of the uploaded file in AWS S3
+        The URL is has no expiration time limit and is available forever
+
+        1. take a file path of type path or str to the file on local storage
+            * see Example for more details
+        1. convert the file path to pathlib object, so it is versatile and
+            always uniform regardless if the user passes in a str or path object
+        1. get the file
+        1. rename the file to avoid clash or overwriting of previously uploaded files
+            * change file name to `original_name_uuid4.extension`
+                *  `document_42926a201a624fdba0fd6271defc9e88.txt`
+        1. upload file to AWS S3
+        1. get the link of the uploaded file and return it
+
+
+        Parameters
+        ----------
+        file_path: Union[str, Path]
+            file path as str or Path object. Path Object is recommended
+
+        Examples
+        --------
+        ```python
+        import cript
+
+        api = cript.API(host, token)
+
+        # programmatically create the absolute path of your file, so the program always works correctly
+        my_file_path = (Path(__file__) / Path('../upload_files/my_file.txt')).resolve()
+
+        my_file_s3_url = api.upload_file(absolute_file_path=my_file_path)
+        ```
+
+        Raises
+        ------
+        FileNotFoundError
+            In case the CRIPT Python SDK cannot find the file on your computer because the file does not exist
+            or the path to it is incorrect it raises
+            [FileNotFoundError](https://docs.python.org/3/library/exceptions.html#FileNotFoundError)
+
+        Returns
+        -------
+        object_name: str
+            object_name of the AWS S3 uploaded file to be put into the File node source attribute
+        """
+        # trunk-ignore-end(cspell)
+
+        # TODO consider using a new variable when converting `file_path` from parameter
+        #  to a Path object with a new type
+        # convert file path from whatever the user passed in to a pathlib object
+        file_path = Path(file_path).resolve()
+
+        # get file_name and file_extension from absolute file path
+        # file_extension includes the dot, e.g. ".txt"
+        file_name, file_extension = os.path.splitext(os.path.basename(file_path))
+
+        # generate a UUID4 string without dashes, making a cleaner file name
+        uuid_str: str = str(uuid.uuid4().hex)
+
+        new_file_name: str = f"{file_name}_{uuid_str}{file_extension}"
+
+        # e.g. "directory/file_name_uuid.extension"
+        object_name: str = f"{self._BUCKET_DIRECTORY_NAME}/{new_file_name}"
+
+        # upload file to AWS S3
+        self._s3_client.upload_file(Filename=file_path, Bucket=self._BUCKET_NAME, Key=object_name)  # type: ignore
+
+        # return the object_name within AWS S3 for easy retrieval
+        return object_name
+
+    @beartype
+    def download_file(self, file_source: str, destination_path: str = ".") -> None:
+        """
+        Download a file from CRIPT Cloud Storage (AWS S3) and save it to the specified path.
+
+        ??? Info "Cloud Storage vs Web URL File Download"
+
+            If the `object_name` does not starts with `http` then the program assumes the file is in AWS S3 storage,
+            and attempts to retrieve it via
+            [boto3 client](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html).
+
+            If the `object_name` starts with `http` then the program knows that
+            it is a file stored on the web. The program makes a simple
+            [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request to get the file,
+            then writes the contents of it to the specified destination.
+
+            > Note: The current version of the program is designed to download files from the web in a straightforward
+            manner. However, please be aware that the program may encounter limitations when dealing with URLs that
+            require JavaScript or a session to be enabled. In such cases, the download method may fail.
+
+            > We acknowledge these limitations and plan to enhance the method in future versions to ensure compatibility
+            with a wider range of web file URLs. Our goal is to develop a robust solution capable of handling any and
+            all web file URLs.
+
+        Parameters
+        ----------
+        file_source: str
+            object_name: within AWS S3 the extension e.g. "my_file_name.txt
+            the file is then searched within "Data/{file_name}" and saved to local storage
+            URL file source: In case of the file source is a URL then it is the file source URL
+                starting with "https://"
+                example: `https://criptscripts.org/cript_graph_json/JSON/cao_protein.json`
+        destination_path: str
+            please provide a path with file name of where you would like the file to be saved
+            on local storage.
+            > If no path is specified, then by default it will download the file
+            to the current working directory.
+
+            > The destination path must include a file name and file extension
+                e.g.: `~/Desktop/my_example_file_name.extension`
+
+        Examples
+        --------
+        ```python
+        from pathlib import Path
+
+        desktop_path = (Path(__file__).parent / "cript_downloads" / "my_downloaded_file.txt").resolve()
+        cript_api.download_file(file_url=my_file_source, destination_path=desktop_path)
+        ```
+
+        Raises
+        ------
+        FileNotFoundError
+            In case the file could not be found because the file does not exist or the path given is incorrect
+
+        Returns
+        -------
+        None
+            Simply downloads the file
+        """
+
+        # if the file source is a URL
+        if file_source.startswith("http"):
+            download_file_from_url(url=file_source, destination_path=Path(destination_path).resolve())
+            return
+
+        # the file is stored in cloud storage and must be retrieved via object_name
+        self._s3_client.download_file(Bucket=self._BUCKET_NAME, Key=file_source, Filename=destination_path)  # type: ignore
+
+    @beartype
+    def search(
+        self,
+        node_type,
+        search_mode: SearchModes,
+        value_to_search: Union[None, str],
+    ) -> Paginator:
+        """
+        This method is used to perform search on the CRIPT platform.
+
+        Examples
+        --------
+        ```python
+        # search by node type
+        materials_paginator = cript_api.search(
+            node_type=cript.Material,
+            search_mode=cript.SearchModes.NODE_TYPE,
+            value_to_search=None,
+        )
+        ```
+
+        Parameters
+        ----------
+        node_type : PrimaryBaseNode
+            Type of node that you are searching for.
+        search_mode : SearchModes
+            Type of search you want to do. You can search by name, `UUID`, `EXACT_NAME`, etc.
+            Refer to [valid search modes](../search_modes)
+        value_to_search : Union[str, None]
+            What you are searching for can be either a value, and if you are only searching for
+            a `NODE_TYPE`, then this value can be empty or `None`
+
+        Returns
+        -------
+        Paginator
+            paginator object for the user to use to flip through pages of search results
+        """
+
+        # get node typ from class
+        node_type = node_type.node_type_snake_case
+        print(node_type)
+
+        # always putting a page parameter of 0 for all search URLs
+        page_number = 0
+
+        api_endpoint: str = ""
+
+        # requesting a page of some primary node
+        if search_mode == SearchModes.NODE_TYPE:
+            api_endpoint = f"{self._host}/{node_type}"
+
+        elif search_mode == SearchModes.CONTAINS_NAME:
+            api_endpoint = f"{self._host}/search/{node_type}"
+
+        elif search_mode == SearchModes.EXACT_NAME:
+            api_endpoint = f"{self._host}/search/exact/{node_type}"
+
+        elif search_mode == SearchModes.UUID:
+            api_endpoint = f"{self._host}/{node_type}/{value_to_search}"
+            # putting the value_to_search in the URL instead of a query
+            value_to_search = None
+
+        assert api_endpoint != ""
+
+        # TODO error handling if none of the API endpoints got hit
+        return Paginator(http_headers=self._http_headers, api_endpoint=api_endpoint, query=value_to_search, current_page_number=page_number)
+
+
+ + + +
+ + + + + + + +
+ + + +

+host + + + property + + +

+ + +
+ +

Read only access to the currently connected host.

+ + + +

Examples:

+

print(cript_api.host)
+
+Output +
https://criptapp.org/api/v1
+

+
+ +
+ +
+ + + +

+schema + + + property + + +

+ + +
+ +

Access the CRIPT Database Schema that is associated with this API connection. +The CRIPT Database Schema is used to validate a node's JSON so that it is compatible with the CRIPT API.

+
+ +
+ + + + +
+ + + +

+__init__(host=None, api_token=None, storage_token=None, config_file_path='') + +

+ + +
+ +

Initialize CRIPT API client with host and token. +Additionally, you can use a config.json file and specify the file path.

+
+

api client context manager

+

It is necessary to use a with context manager for the API

+
+ + + +

Examples:

+
Create API client with host and token
+
with cript.API('https://criptapp.org', 'secret_token') as api:
+   # node creation, api.save(), etc.
+
+
+
Creating API Client
+
+

Token Security

+

It is highly recommended that you store your API tokens in a safe location and read it into your code +Hard-coding API tokens directly into the code can pose security risks, +as the token might be exposed if the code is shared or stored in a version control system. +Anyone that has access to your tokens can impersonate you on the CRIPT platform

+
+
Create API Client with Environment Variables
+

Another great way to keep sensitive information secure is by using +environment variables. +Sensitive information can be securely stored in environment variables and loaded into the code using +os.getenv().

+
Example
+
import os
+
+# securely load sensitive data into the script
+cript_host = os.getenv("cript_host")
+cript_api_token = os.getenv("cript_api_token")
+cript_storage_token = os.getenv("cript_storage_token")
+
+with cript.API(host=cript_host, api_token=cript_api_token, storage_token=cript_storage_token) as api:
+    # write your script
+    pass
+
+
Create API Client with None
+

Alternatively you can configure your system to have an environment variable of +CRIPT_TOKEN for the API token and CRIPT_STORAGE_TOKEN for the storage token, then +initialize cript.API api_token and storage_token with None.

+

The CRIPT Python SDK will try to read the API Token and Storage token from your system's environment variables.

+
with cript.API(host=cript_host, api_token=None, storage_token=None) as api:
+    # write your script
+    pass
+
+
Create API client with config.json
+

config.json +

{
+    "host": "https://criptapp.org",
+    "token": "I am token"
+}
+

+

my_script.py +

from pathlib import Path
+
+# create a file path object of where the config file is
+config_file_path = Path(__file__) / Path('./config.json')
+
+with cript.API(config_file_path=config_file_path) as api:
+    # node creation, api.save(), etc.
+

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
host + (str, None) + +
+

CRIPT host for the Python SDK to connect to such as https://criptapp.org +This host address is the same address used to login to cript website. +If None is specified, the host is inferred from the environment variable CRIPT_HOST.

+
+
+ None +
api_token + (str, None) + +
+

CRIPT API Token used to connect to CRIPT and upload all data with the exception to file upload that needs +a different token. +You can find your personal token on the cript website at User > Security Settings. +The user icon is in the top right. +If None is specified, the token is inferred from the environment variable CRIPT_TOKEN.

+
+
+ None +
storage_token + Union[str, None] + +
+

This token is used to upload local files to CRIPT cloud storage when needed

+
+
+ None +
config_file_path + Union[str, Path] + +
+

the file path to the config.json file where the token and host can be found

+
+
+ '' +
+
Notes
+
    +
  • if host=None and token=None + then the Python SDK will grab the host from the users environment variable of "CRIPT_HOST" + and "CRIPT_TOKEN"
  • +
+ + + +

Warns:

+ + + + + + + + + + + + + +
TypeDescription
+ UserWarning + +
+

If host is using "http" it gives the user a warning that HTTP is insecure and the user should use HTTPS

+
+
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ CRIPTConnectionError + +
+

If it cannot connect to CRIPT with the provided host and token a CRIPTConnectionError is thrown.

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiate a new CRIPT API object

+
+
+ +
+ Source code in src/cript/api/api.py +
@beartype
+def __init__(self, host: Union[str, None] = None, api_token: Union[str, None] = None, storage_token: Union[str, None] = None, config_file_path: Union[str, Path] = ""):
+    """
+    Initialize CRIPT API client with host and token.
+    Additionally, you can  use a config.json file and specify the file path.
+
+    !!! note "api client context manager"
+        It is necessary to use a `with` context manager for the API
+
+    Examples
+    --------
+    ### Create API client with host and token
+    ```Python
+    with cript.API('https://criptapp.org', 'secret_token') as api:
+       # node creation, api.save(), etc.
+    ```
+
+    ---
+
+    ### Creating API Client
+    !!! Warning "Token Security"
+        It is **highly** recommended that you store your API tokens in a safe location and read it into your code
+        Hard-coding API tokens directly into the code can pose security risks,
+        as the token might be exposed if the code is shared or stored in a version control system.
+        Anyone that has access to your tokens can impersonate you on the CRIPT platform
+
+    ### Create API Client with [Environment Variables](https://www.atatus.com/blog/python-environment-variables/)
+    Another great way to keep sensitive information secure is by using
+    [environment variables](https://www.atatus.com/blog/python-environment-variables/).
+    Sensitive information can be securely stored in environment variables and loaded into the code using
+    [os.getenv()](https://docs.python.org/3/library/os.html#os.getenv).
+
+    #### Example
+
+    ```python
+    import os
+
+    # securely load sensitive data into the script
+    cript_host = os.getenv("cript_host")
+    cript_api_token = os.getenv("cript_api_token")
+    cript_storage_token = os.getenv("cript_storage_token")
+
+    with cript.API(host=cript_host, api_token=cript_api_token, storage_token=cript_storage_token) as api:
+        # write your script
+        pass
+    ```
+
+    ### Create API Client with `None`
+    Alternatively you can configure your system to have an environment variable of
+    `CRIPT_TOKEN` for the API token and `CRIPT_STORAGE_TOKEN` for the storage token, then
+    initialize `cript.API` `api_token` and `storage_token` with `None`.
+
+    The CRIPT Python SDK will try to read the API Token and Storage token from your system's environment variables.
+
+    ```python
+    with cript.API(host=cript_host, api_token=None, storage_token=None) as api:
+        # write your script
+        pass
+    ```
+
+    ### Create API client with config.json
+    `config.json`
+    ```json
+    {
+        "host": "https://criptapp.org",
+        "token": "I am token"
+    }
+    ```
+
+    `my_script.py`
+    ```python
+    from pathlib import Path
+
+    # create a file path object of where the config file is
+    config_file_path = Path(__file__) / Path('./config.json')
+
+    with cript.API(config_file_path=config_file_path) as api:
+        # node creation, api.save(), etc.
+    ```
+
+    Parameters
+    ----------
+    host : str, None
+        CRIPT host for the Python SDK to connect to such as `https://criptapp.org`
+        This host address is the same address used to login to cript website.
+        If `None` is specified, the host is inferred from the environment variable `CRIPT_HOST`.
+    api_token : str, None
+        CRIPT API Token used to connect to CRIPT and upload all data with the exception to file upload that needs
+        a different token.
+        You can find your personal token on the cript website at User > Security Settings.
+        The user icon is in the top right.
+        If `None` is specified, the token is inferred from the environment variable `CRIPT_TOKEN`.
+    storage_token: str
+        This token is used to upload local files to CRIPT cloud storage when needed
+    config_file_path: str
+        the file path to the config.json file where the token and host can be found
+
+
+    Notes
+    -----
+    * if `host=None` and `token=None`
+        then the Python SDK will grab the host from the users environment variable of `"CRIPT_HOST"`
+        and `"CRIPT_TOKEN"`
+
+    Warns
+    -----
+    UserWarning
+        If `host` is using "http" it gives the user a warning that HTTP is insecure and the user should use HTTPS
+
+    Raises
+    ------
+    CRIPTConnectionError
+        If it cannot connect to CRIPT with the provided host and token a CRIPTConnectionError is thrown.
+
+    Returns
+    -------
+    None
+        Instantiate a new CRIPT API object
+    """
+
+    # if there is a config.json file or any of the parameters are None, then get the variables from file or env vars
+    if config_file_path or (host is None or api_token is None or storage_token is None):
+        authentication_dict: Dict[str, str] = resolve_host_and_token(host, api_token=api_token, storage_token=storage_token, config_file_path=config_file_path)
+
+        host = authentication_dict["host"]
+        api_token = authentication_dict["api_token"]
+        storage_token = authentication_dict["storage_token"]
+
+    self._host = self._prepare_host(host=host)  # type: ignore
+    self._api_token = api_token  # type: ignore
+    self._storage_token = storage_token  # type: ignore
+
+    # add Bearer to token for HTTP requests
+    self._http_headers = {"Authorization": f"Bearer {self._api_token}", "Content-Type": "application/json"}
+
+    # check that api can connect to CRIPT with host and token
+    self._check_initial_host_connection()
+
+    self._get_db_schema()
+
+
+
+ +
+ + +
+ + + +

+connect() + +

+ + +
+ +

Connect this API globally as the current active access point. +It is not necessary to call this function manually if a context manager is used. +A context manager is preferred where possible. +Jupyter notebooks are a use case where this connection can be handled manually. +If this function is called manually, the API.disconnect function has to be called later.

+

For manual connection: nested API object are discouraged.

+ +
+ Source code in src/cript/api/api.py +
def connect(self):
+    """
+    Connect this API globally as the current active access point.
+    It is not necessary to call this function manually if a context manager is used.
+    A context manager is preferred where possible.
+    Jupyter notebooks are a use case where this connection can be handled manually.
+    If this function is called manually, the `API.disconnect` function has to be called later.
+
+    For manual connection: nested API object are discouraged.
+    """
+    # Store the last active global API (might be None)
+    global _global_cached_api
+    self._previous_global_cached_api = copy.copy(_global_cached_api)
+    _global_cached_api = self
+    return self
+
+
+
+ +
+ + +
+ + + +

+disconnect() + +

+ + +
+ +

Disconnect this API from the active access point. +It is not necessary to call this function manually if a context manager is used. +A context manager is preferred where possible. +Jupyter notebooks are a use case where this connection can be handled manually. +This function has to be called manually if the API.connect function has to be called before.

+

For manual connection: nested API object are discouraged.

+ +
+ Source code in src/cript/api/api.py +
def disconnect(self):
+    """
+    Disconnect this API from the active access point.
+    It is not necessary to call this function manually if a context manager is used.
+    A context manager is preferred where possible.
+    Jupyter notebooks are a use case where this connection can be handled manually.
+    This function has to be called manually if  the `API.connect` function has to be called before.
+
+    For manual connection: nested API object are discouraged.
+    """
+    # Restore the previously active global API (might be None)
+    global _global_cached_api
+    _global_cached_api = self._previous_global_cached_api
+
+
+
+ +
+ + +
+ + + +

+download_file(file_source, destination_path='.') + +

+ + +
+ +

Download a file from CRIPT Cloud Storage (AWS S3) and save it to the specified path.

+
+Cloud Storage vs Web URL File Download +

If the object_name does not starts with http then the program assumes the file is in AWS S3 storage, +and attempts to retrieve it via +boto3 client.

+

If the object_name starts with http then the program knows that +it is a file stored on the web. The program makes a simple +GET request to get the file, +then writes the contents of it to the specified destination.

+
+

Note: The current version of the program is designed to download files from the web in a straightforward +manner. However, please be aware that the program may encounter limitations when dealing with URLs that +require JavaScript or a session to be enabled. In such cases, the download method may fail.

+

We acknowledge these limitations and plan to enhance the method in future versions to ensure compatibility +with a wider range of web file URLs. Our goal is to develop a robust solution capable of handling any and +all web file URLs.

+
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
file_source + str + +
+

object_name: within AWS S3 the extension e.g. "my_file_name.txt +the file is then searched within "Data/{file_name}" and saved to local storage +URL file source: In case of the file source is a URL then it is the file source URL + starting with "https://" + example: https://criptscripts.org/cript_graph_json/JSON/cao_protein.json

+
+
+ required +
destination_path + str + +
+

please provide a path with file name of where you would like the file to be saved +on local storage.

+
+

If no path is specified, then by default it will download the file +to the current working directory.

+

The destination path must include a file name and file extension + e.g.: ~/Desktop/my_example_file_name.extension

+
+
+
+ '.' +
+ + + +

Examples:

+
from pathlib import Path
+
+desktop_path = (Path(__file__).parent / "cript_downloads" / "my_downloaded_file.txt").resolve()
+cript_api.download_file(file_url=my_file_source, destination_path=desktop_path)
+
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ FileNotFoundError + +
+

In case the file could not be found because the file does not exist or the path given is incorrect

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Simply downloads the file

+
+
+ +
+ Source code in src/cript/api/api.py +
@beartype
+def download_file(self, file_source: str, destination_path: str = ".") -> None:
+    """
+    Download a file from CRIPT Cloud Storage (AWS S3) and save it to the specified path.
+
+    ??? Info "Cloud Storage vs Web URL File Download"
+
+        If the `object_name` does not starts with `http` then the program assumes the file is in AWS S3 storage,
+        and attempts to retrieve it via
+        [boto3 client](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html).
+
+        If the `object_name` starts with `http` then the program knows that
+        it is a file stored on the web. The program makes a simple
+        [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request to get the file,
+        then writes the contents of it to the specified destination.
+
+        > Note: The current version of the program is designed to download files from the web in a straightforward
+        manner. However, please be aware that the program may encounter limitations when dealing with URLs that
+        require JavaScript or a session to be enabled. In such cases, the download method may fail.
+
+        > We acknowledge these limitations and plan to enhance the method in future versions to ensure compatibility
+        with a wider range of web file URLs. Our goal is to develop a robust solution capable of handling any and
+        all web file URLs.
+
+    Parameters
+    ----------
+    file_source: str
+        object_name: within AWS S3 the extension e.g. "my_file_name.txt
+        the file is then searched within "Data/{file_name}" and saved to local storage
+        URL file source: In case of the file source is a URL then it is the file source URL
+            starting with "https://"
+            example: `https://criptscripts.org/cript_graph_json/JSON/cao_protein.json`
+    destination_path: str
+        please provide a path with file name of where you would like the file to be saved
+        on local storage.
+        > If no path is specified, then by default it will download the file
+        to the current working directory.
+
+        > The destination path must include a file name and file extension
+            e.g.: `~/Desktop/my_example_file_name.extension`
+
+    Examples
+    --------
+    ```python
+    from pathlib import Path
+
+    desktop_path = (Path(__file__).parent / "cript_downloads" / "my_downloaded_file.txt").resolve()
+    cript_api.download_file(file_url=my_file_source, destination_path=desktop_path)
+    ```
+
+    Raises
+    ------
+    FileNotFoundError
+        In case the file could not be found because the file does not exist or the path given is incorrect
+
+    Returns
+    -------
+    None
+        Simply downloads the file
+    """
+
+    # if the file source is a URL
+    if file_source.startswith("http"):
+        download_file_from_url(url=file_source, destination_path=Path(destination_path).resolve())
+        return
+
+    # the file is stored in cloud storage and must be retrieved via object_name
+    self._s3_client.download_file(Bucket=self._BUCKET_NAME, Key=file_source, Filename=destination_path)  # type: ignore
+
+
+
+ +
+ + +
+ + + +

+get_vocab_by_category(category) + +

+ + +
+ +

get the CRIPT controlled vocabulary by category

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
category + ControlledVocabularyCategories + +
+

category of

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[dict] + +
+

list of JSON containing the controlled vocabulary

+
+
+ +
+ Source code in src/cript/api/api.py +
@beartype
+def get_vocab_by_category(self, category: ControlledVocabularyCategories) -> List[dict]:
+    """
+    get the CRIPT controlled vocabulary by category
+
+    Parameters
+    ----------
+    category: str
+        category of
+
+    Returns
+    -------
+    List[dict]
+        list of JSON containing the controlled vocabulary
+    """
+
+    # check if the vocabulary category is already cached
+    if category.value in self._vocabulary:
+        return self._vocabulary[category.value]
+
+    # if vocabulary category is not in cache, then get it from API and cache it
+    response = requests.get(f"{self.host}/cv/{category.value}").json()
+
+    if response["code"] != 200:
+        # TODO give a better CRIPT custom Exception
+        raise Exception(f"while getting controlled vocabulary from CRIPT for {category}, " f"the API responded with http {response} ")
+
+    # add to cache
+    self._vocabulary[category.value] = response["data"]
+
+    return self._vocabulary[category.value]
+
+
+
+ +
+ + +
+ + + +

+save(project) + +

+ + +
+ +

This method takes a project node, serializes the class into JSON +and then sends the JSON to be saved to the API. +It takes Project node because everything is connected to the Project node, +and it can be used to send either a POST or PATCH request to API

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
project + Project + +
+

the Project Node that the user wants to save

+
+
+ required +
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ CRIPTAPISaveError + +
+

If the API responds with anything other than an HTTP of 200, the API error is displayed to the user

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ A set of extra saved node UUIDs. + +
+

Just sends a POST or Patch request to the API

+
+
+ +
+ Source code in src/cript/api/api.py +
def save(self, project: Project) -> None:
+    """
+    This method takes a project node, serializes the class into JSON
+    and then sends the JSON to be saved to the API.
+    It takes Project node because everything is connected to the Project node,
+    and it can be used to send either a POST or PATCH request to API
+
+    Parameters
+    ----------
+    project: Project
+        the Project Node that the user wants to save
+
+    Raises
+    ------
+    CRIPTAPISaveError
+        If the API responds with anything other than an HTTP of `200`, the API error is displayed to the user
+
+    Returns
+    -------
+    A set of extra saved node UUIDs.
+        Just sends a `POST` or `Patch` request to the API
+    """
+    try:
+        self._internal_save(project)
+    except CRIPTAPISaveError as exc:
+        if exc.pre_saved_nodes:
+            for node_uuid in exc.pre_saved_nodes:
+                # TODO remove all pre-saved nodes by their uuid.
+                pass
+        raise exc from exc
+
+
+
+ +
+ + +
+ + + +

+search(node_type, search_mode, value_to_search) + +

+ + +
+ +

This method is used to perform search on the CRIPT platform.

+ + + +

Examples:

+
# search by node type
+materials_paginator = cript_api.search(
+    node_type=cript.Material,
+    search_mode=cript.SearchModes.NODE_TYPE,
+    value_to_search=None,
+)
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
node_type + PrimaryBaseNode + +
+

Type of node that you are searching for.

+
+
+ required +
search_mode + SearchModes + +
+

Type of search you want to do. You can search by name, UUID, EXACT_NAME, etc. +Refer to valid search modes

+
+
+ required +
value_to_search + Union[str, None] + +
+

What you are searching for can be either a value, and if you are only searching for +a NODE_TYPE, then this value can be empty or None

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Paginator + +
+

paginator object for the user to use to flip through pages of search results

+
+
+ +
+ Source code in src/cript/api/api.py +
@beartype
+def search(
+    self,
+    node_type,
+    search_mode: SearchModes,
+    value_to_search: Union[None, str],
+) -> Paginator:
+    """
+    This method is used to perform search on the CRIPT platform.
+
+    Examples
+    --------
+    ```python
+    # search by node type
+    materials_paginator = cript_api.search(
+        node_type=cript.Material,
+        search_mode=cript.SearchModes.NODE_TYPE,
+        value_to_search=None,
+    )
+    ```
+
+    Parameters
+    ----------
+    node_type : PrimaryBaseNode
+        Type of node that you are searching for.
+    search_mode : SearchModes
+        Type of search you want to do. You can search by name, `UUID`, `EXACT_NAME`, etc.
+        Refer to [valid search modes](../search_modes)
+    value_to_search : Union[str, None]
+        What you are searching for can be either a value, and if you are only searching for
+        a `NODE_TYPE`, then this value can be empty or `None`
+
+    Returns
+    -------
+    Paginator
+        paginator object for the user to use to flip through pages of search results
+    """
+
+    # get node typ from class
+    node_type = node_type.node_type_snake_case
+    print(node_type)
+
+    # always putting a page parameter of 0 for all search URLs
+    page_number = 0
+
+    api_endpoint: str = ""
+
+    # requesting a page of some primary node
+    if search_mode == SearchModes.NODE_TYPE:
+        api_endpoint = f"{self._host}/{node_type}"
+
+    elif search_mode == SearchModes.CONTAINS_NAME:
+        api_endpoint = f"{self._host}/search/{node_type}"
+
+    elif search_mode == SearchModes.EXACT_NAME:
+        api_endpoint = f"{self._host}/search/exact/{node_type}"
+
+    elif search_mode == SearchModes.UUID:
+        api_endpoint = f"{self._host}/{node_type}/{value_to_search}"
+        # putting the value_to_search in the URL instead of a query
+        value_to_search = None
+
+    assert api_endpoint != ""
+
+    # TODO error handling if none of the API endpoints got hit
+    return Paginator(http_headers=self._http_headers, api_endpoint=api_endpoint, query=value_to_search, current_page_number=page_number)
+
+
+
+ +
+ + +
+ + + +

+upload_file(file_path) + +

+ + +
+ +

uploads a file to AWS S3 bucket and returns a URL of the uploaded file in AWS S3 +The URL is has no expiration time limit and is available forever

+
    +
  1. take a file path of type path or str to the file on local storage
      +
    • see Example for more details
    • +
    +
  2. +
  3. convert the file path to pathlib object, so it is versatile and + always uniform regardless if the user passes in a str or path object
  4. +
  5. get the file
  6. +
  7. rename the file to avoid clash or overwriting of previously uploaded files
      +
    • change file name to original_name_uuid4.extension
        +
      • document_42926a201a624fdba0fd6271defc9e88.txt
      • +
      +
    • +
    +
  8. +
  9. upload file to AWS S3
  10. +
  11. get the link of the uploaded file and return it
  12. +
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
file_path + Union[Path, str] + +
+

file path as str or Path object. Path Object is recommended

+
+
+ required +
+ + + +

Examples:

+
import cript
+
+api = cript.API(host, token)
+
+# programmatically create the absolute path of your file, so the program always works correctly
+my_file_path = (Path(__file__) / Path('../upload_files/my_file.txt')).resolve()
+
+my_file_s3_url = api.upload_file(absolute_file_path=my_file_path)
+
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ FileNotFoundError + +
+

In case the CRIPT Python SDK cannot find the file on your computer because the file does not exist +or the path to it is incorrect it raises +FileNotFoundError

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
object_name + str + +
+

object_name of the AWS S3 uploaded file to be put into the File node source attribute

+
+
+ +
+ Source code in src/cript/api/api.py +
def upload_file(self, file_path: Union[Path, str]) -> str:
+    # trunk-ignore-begin(cspell)
+    """
+    uploads a file to AWS S3 bucket and returns a URL of the uploaded file in AWS S3
+    The URL is has no expiration time limit and is available forever
+
+    1. take a file path of type path or str to the file on local storage
+        * see Example for more details
+    1. convert the file path to pathlib object, so it is versatile and
+        always uniform regardless if the user passes in a str or path object
+    1. get the file
+    1. rename the file to avoid clash or overwriting of previously uploaded files
+        * change file name to `original_name_uuid4.extension`
+            *  `document_42926a201a624fdba0fd6271defc9e88.txt`
+    1. upload file to AWS S3
+    1. get the link of the uploaded file and return it
+
+
+    Parameters
+    ----------
+    file_path: Union[str, Path]
+        file path as str or Path object. Path Object is recommended
+
+    Examples
+    --------
+    ```python
+    import cript
+
+    api = cript.API(host, token)
+
+    # programmatically create the absolute path of your file, so the program always works correctly
+    my_file_path = (Path(__file__) / Path('../upload_files/my_file.txt')).resolve()
+
+    my_file_s3_url = api.upload_file(absolute_file_path=my_file_path)
+    ```
+
+    Raises
+    ------
+    FileNotFoundError
+        In case the CRIPT Python SDK cannot find the file on your computer because the file does not exist
+        or the path to it is incorrect it raises
+        [FileNotFoundError](https://docs.python.org/3/library/exceptions.html#FileNotFoundError)
+
+    Returns
+    -------
+    object_name: str
+        object_name of the AWS S3 uploaded file to be put into the File node source attribute
+    """
+    # trunk-ignore-end(cspell)
+
+    # TODO consider using a new variable when converting `file_path` from parameter
+    #  to a Path object with a new type
+    # convert file path from whatever the user passed in to a pathlib object
+    file_path = Path(file_path).resolve()
+
+    # get file_name and file_extension from absolute file path
+    # file_extension includes the dot, e.g. ".txt"
+    file_name, file_extension = os.path.splitext(os.path.basename(file_path))
+
+    # generate a UUID4 string without dashes, making a cleaner file name
+    uuid_str: str = str(uuid.uuid4().hex)
+
+    new_file_name: str = f"{file_name}_{uuid_str}{file_extension}"
+
+    # e.g. "directory/file_name_uuid.extension"
+    object_name: str = f"{self._BUCKET_DIRECTORY_NAME}/{new_file_name}"
+
+    # upload file to AWS S3
+    self._s3_client.upload_file(Filename=file_path, Bucket=self._BUCKET_NAME, Key=object_name)  # type: ignore
+
+    # return the object_name within AWS S3 for easy retrieval
+    return object_name
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/controlled_vocabulary_categories/index.html b/api/controlled_vocabulary_categories/index.html new file mode 100644 index 000000000..33786b82b --- /dev/null +++ b/api/controlled_vocabulary_categories/index.html @@ -0,0 +1,1711 @@ + + + + + + + + + + + + + + + + + + + + + + Controlled Vocabulary Categories - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Controlled Vocabulary Categories

+ +
+ + + +
+

+ Bases: Enum

+ + +

All available CRIPT controlled vocabulary categories

+

Controlled vocabulary categories are used to classify data.

+ + + +

Attributes:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ALGORITHM_KEY + str + +
+

Algorithm key.

+
+
ALGORITHM_TYPE + str + +
+

Algorithm type.

+
+
BUILDING_BLOCK + str + +
+

Building block.

+
+
CITATION_TYPE + str + +
+

Citation type.

+
+
COMPUTATION_TYPE + str + +
+

Computation type.

+
+
COMPUTATIONAL_FORCEFIELD_KEY + str + +
+

Computational forcefield key.

+
+
COMPUTATIONAL_PROCESS_PROPERTY_KEY + str + +
+

Computational process property key.

+
+
COMPUTATIONAL_PROCESS_TYPE + str + +
+

Computational process type.

+
+
CONDITION_KEY + str + +
+

Condition key.

+
+
DATA_LICENSE + str + +
+

Data license.

+
+
DATA_TYPE + str + +
+

Data type.

+
+
EQUIPMENT_KEY + str + +
+

Equipment key.

+
+
FILE_TYPE + str + +
+

File type.

+
+
INGREDIENT_KEYWORD + str + +
+

Ingredient keyword.

+
+
MATERIAL_IDENTIFIER_KEY + str + +
+

Material identifier key.

+
+
MATERIAL_KEYWORD + str + +
+

Material keyword.

+
+
MATERIAL_PROPERTY_KEY + str + +
+

Material property key.

+
+
PARAMETER_KEY + str + +
+

Parameter key.

+
+
PROCESS_KEYWORD + str + +
+

Process keyword.

+
+
PROCESS_PROPERTY_KEY + str + +
+

Process property key.

+
+
PROCESS_TYPE + str + +
+

Process type.

+
+
PROPERTY_METHOD + str + +
+

Property method.

+
+
QUANTITY_KEY + str + +
+

Quantity key.

+
+
REFERENCE_TYPE + str + +
+

Reference type.

+
+
SET_TYPE + str + +
+

Set type.

+
+
UNCERTAINTY_TYPE + str + +
+

Uncertainty type.

+
+
+ + + +

Examples:

+
algorithm_vocabulary = api.get_vocabulary_by_category(
+    ControlledVocabularyCategories.ALGORITHM_KEY
+    )
+
+ +
+ Source code in src/cript/api/vocabulary_categories.py +
 4
+ 5
+ 6
+ 7
+ 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
class ControlledVocabularyCategories(Enum):
+    """
+    All available CRIPT controlled vocabulary categories
+
+    Controlled vocabulary categories are used to classify data.
+
+    Attributes
+    ----------
+    ALGORITHM_KEY: str
+        Algorithm key.
+    ALGORITHM_TYPE: str
+        Algorithm type.
+    BUILDING_BLOCK: str
+        Building block.
+    CITATION_TYPE: str
+        Citation type.
+    COMPUTATION_TYPE: str
+       Computation type.
+    COMPUTATIONAL_FORCEFIELD_KEY: str
+        Computational forcefield key.
+    COMPUTATIONAL_PROCESS_PROPERTY_KEY: str
+        Computational process property key.
+    COMPUTATIONAL_PROCESS_TYPE: str
+        Computational process type.
+    CONDITION_KEY: str
+        Condition key.
+    DATA_LICENSE: str
+        Data license.
+    DATA_TYPE: str
+        Data type.
+    EQUIPMENT_KEY: str
+        Equipment key.
+    FILE_TYPE: str
+        File type.
+    INGREDIENT_KEYWORD: str
+        Ingredient keyword.
+    MATERIAL_IDENTIFIER_KEY: str
+        Material identifier key.
+    MATERIAL_KEYWORD: str
+        Material keyword.
+    MATERIAL_PROPERTY_KEY: str
+        Material property key.
+    PARAMETER_KEY: str
+        Parameter key.
+    PROCESS_KEYWORD: str
+        Process keyword.
+    PROCESS_PROPERTY_KEY: str
+        Process property key.
+    PROCESS_TYPE: str
+        Process type.
+    PROPERTY_METHOD: str
+        Property method.
+    QUANTITY_KEY: str
+        Quantity key.
+    REFERENCE_TYPE: str
+        Reference type.
+    SET_TYPE: str
+        Set type.
+    UNCERTAINTY_TYPE: str
+        Uncertainty type.
+
+    Examples
+    --------
+    ```python
+    algorithm_vocabulary = api.get_vocabulary_by_category(
+        ControlledVocabularyCategories.ALGORITHM_KEY
+        )
+    ```
+    """
+
+    ALGORITHM_KEY: str = "algorithm_key"
+    ALGORITHM_TYPE: str = "algorithm_type"
+    BUILDING_BLOCK: str = "building_block"
+    CITATION_TYPE: str = "citation_type"
+    COMPUTATION_TYPE: str = "computation_type"
+    COMPUTATIONAL_FORCEFIELD_KEY: str = "computational_forcefield_key"
+    COMPUTATIONAL_PROCESS_PROPERTY_KEY: str = "computational_process_property_key"
+    COMPUTATIONAL_PROCESS_TYPE: str = "computational_process_type"
+    CONDITION_KEY: str = "condition_key"
+    DATA_LICENSE: str = "data_license"
+    DATA_TYPE: str = "data_type"
+    EQUIPMENT_KEY: str = "equipment_key"
+    FILE_TYPE: str = "file_type"
+    INGREDIENT_KEYWORD: str = "ingredient_keyword"
+    MATERIAL_IDENTIFIER_KEY: str = "material_identifier_key"
+    MATERIAL_KEYWORD: str = "material_keyword"
+    MATERIAL_PROPERTY_KEY: str = "material_property_key"
+    PARAMETER_KEY: str = "parameter_key"
+    PROCESS_KEYWORD: str = "process_keyword"
+    PROCESS_PROPERTY_KEY: str = "process_property_key"
+    PROCESS_TYPE: str = "process_type"
+    PROPERTY_METHOD: str = "property_method"
+    QUANTITY_KEY: str = "quantity_key"
+    REFERENCE_TYPE: str = "reference_type"
+    SET_TYPE: str = "set_type"
+    UNCERTAINTY_TYPE: str = "uncertainty_type"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/paginator/index.html b/api/paginator/index.html new file mode 100644 index 000000000..6d6560a21 --- /dev/null +++ b/api/paginator/index.html @@ -0,0 +1,2304 @@ + + + + + + + + + + + + + + + + + + + + + + Paginator - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Paginator

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Paginator + + +

+ + +
+ + +

Paginator is used to flip through different pages of data that the API returns when searching

+

When conducting any kind of search the API returns pages of data and each page contains 10 results. +This is equivalent to conducting a Google search when Google returns a limited number of links on the first page +and all other results are on the next pages.

+

Using the Paginator object, the user can simply and easily flip through the pages of data the API provides.

+
+

Do not create paginator objects

+

Please note that you are not required or advised to create a paginator object, and instead the +Python SDK API object will create a paginator for you, return it, and let you simply use it

+
+ +
+ Source code in src/cript/api/paginator.py +
class Paginator:
+    """
+    Paginator is used to flip through different pages of data that the API returns when searching
+
+    When conducting any kind of search the API returns pages of data and each page contains 10 results.
+    This is equivalent to conducting a Google search when Google returns a limited number of links on the first page
+    and all other results are on the next pages.
+
+    Using the Paginator object, the user can simply and easily flip through the pages of data the API provides.
+
+    !!! Warning "Do not create paginator objects"
+        Please note that you are not required or advised to create a paginator object, and instead the
+        Python SDK API object will create a paginator for you, return it, and let you simply use it
+    """
+
+    _http_headers: dict
+
+    api_endpoint: str
+
+    # if query or page number are None, then it means that api_endpoint does not allow for whatever that is None
+    # and that is not added to the URL
+    # by default the page_number and query are `None` and they can get filled in
+    query: Union[str, None]
+    _current_page_number: int
+
+    current_page_results: List[dict]
+
+    @beartype
+    def __init__(
+        self,
+        http_headers: dict,
+        api_endpoint: str,
+        query: Optional[str] = None,
+        current_page_number: int = 0,
+    ):
+        """
+        create a paginator
+
+        1. set all the variables coming into constructor
+        1. then prepare any variable as needed e.g. strip extra spaces or url encode query
+
+        Parameters
+        ----------
+        http_headers: dict
+            get already created http headers from API and just use them in paginator
+        api_endpoint: str
+            api endpoint to send the search requests to
+            it already contains what node the user is looking for
+        current_page_number: int
+            page number to start from. Keep track of current page for user to flip back and forth between pages of data
+        query: str
+            the value the user is searching for
+
+        Returns
+        -------
+        None
+            instantiate a paginator
+        """
+        self._http_headers = http_headers
+        self.api_endpoint = api_endpoint
+        self.query = query
+        self._current_page_number = current_page_number
+
+        # check if it is a string and not None to avoid AttributeError
+        if api_endpoint is not None:
+            # strip the ending slash "/" to make URL uniform and any trailing spaces from either side
+            self.api_endpoint = api_endpoint.rstrip("/").strip()
+
+        # check if it is a string and not None to avoid AttributeError
+        if query is not None:
+            # URL encode query
+            self.query = quote(query)
+
+        self.fetch_page_from_api()
+
+    def next_page(self):
+        """
+        flip to the next page of data.
+
+        Examples
+        --------
+        ```python
+        my_paginator.next_page()
+        ```
+        """
+        self.current_page_number += 1
+
+    def previous_page(self):
+        """
+        flip to the next page of data.
+
+        Examples
+        --------
+        ```python
+        my_paginator.previous_page()
+        ```
+        """
+        self.current_page_number -= 1
+
+    @property
+    @beartype
+    def current_page_number(self) -> int:
+        """
+        get the current page number that you are on.
+
+        Setting the page will take you to that specific page of results
+
+        Examples
+        --------
+        ```python
+        my_paginator.current_page = 10
+        ```
+
+        Returns
+        -------
+        current page number: int
+            the current page number of the data
+        """
+        return self._current_page_number
+
+    @current_page_number.setter
+    @beartype
+    def current_page_number(self, new_page_number: int) -> None:
+        """
+        flips to a specific page of data that has been requested
+
+        sets the current_page_number and then sends the request to the API and gets the results of this page number
+
+        Parameters
+        ----------
+        new_page_number (int): specific page of data that the user wants to go to
+
+        Examples
+        --------
+        requests.get("https://criptapp.org/api?page=2)
+        requests.get(f"{self.query}?page={self.current_page_number - 1}")
+
+        Raises
+        --------
+        InvalidPageRequest, in case the user tries to get a negative page or a page that doesn't exist
+        """
+        if new_page_number < 0:
+            error_message: str = f"Paginator current page number is invalid because it is negative: " f"{self.current_page_number} please set paginator.current_page_number " f"to a positive page number"
+
+            # TODO replace with custom error
+            raise Exception(error_message)
+
+        else:
+            self._current_page_number = new_page_number
+            # when new page number is set, it is then fetched from the API
+            self.fetch_page_from_api()
+
+    @beartype
+    def fetch_page_from_api(self) -> List[dict]:
+        """
+        1. builds the URL from the query and page number
+        1. makes the request to the API
+        1. API responds with a JSON that has data or JSON that has data and result
+            1. parses it and correctly sets the current_page_results property
+
+        Raises
+        ------
+        InvalidSearchRequest
+            In case the API responds with an error
+
+        Returns
+        -------
+        current page results: List[dict]
+            makes a request to the API and gets a page of data
+        """
+
+        # temporary variable to not overwrite api_endpoint
+        temp_api_endpoint: str = self.api_endpoint
+
+        if self.query is not None:
+            temp_api_endpoint = f"{temp_api_endpoint}/?q={self.query}"
+
+        elif self.query is None:
+            temp_api_endpoint = f"{temp_api_endpoint}/?q="
+
+        temp_api_endpoint = f"{temp_api_endpoint}&page={self.current_page_number}"
+
+        response = requests.get(
+            url=temp_api_endpoint,
+            headers=self._http_headers,
+        ).json()
+
+        # handling both cases in case there is result inside of data or just data
+        try:
+            self.current_page_results = response["data"]["result"]
+        except KeyError:
+            self.current_page_results = response["data"]
+        except TypeError:
+            self.current_page_results = response["data"]
+
+        if response["code"] == 404 and response["error"] == "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.":
+            self.current_page_results = []
+            return self.current_page_results
+
+        # TODO give a CRIPT error if HTTP response is anything other than 200
+        if response["code"] != 200:
+            raise Exception(f"API responded with: {response['error']}")
+
+        return self.current_page_results
+
+
+ + + +
+ + + + + + + +
+ + + +

+current_page_number: int + + + property + writable + + +

+ + +
+ +

get the current page number that you are on.

+

Setting the page will take you to that specific page of results

+ + + +

Examples:

+
my_paginator.current_page = 10
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ current page number: int + +
+

the current page number of the data

+
+
+
+ +
+ + + + +
+ + + +

+__init__(http_headers, api_endpoint, query=None, current_page_number=0) + +

+ + +
+ +

create a paginator

+
    +
  1. set all the variables coming into constructor
  2. +
  3. then prepare any variable as needed e.g. strip extra spaces or url encode query
  4. +
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
http_headers + dict + +
+

get already created http headers from API and just use them in paginator

+
+
+ required +
api_endpoint + str + +
+

api endpoint to send the search requests to +it already contains what node the user is looking for

+
+
+ required +
current_page_number + int + +
+

page number to start from. Keep track of current page for user to flip back and forth between pages of data

+
+
+ 0 +
query + Optional[str] + +
+

the value the user is searching for

+
+
+ None +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate a paginator

+
+
+ +
+ Source code in src/cript/api/paginator.py +
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
@beartype
+def __init__(
+    self,
+    http_headers: dict,
+    api_endpoint: str,
+    query: Optional[str] = None,
+    current_page_number: int = 0,
+):
+    """
+    create a paginator
+
+    1. set all the variables coming into constructor
+    1. then prepare any variable as needed e.g. strip extra spaces or url encode query
+
+    Parameters
+    ----------
+    http_headers: dict
+        get already created http headers from API and just use them in paginator
+    api_endpoint: str
+        api endpoint to send the search requests to
+        it already contains what node the user is looking for
+    current_page_number: int
+        page number to start from. Keep track of current page for user to flip back and forth between pages of data
+    query: str
+        the value the user is searching for
+
+    Returns
+    -------
+    None
+        instantiate a paginator
+    """
+    self._http_headers = http_headers
+    self.api_endpoint = api_endpoint
+    self.query = query
+    self._current_page_number = current_page_number
+
+    # check if it is a string and not None to avoid AttributeError
+    if api_endpoint is not None:
+        # strip the ending slash "/" to make URL uniform and any trailing spaces from either side
+        self.api_endpoint = api_endpoint.rstrip("/").strip()
+
+    # check if it is a string and not None to avoid AttributeError
+    if query is not None:
+        # URL encode query
+        self.query = quote(query)
+
+    self.fetch_page_from_api()
+
+
+
+ +
+ + +
+ + + +

+fetch_page_from_api() + +

+ + +
+ +
    +
  1. builds the URL from the query and page number
  2. +
  3. makes the request to the API
  4. +
  5. API responds with a JSON that has data or JSON that has data and result
      +
    1. parses it and correctly sets the current_page_results property
    2. +
    +
  6. +
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ InvalidSearchRequest + +
+

In case the API responds with an error

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ current page results: List[dict] + +
+

makes a request to the API and gets a page of data

+
+
+ +
+ Source code in src/cript/api/paginator.py +
@beartype
+def fetch_page_from_api(self) -> List[dict]:
+    """
+    1. builds the URL from the query and page number
+    1. makes the request to the API
+    1. API responds with a JSON that has data or JSON that has data and result
+        1. parses it and correctly sets the current_page_results property
+
+    Raises
+    ------
+    InvalidSearchRequest
+        In case the API responds with an error
+
+    Returns
+    -------
+    current page results: List[dict]
+        makes a request to the API and gets a page of data
+    """
+
+    # temporary variable to not overwrite api_endpoint
+    temp_api_endpoint: str = self.api_endpoint
+
+    if self.query is not None:
+        temp_api_endpoint = f"{temp_api_endpoint}/?q={self.query}"
+
+    elif self.query is None:
+        temp_api_endpoint = f"{temp_api_endpoint}/?q="
+
+    temp_api_endpoint = f"{temp_api_endpoint}&page={self.current_page_number}"
+
+    response = requests.get(
+        url=temp_api_endpoint,
+        headers=self._http_headers,
+    ).json()
+
+    # handling both cases in case there is result inside of data or just data
+    try:
+        self.current_page_results = response["data"]["result"]
+    except KeyError:
+        self.current_page_results = response["data"]
+    except TypeError:
+        self.current_page_results = response["data"]
+
+    if response["code"] == 404 and response["error"] == "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.":
+        self.current_page_results = []
+        return self.current_page_results
+
+    # TODO give a CRIPT error if HTTP response is anything other than 200
+    if response["code"] != 200:
+        raise Exception(f"API responded with: {response['error']}")
+
+    return self.current_page_results
+
+
+
+ +
+ + +
+ + + +

+next_page() + +

+ + +
+ +

flip to the next page of data.

+ + + +

Examples:

+
my_paginator.next_page()
+
+ +
+ Source code in src/cript/api/paginator.py +
83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
def next_page(self):
+    """
+    flip to the next page of data.
+
+    Examples
+    --------
+    ```python
+    my_paginator.next_page()
+    ```
+    """
+    self.current_page_number += 1
+
+
+
+ +
+ + +
+ + + +

+previous_page() + +

+ + +
+ +

flip to the next page of data.

+ + + +

Examples:

+
my_paginator.previous_page()
+
+ +
+ Source code in src/cript/api/paginator.py +
def previous_page(self):
+    """
+    flip to the next page of data.
+
+    Examples
+    --------
+    ```python
+    my_paginator.previous_page()
+    ```
+    """
+    self.current_page_number -= 1
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/search_modes/index.html b/api/search_modes/index.html new file mode 100644 index 000000000..01bd3b01d --- /dev/null +++ b/api/search_modes/index.html @@ -0,0 +1,1341 @@ + + + + + + + + + + + + + + + + + + + + + + Search Modes - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Search Modes

+ +
+ + + +
+

+ Bases: Enum

+ + +

Available search modes to use with the CRIPT API search

+ + + +

Attributes:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
NODE_TYPE + str + +
+

Search by node type.

+
+
EXACT_NAME + str + +
+

Search by exact node name.

+
+
CONTAINS_NAME + str + +
+

Search by node name containing a given string.

+
+
UUID + str + +
+

Search by node UUID.

+
+
+ + + +

Examples:

+
# search by node type
+materials_paginator = cript_api.search(
+    node_type=cript.Material,
+    search_mode=cript.SearchModes.NODE_TYPE,
+    value_to_search=None,
+)
+
+ +
+ Source code in src/cript/api/valid_search_modes.py +
 4
+ 5
+ 6
+ 7
+ 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
class SearchModes(Enum):
+    """
+    Available search modes to use with the CRIPT API search
+
+    Attributes
+    ----------
+    NODE_TYPE : str
+        Search by node type.
+    EXACT_NAME : str
+        Search by exact node name.
+    CONTAINS_NAME : str
+        Search by node name containing a given string.
+    UUID : str
+        Search by node UUID.
+
+    Examples
+    -------
+    ```python
+    # search by node type
+    materials_paginator = cript_api.search(
+        node_type=cript.Material,
+        search_mode=cript.SearchModes.NODE_TYPE,
+        value_to_search=None,
+    )
+    ```
+    """
+
+    NODE_TYPE: str = ""
+    EXACT_NAME: str = "exact_name"
+    CONTAINS_NAME: str = "contains_name"
+    UUID: str = "uuid"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/assets/_mkdocstrings.css b/assets/_mkdocstrings.css new file mode 100644 index 000000000..049a254b9 --- /dev/null +++ b/assets/_mkdocstrings.css @@ -0,0 +1,64 @@ + +/* Avoid breaking parameter names, etc. in table cells. */ +.doc-contents td code { + word-break: normal !important; +} + +/* No line break before first paragraph of descriptions. */ +.doc-md-description, +.doc-md-description>p:first-child { + display: inline; +} + +/* Max width for docstring sections tables. */ +.doc .md-typeset__table, +.doc .md-typeset__table table { + display: table !important; + width: 100%; +} + +.doc .md-typeset__table tr { + display: table-row; +} + +/* Defaults in Spacy table style. */ +.doc-param-default { + float: right; +} + +/* Keep headings consistent. */ +h1.doc-heading, +h2.doc-heading, +h3.doc-heading, +h4.doc-heading, +h5.doc-heading, +h6.doc-heading { + font-weight: 400; + line-height: 1.5; + color: inherit; + text-transform: none; +} + +h1.doc-heading { + font-size: 1.6rem; +} + +h2.doc-heading { + font-size: 1.2rem; +} + +h3.doc-heading { + font-size: 1.15rem; +} + +h4.doc-heading { + font-size: 1.10rem; +} + +h5.doc-heading { + font-size: 1.05rem; +} + +h6.doc-heading { + font-size: 1rem; +} \ No newline at end of file diff --git a/assets/images/favicon.png b/assets/images/favicon.png new file mode 100644 index 000000000..1cf13b9f9 Binary files /dev/null and b/assets/images/favicon.png differ diff --git a/assets/javascripts/bundle.220ee61c.min.js b/assets/javascripts/bundle.220ee61c.min.js new file mode 100644 index 000000000..116072a11 --- /dev/null +++ b/assets/javascripts/bundle.220ee61c.min.js @@ -0,0 +1,29 @@ +"use strict";(()=>{var Ci=Object.create;var gr=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var ki=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Hi=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))yr.call(t,r)&&rn(e,r,t[r]);if(Ht)for(var r of Ht(t))nn.call(t,r)&&rn(e,r,t[r]);return e};var on=(e,t)=>{var r={};for(var n in e)yr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ht)for(var n of Ht(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);return r};var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ki(t))!yr.call(e,o)&&o!==r&&gr(e,o,{get:()=>t[o],enumerable:!(n=Ri(t,o))||n.enumerable});return e};var yt=(e,t,r)=>(r=e!=null?Ci(Hi(e)):{},Pi(t||!e||!e.__esModule?gr(r,"default",{value:e,enumerable:!0}):r,e));var sn=Pt((xr,an)=>{(function(e,t){typeof xr=="object"&&typeof an!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(xr,function(){"use strict";function e(r){var n=!0,o=!1,i=null,s={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(O){return!!(O&&O!==document&&O.nodeName!=="HTML"&&O.nodeName!=="BODY"&&"classList"in O&&"contains"in O.classList)}function f(O){var Qe=O.type,De=O.tagName;return!!(De==="INPUT"&&s[Qe]&&!O.readOnly||De==="TEXTAREA"&&!O.readOnly||O.isContentEditable)}function c(O){O.classList.contains("focus-visible")||(O.classList.add("focus-visible"),O.setAttribute("data-focus-visible-added",""))}function u(O){O.hasAttribute("data-focus-visible-added")&&(O.classList.remove("focus-visible"),O.removeAttribute("data-focus-visible-added"))}function p(O){O.metaKey||O.altKey||O.ctrlKey||(a(r.activeElement)&&c(r.activeElement),n=!0)}function m(O){n=!1}function d(O){a(O.target)&&(n||f(O.target))&&c(O.target)}function h(O){a(O.target)&&(O.target.classList.contains("focus-visible")||O.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(i),i=window.setTimeout(function(){o=!1},100),u(O.target))}function v(O){document.visibilityState==="hidden"&&(o&&(n=!0),Y())}function Y(){document.addEventListener("mousemove",N),document.addEventListener("mousedown",N),document.addEventListener("mouseup",N),document.addEventListener("pointermove",N),document.addEventListener("pointerdown",N),document.addEventListener("pointerup",N),document.addEventListener("touchmove",N),document.addEventListener("touchstart",N),document.addEventListener("touchend",N)}function B(){document.removeEventListener("mousemove",N),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",N),document.removeEventListener("pointermove",N),document.removeEventListener("pointerdown",N),document.removeEventListener("pointerup",N),document.removeEventListener("touchmove",N),document.removeEventListener("touchstart",N),document.removeEventListener("touchend",N)}function N(O){O.target.nodeName&&O.target.nodeName.toLowerCase()==="html"||(n=!1,B())}document.addEventListener("keydown",p,!0),document.addEventListener("mousedown",m,!0),document.addEventListener("pointerdown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("visibilitychange",v,!0),Y(),r.addEventListener("focus",d,!0),r.addEventListener("blur",h,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var cn=Pt(Er=>{(function(e){var t=function(){try{return!!Symbol.iterator}catch(c){return!1}},r=t(),n=function(c){var u={next:function(){var p=c.shift();return{done:p===void 0,value:p}}};return r&&(u[Symbol.iterator]=function(){return u}),u},o=function(c){return encodeURIComponent(c).replace(/%20/g,"+")},i=function(c){return decodeURIComponent(String(c).replace(/\+/g," "))},s=function(){var c=function(p){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var m=typeof p;if(m!=="undefined")if(m==="string")p!==""&&this._fromString(p);else if(p instanceof c){var d=this;p.forEach(function(B,N){d.append(N,B)})}else if(p!==null&&m==="object")if(Object.prototype.toString.call(p)==="[object Array]")for(var h=0;hd[0]?1:0}),c._entries&&(c._entries={});for(var p=0;p1?i(d[1]):"")}})})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er);(function(e){var t=function(){try{var o=new e.URL("b","http://a");return o.pathname="c d",o.href==="http://a/c%20d"&&o.searchParams}catch(i){return!1}},r=function(){var o=e.URL,i=function(f,c){typeof f!="string"&&(f=String(f)),c&&typeof c!="string"&&(c=String(c));var u=document,p;if(c&&(e.location===void 0||c!==e.location.href)){c=c.toLowerCase(),u=document.implementation.createHTMLDocument(""),p=u.createElement("base"),p.href=c,u.head.appendChild(p);try{if(p.href.indexOf(c)!==0)throw new Error(p.href)}catch(O){throw new Error("URL unable to set base "+c+" due to "+O)}}var m=u.createElement("a");m.href=f,p&&(u.body.appendChild(m),m.href=m.href);var d=u.createElement("input");if(d.type="url",d.value=f,m.protocol===":"||!/:/.test(m.href)||!d.checkValidity()&&!c)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:m});var h=new e.URLSearchParams(this.search),v=!0,Y=!0,B=this;["append","delete","set"].forEach(function(O){var Qe=h[O];h[O]=function(){Qe.apply(h,arguments),v&&(Y=!1,B.search=h.toString(),Y=!0)}}),Object.defineProperty(this,"searchParams",{value:h,enumerable:!0});var N=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==N&&(N=this.search,Y&&(v=!1,this.searchParams._fromString(this.search),v=!0))}})},s=i.prototype,a=function(f){Object.defineProperty(s,f,{get:function(){return this._anchorElement[f]},set:function(c){this._anchorElement[f]=c},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(f){a(f)}),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(f){this._anchorElement.search=f,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var f=this;return function(){return f.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(f){this._anchorElement.href=f,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(f){this._anchorElement.pathname=f},enumerable:!0},origin:{get:function(){var f={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],c=this._anchorElement.port!=f&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(c?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(f){},enumerable:!0},username:{get:function(){return""},set:function(f){},enumerable:!0}}),i.createObjectURL=function(f){return o.createObjectURL.apply(o,arguments)},i.revokeObjectURL=function(f){return o.revokeObjectURL.apply(o,arguments)},e.URL=i};if(t()||r(),e.location!==void 0&&!("origin"in e.location)){var n=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:n,enumerable:!0})}catch(o){setInterval(function(){e.location.origin=n()},100)}}})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er)});var qr=Pt((Mt,Nr)=>{/*! + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */(function(t,r){typeof Mt=="object"&&typeof Nr=="object"?Nr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Mt=="object"?Mt.ClipboardJS=r():t.ClipboardJS=r()})(Mt,function(){return function(){var e={686:function(n,o,i){"use strict";i.d(o,{default:function(){return Ai}});var s=i(279),a=i.n(s),f=i(370),c=i.n(f),u=i(817),p=i.n(u);function m(j){try{return document.execCommand(j)}catch(T){return!1}}var d=function(T){var E=p()(T);return m("cut"),E},h=d;function v(j){var T=document.documentElement.getAttribute("dir")==="rtl",E=document.createElement("textarea");E.style.fontSize="12pt",E.style.border="0",E.style.padding="0",E.style.margin="0",E.style.position="absolute",E.style[T?"right":"left"]="-9999px";var H=window.pageYOffset||document.documentElement.scrollTop;return E.style.top="".concat(H,"px"),E.setAttribute("readonly",""),E.value=j,E}var Y=function(T,E){var H=v(T);E.container.appendChild(H);var I=p()(H);return m("copy"),H.remove(),I},B=function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},H="";return typeof T=="string"?H=Y(T,E):T instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(T==null?void 0:T.type)?H=Y(T.value,E):(H=p()(T),m("copy")),H},N=B;function O(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(E){return typeof E}:O=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},O(j)}var Qe=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=T.action,H=E===void 0?"copy":E,I=T.container,q=T.target,Me=T.text;if(H!=="copy"&&H!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(q!==void 0)if(q&&O(q)==="object"&&q.nodeType===1){if(H==="copy"&&q.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(H==="cut"&&(q.hasAttribute("readonly")||q.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Me)return N(Me,{container:I});if(q)return H==="cut"?h(q):N(q,{container:I})},De=Qe;function $e(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$e=function(E){return typeof E}:$e=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},$e(j)}function Ei(j,T){if(!(j instanceof T))throw new TypeError("Cannot call a class as a function")}function tn(j,T){for(var E=0;E0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=$e(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var q=this;this.listener=c()(I,"click",function(Me){return q.onClick(Me)})}},{key:"onClick",value:function(I){var q=I.delegateTarget||I.currentTarget,Me=this.action(q)||"copy",kt=De({action:Me,container:this.container,target:this.target(q),text:this.text(q)});this.emit(kt?"success":"error",{action:Me,text:kt,trigger:q,clearSelection:function(){q&&q.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return vr("action",I)}},{key:"defaultTarget",value:function(I){var q=vr("target",I);if(q)return document.querySelector(q)}},{key:"defaultText",value:function(I){return vr("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return N(I,q)}},{key:"cut",value:function(I){return h(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],q=typeof I=="string"?[I]:I,Me=!!document.queryCommandSupported;return q.forEach(function(kt){Me=Me&&!!document.queryCommandSupported(kt)}),Me}}]),E}(a()),Ai=Li},828:function(n){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function s(a,f){for(;a&&a.nodeType!==o;){if(typeof a.matches=="function"&&a.matches(f))return a;a=a.parentNode}}n.exports=s},438:function(n,o,i){var s=i(828);function a(u,p,m,d,h){var v=c.apply(this,arguments);return u.addEventListener(m,v,h),{destroy:function(){u.removeEventListener(m,v,h)}}}function f(u,p,m,d,h){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof m=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(v){return a(v,p,m,d,h)}))}function c(u,p,m,d){return function(h){h.delegateTarget=s(h.target,p),h.delegateTarget&&d.call(u,h)}}n.exports=f},879:function(n,o){o.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},o.nodeList=function(i){var s=Object.prototype.toString.call(i);return i!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in i&&(i.length===0||o.node(i[0]))},o.string=function(i){return typeof i=="string"||i instanceof String},o.fn=function(i){var s=Object.prototype.toString.call(i);return s==="[object Function]"}},370:function(n,o,i){var s=i(879),a=i(438);function f(m,d,h){if(!m&&!d&&!h)throw new Error("Missing required arguments");if(!s.string(d))throw new TypeError("Second argument must be a String");if(!s.fn(h))throw new TypeError("Third argument must be a Function");if(s.node(m))return c(m,d,h);if(s.nodeList(m))return u(m,d,h);if(s.string(m))return p(m,d,h);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(m,d,h){return m.addEventListener(d,h),{destroy:function(){m.removeEventListener(d,h)}}}function u(m,d,h){return Array.prototype.forEach.call(m,function(v){v.addEventListener(d,h)}),{destroy:function(){Array.prototype.forEach.call(m,function(v){v.removeEventListener(d,h)})}}}function p(m,d,h){return a(document.body,m,d,h)}n.exports=f},817:function(n){function o(i){var s;if(i.nodeName==="SELECT")i.focus(),s=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var a=i.hasAttribute("readonly");a||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),a||i.removeAttribute("readonly"),s=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var f=window.getSelection(),c=document.createRange();c.selectNodeContents(i),f.removeAllRanges(),f.addRange(c),s=f.toString()}return s}n.exports=o},279:function(n){function o(){}o.prototype={on:function(i,s,a){var f=this.e||(this.e={});return(f[i]||(f[i]=[])).push({fn:s,ctx:a}),this},once:function(i,s,a){var f=this;function c(){f.off(i,c),s.apply(a,arguments)}return c._=s,this.on(i,c,a)},emit:function(i){var s=[].slice.call(arguments,1),a=((this.e||(this.e={}))[i]||[]).slice(),f=0,c=a.length;for(f;f{"use strict";/*! + * escape-html + * Copyright(c) 2012-2013 TJ Holowaychuk + * Copyright(c) 2015 Andreas Lubbe + * Copyright(c) 2015 Tiancheng "Timothy" Gu + * MIT Licensed + */var rs=/["'&<>]/;Yo.exports=ns;function ns(e){var t=""+e,r=rs.exec(t);if(!r)return t;var n,o="",i=0,s=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n1||a(m,d)})})}function a(m,d){try{f(n[m](d))}catch(h){p(i[0][3],h)}}function f(m){m.value instanceof et?Promise.resolve(m.value.v).then(c,u):p(i[0][2],m)}function c(m){a("next",m)}function u(m){a("throw",m)}function p(m,d){m(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function pn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Ee=="function"?Ee(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,f){s=e[i](s),o(a,f,s.done,s.value)})}}function o(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function C(e){return typeof e=="function"}function at(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var It=at(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: +`+r.map(function(n,o){return o+1+") "+n.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=r}});function Ve(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ie=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ee(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(v){t={error:v}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(C(u))try{u()}catch(v){i=v instanceof It?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=Ee(p),d=m.next();!d.done;d=m.next()){var h=d.value;try{ln(h)}catch(v){i=i!=null?i:[],v instanceof It?i=D(D([],W(i)),W(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{d&&!d.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}}if(i)throw new It(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ln(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ve(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ve(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Sr=Ie.EMPTY;function jt(e){return e instanceof Ie||e&&"closed"in e&&C(e.remove)&&C(e.add)&&C(e.unsubscribe)}function ln(e){C(e)?e():e.unsubscribe()}var Le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var st={setTimeout:function(e,t){for(var r=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Sr:(this.currentObservers=null,a.push(r),new Ie(function(){n.currentObservers=null,Ve(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new F;return r.source=this,r},t.create=function(r,n){return new xn(r,n)},t}(F);var xn=function(e){ie(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Sr},t}(x);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var wt=function(e){ie(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,f=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),f=0;f0?e.prototype.requestAsyncId.call(this,r,n,o):(r.actions.push(this),r._scheduled||(r._scheduled=ut.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,o){var i;if(o===void 0&&(o=0),o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,o);var s=r.actions;n!=null&&((i=s[s.length-1])===null||i===void 0?void 0:i.id)!==n&&(ut.cancelAnimationFrame(n),r._scheduled=void 0)},t}(Wt);var Sn=function(e){ie(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var o=this.actions,i;r=r||o.shift();do if(i=r.execute(r.state,r.delay))break;while((r=o[0])&&r.id===n&&o.shift());if(this._active=!1,i){for(;(r=o[0])&&r.id===n&&o.shift();)r.unsubscribe();throw i}},t}(Dt);var Oe=new Sn(wn);var M=new F(function(e){return e.complete()});function Vt(e){return e&&C(e.schedule)}function Cr(e){return e[e.length-1]}function Ye(e){return C(Cr(e))?e.pop():void 0}function Te(e){return Vt(Cr(e))?e.pop():void 0}function zt(e,t){return typeof Cr(e)=="number"?e.pop():t}var pt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function Nt(e){return C(e==null?void 0:e.then)}function qt(e){return C(e[ft])}function Kt(e){return Symbol.asyncIterator&&C(e==null?void 0:e[Symbol.asyncIterator])}function Qt(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function zi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yt=zi();function Gt(e){return C(e==null?void 0:e[Yt])}function Bt(e){return un(this,arguments,function(){var r,n,o,i;return $t(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,et(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,et(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,et(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Jt(e){return C(e==null?void 0:e.getReader)}function U(e){if(e instanceof F)return e;if(e!=null){if(qt(e))return Ni(e);if(pt(e))return qi(e);if(Nt(e))return Ki(e);if(Kt(e))return On(e);if(Gt(e))return Qi(e);if(Jt(e))return Yi(e)}throw Qt(e)}function Ni(e){return new F(function(t){var r=e[ft]();if(C(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function qi(e){return new F(function(t){for(var r=0;r=2;return function(n){return n.pipe(e?A(function(o,i){return e(o,i,n)}):de,ge(1),r?He(t):Dn(function(){return new Zt}))}}function Vn(){for(var e=[],t=0;t=2,!0))}function pe(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new x}:t,n=e.resetOnError,o=n===void 0?!0:n,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,f=a===void 0?!0:a;return function(c){var u,p,m,d=0,h=!1,v=!1,Y=function(){p==null||p.unsubscribe(),p=void 0},B=function(){Y(),u=m=void 0,h=v=!1},N=function(){var O=u;B(),O==null||O.unsubscribe()};return y(function(O,Qe){d++,!v&&!h&&Y();var De=m=m!=null?m:r();Qe.add(function(){d--,d===0&&!v&&!h&&(p=$r(N,f))}),De.subscribe(Qe),!u&&d>0&&(u=new rt({next:function($e){return De.next($e)},error:function($e){v=!0,Y(),p=$r(B,o,$e),De.error($e)},complete:function(){h=!0,Y(),p=$r(B,s),De.complete()}}),U(O).subscribe(u))})(c)}}function $r(e,t){for(var r=[],n=2;ne.next(document)),e}function K(e,t=document){return Array.from(t.querySelectorAll(e))}function z(e,t=document){let r=ce(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function ce(e,t=document){return t.querySelector(e)||void 0}function _e(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}function tr(e){return L(b(document.body,"focusin"),b(document.body,"focusout")).pipe(ke(1),l(()=>{let t=_e();return typeof t!="undefined"?e.contains(t):!1}),V(e===_e()),J())}function Xe(e){return{x:e.offsetLeft,y:e.offsetTop}}function Kn(e){return L(b(window,"load"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>Xe(e)),V(Xe(e)))}function rr(e){return{x:e.scrollLeft,y:e.scrollTop}}function dt(e){return L(b(e,"scroll"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>rr(e)),V(rr(e)))}var Yn=function(){if(typeof Map!="undefined")return Map;function e(t,r){var n=-1;return t.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o0},e.prototype.connect_=function(){!Wr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),va?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Wr||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=ba.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Gn=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),Jn=typeof WeakMap!="undefined"?new WeakMap:new Yn,Xn=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ga.getInstance(),n=new La(t,r,this);Jn.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Xn.prototype[e]=function(){var t;return(t=Jn.get(this))[e].apply(t,arguments)}});var Aa=function(){return typeof nr.ResizeObserver!="undefined"?nr.ResizeObserver:Xn}(),Zn=Aa;var eo=new x,Ca=$(()=>k(new Zn(e=>{for(let t of e)eo.next(t)}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function he(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ye(e){return Ca.pipe(S(t=>t.observe(e)),g(t=>eo.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(()=>he(e)))),V(he(e)))}function bt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function ar(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var to=new x,Ra=$(()=>k(new IntersectionObserver(e=>{for(let t of e)to.next(t)},{threshold:0}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function sr(e){return Ra.pipe(S(t=>t.observe(e)),g(t=>to.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(({isIntersecting:r})=>r))))}function ro(e,t=16){return dt(e).pipe(l(({y:r})=>{let n=he(e),o=bt(e);return r>=o.height-n.height-t}),J())}var cr={drawer:z("[data-md-toggle=drawer]"),search:z("[data-md-toggle=search]")};function no(e){return cr[e].checked}function Ke(e,t){cr[e].checked!==t&&cr[e].click()}function Ue(e){let t=cr[e];return b(t,"change").pipe(l(()=>t.checked),V(t.checked))}function ka(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function Ha(){return L(b(window,"compositionstart").pipe(l(()=>!0)),b(window,"compositionend").pipe(l(()=>!1))).pipe(V(!1))}function oo(){let e=b(window,"keydown").pipe(A(t=>!(t.metaKey||t.ctrlKey)),l(t=>({mode:no("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),A(({mode:t,type:r})=>{if(t==="global"){let n=_e();if(typeof n!="undefined")return!ka(n,r)}return!0}),pe());return Ha().pipe(g(t=>t?M:e))}function le(){return new URL(location.href)}function ot(e){location.href=e.href}function io(){return new x}function ao(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)ao(e,r)}function _(e,t,...r){let n=document.createElement(e);if(t)for(let o of Object.keys(t))typeof t[o]!="undefined"&&(typeof t[o]!="boolean"?n.setAttribute(o,t[o]):n.setAttribute(o,""));for(let o of r)ao(n,o);return n}function fr(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function so(){return location.hash.substring(1)}function Dr(e){let t=_("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Pa(e){return L(b(window,"hashchange"),e).pipe(l(so),V(so()),A(t=>t.length>0),X(1))}function co(e){return Pa(e).pipe(l(t=>ce(`[id="${t}"]`)),A(t=>typeof t!="undefined"))}function Vr(e){let t=matchMedia(e);return er(r=>t.addListener(()=>r(t.matches))).pipe(V(t.matches))}function fo(){let e=matchMedia("print");return L(b(window,"beforeprint").pipe(l(()=>!0)),b(window,"afterprint").pipe(l(()=>!1))).pipe(V(e.matches))}function zr(e,t){return e.pipe(g(r=>r?t():M))}function ur(e,t={credentials:"same-origin"}){return ue(fetch(`${e}`,t)).pipe(fe(()=>M),g(r=>r.status!==200?Ot(()=>new Error(r.statusText)):k(r)))}function We(e,t){return ur(e,t).pipe(g(r=>r.json()),X(1))}function uo(e,t){let r=new DOMParser;return ur(e,t).pipe(g(n=>n.text()),l(n=>r.parseFromString(n,"text/xml")),X(1))}function pr(e){let t=_("script",{src:e});return $(()=>(document.head.appendChild(t),L(b(t,"load"),b(t,"error").pipe(g(()=>Ot(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(l(()=>{}),R(()=>document.head.removeChild(t)),ge(1))))}function po(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function lo(){return L(b(window,"scroll",{passive:!0}),b(window,"resize",{passive:!0})).pipe(l(po),V(po()))}function mo(){return{width:innerWidth,height:innerHeight}}function ho(){return b(window,"resize",{passive:!0}).pipe(l(mo),V(mo()))}function bo(){return G([lo(),ho()]).pipe(l(([e,t])=>({offset:e,size:t})),X(1))}function lr(e,{viewport$:t,header$:r}){let n=t.pipe(ee("size")),o=G([n,r]).pipe(l(()=>Xe(e)));return G([r,t,o]).pipe(l(([{height:i},{offset:s,size:a},{x:f,y:c}])=>({offset:{x:s.x-f,y:s.y-c+i},size:a})))}(()=>{function e(n,o){parent.postMessage(n,o||"*")}function t(...n){return n.reduce((o,i)=>o.then(()=>new Promise(s=>{let a=document.createElement("script");a.src=i,a.onload=s,document.body.appendChild(a)})),Promise.resolve())}var r=class extends EventTarget{constructor(n){super(),this.url=n,this.m=i=>{i.source===this.w&&(this.dispatchEvent(new MessageEvent("message",{data:i.data})),this.onmessage&&this.onmessage(i))},this.e=(i,s,a,f,c)=>{if(s===`${this.url}`){let u=new ErrorEvent("error",{message:i,filename:s,lineno:a,colno:f,error:c});this.dispatchEvent(u),this.onerror&&this.onerror(u)}};let o=document.createElement("iframe");o.hidden=!0,document.body.appendChild(this.iframe=o),this.w.document.open(),this.w.document.write(` + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + + + + + +
+
+ + + + + + + +

Simulation

+ +
+

Abstract

+

This tutorial guides you through an example material synthesis workflow using the +CRIPT Python SDK.

+
+

Installation

+

Before you start, be sure the cript python package is installed.

+
pip install cript
+
+

Connect to CRIPT

+

To connect to CRIPT, you must enter a host and an API Token. For most users, host will be https://criptapp.org.

+
+

Keep API Token Secure

+

To ensure security, avoid storing sensitive information like tokens directly in your code. +Instead, use environment variables. +Storing tokens in code shared on platforms like GitHub can lead to security incidents. +Anyone that possesses your token can impersonate you on the CRIPT platform. +Consider alternative methods for loading tokens with the CRIPT API Client. +In case your token is exposed be sure to immediately generate a new token to revoke the access of the old one +and keep the new token safe.

+
+
import cript
+
+with cript.API(host="http://development.api.mycriptapp.org/", api_token="123456", storage_token="987654") as api:
+    pass
+
+
+

Note

+

You may notice, that we are not executing any code inside the context manager block. +If you were to write a python script, compared to a jupyter notebook, you would add all the following code inside that block. +Here in a jupyter notebook, we need to connect manually. We just have to remember to disconnect at the end.

+
+
api = cript.API(host="http://development.api.mycriptapp.org/", api_token=None, storage_token="123456")
+api = api.connect()
+
+

Create a Project

+

All data uploaded to CRIPT must be associated with a Project node. +Project can be thought of as an overarching research goal. +For example, finding a replacement for an existing material from a sustainable feedstock.

+
# create a new project in the CRIPT database
+project = cript.Project(name="My simulation project.")
+
+

Create a Collection node

+

For this project, you can create multiple collections, which represent a set of experiments. +For example, you can create a collection for a specific manuscript, +or you can create a collection for initial screening of candidates and one for later refinements etc.

+

So, let's create a collection node and add it to the project.

+
collection = cript.Collection(name="Initial simulation screening")
+# We add this collection to the project as a list.
+project.collection += [collection]
+
+
+

Viewing CRIPT JSON

+

Note, that if you are interested into the inner workings of CRIPT, +you can obtain a JSON representation of your data graph at any time to see what is being sent to the API.

+
+
print(project.json)
+print("\nOr more pretty\n")
+print(project.get_json(indent=2).json)
+
+

Create an Experiment node

+

The Collection node holds a series of +Experiment nodes nodes.

+

And we can add this experiment to the collection of the project.

+
experiment = cript.Experiment(name="Simulation for the first candidate")
+collection.experiment += [experiment]
+
+

Create relevant Software nodes

+

Software nodes refer to software that you use during your simulation experiment. +In general Software nodes can be shared between project, and it is encouraged to do so if the software you are using is already present in the CRIPT project use it.

+

If They are not, you can create them as follows:

+
python = cript.Software(name="python", version="3.9")
+rdkit = cript.Software(name="rdkit", version="2020.9")
+stage = cript.Software(name="stage", source="https://doi.org/10.1021/jp505332p", version="N/A")
+packmol = cript.Software(name="Packmol", source="http://m3g.iqm.unicamp.br/packmol", version="N/A")
+openmm = cript.Software(name="openmm", version="7.5")
+
+

Generally, provide as much information about the software as possible this helps to make your results reproducible. +Even a software is not publicly available, like an in-house code, we encourage you to specify them in CRIPT. +If a version is not available, consider using git-hashes.

+

Create Software Configurations

+

Now that we have our Software nodes, we can create +SoftwareConfiguration nodes. SoftwareConfigurations nodes are designed to let you specify details, about which algorithms from the software package you are using and log parameters for these algorithms.

+

The SoftwareConfigurations are then used for constructing our Computation node, which describe the actual computation you are performing.

+

We can also attach Algorithm nodes to a SoftwareConfiguration +node. The Algorithm nodes may contain nested Parameter nodes, as shown in the example below.

+
# create some software configuration nodes
+python_config = cript.SoftwareConfiguration(software=python)
+rdkit_config = cript.SoftwareConfiguration(software=rdkit)
+stage_config = cript.SoftwareConfiguration(software=stage)
+
+# create a software configuration node with a child Algorithm node
+openmm_config = cript.SoftwareConfiguration(
+    software=openmm,
+    algorithm=[
+        cript.Algorithm(
+            key="energy_minimization",
+            type="initialization",
+        ),
+    ],
+)
+packmol_config = cript.SoftwareConfiguration(software=packmol)
+
+
+

Algorithm keys

+

The allowed Algorithm keys are listed under algorithm keys in the CRIPT controlled vocabulary.

+
+
+

Parameter keys

+

The allowed Parameter keys are listed under parameter keys in the CRIPT controlled vocabulary.

+
+

Create Computations

+

Now that we've created some SoftwareConfiguration nodes, we can used them to build full Computation nodes. +In some cases, we may also want to add Condition nodes to our computation, to specify the conditions at which the computation was carried out. An example of this is shown below.

+
# Create a ComputationNode
+# This block of code represents the computation involved in generating forces.
+# It also details the initial placement of molecules within a simulation box.
+init = cript.Computation(
+    name="Initial snapshot and force-field generation",
+    type="initialization",
+    software_configuration=[
+        python_config,
+        rdkit_config,
+        stage_config,
+        packmol_config,
+        openmm_config,
+    ],
+)
+
+# Initiate the simulation equilibration using a separate node.
+# The equilibration process is governed by specific conditions and a set equilibration time.
+# Given this is an NPT (Number of particles, Pressure, Temperature) simulation, conditions such as the number of chains, temperature, and pressure are specified.
+equilibration = cript.Computation(
+    name="Equilibrate data prior to measurement",
+    type="MD",
+    software_configuration=[python_config, openmm_config],
+    condition=[
+        cript.Condition(key="time_duration", type="value", value=100.0, unit="ns"),
+        cript.Condition(key="temperature", type="value", value=450.0, unit="K"),
+        cript.Condition(key="pressure", type="value", value=1.0, unit="bar"),
+        cript.Condition(key="number", type="value", value=31),
+    ],
+    prerequisite_computation=init,
+)
+
+# This section involves the actual data measurement.
+# Note that we use the previously computed data as a prerequisite. Additionally, we incorporate the input data at a later stage.
+bulk = cript.Computation(
+    name="Bulk simulation for measurement",
+    type="MD",
+    software_configuration=[python_config, openmm_config],
+    condition=[
+        cript.Condition(key="time_duration", type="value", value=50.0, unit="ns"),
+        cript.Condition(key="temperature", type="value", value=450.0, unit="K"),
+        cript.Condition(key="pressure", type="value", value=1.0, unit="bar"),
+        cript.Condition(key="number", type="value", value=31),
+    ],
+    prerequisite_computation=equilibration,
+)
+
+# The following step involves analyzing the data from the measurement run to ascertain a specific property.
+ana = cript.Computation(
+    name="Density analysis",
+    type="analysis",
+    software_configuration=[python_config],
+    prerequisite_computation=bulk,
+)
+
+# Add all these computations to the experiment.
+experiment.computation += [init, equilibration, bulk, ana]
+
+
+

Computation types

+

The allowed Computation types are listed under computation types in the CRIPT controlled vocabulary.

+
+
+

Condition keys

+

The allowed Condition keys are listed under condition keys in the CRIPT controlled vocabulary.

+
+

Create and Upload Files

+

New we'd like to upload files associated with our simulation. First, we'll instantiate our File nodes under a specific project.

+
packing_file = cript.File("Initial simulation box snapshot with roughly packed molecules", type="computation_snapshot", source="path/to/local/file")
+forcefield_file = cript.File(name="Forcefield definition file", type="data", source="path/to/local/file")
+snap_file = cript.File("Bulk measurement initial system snap shot", type="computation_snapshot", source="path/to/local/file")
+final_file = cript.File("Final snapshot of the system at the end the simulations", type="computation_snapshot", source="path/to/local/file")
+
+
+

Note

+

The source field should point to any file on your local filesystem.

+
+
+

Info

+

Depending on the file size, there could be a delay while the checksum is generated.

+
+

Note, that we haven't uploaded the files to CRIPT yet, this is automatically performed, when the project is uploaded via api.save(project).

+

Create Data

+

Next, we'll create a Data node which helps organize our File nodes and links back to our Computation objects.

+
packing_data = cript.Data(
+    name="Loosely packed chains",
+    type="computation_config",
+    file=[packing_file],
+    computation=[init],
+    notes="PDB file without topology describing an initial system.",
+)
+
+forcefield_data = cript.Data(
+    name="OpenMM forcefield",
+    type="computation_forcefield",
+    file=[forcefield_file],
+    computation=[init],
+    notes="Full forcefield definition and topology.",
+)
+
+equilibration_snap = cript.Data(
+    name="Equilibrated simulation snapshot",
+    type="computation_config",
+    file=[snap_file],
+    computation=[equilibration],
+)
+
+final_data = cript.Data(
+    name="Logged volume during simulation",
+    type="computation_trajectory",
+    file=[final_file],
+    computation=[bulk],
+)
+
+
+

Data types

+

The allowed Data types are listed under the data types in the CRIPT controlled vocabulary.

+
+

Next, we'll link these Data nodes to the appropriate Computation nodes.

+
# Observe how this step also forms a continuous graph, enabling data to flow from one computation to the next.
+# The sequence initiates with the computation process and culminates with the determination of the material property.
+init.output_data = [packing_data, forcefield_data]
+equilibration.input_data = [packing_data, forcefield_data]
+equilibration.output_data = [equilibration_snap]
+ana.input_data = [final_data]
+bulk.output_data = [final_data]
+
+

Create a virtual Material

+

Finally, we'll create a virtual material and link it to the Computation nodes that we've built.

+

+
+

Next, let's add some Identifiers nodes to the material to make it easier to identify and search.

+
names = cript.Identifier(
+    key="names",
+    value=["poly(styrene)", "poly(vinylbenzene)"],
+)
+
+bigsmiles = cript.Identifier(
+    key="bigsmiles",
+    value="[H]{[>][<]C(C[>])c1ccccc1[<]}C(C)CC",
+)
+
+chem_repeat = cript.Identifier(
+    key="chem_repeat",
+    value="C8H8",
+)
+
+polystyrene.add_identifier(names)
+polystyrene.add_identifier(chem_repeat)
+polystyrene.add_identifier(bigsmiles)
+
+
+

Identifier keys

+

The allowed Identifiers keys are listed in the material identifier keys in the CRIPT controlled vocabulary.

+
+

Let's also add some Property nodes to the Material, which represent its physical or virtual (in the case of a simulated material) properties.

+
phase = cript.Property(key="phase", value="solid")
+color = cript.Property(key="color", value="white")
+
+polystyrene.add_property(phase)
+polystyrene.add_property(color)
+
+
+

Material property keys

+

The allowed material Property keys are listed in the material property keys in the CRIPT controlled vocabulary.

+
+
identifiers = [{"names": ["poly(styrene)", "poly(vinylbenzene)"]}]
+identifiers += [{"bigsmiles": "[H]{[>][<]C(C[>])c1ccccc1[<]}C(C)CC"}]
+identifiers += [{"chem_repeat": ["C8H8"]}]
+
+polystyrene = cript.Material(name="virtual polystyrene", identifiers=identifiers)
+
+

Finally, we'll create a ComputationalForcefield node and link it to the Material.

+
forcefield = cript.ComputationalForcefield(
+    key="opls_aa",
+    building_block="atom",
+    source="Custom determination via STAGE",
+    data=[forcefield_data],
+)
+
+polystyrene.computational_forcefield = forcefield
+
+
+

Computational forcefield keys

+

The allowed ComputationalForcefield keys are listed under the computational forcefield keys in the CRIPT controlled vocabulary.

+
+

Now we can save the project to CRIPT (and upload the files) or inspect the JSON output

+
# Before we can save it, we should add all the orphaned nodes to the experiments.
+# It is important to do this for every experiment separately, but here we only have one.
+cript.add_orphaned_nodes_to_project(project, active_experiment=experiment)
+project.validate()
+
+# api.save(project)
+print(project.get_json(indent=2).json)
+
+# Let's not forget to close the API connection after everything is done.
+api.disconnect()
+
+

Conclusion

+

You made it! We hope this tutorial has been helpful.

+

Please let us know how you think it could be improved. +Feel free to reach out to us on our CRIPT Python SDK GitHub. +We'd love your inputs and contributions!

+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/examples/synthesis/index.html b/examples/synthesis/index.html new file mode 100644 index 000000000..50aef0e5f --- /dev/null +++ b/examples/synthesis/index.html @@ -0,0 +1,1519 @@ + + + + + + + + + + + + + + + + + + + + + + Synthesis - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + + + + + +
+
+ + + + + + + +

Synthesis

+ +
+

Abstract

+

This tutorial guides you through an example material synthesis workflow using the +CRIPT Python SDK.

+
+

Installation

+

Before you start, be sure the cript python package is installed.

+
pip install cript
+
+

Connect to CRIPT

+

To connect to CRIPT, you must enter a host and an API Token. For most users, host will be https://criptapp.org.

+
+

Keep API Token Secure

+

To ensure security, avoid storing sensitive information like tokens directly in your code. +Instead, use environment variables. +Storing tokens in code shared on platforms like GitHub can lead to security incidents. +Anyone that possesses your token can impersonate you on the CRIPT platform. +Consider alternative methods for loading tokens with the CRIPT API Client. +In case your token is exposed be sure to immediately generate a new token to revoke the access of the old one +and keep the new token safe.

+
+
import cript
+
+with cript.API(host="http://development.api.mycriptapp.org/", api_token="123456", storage_token="987654") as api:
+    pass
+
+
+

Note

+

You may notice, that we are not executing any code inside the context manager block. +If you were to write a python script, compared to a jupyter notebook, you would add all the following code inside that block. +Here in a jupyter notebook, we need to connect manually. We just have to remember to disconnect at the end.

+
+
api = cript.API(host="http://development.api.mycriptapp.org/", api_token=None, storage_token="123456")
+api = api.connect()
+
+

Create a Project

+

All data uploaded to CRIPT must be associated with a project node. +Project can be thought of as an overarching research goal. +For example, finding a replacement for an existing material from a sustainable feedstock.

+
# create a new project in the CRIPT database
+project = cript.Project(name="My first project.")
+
+

Create a Collection node

+

For this project, you can create multiple collections, which represent a set of experiments. +For example, you can create a collection for a specific manuscript, +or you can create a collection for initial screening of candidates and one for later refinements etc.

+

So, let's create a collection node and add it to the project.

+
collection = cript.Collection(name="Initial screening")
+# We add this collection to the project as a list.
+project.collection += [collection]
+
+
+

Viewing CRIPT JSON

+

Note, that if you are interested into the inner workings of CRIPT, +you can obtain a JSON representation of your data graph at any time to see what is being sent to the API.

+
+
print(project.json)
+print("\nOr more pretty\n")
+print(project.get_json(indent=2).json)
+
+

Create an Experiment node

+

The collection node holds a series of +Experiment nodes nodes.

+

And we can add this experiment to the collection of the project.

+
experiment = cript.Experiment(name="Anionic Polymerization of Styrene with SecBuLi")
+collection.experiment += [experiment]
+
+

Create an Inventory

+

An Inventory contains materials, +that are well known and usually not of polymeric nature. +They are for example the chemical you buy commercially and use as input into your synthesis.

+

For this we create this inventory by adding the Material we need one by one.

+
# create a list of identifiers as dictionaries to
+# identify your material to the community and your team
+my_solution_material_identifiers = [
+    {"chemical_id": "598-30-1"}
+]
+
+solution = cript.Material(
+    name="SecBuLi solution 1.4M cHex",
+    identifiers=my_solution_material_identifiers
+)
+
+

These materials are simple, notice how we use the SMILES notation here as an identifier for the material. +Similarly, we can create more initial materials.

+
toluene = cript.Material(name="toluene", identifiers=[{"smiles": "Cc1ccccc1"}, {"pubchem_id": 1140}])
+styrene = cript.Material(name="styrene", identifiers=[{"smiles": "c1ccccc1C=C"}, {"inchi": "InChI=1S/C8H8/c1-2-8-6-4-3-5-7-8/h2-7H,1H2"}])
+butanol = cript.Material(name="1-butanol", identifiers=[{"smiles": "OCCCC"}, {"inchi_key": "InChIKey=LRHPLDYGYMQRHN-UHFFFAOYSA-N"}])
+methanol = cript.Material(name="methanol", identifiers=[{"smiles": "CO"}, {"names": ["Butan-1-ol", "Butyric alcohol", "Methylolpropane", "n-Butan-1-ol", "methanol"]}])
+
+

Now that we defined those materials, we can combine them into an inventory +for easy access and sharing between experiments/projects.

+
inventory = cript.Inventory(
+    name="Common chemicals for poly-styrene synthesis",
+    material=[solution, toluene, styrene, butanol, methanol],
+)
+collection.inventory += [inventory]
+
+

Create a Process node

+

A Process is a step in an experiment. +You decide how many Process are required for your experiment, +so you can list details for your experiment as fine-grained as desired. +Here we use just one step to describe the entire synthesis.

+
process = cript.Process(
+    name="Anionic of Synthesis Poly-Styrene",
+    type="multistep",
+    description="In an argon filled glove box, a round bottom flask was filled with 216 ml of dried toluene. The "
+    "solution of secBuLi (3 ml, 3.9 mmol) was added next, followed by styrene (22.3 g, 176 mmol) to "
+    "initiate the polymerization. The reaction mixture immediately turned orange. After 30 min, "
+    "the reaction was quenched with the addition of 3 ml of methanol. The polymer was isolated by "
+    "precipitation in methanol 3 times and dried under vacuum.",
+)
+experiment.process += [process]
+
+

Add Ingredients to a Process

+

From a chemistry standpoint, most experimental processes, regardless of whether they are carried out in the lab +or simulated using computer code, consist of input ingredients that are transformed in some way. +Let's add ingredients to the Process that we just created. +For this we use the materials from the inventory. +Next, define Quantities nodes indicating the amount of each +Ingredient that we will use in the Process.

+
initiator_qty = cript.Quantity(key="volume", value=1.7e-8, unit="m**3")
+solvent_qty = cript.Quantity(key="volume", value=1e-4, unit="m**3")
+monomer_qty = cript.Quantity(key="mass", value=0.455e-3, unit="kg")
+quench_qty = cript.Quantity(key="volume", value=5e-3, unit="m**3")
+workup_qty = cript.Quantity(key="volume", value=0.1, unit="m**3")
+
+

Now we can create an Ingredient +node for each ingredient using the Material +and quantities attributes.

+
initiator = cript.Ingredient(
+    keyword=["initiator"], material=solution, quantity=[initiator_qty]
+)
+
+solvent = cript.Ingredient(
+    keyword=["solvent"], material=toluene, quantity=[solvent_qty]
+)
+
+monomer = cript.Ingredient(
+    keyword=["monomer"], material=styrene, quantity=[monomer_qty]
+)
+
+quench = cript.Ingredient(
+    keyword=["quench"], material=butanol, quantity=[quench_qty]
+)
+
+workup = cript.Ingredient(
+    keyword=["workup"], material=methanol, quantity=[workup_qty]
+)
+
+

Finally, we can add the Ingredient nodes to the Process node.

+
process.ingredient += [initiator, solvent, monomer, quench, workup]
+
+

Add Conditions to the Process

+

Its possible that our Process was carried out under specific physical conditions. We can codify this by adding +Condition nodes to the process.

+
temp = cript.Condition(key="temperature", type="value", value=25, unit="celsius")
+time = cript.Condition(key="time_duration", type="value", value=60, unit="min")
+process.condition = [temp, time]
+
+

Add a Property to a Process

+

We may also want to associate our process with certain properties. We can do this by adding +Property nodes to the process.

+
yield_mass = cript.Property(key="yield_mass", type="number", value=47e-5, unit="kilogram", method="scale")
+process.property += [yield_mass]
+
+

Create a Material node (process product)

+

Along with input Ingredients, our Process +may also produce product materials.

+

First, let's create the Material +that will serve as our product. We give the material a name attribute and add it to our +[Project]((../../nodes/primary_nodes/project).

+
polystyrene = cript.Material(name="polystyrene", identifiers=[])
+project.material += [polystyrene]
+
+

Let's add some Identifiers to the material to make it easier to identify and search.

+
# create a name identifier
+polystyrene.identifiers += [{"names": ["poly(styrene)", "poly(vinylbenzene)"]}]
+
+# create a BigSMILES identifier
+polystyrene.identifiers += [{"bigsmiles": "[H]{[>][<]C(C[>])c1ccccc1[<]}C(C)CC"}]
+# create a chemical repeat unit identifier
+polystyrene.identifiers += [{"chem_repeat": ["C8H8"]}]
+
+

Next, we'll add some Property nodes to the +Material , which represent its physical or virtual +(in the case of a simulated material) properties.

+
# create a phase property
+phase = cript.Property(key="phase", value="solid", type="none", unit=None)
+# create a color property
+color = cript.Property(key="color", value="white", type="none", unit=None)
+
+# add the properties to the material
+polystyrene.property += [phase, color]
+
+

Congratulations! You've just created a process that represents the polymerization reaction of Polystyrene, starting with a set of input ingredients in various quantities, and ending with a new polymer with specific identifiers and physical properties.

+

Now we can save the project to CRIPT via the api object.

+
project.validate()
+print(project.get_json(indent=2, condense_to_uuid={}).json)
+# api.save(project)
+
+
# Don't forget to disconnect once everything is done
+api.disconnect()
+
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/exceptions/api_exceptions/index.html b/exceptions/api_exceptions/index.html new file mode 100644 index 000000000..883e54665 --- /dev/null +++ b/exceptions/api_exceptions/index.html @@ -0,0 +1,2351 @@ + + + + + + + + + + + + + + + + + + + + + + API Exceptions - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

API Exceptions

+ +

API Client Exceptions

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ APIError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

This is a generic error made to display API errors to the user to troubleshoot.

+
How to Fix
+

Please keep in mind that the CRIPT Python SDK turns the Project +node into a giant JSON and sends that to the API to be processed. If there are any errors while processing +the giant JSON generated by the CRIPT Python SDK, then the API will return an error about the http request +and the JSON sent to it. Therefore, the error shown might be an error within the JSON and not particular +within the Python code that was created

+

The best way to trouble shoot this is to figure out what the API error means and figure out where +in the Python SDK this error occurred and what have been the reason under the hood.

+ +
+ Source code in src/cript/api/exceptions.py +
class APIError(CRIPTException):
+    """
+    ## Definition
+    This is a generic error made to display API errors to the user to troubleshoot.
+
+    ## How to Fix
+    Please keep in mind that the CRIPT Python SDK turns the [Project](../../nodes/primary_nodes/project)
+    node into a giant JSON and sends that to the API to be processed. If there are any errors while processing
+    the giant JSON generated by the CRIPT Python SDK, then the API will return an error about the http request
+    and the JSON sent to it. Therefore, the error shown might be an error within the JSON and not particular
+    within the Python code that was created
+
+    The best way to trouble shoot this is to figure out what the API error means and figure out where
+    in the Python SDK this error occurred and what have been the reason under the hood.
+    """
+
+    api_error: str = ""
+
+    def __init__(self, api_error: str) -> None:
+        self.api_error = api_error
+
+    def __str__(self) -> str:
+        error_message: str = f"The API responded with {self.api_error}"
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTAPIRequiredError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

Exception to be raised when the API object is requested, but no cript.API object exists yet.

+

The CRIPT Python SDK relies on a cript.API object for creation, validation, and modification of nodes. +The cript.API object may be explicitly called by the user to perform operations to the API, or +implicitly called by the Python SDK under the hood to perform some sort of validation.

+
How to Fix
+

To fix this error please instantiate an api object

+
import cript
+
+my_host = "https://criptapp.org"
+my_token = "123456" # To use your token securely, please consider using environment variables
+
+my_api = cript.API(host=my_host, token=my_token)
+
+ +
+ Source code in src/cript/api/exceptions.py +
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
class CRIPTAPIRequiredError(CRIPTException):
+    """
+    ## Definition
+    Exception to be raised when the API object is requested, but no cript.API object exists yet.
+
+    The CRIPT Python SDK relies on a cript.API object for creation, validation, and modification of nodes.
+    The cript.API object may be explicitly called by the user to perform operations to the API, or
+    implicitly called by the Python SDK under the hood to perform some sort of validation.
+
+    ## How to Fix
+    To fix this error please instantiate an api object
+
+    ```python
+    import cript
+
+    my_host = "https://criptapp.org"
+    my_token = "123456" # To use your token securely, please consider using environment variables
+
+    my_api = cript.API(host=my_host, token=my_token)
+    ```
+    """
+
+    def __init__(self):
+        pass
+
+    def __str__(self) -> str:
+        error_message = "cript.API object is required for an operation, but it does not exist." "Please instantiate a cript.API object to continue." "See the documentation for more details."
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTAPISaveError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

CRIPTAPISaveError is raised when the API responds with a http status code that is anything other than 200. +The status code and API response is shown to the user to help them debug the issue.

+
How to Fix
+

This error is more of a case by case basis, but the best way to approach it to understand that the +CRIPT Python SDK sent an HTTP POST request with a giant JSON in the request body +to the CRIPT API. The API then read that request, and it responded with some sort of error either +to the that JSON or how the request was sent.

+ +
+ Source code in src/cript/api/exceptions.py +
class CRIPTAPISaveError(CRIPTException):
+    """
+    ## Definition
+    CRIPTAPISaveError is raised when the API responds with a http status code that is anything other than 200.
+    The status code and API response is shown to the user to help them debug the issue.
+
+    ## How to Fix
+    This error is more of a case by case basis, but the best way to approach it to understand that the
+    CRIPT Python SDK sent an HTTP POST request with a giant JSON in the request body
+    to the CRIPT API. The API then read that request, and it responded with some sort of error either
+    to the that JSON or how the request was sent.
+    """
+
+    api_host_domain: str
+    http_code: str
+    api_response: str
+
+    def __init__(self, api_host_domain: str, http_code: str, api_response: str, patch_request: bool, pre_saved_nodes: Optional[Set[str]] = None, json_data: Optional[str] = None):
+        self.api_host_domain = api_host_domain
+        self.http_code = http_code
+        self.api_response = api_response
+        self.patch_request = patch_request
+        self.pre_saved_nodes = pre_saved_nodes
+        self.json_data = json_data
+
+    def __str__(self) -> str:
+        type = "POST"
+        if self.patch_request:
+            type = "PATCH"
+        error_message = f"API responded to {type} with 'http:{self.http_code} {self.api_response}'"
+        if self.json_data:
+            error_message += f" data: {self.json_data}"
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTConnectionError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

Raised when the cript.API object cannot connect to CRIPT with the given host and token

+
How to Fix
+

The best way to fix this error is to check that your host and token are written and used correctly within +the cript.API object. This error could also be shown if the API is unresponsive and the cript.API object +just cannot successfully connect to it.

+ +
+ Source code in src/cript/api/exceptions.py +
 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
class CRIPTConnectionError(CRIPTException):
+    """
+    ## Definition
+    Raised when the cript.API object cannot connect to CRIPT with the given host and token
+
+    ## How to Fix
+    The best way to fix this error is to check that your host and token are written and used correctly within
+    the cript.API object. This error could also be shown if the API is unresponsive and the cript.API object
+    just cannot successfully connect to it.
+    """
+
+    def __init__(self, host, token):
+        self.host = host
+        # Do not store full token in stack trace for security reasons
+        uncovered_chars = len(token) // 4
+        self.token = token[:uncovered_chars]
+        self.token += "*" * (len(token) - 2 * uncovered_chars)
+        self.token += token[-uncovered_chars:]
+
+    def __str__(self) -> str:
+        error_message = f"Could not connect to CRIPT with the given host ({self.host}) and token ({self.token}). " f"Please be sure both host and token are entered correctly."
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ FileDownloadError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

This error is raised when the API wants to download a file from an AWS S3 URL +via the cript.API.download_file() method, but the status is something other than 200.

+ +
+ Source code in src/cript/api/exceptions.py +
class FileDownloadError(CRIPTException):
+    """
+    ## Definition
+    This error is raised when the API wants to download a file from an AWS S3 URL
+    via the `cript.API.download_file()` method, but the status is something other than 200.
+    """
+
+    error_message: str = ""
+
+    def __init__(self, error_message: str) -> None:
+        self.error_message = error_message
+
+    def __str__(self) -> str:
+        return self.error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ InvalidHostError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

Exception is raised when the host given to the API is invalid

+
How to Fix
+

This is a simple error to fix, simply put http:// or preferably https:// in front of your domain +when passing in the host to the cript.API class such as https://criptapp.org

+

Currently, the only web protocol that is supported with the CRIPT Python SDK is HTTP.

+
Example
+
import cript
+
+my_valid_host = "https://criptapp.org"
+my_token = "123456" # To use your token securely, please consider using environment variables
+
+my_api = cript.API(host=my_valid_host, token=my_token)
+
+
Warnings
+

Please consider always using HTTPS +as that is a secure protocol and avoid using HTTP as it is insecure. +The CRIPT Python SDK will give a warning in the terminal when it detects a host with HTTP

+ +
+ Source code in src/cript/api/exceptions.py +
class InvalidHostError(CRIPTException):
+    """
+    ## Definition
+    Exception is raised when the host given to the API is invalid
+
+    ## How to Fix
+    This is a simple error to fix, simply put `http://` or preferably `https://` in front of your domain
+    when passing in the host to the cript.API class such as `https://criptapp.org`
+
+    Currently, the only web protocol that is supported with the CRIPT Python SDK is `HTTP`.
+
+    ### Example
+    ```python
+    import cript
+
+    my_valid_host = "https://criptapp.org"
+    my_token = "123456" # To use your token securely, please consider using environment variables
+
+    my_api = cript.API(host=my_valid_host, token=my_token)
+    ```
+
+    Warnings
+    --------
+    Please consider always using [HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS)
+    as that is a secure protocol and avoid using `HTTP` as it is insecure.
+    The CRIPT Python SDK will give a warning in the terminal when it detects a host with `HTTP`
+
+
+    """
+
+    def __init__(self) -> None:
+        pass
+
+    def __str__(self) -> str:
+        return "The host must start with http or https"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ InvalidVocabulary + + +

+ + +
+

+ Bases: CRIPTException

+ + +

Raised when the CRIPT controlled vocabulary is invalid

+ +
+ Source code in src/cript/api/exceptions.py +
32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
class InvalidVocabulary(CRIPTException):
+    """
+    Raised when the CRIPT controlled vocabulary is invalid
+    """
+
+    vocab: str = ""
+    possible_vocab: List[str] = []
+
+    def __init__(self, vocab: str, possible_vocab: List[str]) -> None:
+        self.vocab = vocab
+        self.possible_vocab = possible_vocab
+
+    def __str__(self) -> str:
+        error_message = f"The vocabulary '{self.vocab}' entered does not exist within the CRIPT controlled vocabulary." f" Please pick a valid CRIPT vocabulary from {self.possible_vocab}"
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ InvalidVocabularyCategory + + +

+ + +
+

+ Bases: CRIPTException

+ + +

Raised when the CRIPT controlled vocabulary category is unknown +and gives the user a list of all valid vocabulary categories

+ +
+ Source code in src/cript/api/exceptions.py +
49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
class InvalidVocabularyCategory(CRIPTException):
+    """
+    Raised when the CRIPT controlled vocabulary category is unknown
+    and gives the user a list of all valid vocabulary categories
+    """
+
+    def __init__(self, vocab_category: str, valid_vocab_category: List[str]):
+        self.vocab_category = vocab_category
+        self.valid_vocab_category = valid_vocab_category
+
+    def __str__(self) -> str:
+        error_message = f"The vocabulary category {self.vocab_category} does not exist within the CRIPT controlled vocabulary. " f"Please pick a valid CRIPT vocabulary category from {self.valid_vocab_category}."
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/exceptions/node_exceptions/index.html b/exceptions/node_exceptions/index.html new file mode 100644 index 000000000..19788477b --- /dev/null +++ b/exceptions/node_exceptions/index.html @@ -0,0 +1,3674 @@ + + + + + + + + + + + + + + + + + + + + + + Node Exceptions - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Node Exceptions

+ +

Node Exceptions

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ CRIPTAttributeModificationError + + +

+ + +
+

+ Bases: CRIPTException

+ + +

Exception that is thrown when a node attribute is modified, that wasn't intended to be modified.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTAttributeModificationError(CRIPTException):
+    """
+    Exception that is thrown when a node attribute is modified, that wasn't intended to be modified.
+    """
+
+    def __init__(self, name, key, value):
+        self.name = name
+        self.key = key
+        self.value = value
+
+    def __str__(self):
+        return (
+            f"Attempt to modify an attribute of a node ({self.name}) that wasn't intended to be modified.\n"
+            f"Here the non-existing attribute {self.key} of {self.name} was attempted to be modified.\n"
+            "Most likely this is due to a typo in the attribute that was intended to be modified i.e. `project.materials` instead of `project.material`.\n"
+            "To ensure compatibility with the underlying CRIPT data model we do not allow custom attributes.\n"
+        )
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTDeserializationUIDError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

This exception is raised when converting a node from JSON to Python class fails, +because a node is specified with its UID only, but not part of the data graph elsewhere.

+
Error Example
+

Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node

+

{
+"node": ["Algorithm"],
+"key": "mc_barostat",
+"type": "barostat",
+"parameter": {"node": ["Parameter"], "uid": "uid-string"}
+}
+
+Here the algorithm has a parameter attribute, but the parameter is specified as uid only.

+
Valid Example
+

Valid JSON that can be deserialized to a CRIPT Python SDK Node

+

{
+"node": ["Algorithm"],
+"key": "mc_barostat",
+"type": "barostat",
+"parameter": {"node": ["Parameter"], "uid": "uid-string",
+              "key": "update_frequency", "value":1, "unit": "1/second"}
+}
+
+Now the node is fully specified.

+
How to Fix
+

Specify the full node instead. This error might appear if you try to partially load previously generated JSON.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTDeserializationUIDError(CRIPTException):
+    """
+    ## Definition
+    This exception is raised when converting a node from JSON to Python class fails,
+    because a node is specified with its UID only, but not part of the data graph elsewhere.
+
+    ### Error Example
+    Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node
+
+    ```json
+    {
+    "node": ["Algorithm"],
+    "key": "mc_barostat",
+    "type": "barostat",
+    "parameter": {"node": ["Parameter"], "uid": "uid-string"}
+    }
+    ```
+    Here the algorithm has a parameter attribute, but the parameter is specified as uid only.
+
+    ### Valid Example
+    Valid JSON that can be deserialized to a CRIPT Python SDK Node
+
+    ```json
+    {
+    "node": ["Algorithm"],
+    "key": "mc_barostat",
+    "type": "barostat",
+    "parameter": {"node": ["Parameter"], "uid": "uid-string",
+                  "key": "update_frequency", "value":1, "unit": "1/second"}
+    }
+    ```
+    Now the node is fully specified.
+
+    ## How to Fix
+    Specify the full node instead. This error might appear if you try to partially load previously generated JSON.
+    """
+
+    def __init__(self, node_type: str, uid: str) -> None:
+        self.node_type = node_type
+        self.uid = uid
+
+    def __str__(self) -> str:
+        return f"JSON deserialization failed for node type {self.node_type} with unknown UID: {self.uid}"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTJsonDeserializationError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

This exception is raised when converting a node from JSON to Python class fails. +This process fails when the attributes within the JSON does not match the node's class +attributes within the JsonAttributes of that specific node

+
Error Example
+

Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node

+

+
+
Valid Example
+

Valid JSON that can be deserialized to a CRIPT Python SDK Node

+

+
+
How to Fix
+ +
+ Source code in src/cript/nodes/exceptions.py +
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
class CRIPTJsonDeserializationError(CRIPTException):
+    """
+    ## Definition
+    This exception is raised when converting a node from JSON to Python class fails.
+    This process fails when the attributes within the JSON does not match the node's class
+    attributes within the `JsonAttributes` of that specific node
+
+    ### Error Example
+    Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node
+
+    ```json
+    ```
+
+
+    ### Valid Example
+    Valid JSON that can be deserialized to a CRIPT Python SDK Node
+
+    ```json
+    ```
+
+    ## How to Fix
+    """
+
+    def __init__(self, node_type: str, json_str: str) -> None:
+        self.node_type = node_type
+        self.json_str = json_str
+
+    def __str__(self) -> str:
+        return f"JSON deserialization failed for node type {self.node_type} with JSON str: {self.json_str}"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTJsonNodeError + + +

+ + +
+

+ Bases: CRIPTJsonDeserializationError

+ + +
Definition
+

This exception is raised if a node attribute is present in JSON, +but the list has more or less than exactly one type of node type.

+
+

Note: It is expected that there is only a single node type per JSON object.

+
+
Example
+
+

Valid JSON representation of a Material node

+
{
+  "node": [
+    "Material"
+  ],
+  "name": "Whey protein isolate",
+  "uid": "_:Whey protein isolate"
+},
+
+
+
+Invalid JSON representation of a Material node +
{
+  "node": [
+    "Material",
+    "Property"
+  ],
+  "name": "Whey protein isolate",
+  "uid": "_:Whey protein isolate"
+},
+
+
+
{
+  "node": [],
+  "name": "Whey protein isolate",
+  "uid": "_:Whey protein isolate"
+},
+
+
+
How to Fix
+

Debugging skills are most helpful here as there is no one-size-fits-all approach.

+

It is best to identify whether the invalid JSON was created in the Python SDK +or if the invalid JSON was given from the API.

+

If the Python SDK created invalid JSON during serialization, then it is helpful to track down and +identify the point where the invalid JSON was started.

+

You may consider, inspecting the python objects to see if the node type are written incorrectly in python +and the issue is only being caught during serialization or if the Python node is written correctly +and the issue is created during serialization.

+

If the problem is with the Python SDK or API, it is best to leave an issue or create a discussion within the +Python SDK GitHub repository for one of the members of the +CRIPT team to look into any issues that there could have been.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTJsonNodeError(CRIPTJsonDeserializationError):
+    """
+    ## Definition
+    This exception is raised if a `node` attribute is present in JSON,
+    but the list has more or less than exactly one type of node type.
+
+    > Note: It is expected that there is only a single node type per JSON object.
+
+    ### Example
+    !!! Example "Valid JSON representation of a Material node"
+        ```json
+        {
+          "node": [
+            "Material"
+          ],
+          "name": "Whey protein isolate",
+          "uid": "_:Whey protein isolate"
+        },
+        ```
+
+    ??? Example "Invalid JSON representation of a Material node"
+
+        ```json
+        {
+          "node": [
+            "Material",
+            "Property"
+          ],
+          "name": "Whey protein isolate",
+          "uid": "_:Whey protein isolate"
+        },
+        ```
+
+        ---
+
+        ```json
+        {
+          "node": [],
+          "name": "Whey protein isolate",
+          "uid": "_:Whey protein isolate"
+        },
+        ```
+
+
+    ## How to Fix
+    Debugging skills are most helpful here as there is no one-size-fits-all approach.
+
+    It is best to identify whether the invalid JSON was created in the Python SDK
+    or if the invalid JSON was given from the API.
+
+    If the Python SDK created invalid JSON during serialization, then it is helpful to track down and
+    identify the point where the invalid JSON was started.
+
+    You may consider, inspecting the python objects to see if the node type are written incorrectly in python
+    and the issue is only being caught during serialization or if the Python node is written correctly
+    and the issue is created during serialization.
+
+    If the problem is with the Python SDK or API, it is best to leave an issue or create a discussion within the
+    [Python SDK GitHub repository](https://github.com/C-Accel-CRIPT/Python-SDK) for one of the members of the
+    CRIPT team to look into any issues that there could have been.
+    """
+
+    def __init__(self, node_list: List, json_str: str) -> None:
+        self.node_list = node_list
+        self.json_str = json_str
+
+    def __str__(self) -> str:
+        error_message: str = f"The 'node' attribute in the JSON string must be a single element list with the node name " f" such as `'node: ['Material']`. The `node` attribute provided was: `{self.node_list}`" f"The full JSON was: {self.json_str}."
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTJsonSerializationError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

This Exception is raised if serialization of node from JSON to Python Object fails.

+
How to Fix
+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTJsonSerializationError(CRIPTException):
+    """
+    ## Definition
+    This Exception is raised if serialization of node from JSON to Python Object fails.
+
+    ## How to Fix
+    """
+
+    def __init__(self, node_type: str, json_dict: str) -> None:
+        self.node_type = node_type
+        self.json_str = str(json_dict)
+
+    def __str__(self) -> str:
+        return f"JSON Serialization failed for node type {self.node_type} with JSON dict: {self.json_str}"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTNodeSchemaError + + +

+ + +
+

+ Bases: CRIPTException

+ + +
Definition
+

This error is raised when the CRIPT json database schema +validation fails for a node.

+

Please keep in mind that the CRIPT Python SDK converts all the Python nodes inside the +Project into a giant JSON +and sends an HTTP POST or PATCH request to the API to be processed.

+

However, before a request is sent to the API, the JSON is validated against API database schema +via the JSON Schema library, +and if the database schema validation fails for whatever reason this error is shown.

+
Possible Reasons
+
    +
  1. There was a mistake in nesting of the nodes
  2. +
  3. There was a mistake in creating the nodes
  4. +
  5. Nodes are missing
  6. +
  7. Nodes have invalid vocabulary
      +
    • The database schema wants something a different controlled vocabulary than what is provided
    • +
    +
  8. +
  9. There was an error with the way the JSON was created within the Python SDK
      +
    • The format of the JSON the CRIPT Python SDK created was invalid
    • +
    +
  10. +
  11. There is something wrong with the database schema
  12. +
+
How to Fix
+

The easiest way to troubleshoot this is to examine the JSON that the SDK created via printing out the +Project node's JSON and checking the place that the schema validation +says failed

+
Example
+
print(my_project.json)
+
+ +
+ Source code in src/cript/nodes/exceptions.py +
 7
+ 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
class CRIPTNodeSchemaError(CRIPTException):
+    """
+    ## Definition
+    This error is raised when the CRIPT [json database schema](https://json-schema.org/)
+    validation fails for a node.
+
+    Please keep in mind that the CRIPT Python SDK converts all the Python nodes inside the
+    [Project](../../nodes/primary_nodes/project) into a giant JSON
+    and sends an HTTP `POST` or `PATCH` request to the API to be processed.
+
+    However, before a request is sent to the API, the JSON is validated against API database schema
+    via the [JSON Schema library](https://python-jsonschema.readthedocs.io/en/stable/),
+    and if the database schema validation fails for whatever reason this error is shown.
+
+    ### Possible Reasons
+
+    1. There was a mistake in nesting of the nodes
+    1. There was a mistake in creating the nodes
+    1. Nodes are missing
+    1. Nodes have invalid vocabulary
+        * The database schema wants something a different controlled vocabulary than what is provided
+    1. There was an error with the way the JSON was created within the Python SDK
+        * The format of the JSON the CRIPT Python SDK created was invalid
+    1. There is something wrong with the database schema
+
+    ## How to Fix
+    The easiest way to troubleshoot this is to examine the JSON that the SDK created via printing out the
+    [Project](../../nodes/primary_nodes/project) node's JSON and checking the place that the schema validation
+    says failed
+
+    ### Example
+    ```python
+    print(my_project.json)
+    ```
+    """
+
+    node_type: str = ""
+    json_schema_validation_error: str = ""
+
+    def __init__(self, node_type: str, json_schema_validation_error: str) -> None:
+        self.json_schema_validation_error: str = json_schema_validation_error
+        self.node_type = node_type
+
+    def __str__(self) -> str:
+        error_message: str = f"JSON database schema validation for node {self.node_type} failed."
+        error_message += f"Error: {self.json_schema_validation_error}"
+
+        return error_message
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedComputationError + + +

+ + +
+

+ Bases: CRIPTOrphanedExperimentError

+ + +
Definition
+

CRIPTOrphanedExperimentError, but specific for orphaned Computation node that should be +listed in one of the experiments.

+
How To Fix
+

Handle this error by adding the orphaned node into one the parent project's experiments +Computation attribute.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedComputationError(CRIPTOrphanedExperimentError):
+    """
+    ## Definition
+    CRIPTOrphanedExperimentError, but specific for orphaned Computation node that should be
+    listed in one of the experiments.
+
+    ## How To Fix
+    Handle this error by adding the orphaned node into one the parent project's experiments
+    `Computation` attribute.
+    """
+
+    def __init__(self, orphaned_node):
+        from cript.nodes.primary_nodes.computation import Computation
+
+        assert isinstance(orphaned_node, Computation)
+        super().__init__(orphaned_node)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(orphaned_node) + +

+ + +
+ +
+ Source code in src/cript/nodes/exceptions.py +
def __init__(self, orphaned_node):
+    from cript.nodes.primary_nodes.computation import Computation
+
+    assert isinstance(orphaned_node, Computation)
+    super().__init__(orphaned_node)
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedComputationalProcessError + + +

+ + +
+

+ Bases: CRIPTOrphanedExperimentError

+ + +
Definition
+

CRIPTOrphanedExperimentError, but specific for orphaned ComputationalProcess +node that should be listed in one of the experiments.

+
How To Fix
+

Handle this error by adding the orphaned node into one the parent project's experiments +ComputationalProcess attribute.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedComputationalProcessError(CRIPTOrphanedExperimentError):
+    """
+    ## Definition
+    CRIPTOrphanedExperimentError, but specific for orphaned ComputationalProcess
+    node that should be listed in one of the experiments.
+
+    ## How To Fix
+    Handle this error by adding the orphaned node into one the parent project's experiments
+    `ComputationalProcess` attribute.
+    """
+
+    def __init__(self, orphaned_node):
+        from cript.nodes.primary_nodes.computation_process import ComputationProcess
+
+        assert isinstance(orphaned_node, ComputationProcess)
+        super().__init__(orphaned_node)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(orphaned_node) + +

+ + +
+ +
+ Source code in src/cript/nodes/exceptions.py +
def __init__(self, orphaned_node):
+    from cript.nodes.primary_nodes.computation_process import ComputationProcess
+
+    assert isinstance(orphaned_node, ComputationProcess)
+    super().__init__(orphaned_node)
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedDataError + + +

+ + +
+

+ Bases: CRIPTOrphanedExperimentError

+ + +
Definition
+

CRIPTOrphanedExperimentError, but specific for orphaned Data node that should be listed in one of the experiments.

+
How To Fix
+

Handle this error by adding the orphaned node into one the parent project's experiments data attribute.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedDataError(CRIPTOrphanedExperimentError):
+    """
+    ## Definition
+    CRIPTOrphanedExperimentError, but specific for orphaned Data node that should be listed in one of the experiments.
+
+    ## How To Fix
+    Handle this error by adding the orphaned node into one the parent project's experiments `data` attribute.
+    """
+
+    def __init__(self, orphaned_node):
+        from cript.nodes.primary_nodes.data import Data
+
+        assert isinstance(orphaned_node, Data)
+        super().__init__(orphaned_node)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(orphaned_node) + +

+ + +
+ +
+ Source code in src/cript/nodes/exceptions.py +
def __init__(self, orphaned_node):
+    from cript.nodes.primary_nodes.data import Data
+
+    assert isinstance(orphaned_node, Data)
+    super().__init__(orphaned_node)
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedExperimentError + + +

+ + +
+

+ Bases: CRIPTOrphanedNodesError

+ + +
Definition
+

CRIPTOrphanedNodesError, but specific for orphaned nodes that should be listed in one of the experiments.

+
How To Fix
+

Handle this error by adding the orphaned node into one the parent project's experiments.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedExperimentError(CRIPTOrphanedNodesError):
+    """
+    ## Definition
+    CRIPTOrphanedNodesError, but specific for orphaned nodes that should be listed in one of the experiments.
+
+    ## How To Fix
+    Handle this error by adding the orphaned node into one the parent project's experiments.
+    """
+
+    def __init__(self, orphaned_node):
+        super().__init__(orphaned_node)
+
+    def __str__(self) -> str:
+        node_name = self.orphaned_node.node_type.lower()
+        ret_string = f"While validating a project graph, an orphaned {node_name} node was found. "
+        ret_string += f"This {node_name} node is present in the graph, but not listed in any of the experiments of the  project. "
+        ret_string += f"Please add the node like: `your_experiment.{node_name} += [orphaned_{node_name}]`. "
+        ret_string += f"The orphaned {node_name} was {self.orphaned_node}."
+        return ret_string
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedMaterialError + + +

+ + +
+

+ Bases: CRIPTOrphanedNodesError

+ + +
Definition
+

CRIPTOrphanedNodesError, but specific for orphaned materials.

+
How To Fix
+

Handle this error by adding the orphaned materials into the parent project or its inventories.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedMaterialError(CRIPTOrphanedNodesError):
+    """
+    ## Definition
+    CRIPTOrphanedNodesError, but specific for orphaned materials.
+
+    ## How To Fix
+    Handle this error by adding the orphaned materials into the parent project or its inventories.
+    """
+
+    def __init__(self, orphaned_node):
+        from cript.nodes.primary_nodes.material import Material
+
+        assert isinstance(orphaned_node, Material)
+        super().__init__(orphaned_node)
+
+    def __str__(self):
+        ret_string = "While validating a project graph, an orphaned material node was found. "
+        ret_string += "This material is present in the graph, but not listed in the project. "
+        ret_string += "Please add the node like: `my_project.material += [orphaned_material]`. "
+        ret_string += f"The orphaned material was {self.orphaned_node}."
+        return ret_string
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(orphaned_node) + +

+ + +
+ +
+ Source code in src/cript/nodes/exceptions.py +
def __init__(self, orphaned_node):
+    from cript.nodes.primary_nodes.material import Material
+
+    assert isinstance(orphaned_node, Material)
+    super().__init__(orphaned_node)
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedNodesError + + +

+ + +
+

+ Bases: CRIPTException, ABC

+ + +
Definition
+

This error is raised when a child node is not attached to the +appropriate parent node. For example, all material nodes used +within a project must belong to the project inventory or are explicitly listed as material of that project. +If there is a material node that is used within a project but not a part of the +inventory and the validation code finds it then it raises an CRIPTOrphanedNodeError

+
How To Fix
+

Fixing this is simple and easy, just take the node that CRIPT Python SDK +found a problem with and associate it with the appropriate parent via

+
my_project.material += my_orphaned_material_node
+
+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedNodesError(CRIPTException, ABC):
+    """
+    ## Definition
+    This error is raised when a child node is not attached to the
+    appropriate parent node. For example, all material nodes used
+    within a project must belong to the project inventory or are explicitly listed as material of that project.
+    If there is a material node that is used within a project but not a part of the
+    inventory and the validation code finds it then it raises an `CRIPTOrphanedNodeError`
+
+    ## How To Fix
+    Fixing this is simple and easy, just take the node that CRIPT Python SDK
+    found a problem with and associate it with the appropriate parent via
+
+    ```
+    my_project.material += my_orphaned_material_node
+    ```
+    """
+
+    def __init__(self, orphaned_node):
+        self.orphaned_node = orphaned_node
+
+    @abstractmethod
+    def __str__(self):
+        pass
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ CRIPTOrphanedProcessError + + +

+ + +
+

+ Bases: CRIPTOrphanedExperimentError

+ + +
Definition
+

CRIPTOrphanedExperimentError, but specific for orphaned Process node that should be +listed in one of the experiments.

+
How To Fix
+

Handle this error by adding the orphaned node into one the parent project's experiments +process attribute.

+ +
+ Source code in src/cript/nodes/exceptions.py +
class CRIPTOrphanedProcessError(CRIPTOrphanedExperimentError):
+    """
+    ## Definition
+    CRIPTOrphanedExperimentError, but specific for orphaned Process node that should be
+    listed in one of the experiments.
+
+    ## How To Fix
+    Handle this error by adding the orphaned node into one the parent project's experiments
+    `process` attribute.
+    """
+
+    def __init__(self, orphaned_node):
+        from cript.nodes.primary_nodes.process import Process
+
+        assert isinstance(orphaned_node, Process)
+        super().__init__(orphaned_node)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(orphaned_node) + +

+ + +
+ +
+ Source code in src/cript/nodes/exceptions.py +
def __init__(self, orphaned_node):
+    from cript.nodes.primary_nodes.process import Process
+
+    assert isinstance(orphaned_node, Process)
+    super().__init__(orphaned_node)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + +
+ + + +

+get_orphaned_experiment_exception(orphaned_node) + +

+ + +
+ +

Return the correct specific Exception based in the orphaned node type for nodes not correctly listed in experiment.

+ +
+ Source code in src/cript/nodes/exceptions.py +
def get_orphaned_experiment_exception(orphaned_node):
+    """
+    Return the correct specific Exception based in the orphaned node type for nodes not correctly listed in experiment.
+    """
+    from cript.nodes.primary_nodes.computation import Computation
+    from cript.nodes.primary_nodes.computation_process import ComputationProcess
+    from cript.nodes.primary_nodes.data import Data
+    from cript.nodes.primary_nodes.process import Process
+
+    if isinstance(orphaned_node, Data):
+        return CRIPTOrphanedDataError(orphaned_node)
+    if isinstance(orphaned_node, Process):
+        return CRIPTOrphanedProcessError(orphaned_node)
+    if isinstance(orphaned_node, Computation):
+        return CRIPTOrphanedComputationError(orphaned_node)
+    if isinstance(orphaned_node, ComputationProcess):
+        return CRIPTOrphanedComputationalProcessError(orphaned_node)
+    # Base case raise the parent exception. TODO add bug warning.
+    return CRIPTOrphanedExperimentError(orphaned_node)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/extra.css b/extra.css new file mode 100644 index 000000000..93eb0db23 --- /dev/null +++ b/extra.css @@ -0,0 +1,3 @@ +.screenshot-border { + border: black solid 0.1rem; +} diff --git a/faq/index.html b/faq/index.html new file mode 100644 index 000000000..6d8a73975 --- /dev/null +++ b/faq/index.html @@ -0,0 +1,1208 @@ + + + + + + + + + + + + + + + + + + + + FAQ - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

FAQ

+ +

Frequently Asked Questions

+


+

Q: Where can I find more information about the CRIPT data model?

+

A: Please feel free to review the +CRIPT data model document +and the CRIPT research paper

+
+

Q: What does this error mean?

+

A: Please visit the Exceptions documentation

+
+

Q: Where do I report an issue that I encountered?

+

A: Please feel free to report issues to our GitHub repository. +We are always looking for ways to improve and create software that is a joy to use!

+
+

Q: Where can I find more CRIPT examples?

+

A: Please visit CRIPT Scripts where there are many CRIPT examples ranging from CRIPT graphs drawn out from research papers, Python scripts, TypeScript scripts, and more!

+
+

Q: Where can I find more example code?

+

A: We have written a lot of tests for our software, and if needed, those tests can be referred to as example code to work with the Python SDK software. The Python SDK tests are located within the GitHub repository/tests, and there they are broken down to different kinds of tests

+
+

Q: How can I contribute to this project?

+

A: We would love to have you contribute. +Please read theGitHub repository wiki +to understand more and get started. Feel free to contribute to any bugs you find, any issues within the +GitHub repository, or any features you want.

+
+

Q: This repository is awesome, how can I build a plugin to add to it?

+

A: We have built this code with plugins in mind! Please visit the +CRIPT Python SDK GitHub repository Wiki +tab for developer documentation.

+
+

Q: I have this question that is not covered anywhere, where can I ask it?

+

A: Please visit the CRIPT Python SDK repository +and ask your question within the +discussions tab Q/A section

+
+

Q: Where is the best place where I can contact the CRIPT Python SDK team for questions or support?

+

A: We would love to hear from you! Please visit our CRIPT Python SDK Repository GitHub Discussions to easily send us questions. +Our repository's issue page is also another good way to let us know about any issues or suggestions you might have. +A GitHub account is required.

+
+

Q: How can I report security issues?

+

A: Please visit the CRIPT Python SDK GitHub repository security tab for any security issues.

+
+

Q: Besides the user documentation are there any developer documentation that I can read through on how +the code is written to get a better grasp of it?

+

A: You bet! There are documentation for developers within the +CRIPT Python SDK Wiki. +There you will find documentation on everything from how our code is structure, +how we aim to write our documentation, CI/CD, and more.

+

We try to also have type hinting, comments, and docstrings for all the code that we work on so it is clear and easy for anyone reading it to easily understand.

+

if all else fails, contact us on our GitHub Repository.

+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/images/CRIPT_full_logo_colored_transparent.png b/images/CRIPT_full_logo_colored_transparent.png new file mode 100644 index 000000000..942727248 Binary files /dev/null and b/images/CRIPT_full_logo_colored_transparent.png differ diff --git a/images/cript_token_page.png b/images/cript_token_page.png new file mode 100644 index 000000000..a7d86d57f Binary files /dev/null and b/images/cript_token_page.png differ diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 000000000..38e43d6b5 Binary files /dev/null and b/images/favicon.ico differ diff --git a/index.html b/index.html new file mode 100644 index 000000000..1d7878fb1 --- /dev/null +++ b/index.html @@ -0,0 +1,1192 @@ + + + + + + + + + + + + + + + + + + + + CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Home

+ +

CRIPT Logo

+

CRIPT (the Community Resource for Innovation in Polymer Technology) is a web-based platform for capturing and sharing polymer data. In addition to a user interface, CRIPT enables programmatic access to the platform through the CRIPT Python SDK, which interfaces with a REST API.

+

CRIPT offers multiple options to upload data, and scientists can pick the method that best suits them. Using the SDK to upload is a great choice if you have a large amount of data, stored it in an unconventional way, and know some python programming. You can easily use a library such as Pandas or Numpy to parse your data, create the needed CRIPT objects/nodes and upload them into CRIPT.

+

Another great option can be the Excel Uploader for scientists that do not have past Python experience or would rather easily input their data into the CRIPT Excel Template.

+
+

Resources

+
+CRIPT Resources + +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/base_node/index.html b/nodes/primary_nodes/base_node/index.html new file mode 100644 index 000000000..d4b474ec5 --- /dev/null +++ b/nodes/primary_nodes/base_node/index.html @@ -0,0 +1,1097 @@ + + + + + + + + + + + + + + + + + + Base node - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Base node

+ +

Base node

+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/collection/index.html b/nodes/primary_nodes/collection/index.html new file mode 100644 index 000000000..acc93e419 --- /dev/null +++ b/nodes/primary_nodes/collection/index.html @@ -0,0 +1,2505 @@ + + + + + + + + + + + + + + + + + + + + + + Collection - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Collection

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Collection + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

A +Collection node +is nested inside a Project node.

+

A Collection node can be thought as a folder/bucket that can hold experiment +or Inventories node.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescription
experimentlist[Experiment]experiment that relate to the collection
inventorylist[Inventory]inventory owned by the collection
doistr10.1038/1781168a0DOI: digital object identifier for a published collection; CRIPT generated DOI
citationlist[Citation]reference to a book, paper, or scholarly work
+
JSON Representation
+
{
+"name": "my collection JSON",
+ "node":["Collection"],
+ "uid":"_:fccd3549-07cb-4e23-ba79-323597ec9bfd",
+ "uuid":"fccd3549-07cb-4e23-ba79-323597ec9bfd"
+
+ "experiment":[
+    {
+       "name":"my experiment name",
+       "node":["Experiment"],
+       "uid":"_:8256b75b-1f4e-4f69-9fe6-3bcb2298e470",
+       "uuid":"8256b75b-1f4e-4f69-9fe6-3bcb2298e470"
+    }
+ ],
+ "inventory":[],
+ "citation":[],
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/collection.py +
class Collection(PrimaryBaseNode):
+    """
+    ## Definition
+
+    A
+    [Collection node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=8)
+    is nested inside a [Project](../project) node.
+
+    A Collection node can be thought as a folder/bucket that can hold [experiment](../experiment)
+    or [Inventories](../inventory) node.
+
+    | attribute  | type             | example             | description                                                                    |
+    |------------|------------------|---------------------|--------------------------------------------------------------------------------|
+    | experiment | list[Experiment] |                     | experiment that relate to the collection                                       |
+    | inventory  | list[Inventory]  |                     | inventory owned by the collection                                              |
+    | doi        | str              | `10.1038/1781168a0` | DOI: digital object identifier for a published collection; CRIPT generated DOI |
+    | citation   | list[Citation]   |                     | reference to a book, paper, or scholarly work                                  |
+
+
+    ## JSON Representation
+    ```json
+    {
+    "name": "my collection JSON",
+     "node":["Collection"],
+     "uid":"_:fccd3549-07cb-4e23-ba79-323597ec9bfd",
+     "uuid":"fccd3549-07cb-4e23-ba79-323597ec9bfd"
+
+     "experiment":[
+        {
+           "name":"my experiment name",
+           "node":["Experiment"],
+           "uid":"_:8256b75b-1f4e-4f69-9fe6-3bcb2298e470",
+           "uuid":"8256b75b-1f4e-4f69-9fe6-3bcb2298e470"
+        }
+     ],
+     "inventory":[],
+     "citation":[],
+    }
+    ```
+
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Collection attributes
+        """
+
+        # TODO add proper typing in future, using Any for now to avoid circular import error
+        member: List[User] = field(default_factory=list)
+        admin: List[User] = field(default_factory=list)
+        experiment: Optional[List[Any]] = None
+        inventory: Optional[List[Any]] = None
+        doi: str = ""
+        citation: Optional[List[Any]] = None
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, name: str, experiment: Optional[List[Any]] = None, inventory: Optional[List[Any]] = None, doi: str = "", citation: Optional[List[Any]] = None, notes: str = "", **kwargs) -> None:
+        """
+        create a Collection with a name
+        add list of experiment, inventory, citation, doi, and notes if available.
+
+        Parameters
+        ----------
+        name: str
+            name of the Collection you want to make
+        experiment: Optional[List[Experiment]], default=None
+            list of experiment within the Collection
+        inventory: Optional[List[Inventory]], default=None
+            list of inventories within this collection
+        doi: str = "", default=""
+            cript doi
+        citation: Optional[List[Citation]], default=None
+            List of citations for this collection
+
+        Returns
+        -------
+        None
+            Instantiates a Collection node
+        """
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        if experiment is None:
+            experiment = []
+
+        if inventory is None:
+            inventory = []
+
+        if citation is None:
+            citation = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            name=name,
+            experiment=experiment,
+            inventory=inventory,
+            doi=doi,
+            citation=citation,
+        )
+
+        self.validate()
+
+    @property
+    @beartype
+    def member(self) -> List[User]:
+        return self._json_attrs.member.copy()
+
+    @property
+    @beartype
+    def admin(self) -> List[User]:
+        return self._json_attrs.admin
+
+    @property
+    @beartype
+    def experiment(self) -> List[Any]:
+        """
+        List of all [experiment](../experiment) within this Collection
+
+        Examples
+        --------
+        ```python
+        my_collection.experiment = [my_first_experiment]
+        ```
+
+        Returns
+        -------
+        List[Experiment]
+            list of all [experiment](../experiment) within this Collection
+        """
+        return self._json_attrs.experiment.copy()  # type: ignore
+
+    @experiment.setter
+    @beartype
+    def experiment(self, new_experiment: List[Any]) -> None:
+        """
+        sets the Experiment list within this collection
+
+        Parameters
+        ----------
+        new_experiment: List[Experiment]
+            list of experiment
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, experiment=new_experiment)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def inventory(self) -> List[Any]:
+        """
+        List of [inventory](../inventory) that belongs to this collection
+
+        Examples
+        --------
+        ```python
+        material_1 = cript.Material(
+            name="material 1",
+            identifiers=[{"alternative_names": "material 1 alternative name"}],
+        )
+
+        material_2 = cript.Material(
+            name="material 2",
+            identifiers=[{"alternative_names": "material 2 alternative name"}],
+        )
+
+        my_inventory = cript.Inventory(
+            name="my inventory name", materials_list=[material_1, material_2]
+        )
+
+        my_collection.inventory = [my_inventory]
+        ```
+
+        Returns
+        -------
+        inventory: List[Inventory]
+            list of inventories in this collection
+        """
+        return self._json_attrs.inventory.copy()  # type: ignore
+
+    @inventory.setter
+    @beartype
+    def inventory(self, new_inventory: List[Any]) -> None:
+        """
+        Sets the List of inventories within this collection to a new list
+
+        Parameters
+        ----------
+        new_inventory: List[Inventory]
+            new list of inventories for the collection to overwrite the current list
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, inventory=new_inventory)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def doi(self) -> str:
+        """
+        The CRIPT DOI for this collection
+
+        ```python
+        my_collection.doi = "10.1038/1781168a0"
+        ```
+
+        Returns
+        -------
+        doi: str
+            the CRIPT DOI e.g. `10.1038/1781168a0`
+        """
+        return self._json_attrs.doi
+
+    @doi.setter
+    @beartype
+    def doi(self, new_doi: str) -> None:
+        """
+        set the CRIPT DOI for this collection to new CRIPT DOI
+
+        Parameters
+        ----------
+        new_doi: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, doi=new_doi)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Any]:
+        """
+        List of Citations within this Collection
+
+        Examples
+        --------
+        ```python
+        my_citation = cript.Citation(type="derived_from", reference=simple_reference_node)
+
+        my_collections.citation = my_citations
+        ```
+
+        Returns
+        -------
+        citation: List[Citation]:
+            list of Citations within this Collection
+        """
+        return self._json_attrs.citation.copy()  # type: ignore
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation: List[Any]) -> None:
+        """
+        set the list of citations for this Collection
+
+        Parameters
+        ----------
+        new_citation: List[Citation]
+            set the list of citations for this Collection
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Any] + + + property + writable + + +

+ + +
+ +

List of Citations within this Collection

+ + + +

Examples:

+
my_citation = cript.Citation(type="derived_from", reference=simple_reference_node)
+
+my_collections.citation = my_citations
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
citation + List[Citation]: + +
+

list of Citations within this Collection

+
+
+
+ +
+ +
+ + + +

+doi: str + + + property + writable + + +

+ + +
+ +

The CRIPT DOI for this collection

+
my_collection.doi = "10.1038/1781168a0"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
doi + str + +
+

the CRIPT DOI e.g. 10.1038/1781168a0

+
+
+
+ +
+ +
+ + + +

+experiment: List[Any] + + + property + writable + + +

+ + +
+ +

List of all experiment within this Collection

+ + + +

Examples:

+
my_collection.experiment = [my_first_experiment]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Experiment] + +
+

list of all experiment within this Collection

+
+
+
+ +
+ +
+ + + +

+inventory: List[Any] + + + property + writable + + +

+ + +
+ +

List of inventory that belongs to this collection

+ + + +

Examples:

+
material_1 = cript.Material(
+    name="material 1",
+    identifiers=[{"alternative_names": "material 1 alternative name"}],
+)
+
+material_2 = cript.Material(
+    name="material 2",
+    identifiers=[{"alternative_names": "material 2 alternative name"}],
+)
+
+my_inventory = cript.Inventory(
+    name="my inventory name", materials_list=[material_1, material_2]
+)
+
+my_collection.inventory = [my_inventory]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
inventory + List[Inventory] + +
+

list of inventories in this collection

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Collection attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/collection.py +
53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Collection attributes
+    """
+
+    # TODO add proper typing in future, using Any for now to avoid circular import error
+    member: List[User] = field(default_factory=list)
+    admin: List[User] = field(default_factory=list)
+    experiment: Optional[List[Any]] = None
+    inventory: Optional[List[Any]] = None
+    doi: str = ""
+    citation: Optional[List[Any]] = None
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, experiment=None, inventory=None, doi='', citation=None, notes='', **kwargs) + +

+ + +
+ +

create a Collection with a name +add list of experiment, inventory, citation, doi, and notes if available.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

name of the Collection you want to make

+
+
+ required +
experiment + Optional[List[Any]] + +
+

list of experiment within the Collection

+
+
+ None +
inventory + Optional[List[Any]] + +
+

list of inventories within this collection

+
+
+ None +
doi + str + +
+

cript doi

+
+
+ '' +
citation + Optional[List[Any]] + +
+

List of citations for this collection

+
+
+ None +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiates a Collection node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/collection.py +
@beartype
+def __init__(self, name: str, experiment: Optional[List[Any]] = None, inventory: Optional[List[Any]] = None, doi: str = "", citation: Optional[List[Any]] = None, notes: str = "", **kwargs) -> None:
+    """
+    create a Collection with a name
+    add list of experiment, inventory, citation, doi, and notes if available.
+
+    Parameters
+    ----------
+    name: str
+        name of the Collection you want to make
+    experiment: Optional[List[Experiment]], default=None
+        list of experiment within the Collection
+    inventory: Optional[List[Inventory]], default=None
+        list of inventories within this collection
+    doi: str = "", default=""
+        cript doi
+    citation: Optional[List[Citation]], default=None
+        List of citations for this collection
+
+    Returns
+    -------
+    None
+        Instantiates a Collection node
+    """
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    if experiment is None:
+        experiment = []
+
+    if inventory is None:
+        inventory = []
+
+    if citation is None:
+        citation = []
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        name=name,
+        experiment=experiment,
+        inventory=inventory,
+        doi=doi,
+        citation=citation,
+    )
+
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/computation/index.html b/nodes/primary_nodes/computation/index.html new file mode 100644 index 000000000..79be8e61f --- /dev/null +++ b/nodes/primary_nodes/computation/index.html @@ -0,0 +1,3271 @@ + + + + + + + + + + + + + + + + + + + + + + Computation - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+ +
+ + + +
+
+ + + + + + + +

Computation

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Computation + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

The +Computation node +describes the transformation of data or the creation of a computational data +set.

+

Common computations for simulations are energy minimization, annealing, quenching, or +NPT/NVT (isothermal-isobaric/canonical ensemble) simulations.

+

Common computations for experimental data include fitting a reaction model to kinetic data +to determine rate constants, a plateau modulus from a time-temperature-superposition, or calculating radius of +gyration with the Debye function from small angle scattering data.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
typestrgeneral molecular dynamics simulationcategory of computationTrueTrue
input_datalist[Data]input data nodes
output_datalist[Data]output data nodes
software_ configurationslist[Software Configuration]software and algorithms used
conditionlist[Condition]setup information
prerequisite_computationComputationprior computation method in chain
citationlist[Citation]reference to a book, paper, or scholarly work
notesstradditional description of the step
+
JSON Representation
+
{
+   "name":"my computation name",
+   "node":["Computation"],
+   "type":"analysis",
+   "uid":"_:69f29bec-e30a-4932-b78d-2e4585b37d74",
+   "uuid":"69f29bec-e30a-4932-b78d-2e4585b37d74"
+   "citation":[],
+}
+
+
Available Subobjects
+ + +
+ Source code in src/cript/nodes/primary_nodes/computation.py +
  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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
class Computation(PrimaryBaseNode):
+    """
+    ## Definition
+
+    The
+    [Computation node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=14)
+    describes the transformation of data or the creation of a computational data
+    set.
+
+    **Common computations for simulations** are energy minimization, annealing, quenching, or
+    NPT/NVT (isothermal-isobaric/canonical ensemble) simulations.
+
+    **Common computations for experimental** data include fitting a reaction model to kinetic data
+    to determine rate constants, a plateau modulus from a time-temperature-superposition, or calculating radius of
+    gyration with the Debye function from small angle scattering data.
+
+
+
+    ## Attributes
+    | attribute                | type                          | example                               | description                                   | required | vocab |
+    |--------------------------|-------------------------------|---------------------------------------|-----------------------------------------------|----------|-------|
+    | type                     | str                           | general molecular dynamics simulation | category of computation                       | True     | True  |
+    | input_data               | list[Data]                    |                                       | input data nodes                              |          |       |
+    | output_data              | list[Data]                    |                                       | output data nodes                             |          |       |
+    | software_ configurations | list[Software  Configuration] |                                       | software and algorithms used                  |          |       |
+    | condition                | list[Condition]               |                                       | setup information                             |          |       |
+    | prerequisite_computation | Computation                   |                                       | prior computation method in chain             |          |       |
+    | citation                | list[Citation]                |                                       | reference to a book, paper, or scholarly work |          |       |
+    | notes                    | str                           |                                       | additional description of the step            |          |       |
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my computation name",
+       "node":["Computation"],
+       "type":"analysis",
+       "uid":"_:69f29bec-e30a-4932-b78d-2e4585b37d74",
+       "uuid":"69f29bec-e30a-4932-b78d-2e4585b37d74"
+       "citation":[],
+    }
+    ```
+
+
+    ## Available Subobjects
+    * [Software Configuration](../../subobjects/software_configuration)
+    * [Condition](../../subobjects/condition)
+    * [Citation](../../subobjects/citation)
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all computation nodes attributes
+        """
+
+        type: str = ""
+        # TODO add proper typing in future, using Any for now to avoid circular import error
+        input_data: List[Any] = field(default_factory=list)
+        output_data: List[Any] = field(default_factory=list)
+        software_configuration: List[Any] = field(default_factory=list)
+        condition: List[Any] = field(default_factory=list)
+        prerequisite_computation: Optional["Computation"] = None
+        citation: Optional[List[Any]] = None
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        name: str,
+        type: str,
+        input_data: Optional[List[Any]] = None,
+        output_data: Optional[List[Any]] = None,
+        software_configuration: Optional[List[Any]] = None,
+        condition: Optional[List[Any]] = None,
+        prerequisite_computation: Optional["Computation"] = None,
+        citation: Optional[List[Any]] = None,
+        notes: str = "",
+        **kwargs
+    ) -> None:
+        """
+        create a computation node
+
+        Parameters
+        ----------
+        name: str
+            name of computation node
+        type: str
+            type of computation node. Computation type must come from CRIPT controlled vocabulary
+        input_data: List[Data] default=None
+            input data (data node)
+        output_data: List[Data] default=None
+            output data (data node)
+        software_configuration: List[SoftwareConfiguration] default=None
+            software configuration of computation node
+        condition: List[Condition] default=None
+            condition for the computation node
+        prerequisite_computation: Computation default=None
+            prerequisite computation
+        citation: List[Citation] default=None
+            list of citations
+        notes: str = ""
+            any notes for this computation node
+        **kwargs
+            for internal use of deserialize JSON from API to node
+
+        Examples
+        --------
+        ```python
+        my_computation = cript.Computation(name="my computation name", type="analysis")
+        ```
+
+        Returns
+        -------
+        None
+            instantiate a computation node
+
+        """
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        if input_data is None:
+            input_data = []
+
+        if output_data is None:
+            output_data = []
+
+        if software_configuration is None:
+            software_configuration = []
+
+        if condition is None:
+            condition = []
+
+        if citation is None:
+            citation = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            type=type,
+            input_data=input_data,
+            output_data=output_data,
+            software_configuration=software_configuration,
+            condition=condition,
+            prerequisite_computation=prerequisite_computation,
+            citation=citation,
+        )
+
+        self.validate()
+
+    # ------------------ Properties ------------------
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        The type of computation
+
+        the computation type must come from CRIPT controlled vocabulary
+
+        Examples
+        --------
+        ```python
+        my_computation.type = "type="analysis"
+        ```
+
+        Returns
+        -------
+        str
+            type of computation
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_computation_type: str) -> None:
+        """
+        set the computation type
+
+        the computation type must come from CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_computation_type: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, type=new_computation_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def input_data(self) -> List[Any]:
+        """
+        List of input data (data nodes) for this node
+
+        Examples
+        --------
+        ```python
+        # create file node
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+        )
+
+        # create a data node
+        my_input_data = cript.Data(name="my data name", type="afm_amp", files=[my_file])
+
+        my_computation.input_data = [my_input_data]
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of input data for this computation
+        """
+        return self._json_attrs.input_data.copy()
+
+    @input_data.setter
+    @beartype
+    def input_data(self, new_input_data_list: List[Any]) -> None:
+        """
+        set the input data list
+
+        Parameters
+        ----------
+        new_input_data_list: List[Data]
+            list of input data (data nodes) to replace the current
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, input_data=new_input_data_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def output_data(self) -> List[Any]:
+        """
+        List of output data (data nodes)
+
+        Examples
+        --------
+        ```python
+        # create file node
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+        )
+
+        # create a data node
+        my_output_data = cript.Data(name="my data name", type="afm_amp", files=[my_file])
+
+        my_computation.output_data = [my_output_data]
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of output data for this computation
+        """
+        return self._json_attrs.output_data.copy()
+
+    @output_data.setter
+    @beartype
+    def output_data(self, new_output_data_list: List[Any]) -> None:
+        """
+        set the list of output data (data nodes) for this node
+
+        Parameters
+        ----------
+        new_output_data_list: List[Data]
+            replace the current list of output data for this node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, output_data=new_output_data_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def software_configuration(self) -> List[Any]:
+        """
+        List of software_configuration for this computation node
+
+        Examples
+        --------
+        ```python
+        # create software configuration node
+        my_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)
+
+        my_computation.software_configuration = my_software_configuration
+        ```
+
+        Returns
+        -------
+        List[SoftwareConfiguration]
+            list of software configurations
+        """
+        return self._json_attrs.software_configuration.copy()
+
+    @software_configuration.setter
+    @beartype
+    def software_configuration(self, new_software_configuration_list: List[Any]) -> None:
+        """
+        set the list of software_configuration for this computation node
+
+        Parameters
+        ----------
+        new_software_configuration_list: List[software_configuration]
+            new_software_configuration_list to replace the current one
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, software_configuration=new_software_configuration_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def condition(self) -> List[Any]:
+        """
+        List of condition for this computation node
+
+        Examples
+        --------
+        ```python
+        # create a condition node
+        my_condition = cript.Condition(key="atm", type="min", value=1)
+
+        my_computation.condition = my_condition
+        ```
+
+        Returns
+        -------
+        List[Condition]
+            list of condition for the computation node
+        """
+        return self._json_attrs.condition.copy()
+
+    @condition.setter
+    @beartype
+    def condition(self, new_condition_list: List[Any]) -> None:
+        """
+        set the list of condition for this node
+
+        Parameters
+        ----------
+        new_condition_list: List[Condition]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, condition=new_condition_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def prerequisite_computation(self) -> Optional["Computation"]:
+        """
+        prerequisite computation
+
+        Examples
+        --------
+        ```python
+        # create computation node for prerequisite_computation
+        my_prerequisite_computation = cript.Computation(name="my prerequisite computation name", type="data_fit")
+
+        my_computation.prerequisite_computation = my_prerequisite_computation
+        ```
+
+        Returns
+        -------
+        Computation
+            prerequisite computation
+        """
+        return self._json_attrs.prerequisite_computation
+
+    @prerequisite_computation.setter
+    @beartype
+    def prerequisite_computation(self, new_prerequisite_computation: Optional["Computation"]) -> None:
+        """
+        set new prerequisite_computation
+
+        Parameters
+        ----------
+        new_prerequisite_computation: "Computation"
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, prerequisite_computation=new_prerequisite_computation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Any]:
+        """
+        List of citations
+
+         Examples
+         --------
+         ```python
+         # create a reference node for the citation
+         my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+         # create a reference
+         my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+         my_computation.citation = [my_citation]
+         ```
+
+         Returns
+         -------
+         List[Citation]
+             list of citations for this computation node
+        """
+        return self._json_attrs.citation.copy()  # type: ignore
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation_list: List[Any]) -> None:
+        """
+        set the List of citations
+
+        Parameters
+        ----------
+        new_citation_list: List[Citation]
+            list of citations for this computation node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Any] + + + property + writable + + +

+ + +
+ +

List of citations

+

Examples

+
+
# create a reference node for the citation
+my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+# create a reference
+my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+my_computation.citation = [my_citation]
+
+

Returns

+
+

List[Citation] + list of citations for this computation node

+
+ +
+ +
+ + + +

+condition: List[Any] + + + property + writable + + +

+ + +
+ +

List of condition for this computation node

+ + + +

Examples:

+
# create a condition node
+my_condition = cript.Condition(key="atm", type="min", value=1)
+
+my_computation.condition = my_condition
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Condition] + +
+

list of condition for the computation node

+
+
+
+ +
+ +
+ + + +

+input_data: List[Any] + + + property + writable + + +

+ + +
+ +

List of input data (data nodes) for this node

+ + + +

Examples:

+
# create file node
+my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary"
+)
+
+# create a data node
+my_input_data = cript.Data(name="my data name", type="afm_amp", files=[my_file])
+
+my_computation.input_data = [my_input_data]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Data] + +
+

list of input data for this computation

+
+
+
+ +
+ +
+ + + +

+output_data: List[Any] + + + property + writable + + +

+ + +
+ +

List of output data (data nodes)

+ + + +

Examples:

+
# create file node
+my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary"
+)
+
+# create a data node
+my_output_data = cript.Data(name="my data name", type="afm_amp", files=[my_file])
+
+my_computation.output_data = [my_output_data]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Data] + +
+

list of output data for this computation

+
+
+
+ +
+ +
+ + + +

+prerequisite_computation: Optional[Computation] + + + property + writable + + +

+ + +
+ +

prerequisite computation

+ + + +

Examples:

+
# create computation node for prerequisite_computation
+my_prerequisite_computation = cript.Computation(name="my prerequisite computation name", type="data_fit")
+
+my_computation.prerequisite_computation = my_prerequisite_computation
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Computation + +
+

prerequisite computation

+
+
+
+ +
+ +
+ + + +

+software_configuration: List[Any] + + + property + writable + + +

+ + +
+ +

List of software_configuration for this computation node

+ + + +

Examples:

+
# create software configuration node
+my_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)
+
+my_computation.software_configuration = my_software_configuration
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[SoftwareConfiguration] + +
+

list of software configurations

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

The type of computation

+

the computation type must come from CRIPT controlled vocabulary

+ + + +

Examples:

+
my_computation.type = "type="analysis"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

type of computation

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all computation nodes attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/computation.py +
59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all computation nodes attributes
+    """
+
+    type: str = ""
+    # TODO add proper typing in future, using Any for now to avoid circular import error
+    input_data: List[Any] = field(default_factory=list)
+    output_data: List[Any] = field(default_factory=list)
+    software_configuration: List[Any] = field(default_factory=list)
+    condition: List[Any] = field(default_factory=list)
+    prerequisite_computation: Optional["Computation"] = None
+    citation: Optional[List[Any]] = None
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, type, input_data=None, output_data=None, software_configuration=None, condition=None, prerequisite_computation=None, citation=None, notes='', **kwargs) + +

+ + +
+ +

create a computation node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

name of computation node

+
+
+ required +
type + str + +
+

type of computation node. Computation type must come from CRIPT controlled vocabulary

+
+
+ required +
input_data + Optional[List[Any]] + +
+

input data (data node)

+
+
+ None +
output_data + Optional[List[Any]] + +
+

output data (data node)

+
+
+ None +
software_configuration + Optional[List[Any]] + +
+

software configuration of computation node

+
+
+ None +
condition + Optional[List[Any]] + +
+

condition for the computation node

+
+
+ None +
prerequisite_computation + Optional[Computation] + +
+

prerequisite computation

+
+
+ None +
citation + Optional[List[Any]] + +
+

list of citations

+
+
+ None +
notes + str + +
+

any notes for this computation node

+
+
+ '' +
**kwargs + +
+

for internal use of deserialize JSON from API to node

+
+
+ {} +
+ + + +

Examples:

+
my_computation = cript.Computation(name="my computation name", type="analysis")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate a computation node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/computation.py +
@beartype
+def __init__(
+    self,
+    name: str,
+    type: str,
+    input_data: Optional[List[Any]] = None,
+    output_data: Optional[List[Any]] = None,
+    software_configuration: Optional[List[Any]] = None,
+    condition: Optional[List[Any]] = None,
+    prerequisite_computation: Optional["Computation"] = None,
+    citation: Optional[List[Any]] = None,
+    notes: str = "",
+    **kwargs
+) -> None:
+    """
+    create a computation node
+
+    Parameters
+    ----------
+    name: str
+        name of computation node
+    type: str
+        type of computation node. Computation type must come from CRIPT controlled vocabulary
+    input_data: List[Data] default=None
+        input data (data node)
+    output_data: List[Data] default=None
+        output data (data node)
+    software_configuration: List[SoftwareConfiguration] default=None
+        software configuration of computation node
+    condition: List[Condition] default=None
+        condition for the computation node
+    prerequisite_computation: Computation default=None
+        prerequisite computation
+    citation: List[Citation] default=None
+        list of citations
+    notes: str = ""
+        any notes for this computation node
+    **kwargs
+        for internal use of deserialize JSON from API to node
+
+    Examples
+    --------
+    ```python
+    my_computation = cript.Computation(name="my computation name", type="analysis")
+    ```
+
+    Returns
+    -------
+    None
+        instantiate a computation node
+
+    """
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    if input_data is None:
+        input_data = []
+
+    if output_data is None:
+        output_data = []
+
+    if software_configuration is None:
+        software_configuration = []
+
+    if condition is None:
+        condition = []
+
+    if citation is None:
+        citation = []
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        type=type,
+        input_data=input_data,
+        output_data=output_data,
+        software_configuration=software_configuration,
+        condition=condition,
+        prerequisite_computation=prerequisite_computation,
+        citation=citation,
+    )
+
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/computation_process/index.html b/nodes/primary_nodes/computation_process/index.html new file mode 100644 index 000000000..9f32830d4 --- /dev/null +++ b/nodes/primary_nodes/computation_process/index.html @@ -0,0 +1,3809 @@ + + + + + + + + + + + + + + + + + + + + + + Computation Process - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+ +
+ + + +
+
+ + + + + + + +

Computation Process

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ ComputationProcess + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

A +Computational_Process +is a simulation that processes or changes a virtual material. Examples +include simulations of chemical reactions, chain scission, cross-linking, strong shear, etc. A +computational process may also encapsulate any computation that dramatically changes the +materials properties, molecular topology, and physical aspects like molecular orientation, etc. The +computation_forcefield of a simulation is associated with a material. As a consequence, if the +forcefield changes or gets refined via a computational procedure (density functional theory, +iterative Boltzmann inversion for coarse-graining etc.) this forcefield changing step must be +described as a computational_process and a new material node with a different +computation_forcefield needs to be created.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
typestrgeneral molecular dynamics simulationcategory of computationTrueTrue
input_datalist[Data]input data nodesTrue
output_datalist[Data]output data nodes
ingredientlist[Ingredient]ingredientsTrue
software_ configurationslist[Software Configuration]software and algorithms used
conditionlist[Condition]setup information
propertylist[Property]computation process properties
citationlist[Citation]reference to a book, paper, or scholarly work
notesstradditional description of the step
+
Available Subobjects
+ +
JSON Representation
+
{
+   "name":"my computational process node name",
+   "node":["ComputationProcess"],
+   "type":"cross_linking",
+   "uid":"_:b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6",
+   "uuid":"b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6"
+   "ingredient":[
+      {
+        "node":["Ingredient"],
+        "uid":"_:f68d6fff-9327-48b1-9249-33ce498005e8",
+         "uuid":"f68d6fff-9327-48b1-9249-33ce498005e8"
+         "keyword":["catalyst"],
+         "material":{
+            "name":"my material name",
+            "node":["Material"],
+            "uid":"_:3b12f92c-2121-4520-920e-b4c5622de34a",
+            "uuid":"3b12f92c-2121-4520-920e-b4c5622de34a",
+            "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+         },
+
+         "quantity":[
+            {
+               "key":"mass",
+               "node":["Quantity"],
+               "uid":"_:07c4a6a9-9385-4505-a30a-ca3549cedcd8",
+               "uuid":"07c4a6a9-9385-4505-a30a-ca3549cedcd8",
+               "uncertainty":0.2,
+               "uncertainty_type":"stdev",
+               "unit":"kg",
+               "value":11.2
+            }
+         ]
+      }
+   ],
+   "input_data":[
+      {
+        "name":"my data name",
+         "node":["Data"],
+         "type":"afm_amp",
+         "uid":"_:3c16bb05-ded1-4f52-9d02-c88c1a1de915",
+         "uuid":"3c16bb05-ded1-4f52-9d02-c88c1a1de915"
+         "file":[
+            {
+               "name":"my file node name",
+               "node":["File"],
+               "source":"https://criptapp.org",
+               "type":"calibration",
+                "data_dictionary":"my file's data dictionary",
+               "extension":".csv",
+               "uid":"_:ee8153db-4108-49e4-8c5b-ffc26d4e6f71",
+               "uuid":"ee8153db-4108-49e4-8c5b-ffc26d4e6f71"
+            }
+         ],
+      }
+   ],
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/computation_process.py +
  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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+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
+515
+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
+561
+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
class ComputationProcess(PrimaryBaseNode):
+    """
+    ## Definition
+
+    A
+    [Computational_Process](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=15)
+    is a simulation that processes or changes a virtual material. Examples
+    include simulations of chemical reactions, chain scission, cross-linking, strong shear, etc. A
+    computational process may also encapsulate any computation that dramatically changes the
+    materials properties, molecular topology, and physical aspects like molecular orientation, etc. The
+    computation_forcefield of a simulation is associated with a material. As a consequence, if the
+    forcefield changes or gets refined via a computational procedure (density functional theory,
+    iterative Boltzmann inversion for coarse-graining etc.) this forcefield changing step must be
+    described as a computational_process and a new material node with a different
+    computation_forcefield needs to be created.
+
+    ## Attributes
+    | attribute                | type                          | example                               | description                                     | required | vocab |
+    |--------------------------|-------------------------------|---------------------------------------|-------------------------------------------------|----------|-------|
+    | type                     | str                           | general molecular dynamics simulation | category of computation                         | True     | True  |
+    | input_data               | list[Data]                    |                                       | input data nodes                                | True     |       |
+    | output_data              | list[Data]                    |                                       | output data nodes                               |          |       |
+    | ingredient              | list[Ingredient]              |                                       | ingredients                                     | True     |       |
+    | software_ configurations | list[Software  Configuration] |                                       | software and algorithms used                    |          |       |
+    | condition                | list[Condition]               |                                       | setup information                               |          |       |
+    | property               | list[Property]                |                                       | computation process properties                  |          |       |
+    | citation                | list[Citation]                |                                       | reference to a book, paper, or scholarly work   |          |       |
+    | notes                    | str                           |                                       | additional description of the step              |          |       |
+
+
+    ## Available Subobjects
+    * [ingredient](../../subobjects/ingredient)
+    * [software_configuration](../../subobjects/software_configuration)
+    * [property](../../subobjects/property)
+    * [condition](../../subobjects/condition)
+    * [citation](../../subobjects/citation)
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my computational process node name",
+       "node":["ComputationProcess"],
+       "type":"cross_linking",
+       "uid":"_:b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6",
+       "uuid":"b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6"
+       "ingredient":[
+          {
+            "node":["Ingredient"],
+            "uid":"_:f68d6fff-9327-48b1-9249-33ce498005e8",
+             "uuid":"f68d6fff-9327-48b1-9249-33ce498005e8"
+             "keyword":["catalyst"],
+             "material":{
+                "name":"my material name",
+                "node":["Material"],
+                "uid":"_:3b12f92c-2121-4520-920e-b4c5622de34a",
+                "uuid":"3b12f92c-2121-4520-920e-b4c5622de34a",
+                "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+             },
+
+             "quantity":[
+                {
+                   "key":"mass",
+                   "node":["Quantity"],
+                   "uid":"_:07c4a6a9-9385-4505-a30a-ca3549cedcd8",
+                   "uuid":"07c4a6a9-9385-4505-a30a-ca3549cedcd8",
+                   "uncertainty":0.2,
+                   "uncertainty_type":"stdev",
+                   "unit":"kg",
+                   "value":11.2
+                }
+             ]
+          }
+       ],
+       "input_data":[
+          {
+            "name":"my data name",
+             "node":["Data"],
+             "type":"afm_amp",
+             "uid":"_:3c16bb05-ded1-4f52-9d02-c88c1a1de915",
+             "uuid":"3c16bb05-ded1-4f52-9d02-c88c1a1de915"
+             "file":[
+                {
+                   "name":"my file node name",
+                   "node":["File"],
+                   "source":"https://criptapp.org",
+                   "type":"calibration",
+                    "data_dictionary":"my file's data dictionary",
+                   "extension":".csv",
+                   "uid":"_:ee8153db-4108-49e4-8c5b-ffc26d4e6f71",
+                   "uuid":"ee8153db-4108-49e4-8c5b-ffc26d4e6f71"
+                }
+             ],
+          }
+       ],
+    }
+    ```
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all computational_process nodes attributes
+        """
+
+        type: str = ""
+        # TODO add proper typing in future, using Any for now to avoid circular import error
+        input_data: List[Any] = field(default_factory=list)
+        output_data: List[Any] = field(default_factory=list)
+        ingredient: List[Any] = field(default_factory=list)
+        software_configuration: List[Any] = field(default_factory=list)
+        condition: List[Any] = field(default_factory=list)
+        property: List[Any] = field(default_factory=list)
+        citation: List[Any] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        name: str,
+        type: str,
+        input_data: List[Any],
+        ingredient: List[Any],
+        output_data: Optional[List[Any]] = None,
+        software_configuration: Optional[List[Any]] = None,
+        condition: Optional[List[Any]] = None,
+        property: Optional[List[Any]] = None,
+        citation: Optional[List[Any]] = None,
+        notes: str = "",
+        **kwargs
+    ):
+        """
+        create a computational_process node
+
+        Examples
+        --------
+        ```python
+
+        # create file node for input data node
+        data_files = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+        )
+
+        # create input data node
+        input_data = cript.Data(name="my data name", type="afm_amp", files=[data_files])
+
+        # Material node for Quantity node
+        my_material = cript.Material(
+            name="my material",
+            identifiers=[{"alternative_names": "my material alternative name"}]
+            )
+
+        # create quantity node
+        my_quantity = cript.Quantity(key="mass", value=1.23, unit="gram")
+
+        # create ingredient node
+        ingredient = cript.Ingredient(
+            material=my_material,
+            quantities=[my_quantity],
+        )
+
+        # create computational process node
+        my_computational_process = cript.ComputationalProcess(
+            name="my computational process name",
+            type="cross_linking",
+            input_data=[input_data],
+            ingredient=[ingredient],
+        )
+        ```
+
+
+        Parameters
+        ----------
+        name: str
+            computational process name
+        type: str
+            type of computation process from CRIPT controlled vocabulary
+        input_data: List[Data]
+            list of input data for computational process
+        ingredient: List[Ingredient]
+            list of ingredients for this computational process node
+        output_data: List[Data] default=None
+            list of output data for this computational process node
+        software_configuration: List[SoftwareConfiguration] default=None
+            list of software configurations for this computational process node
+        condition: List[Condition] default=None
+            list of condition for this computational process node
+        property: List[Property] default=None
+            list of properties for this computational process node
+        citation: List[Citation] default=None
+            list of citation for this computational process node
+        notes: str default=""
+            optional notes for the computational process node
+
+        Returns
+        -------
+        None
+            instantiate computationalProcess node
+        """
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        # TODO validate type from vocab
+
+        if input_data is None:
+            input_data = []
+
+        if ingredient is None:
+            ingredient = []
+
+        if output_data is None:
+            output_data = []
+
+        if software_configuration is None:
+            software_configuration = []
+
+        if condition is None:
+            condition = []
+
+        if property is None:
+            property = []
+
+        if citation is None:
+            citation = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            type=type,
+            input_data=input_data,
+            ingredient=ingredient,
+            output_data=output_data,
+            software_configuration=software_configuration,
+            condition=condition,
+            property=property,
+            citation=citation,
+        )
+
+        # self.validate()
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        The computational process type must come from CRIPT Controlled vocabulary
+
+        Examples
+        --------
+        ```python
+        my_computational_process.type = "DPD"
+        ```
+
+        Returns
+        -------
+        str
+            computational process type
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_type: str) -> None:
+        """
+        set the computational_process type
+
+        computational_process type must come from CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_type: str
+            new computational process type.
+            computational process type must come from CRIPT controlled vocabulary
+
+        Returns
+        -------
+        None
+        """
+        # TODO check computational_process type with CRIPT controlled vocabulary
+        new_attrs = replace(self._json_attrs, type=new_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def input_data(self) -> List[Any]:
+        """
+        List of input data for the computational process node
+
+        Examples
+        --------
+        ```python
+        # create file node for the data node
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+        )
+
+        # create input data node
+        my_input_data = cript.Data(name="my input data name", type="afm_amp", files=[my_file])
+
+        # set computational process data node
+        my_computation.input_data = my_input_data
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of input data for this computational process node
+        """
+        return self._json_attrs.input_data.copy()
+
+    @input_data.setter
+    @beartype
+    def input_data(self, new_input_data_list: List[Any]) -> None:
+        """
+        set the input data for this computational process
+
+        Parameters
+        ----------
+        new_input_data_list: List[Data]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, input_data=new_input_data_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def output_data(self) -> List[Any]:
+        """
+        List of the output data for the computational_process
+
+        Examples
+        --------
+        ```python
+        # create file node for the data node
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+        )
+
+        # create input data node
+        my_output_data = cript.Data(name="my output data name", type="afm_amp", files=[my_file])
+
+        # set computational process data node
+        my_computation.output_data = my_input_data
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of output data from this computational process node
+        """
+        return self._json_attrs.output_data.copy()
+
+    @output_data.setter
+    @beartype
+    def output_data(self, new_output_data_list: List[Any]) -> None:
+        """
+        set the output_data list for the computational_process
+
+        Parameters
+        ----------
+        new_output_data_list: List[Data]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, output_data=new_output_data_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def ingredient(self) -> List[Any]:
+        """
+        List of ingredients for the computational_process
+
+        Examples
+        --------
+        ```python
+        # create ingredient node
+        ingredient = cript.Ingredient(
+            material=simple_material_node,
+            quantities=[simple_quantity_node],
+        )
+
+        my_computational_process.ingredient =
+        ```
+
+        Returns
+        -------
+        List[Ingredient]
+            list of ingredients for this computational process
+        """
+        return self._json_attrs.ingredient.copy()
+
+    @ingredient.setter
+    @beartype
+    def ingredient(self, new_ingredient_list: List[Any]) -> None:
+        """
+        set the ingredients list for this computational process
+
+        Parameters
+        ----------
+        new_ingredient_list: List[Ingredient]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, ingredient=new_ingredient_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def software_configuration(self) -> List[Any]:
+        """
+        List of software_configuration for the computational process
+
+        Examples
+        --------
+        ```python
+        # create software configuration node
+        my_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)
+
+        my_computational_process.software_configuration = my_software_configuration
+        ```
+
+        Returns
+        -------
+        List[SoftwareConfiguration]
+            List of software configurations used for this computational process node
+        """
+        return self._json_attrs.software_configuration.copy()
+
+    @software_configuration.setter
+    @beartype
+    def software_configuration(self, new_software_configuration_list: List[Any]) -> None:
+        """
+        set the list of software_configuration for the computational process
+
+        Parameters
+        ----------
+        new_software_configuration_list: List[SoftwareConfiguration]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, software_configuration=new_software_configuration_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def condition(self) -> List[Any]:
+        """
+        List of condition for the computational process
+
+        Examples
+        --------
+        ```python
+        # create condition node
+         my_condition = cript.Condition(key="atm", type="min", value=1)
+
+         my_computational_process.condition = [my_condition]
+
+        ```
+
+        Returns
+        -------
+        List[Condition]
+            list of condition for this computational process node
+        """
+        return self._json_attrs.condition.copy()
+
+    @condition.setter
+    @beartype
+    def condition(self, new_condition: List[Any]) -> None:
+        """
+        set the condition for the computational process
+
+        Parameters
+        ----------
+        new_condition: List[Condition]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, condition=new_condition)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Any]:
+        """
+        List of citation for the computational process
+
+        Examples
+        --------
+        ```python
+        # create a reference node for the citation
+        my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+        # create a reference
+        my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+        my_computational_process.citation = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of citation for this computational process
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation_list: List[Any]) -> None:
+        """
+        set the citation list for the computational process node
+
+        Parameters
+        ----------
+        new_citation_list: List[Citation]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def property(self) -> List[Any]:
+        """
+        List of properties
+
+        Examples
+        --------
+        ```python
+        # create a property node
+        my_property = cript.Property(key="modulus_shear", type="min", value=1.23, unit="gram")
+
+        my_computational_process.property = [my_property]
+        ```
+
+        Returns
+        -------
+        List[Property]
+            list of properties for this computational process node
+        """
+        return self._json_attrs.property.copy()
+
+    @property.setter
+    @beartype
+    def property(self, new_property_list: List[Any]) -> None:
+        """
+        set the properties list for the computational process
+
+        Parameters
+        ----------
+        new_property_list: List[Property]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, property=new_property_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Any] + + + property + writable + + +

+ + +
+ +

List of citation for the computational process

+ + + +

Examples:

+
# create a reference node for the citation
+my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+# create a reference
+my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+my_computational_process.citation = [my_citation]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Citation] + +
+

list of citation for this computational process

+
+
+
+ +
+ +
+ + + +

+condition: List[Any] + + + property + writable + + +

+ + +
+ +

List of condition for the computational process

+ + + +

Examples:

+
# create condition node
+ my_condition = cript.Condition(key="atm", type="min", value=1)
+
+ my_computational_process.condition = [my_condition]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Condition] + +
+

list of condition for this computational process node

+
+
+
+ +
+ +
+ + + +

+ingredient: List[Any] + + + property + writable + + +

+ + +
+ +

List of ingredients for the computational_process

+ + + +

Examples:

+
# create ingredient node
+ingredient = cript.Ingredient(
+    material=simple_material_node,
+    quantities=[simple_quantity_node],
+)
+
+my_computational_process.ingredient =
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Ingredient] + +
+

list of ingredients for this computational process

+
+
+
+ +
+ +
+ + + +

+input_data: List[Any] + + + property + writable + + +

+ + +
+ +

List of input data for the computational process node

+ + + +

Examples:

+
# create file node for the data node
+my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary"
+)
+
+# create input data node
+my_input_data = cript.Data(name="my input data name", type="afm_amp", files=[my_file])
+
+# set computational process data node
+my_computation.input_data = my_input_data
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Data] + +
+

list of input data for this computational process node

+
+
+
+ +
+ +
+ + + +

+output_data: List[Any] + + + property + writable + + +

+ + +
+ +

List of the output data for the computational_process

+ + + +

Examples:

+
# create file node for the data node
+my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary"
+)
+
+# create input data node
+my_output_data = cript.Data(name="my output data name", type="afm_amp", files=[my_file])
+
+# set computational process data node
+my_computation.output_data = my_input_data
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Data] + +
+

list of output data from this computational process node

+
+
+
+ +
+ +
+ + + +

+property: List[Any] + + + property + writable + + +

+ + +
+ +

List of properties

+ + + +

Examples:

+
# create a property node
+my_property = cript.Property(key="modulus_shear", type="min", value=1.23, unit="gram")
+
+my_computational_process.property = [my_property]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Property] + +
+

list of properties for this computational process node

+
+
+
+ +
+ +
+ + + +

+software_configuration: List[Any] + + + property + writable + + +

+ + +
+ +

List of software_configuration for the computational process

+ + + +

Examples:

+
# create software configuration node
+my_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)
+
+my_computational_process.software_configuration = my_software_configuration
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[SoftwareConfiguration] + +
+

List of software configurations used for this computational process node

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

The computational process type must come from CRIPT Controlled vocabulary

+ + + +

Examples:

+
my_computational_process.type = "DPD"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

computational process type

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all computational_process nodes attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/computation_process.py +
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all computational_process nodes attributes
+    """
+
+    type: str = ""
+    # TODO add proper typing in future, using Any for now to avoid circular import error
+    input_data: List[Any] = field(default_factory=list)
+    output_data: List[Any] = field(default_factory=list)
+    ingredient: List[Any] = field(default_factory=list)
+    software_configuration: List[Any] = field(default_factory=list)
+    condition: List[Any] = field(default_factory=list)
+    property: List[Any] = field(default_factory=list)
+    citation: List[Any] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, type, input_data, ingredient, output_data=None, software_configuration=None, condition=None, property=None, citation=None, notes='', **kwargs) + +

+ + +
+ +

create a computational_process node

+ + + +

Examples:

+
# create file node for input data node
+data_files = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary"
+)
+
+# create input data node
+input_data = cript.Data(name="my data name", type="afm_amp", files=[data_files])
+
+# Material node for Quantity node
+my_material = cript.Material(
+    name="my material",
+    identifiers=[{"alternative_names": "my material alternative name"}]
+    )
+
+# create quantity node
+my_quantity = cript.Quantity(key="mass", value=1.23, unit="gram")
+
+# create ingredient node
+ingredient = cript.Ingredient(
+    material=my_material,
+    quantities=[my_quantity],
+)
+
+# create computational process node
+my_computational_process = cript.ComputationalProcess(
+    name="my computational process name",
+    type="cross_linking",
+    input_data=[input_data],
+    ingredient=[ingredient],
+)
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

computational process name

+
+
+ required +
type + str + +
+

type of computation process from CRIPT controlled vocabulary

+
+
+ required +
input_data + List[Any] + +
+

list of input data for computational process

+
+
+ required +
ingredient + List[Any] + +
+

list of ingredients for this computational process node

+
+
+ required +
output_data + Optional[List[Any]] + +
+

list of output data for this computational process node

+
+
+ None +
software_configuration + Optional[List[Any]] + +
+

list of software configurations for this computational process node

+
+
+ None +
condition + Optional[List[Any]] + +
+

list of condition for this computational process node

+
+
+ None +
property + Optional[List[Any]] + +
+

list of properties for this computational process node

+
+
+ None +
citation + Optional[List[Any]] + +
+

list of citation for this computational process node

+
+
+ None +
notes + str + +
+

optional notes for the computational process node

+
+
+ '' +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate computationalProcess node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/computation_process.py +
@beartype
+def __init__(
+    self,
+    name: str,
+    type: str,
+    input_data: List[Any],
+    ingredient: List[Any],
+    output_data: Optional[List[Any]] = None,
+    software_configuration: Optional[List[Any]] = None,
+    condition: Optional[List[Any]] = None,
+    property: Optional[List[Any]] = None,
+    citation: Optional[List[Any]] = None,
+    notes: str = "",
+    **kwargs
+):
+    """
+    create a computational_process node
+
+    Examples
+    --------
+    ```python
+
+    # create file node for input data node
+    data_files = cript.File(
+        source="https://criptapp.org",
+        type="calibration",
+        extension=".csv",
+        data_dictionary="my file's data dictionary"
+    )
+
+    # create input data node
+    input_data = cript.Data(name="my data name", type="afm_amp", files=[data_files])
+
+    # Material node for Quantity node
+    my_material = cript.Material(
+        name="my material",
+        identifiers=[{"alternative_names": "my material alternative name"}]
+        )
+
+    # create quantity node
+    my_quantity = cript.Quantity(key="mass", value=1.23, unit="gram")
+
+    # create ingredient node
+    ingredient = cript.Ingredient(
+        material=my_material,
+        quantities=[my_quantity],
+    )
+
+    # create computational process node
+    my_computational_process = cript.ComputationalProcess(
+        name="my computational process name",
+        type="cross_linking",
+        input_data=[input_data],
+        ingredient=[ingredient],
+    )
+    ```
+
+
+    Parameters
+    ----------
+    name: str
+        computational process name
+    type: str
+        type of computation process from CRIPT controlled vocabulary
+    input_data: List[Data]
+        list of input data for computational process
+    ingredient: List[Ingredient]
+        list of ingredients for this computational process node
+    output_data: List[Data] default=None
+        list of output data for this computational process node
+    software_configuration: List[SoftwareConfiguration] default=None
+        list of software configurations for this computational process node
+    condition: List[Condition] default=None
+        list of condition for this computational process node
+    property: List[Property] default=None
+        list of properties for this computational process node
+    citation: List[Citation] default=None
+        list of citation for this computational process node
+    notes: str default=""
+        optional notes for the computational process node
+
+    Returns
+    -------
+    None
+        instantiate computationalProcess node
+    """
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    # TODO validate type from vocab
+
+    if input_data is None:
+        input_data = []
+
+    if ingredient is None:
+        ingredient = []
+
+    if output_data is None:
+        output_data = []
+
+    if software_configuration is None:
+        software_configuration = []
+
+    if condition is None:
+        condition = []
+
+    if property is None:
+        property = []
+
+    if citation is None:
+        citation = []
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        type=type,
+        input_data=input_data,
+        ingredient=ingredient,
+        output_data=output_data,
+        software_configuration=software_configuration,
+        condition=condition,
+        property=property,
+        citation=citation,
+    )
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/data/index.html b/nodes/primary_nodes/data/index.html new file mode 100644 index 000000000..59e5e44e8 --- /dev/null +++ b/nodes/primary_nodes/data/index.html @@ -0,0 +1,2999 @@ + + + + + + + + + + + + + + + + + + + + + + Data - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Data

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Data + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

A Data node + node contains the meta-data to describe raw data that is beyond a single value, (i.e. n-dimensional data). + Each Data node must be linked to a single Experiment node.

+
Available Sub-Objects
+ +
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeTypeExampleDescriptionRequired
experimentExperimentExperiment the data belongs toTrue
namestr"my_data_name"Name of the data nodeTrue
typestr"nmr_h1"Pick from CRIPT data type controlled vocabularyTrue
fileList[File][file_1, file_2, file_3]list of file nodesFalse
sample_preparationProcessFalse
computationList[Computation]data produced from this Computation methodFalse
computation_processComputational Processdata was produced from this computation processFalse
materialList[Material]materials with attributes associated with the data nodeFalse
processList[Process]processes with attributes associated with the data nodeFalse
citationCitationreference to a book, paper, or scholarly workFalse
+
Example
+
# list of file nodes
+my_files_list = [
+    # create file node
+    cript.File(
+        source="https://criptapp.org",
+        type="calibration",
+        extension=".csv",
+        data_dictionary="my file's data dictionary"
+    )
+]
+
+# create data node with required arguments
+my_data = cript.Data(name="my data name", type="afm_amp", file=[simple_file_node])
+
+
JSON Representation
+
{
+   "name":"my data name",
+   "node":["Data"],
+   "type":"afm_amp",
+   "uid":"_:80b02470-73d0-416e-8d93-12fdf69e481a",
+   "uuid":"80b02470-73d0-416e-8d93-12fdf69e481a"
+   "file":[
+      {
+        "node":["File"],
+        "name":"my file node name",
+         "uid":"_:535779ea-0d1f-4b23-b3e8-60052f717307",
+         "uuid":"535779ea-0d1f-4b23-b3e8-60052f717307"
+         "type":"calibration",
+         "source":"https://criptapp.org",
+         "extension":".csv",
+         "data_dictionary":"my file's data dictionary",
+      }
+   ]
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/data.py +
  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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
class Data(PrimaryBaseNode):
+    """
+    ## Definition
+    A  [Data node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=13)
+     node contains the meta-data to describe raw data that is beyond a single value, (i.e. n-dimensional data).
+     Each `Data` node must be linked to a single `Experiment` node.
+
+    ## Available Sub-Objects
+    * [Citation](../../subobjects/citation)
+
+    ## Attributes
+    | Attribute           | Type                                              | Example                    | Description                                                                             | Required |
+    |---------------------|---------------------------------------------------|----------------------------|-----------------------------------------------------------------------------------------|----------|
+    | experiment          | [Experiment](experiment.md)                       |                            | Experiment the data belongs to                                                          | True     |
+    | name                | str                                               | `"my_data_name"`           | Name of the data node                                                                   | True     |
+    | type                | str                                               | `"nmr_h1"`                 | Pick from [CRIPT data type controlled vocabulary](https://criptapp.org/keys/data-type/) | True     |
+    | file                | List[[File](../supporting_nodes/file.md)]         | `[file_1, file_2, file_3]` | list of file nodes                                                                      | False    |
+    | sample_preparation  | [Process](process.md)                             |                            |                                                                                         | False    |
+    | computation         | List[[Computation](computation.md)]               |                            | data produced from this Computation method                                              | False    |
+    | computation_process | [Computational Process](./computation_process.md) |                            | data was produced from this computation process                                         | False    |
+    | material            | List[[Material](./material.md)]                   |                            | materials with attributes associated with the data node                                 | False    |
+    | process             | List[[Process](./process.md)]                     |                            | processes with attributes associated with the data node                                 | False    |
+    | citation            | [Citation](../subobjects/citation.md)             |                            | reference to a book, paper, or scholarly work                                           | False    |
+
+    Example
+    --------
+    ```python
+    # list of file nodes
+    my_files_list = [
+        # create file node
+        cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+        )
+    ]
+
+    # create data node with required arguments
+    my_data = cript.Data(name="my data name", type="afm_amp", file=[simple_file_node])
+    ```
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my data name",
+       "node":["Data"],
+       "type":"afm_amp",
+       "uid":"_:80b02470-73d0-416e-8d93-12fdf69e481a",
+       "uuid":"80b02470-73d0-416e-8d93-12fdf69e481a"
+       "file":[
+          {
+            "node":["File"],
+            "name":"my file node name",
+             "uid":"_:535779ea-0d1f-4b23-b3e8-60052f717307",
+             "uuid":"535779ea-0d1f-4b23-b3e8-60052f717307"
+             "type":"calibration",
+             "source":"https://criptapp.org",
+             "extension":".csv",
+             "data_dictionary":"my file's data dictionary",
+          }
+       ]
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Data attributes
+        """
+
+        type: str = ""
+        # TODO add proper typing in future, using Any for now to avoid circular import error
+        file: List[Any] = field(default_factory=list)
+        sample_preparation: Any = field(default_factory=list)
+        computation: List[Any] = field(default_factory=list)
+        computation_process: Any = field(default_factory=list)
+        material: List[Any] = field(default_factory=list)
+        process: List[Any] = field(default_factory=list)
+        citation: List[Any] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        name: str,
+        type: str,
+        file: List[Any],
+        sample_preparation: Any = None,
+        computation: Optional[List[Any]] = None,
+        computation_process: Optional[Any] = None,
+        material: Optional[List[Any]] = None,
+        process: Optional[List[Any]] = None,
+        citation: Optional[List[Any]] = None,
+        notes: str = "",
+        **kwargs
+    ):
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        if file is None:
+            file = []
+
+        if sample_preparation is None:
+            sample_preparation = []
+
+        if computation is None:
+            computation = []
+
+        if computation_process is None:
+            computation_process = []
+
+        if material is None:
+            material = []
+
+        if process is None:
+            process = []
+
+        if citation is None:
+            citation = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            type=type,
+            file=file,
+            sample_preparation=sample_preparation,
+            computation=computation,
+            computation_process=computation_process,
+            material=material,
+            process=process,
+            citation=citation,
+        )
+
+        self.validate()
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        Type of data node. The data type must come from [CRIPT data type vocabulary]()
+
+        Example
+        -------
+        ```python
+        data.type = "afm_height"
+        ```
+
+        Returns
+        -------
+        data type: str
+            data type for the data node must come from CRIPT controlled vocabulary
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_data_type: str) -> None:
+        """
+        set the data type.
+        The data type must come from [CRIPT data type vocabulary]()
+
+        Parameters
+        ----------
+        new_data_type: str
+            new data type to replace the current data type
+
+        Returns
+        -------
+        None
+        """
+        # TODO validate that the data type is valid from CRIPT controlled vocabulary
+        new_attrs = replace(self._json_attrs, type=new_data_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def file(self) -> List[Any]:
+        """
+        get the list of files for this data node
+
+        Examples
+        --------
+        ```python
+        create a list of file nodes
+        my_new_files = [
+            # file with link source
+            cript.File(
+                source="https://pubs.acs.org/doi/10.1021/acscentsci.3c00011",
+                type="computation_config",
+                extension=".pdf",
+                data_dictionary="my second file data dictionary",
+            ),
+        ]
+
+        data_node.file = my_new_files
+        ```
+
+        Returns
+        -------
+        List[File]
+            list of files for this data node
+        """
+        return self._json_attrs.file.copy()
+
+    @file.setter
+    @beartype
+    def file(self, new_file_list: List[Any]) -> None:
+        """
+        set the list of file for this data node
+
+        Parameters
+        ----------
+        new_files_list: List[File]
+            new list of file nodes to replace the current list
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, file=new_file_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def sample_preparation(self) -> Union[Any, None]:
+        """
+        The sample preparation for this data node
+
+        Returns
+        -------
+        sample_preparation: Process
+            sample preparation for this data node
+        """
+        return self._json_attrs.sample_preparation
+
+    @sample_preparation.setter
+    @beartype
+    def sample_preparation(self, new_sample_preparation: Union[Any, None]) -> None:
+        """
+        set sample_preparation
+
+        Parameters
+        ----------
+        new_sample_preparation: Process
+            new_sample_preparation to replace the current one for this node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, sample_preparation=new_sample_preparation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def computation(self) -> List[Any]:
+        """
+        list of computation nodes for this material node
+
+        Returns
+        -------
+        None
+            list of computation nodes
+        """
+        return self._json_attrs.computation.copy()
+
+    @computation.setter
+    @beartype
+    def computation(self, new_computation_list: List[Any]) -> None:
+        """
+        set list of computation  for this data node
+
+        Parameters
+        ----------
+        new_computation_list: List[Computation]
+            new computation list to replace the current one
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, computation=new_computation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def computation_process(self) -> Union[Any, None]:
+        """
+        The computation_process for this data node
+
+        Returns
+        -------
+        ComputationalProcess
+            computational process node for this data node
+        """
+        return self._json_attrs.computation_process
+
+    @computation_process.setter
+    @beartype
+    def computation_process(self, new_computation_process: Union[Any, None]) -> None:
+        """
+        set the computational process
+
+        Parameters
+        ----------
+        new_computation_process: ComputationalProcess
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, computation_process=new_computation_process)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def material(self) -> List[Any]:
+        """
+        List of materials for this node
+
+        Returns
+        -------
+        List[Material]
+            list of material
+        """
+        return self._json_attrs.material.copy()
+
+    @material.setter
+    @beartype
+    def material(self, new_material_list: List[Any]) -> None:
+        """
+        set the list of materials for this data node
+
+        Parameters
+        ----------
+        new_material_list: List[Material]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, material=new_material_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def process(self) -> List[Any]:
+        """
+        list of [Process nodes](./process.md) for this data node
+
+        Notes
+        -----
+        Please note that while the process attribute of the data node is currently set to `Any`
+        the software still expects a Process node in the data's process attribute
+        > It is currently set to `Any` to avoid the circular import error
+
+        Returns
+        -------
+        List[Process]
+            list of process for the data node
+        """
+        return self._json_attrs.process.copy()
+
+    @process.setter
+    @beartype
+    def process(self, new_process_list: List[Any]) -> None:
+        """
+        set the list of process for this data node
+
+        Parameters
+        ----------
+        new_process_list: List[Process]
+            new list of Process
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, process=new_process_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Any]:
+        """
+        List of [citation](../../subobjects/citation) within the data node
+
+        Example
+        -------
+        ```python
+        # create a reference node
+        my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+        # create a citation list to house all the reference nodes
+        my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+        # add citations to data node
+        my_data.citation = my_citations
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of citations for this data node
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation_list: List[Any]) -> None:
+        """
+        set the list of citation
+
+        Parameters
+        ----------
+        new_citation_list: List[Citation]
+            new list of citation to replace the current one
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Any] + + + property + writable + + +

+ + +
+ +

List of citation within the data node

+
Example
+
# create a reference node
+my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+# create a citation list to house all the reference nodes
+my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+# add citations to data node
+my_data.citation = my_citations
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Citation] + +
+

list of citations for this data node

+
+
+
+ +
+ +
+ + + +

+computation: List[Any] + + + property + writable + + +

+ + +
+ +

list of computation nodes for this material node

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

list of computation nodes

+
+
+
+ +
+ +
+ + + +

+computation_process: Union[Any, None] + + + property + writable + + +

+ + +
+ +

The computation_process for this data node

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ComputationalProcess + +
+

computational process node for this data node

+
+
+
+ +
+ +
+ + + +

+file: List[Any] + + + property + writable + + +

+ + +
+ +

get the list of files for this data node

+ + + +

Examples:

+
create a list of file nodes
+my_new_files = [
+    # file with link source
+    cript.File(
+        source="https://pubs.acs.org/doi/10.1021/acscentsci.3c00011",
+        type="computation_config",
+        extension=".pdf",
+        data_dictionary="my second file data dictionary",
+    ),
+]
+
+data_node.file = my_new_files
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[File] + +
+

list of files for this data node

+
+
+
+ +
+ +
+ + + +

+material: List[Any] + + + property + writable + + +

+ + +
+ +

List of materials for this node

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

list of material

+
+
+
+ +
+ +
+ + + +

+process: List[Any] + + + property + writable + + +

+ + +
+ +

list of Process nodes for this data node

+
Notes
+

Please note that while the process attribute of the data node is currently set to Any +the software still expects a Process node in the data's process attribute

+
+

It is currently set to Any to avoid the circular import error

+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Process] + +
+

list of process for the data node

+
+
+
+ +
+ +
+ + + +

+sample_preparation: Union[Any, None] + + + property + writable + + +

+ + +
+ +

The sample preparation for this data node

+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
sample_preparation + Process + +
+

sample preparation for this data node

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

Type of data node. The data type must come from CRIPT data type vocabulary

+
Example
+
data.type = "afm_height"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ data type: str + +
+

data type for the data node must come from CRIPT controlled vocabulary

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Data attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/data.py +
75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Data attributes
+    """
+
+    type: str = ""
+    # TODO add proper typing in future, using Any for now to avoid circular import error
+    file: List[Any] = field(default_factory=list)
+    sample_preparation: Any = field(default_factory=list)
+    computation: List[Any] = field(default_factory=list)
+    computation_process: Any = field(default_factory=list)
+    material: List[Any] = field(default_factory=list)
+    process: List[Any] = field(default_factory=list)
+    citation: List[Any] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/experiment/index.html b/nodes/primary_nodes/experiment/index.html new file mode 100644 index 000000000..105db7b5b --- /dev/null +++ b/nodes/primary_nodes/experiment/index.html @@ -0,0 +1,3065 @@ + + + + + + + + + + + + + + + + + + + + + + Experiment - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Experiment

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Experiment + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

An +Experiment node +is nested inside a Collection node.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypedescriptionrequired
collectionCollectioncollection associated with the experimentTrue
processList[Process]process nodes associated with this experimentFalse
computationsList[Computation]computation method nodes associated with this experimentFalse
computation_processList[Computational Process]computation process nodes associated with this experimentFalse
dataList[Data]data nodes associated with this experimentFalse
fundingList[str]funding source for experimentFalse
citationList[Citation]reference to a book, paper, or scholarly workFalse
+
Subobjects
+

An +Experiment node +can be thought as a folder/bucket that can hold:

+ +
Warnings
+
+

Experiment names

+

Experiment names MUST be unique within a Collection

+
+
+
JSON Representation
+
{
+   "name":"my experiment name",
+   "node":["Experiment"],
+   "uid":"_:886c4deb-2186-4f11-8134-a37111200b83",
+   "uuid":"886c4deb-2186-4f11-8134-a37111200b83"
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/experiment.py +
  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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
class Experiment(PrimaryBaseNode):
+    """
+    ## Definition
+    An
+    [Experiment node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)
+    is nested inside a [Collection](../collection) node.
+
+    ## Attributes
+
+    | attribute           | type                         | description                                               | required |
+    |---------------------|------------------------------|-----------------------------------------------------------|----------|
+    | collection          | Collection                   | collection associated with the experiment                 | True     |
+    | process             | List[Process]                | process nodes associated with this experiment             | False    |
+    | computations        | List[Computation]            | computation method nodes associated with this experiment  | False    |
+    | computation_process | List[Computational  Process] | computation process nodes associated with this experiment | False    |
+    | data                | List[Data]                   | data nodes associated with this experiment                | False    |
+    | funding             | List[str]                    | funding source for experiment                             | False    |
+    | citation            | List[Citation]               | reference to a book, paper, or scholarly work             | False    |
+
+
+    ## Subobjects
+    An
+    [Experiment node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)
+    can be thought as a folder/bucket that can hold:
+
+    * [Process](../process)
+    * [Computations](../computation)
+    * [Computation_Process](../computation_process)
+    * [Data](../data)
+    * [Funding](./#cript.nodes.primary_nodes.experiment.Experiment.funding)
+    * [Citation](../../subobjects/citation)
+
+
+    Warnings
+    --------
+    !!! warning "Experiment names"
+        Experiment names **MUST** be unique within a [Collection](../collection)
+
+    ---
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my experiment name",
+       "node":["Experiment"],
+       "uid":"_:886c4deb-2186-4f11-8134-a37111200b83",
+       "uuid":"886c4deb-2186-4f11-8134-a37111200b83"
+    }
+    ```
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Collection attributes
+        """
+
+        process: List[Any] = field(default_factory=list)
+        computation: List[Any] = field(default_factory=list)
+        computation_process: List[Any] = field(default_factory=list)
+        data: List[Any] = field(default_factory=list)
+        funding: List[str] = field(default_factory=list)
+        citation: List[Any] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        name: str,
+        process: Optional[List[Any]] = None,
+        computation: Optional[List[Any]] = None,
+        computation_process: Optional[List[Any]] = None,
+        data: Optional[List[Any]] = None,
+        funding: Optional[List[str]] = None,
+        citation: Optional[List[Any]] = None,
+        notes: str = "",
+        **kwargs
+    ):
+        """
+        create an Experiment node
+
+        Parameters
+        ----------
+        name: str
+            name of Experiment
+        process: List[Process]
+            list of Process nodes for this Experiment
+        computation: List[Computation]
+            list of computation nodes for this Experiment
+        computation_process: List[ComputationalProcess]
+            list of computational_process nodes for this Experiment
+        data: List[Data]
+            list of data nodes for this experiment
+        funding: List[str]
+            list of the funders names for this Experiment
+        citation: List[Citation]
+            list of Citation nodes for this experiment
+        notes: str default=""
+            notes for the experiment node
+
+        Examples
+        --------
+        ```python
+        # create an experiment node with all possible arguments
+        my_experiment = cript.Experiment(name="my experiment name")
+        ```
+
+        Returns
+        -------
+        None
+            Instantiate an Experiment node
+        """
+
+        if process is None:
+            process = []
+        if computation is None:
+            computation = []
+        if computation_process is None:
+            computation_process = []
+        if data is None:
+            data = []
+        if funding is None:
+            funding = []
+        if citation is None:
+            citation = []
+
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            name=name,
+            process=process,
+            computation=computation,
+            computation_process=computation_process,
+            data=data,
+            funding=funding,
+            citation=citation,
+            notes=notes,
+        )
+
+        # check if the code is still valid
+        self.validate()
+
+    @property
+    @beartype
+    def process(self) -> List[Any]:
+        """
+        List of process for experiment
+
+        ```python
+        # create a simple process node
+        my_process = cript.Process(name="my process name", type="affinity_pure")
+
+        my_experiment.process = [my_process]
+        ```
+
+        Returns
+        -------
+        List[Process]
+            List of process that were performed in this experiment
+        """
+        return self._json_attrs.process.copy()
+
+    @process.setter
+    @beartype
+    def process(self, new_process_list: List[Any]) -> None:
+        """
+        set the list of process for this experiment
+
+        Parameters
+        ----------
+        new_process_list: List[Process]
+            new process list to replace the current process list
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, process=new_process_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def computation(self) -> List[Any]:
+        """
+        List of the [computations](../computation) in this experiment
+
+        Examples
+        --------
+        ```python
+        # create computation node
+        my_computation = cript.Computation(name="my computation name", type="analysis")
+
+        # add computation node to experiment node
+        simple_experiment_node.computation = [simple_computation_node]
+        ```
+
+        Returns
+        -------
+        List[Computation]
+            List of [computations](../computation) for this experiment
+        """
+        return self._json_attrs.computation.copy()
+
+    @computation.setter
+    @beartype
+    def computation(self, new_computation_list: List[Any]) -> None:
+        """
+        set the list of computations for this experiment
+
+        Parameters
+        ----------
+        new_computation_list: List[Computation]
+            new list of computations to replace the current list of experiments
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, computation=new_computation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def computation_process(self) -> List[Any]:
+        """
+        List of [computation_process](../computation_process) for this experiment
+
+        Examples
+        --------
+        ```python
+        my_computation_process = cript.ComputationalProcess(
+            name="my computational process name",
+            type="cross_linking",       # must come from CRIPT Controlled Vocabulary
+            input_data=[input_data],    # input data is another data node
+            ingredients=[ingredients],  # output data is another data node
+        )
+
+        # add computation_process node to experiment node
+        my_experiment.computation_process = [my_computational_process]
+        ```
+
+        Returns
+        -------
+        List[ComputationalProcess]
+            computational process that were performed in this experiment
+        """
+        return self._json_attrs.computation_process.copy()
+
+    @computation_process.setter
+    @beartype
+    def computation_process(self, new_computation_process_list: List[Any]) -> None:
+        """
+        set the list of computation_process for this experiment
+
+        Parameters
+        ----------
+        new_computation_process_list: List[ComputationalProcess]
+            new list of computations to replace the current for the experiment
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, computation_process=new_computation_process_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def data(self) -> List[Any]:
+        """
+        List of [data nodes](../data) for this experiment
+
+        Examples
+        --------
+        ```python
+        # create a simple file node
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary",
+        )
+
+        # create a simple data node
+        my_data = cript.Data(name="my data name", type="afm_amp", files=[my_file])
+
+        my_experiment.data = my_data
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of [data nodes](../data) that belong to this experiment
+        """
+        return self._json_attrs.data.copy()
+
+    @data.setter
+    @beartype
+    def data(self, new_data_list: List[Any]) -> None:
+        """
+        set the list of data for this experiment
+
+        Parameters
+        ----------
+        new_data_list: List[Data]
+            new list of data to replace the current list for this experiment
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, data=new_data_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def funding(self) -> List[str]:
+        """
+        List of strings of all the funders for this experiment
+
+        Examples
+        --------
+        ```python
+        my_experiment.funding = ["National Science Foundation", "IRIS", "NIST"]
+        ```
+
+        Returns
+        -------
+        List[str]
+            List of funders for this experiment
+        """
+        return self._json_attrs.funding.copy()
+
+    @funding.setter
+    @beartype
+    def funding(self, new_funding_list: List[str]) -> None:
+        """
+        set the list of funders for this experiment
+
+        Parameters
+        ----------
+        new_funding_list: List[str]
+            replace the current list of funders
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, funding=new_funding_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Any]:
+        """
+        List of [citation](../../subobjects/citation) for this experiment
+
+        Examples
+        --------
+        ```python
+        # create citation node
+        my_citation = cript.Citation(type="derived_from", reference=simple_reference_node)
+
+        # add citation to experiment
+        my_experiment.citations = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of citations of scholarly work that was used in this experiment
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation_list: List[Any]) -> None:
+        """
+        set the list of citations for this experiment
+
+        Parameters
+        ----------
+        new_citations_list: List[Citation]
+            replace the list of citations for this experiment with a new list of citations
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Any] + + + property + writable + + +

+ + +
+ +

List of citation for this experiment

+ + + +

Examples:

+
# create citation node
+my_citation = cript.Citation(type="derived_from", reference=simple_reference_node)
+
+# add citation to experiment
+my_experiment.citations = [my_citation]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Citation] + +
+

list of citations of scholarly work that was used in this experiment

+
+
+
+ +
+ +
+ + + +

+computation: List[Any] + + + property + writable + + +

+ + +
+ +

List of the computations in this experiment

+ + + +

Examples:

+
# create computation node
+my_computation = cript.Computation(name="my computation name", type="analysis")
+
+# add computation node to experiment node
+simple_experiment_node.computation = [simple_computation_node]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Computation] + +
+

List of computations for this experiment

+
+
+
+ +
+ +
+ + + +

+computation_process: List[Any] + + + property + writable + + +

+ + +
+ +

List of computation_process for this experiment

+ + + +

Examples:

+
my_computation_process = cript.ComputationalProcess(
+    name="my computational process name",
+    type="cross_linking",       # must come from CRIPT Controlled Vocabulary
+    input_data=[input_data],    # input data is another data node
+    ingredients=[ingredients],  # output data is another data node
+)
+
+# add computation_process node to experiment node
+my_experiment.computation_process = [my_computational_process]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[ComputationalProcess] + +
+

computational process that were performed in this experiment

+
+
+
+ +
+ +
+ + + +

+data: List[Any] + + + property + writable + + +

+ + +
+ +

List of data nodes for this experiment

+ + + +

Examples:

+
# create a simple file node
+my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary",
+)
+
+# create a simple data node
+my_data = cript.Data(name="my data name", type="afm_amp", files=[my_file])
+
+my_experiment.data = my_data
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Data] + +
+

list of data nodes that belong to this experiment

+
+
+
+ +
+ +
+ + + +

+funding: List[str] + + + property + writable + + +

+ + +
+ +

List of strings of all the funders for this experiment

+ + + +

Examples:

+
my_experiment.funding = ["National Science Foundation", "IRIS", "NIST"]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[str] + +
+

List of funders for this experiment

+
+
+
+ +
+ +
+ + + +

+process: List[Any] + + + property + writable + + +

+ + +
+ +

List of process for experiment

+
# create a simple process node
+my_process = cript.Process(name="my process name", type="affinity_pure")
+
+my_experiment.process = [my_process]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Process] + +
+

List of process that were performed in this experiment

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Collection attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/experiment.py +
61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Collection attributes
+    """
+
+    process: List[Any] = field(default_factory=list)
+    computation: List[Any] = field(default_factory=list)
+    computation_process: List[Any] = field(default_factory=list)
+    data: List[Any] = field(default_factory=list)
+    funding: List[str] = field(default_factory=list)
+    citation: List[Any] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, process=None, computation=None, computation_process=None, data=None, funding=None, citation=None, notes='', **kwargs) + +

+ + +
+ +

create an Experiment node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

name of Experiment

+
+
+ required +
process + Optional[List[Any]] + +
+

list of Process nodes for this Experiment

+
+
+ None +
computation + Optional[List[Any]] + +
+

list of computation nodes for this Experiment

+
+
+ None +
computation_process + Optional[List[Any]] + +
+

list of computational_process nodes for this Experiment

+
+
+ None +
data + Optional[List[Any]] + +
+

list of data nodes for this experiment

+
+
+ None +
funding + Optional[List[str]] + +
+

list of the funders names for this Experiment

+
+
+ None +
citation + Optional[List[Any]] + +
+

list of Citation nodes for this experiment

+
+
+ None +
notes + str + +
+

notes for the experiment node

+
+
+ '' +
+ + + +

Examples:

+
# create an experiment node with all possible arguments
+my_experiment = cript.Experiment(name="my experiment name")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiate an Experiment node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/experiment.py +
@beartype
+def __init__(
+    self,
+    name: str,
+    process: Optional[List[Any]] = None,
+    computation: Optional[List[Any]] = None,
+    computation_process: Optional[List[Any]] = None,
+    data: Optional[List[Any]] = None,
+    funding: Optional[List[str]] = None,
+    citation: Optional[List[Any]] = None,
+    notes: str = "",
+    **kwargs
+):
+    """
+    create an Experiment node
+
+    Parameters
+    ----------
+    name: str
+        name of Experiment
+    process: List[Process]
+        list of Process nodes for this Experiment
+    computation: List[Computation]
+        list of computation nodes for this Experiment
+    computation_process: List[ComputationalProcess]
+        list of computational_process nodes for this Experiment
+    data: List[Data]
+        list of data nodes for this experiment
+    funding: List[str]
+        list of the funders names for this Experiment
+    citation: List[Citation]
+        list of Citation nodes for this experiment
+    notes: str default=""
+        notes for the experiment node
+
+    Examples
+    --------
+    ```python
+    # create an experiment node with all possible arguments
+    my_experiment = cript.Experiment(name="my experiment name")
+    ```
+
+    Returns
+    -------
+    None
+        Instantiate an Experiment node
+    """
+
+    if process is None:
+        process = []
+    if computation is None:
+        computation = []
+    if computation_process is None:
+        computation_process = []
+    if data is None:
+        data = []
+    if funding is None:
+        funding = []
+    if citation is None:
+        citation = []
+
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        name=name,
+        process=process,
+        computation=computation,
+        computation_process=computation_process,
+        data=data,
+        funding=funding,
+        citation=citation,
+        notes=notes,
+    )
+
+    # check if the code is still valid
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/inventory/index.html b/nodes/primary_nodes/inventory/index.html new file mode 100644 index 000000000..85824120f --- /dev/null +++ b/nodes/primary_nodes/inventory/index.html @@ -0,0 +1,1973 @@ + + + + + + + + + + + + + + + + + + + + + + Inventory - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Inventory

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Inventory + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

An +Inventory Node +is a list of material nodes. +An example of an inventory can be a grouping of materials that were extracted from literature +and curated into a group for machine learning, or it can be a subset of chemicals that are used for a +certain type of synthesis.

+
Attributes
+ + + + + + + + + + + + + + + + + +
AttributeTypeExampleDescription
materiallist[Material]material that you like to group together
+
JSON Representation
+
{
+   "name":"my inventory name",
+   "node":["Inventory"],
+   "uid":"_:90f45778-b7c9-4b77-8b83-a6ea9671a937",
+   "uuid":"90f45778-b7c9-4b77-8b83-a6ea9671a937",
+   "material":[
+      {
+         "node":["Material"],
+         "name":"my material 1",
+         "uid":"_:9679ff12-f9b4-41f4-be95-080b78fa71fd",
+         "uuid":"9679ff12-f9b4-41f4-be95-080b78fa71fd"
+         "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+      },
+      {
+         "node":["Material"],
+         "name":"my material 2",
+         "uid":"_:1ee41708-3531-43eb-8049-4bb91ad73df6",
+         "uuid":"1ee41708-3531-43eb-8049-4bb91ad73df6"
+         "bigsmiles":"654321",
+      }
+   ]
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/inventory.py +
class Inventory(PrimaryBaseNode):
+    """
+    ## Definition
+    An
+    [Inventory Node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)
+    is a list of material nodes.
+    An example of an inventory can be a grouping of materials that were extracted from literature
+    and curated into a group for machine learning, or it can be a subset of chemicals that are used for a
+    certain type of synthesis.
+
+    ## Attributes
+
+    | Attribute  | Type                            | Example             | Description                               |
+    |------------|---------------------------------|---------------------|-------------------------------------------|
+    | material  | list[[Material](./material.md)] |                     | material that you like to group together |
+
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my inventory name",
+       "node":["Inventory"],
+       "uid":"_:90f45778-b7c9-4b77-8b83-a6ea9671a937",
+       "uuid":"90f45778-b7c9-4b77-8b83-a6ea9671a937",
+       "material":[
+          {
+             "node":["Material"],
+             "name":"my material 1",
+             "uid":"_:9679ff12-f9b4-41f4-be95-080b78fa71fd",
+             "uuid":"9679ff12-f9b4-41f4-be95-080b78fa71fd"
+             "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+          },
+          {
+             "node":["Material"],
+             "name":"my material 2",
+             "uid":"_:1ee41708-3531-43eb-8049-4bb91ad73df6",
+             "uuid":"1ee41708-3531-43eb-8049-4bb91ad73df6"
+             "bigsmiles":"654321",
+          }
+       ]
+    }
+    ```
+
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Inventory attributes
+        """
+
+        material: List[Material] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, name: str, material: List[Material], notes: str = "", **kwargs) -> None:
+        """
+        Instantiate an inventory node
+
+        Examples
+        --------
+        ```python
+        material_1 = cript.Material(
+            name="material 1",
+            identifiers=[{"alternative_names": "material 1 alternative name"}],
+        )
+
+        material_2 = cript.Material(
+            name="material 2",
+            identifiers=[{"alternative_names": "material 2 alternative name"}],
+        )
+
+        # instantiate inventory node
+        my_inventory = cript.Inventory(
+            name="my inventory name", material=[material_1, material_2]
+        )
+        ```
+
+        Parameters
+        ----------
+        material: List[Material]
+            list of materials in this inventory
+
+        Returns
+        -------
+        None
+            instantiate an inventory node
+        """
+
+        if material is None:
+            material = []
+
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        self._json_attrs = replace(self._json_attrs, material=material)
+
+    @property
+    @beartype
+    def material(self) -> List[Material]:
+        """
+        List of [material](../material) in this inventory
+
+        Examples
+        --------
+        ```python
+        material_3 = cript.Material(
+            name="new material 3",
+            identifiers=[{"alternative_names": "new material 3 alternative name"}],
+        )
+
+        my_inventory.material = [my_material_3]
+        ```
+
+        Returns
+        -------
+        List[Material]
+            list of material representing the inventory within the collection
+        """
+        return self._json_attrs.material.copy()
+
+    @material.setter
+    @beartype
+    def material(self, new_material_list: List[Material]):
+        """
+        set the list of material for this inventory node
+
+        Parameters
+        ----------
+        new_material_list: List[Material]
+            new list of material to replace the current list of material nodes for this inventory node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, material=new_material_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+material: List[Material] + + + property + writable + + +

+ + +
+ +

List of material in this inventory

+ + + +

Examples:

+
material_3 = cript.Material(
+    name="new material 3",
+    identifiers=[{"alternative_names": "new material 3 alternative name"}],
+)
+
+my_inventory.material = [my_material_3]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

list of material representing the inventory within the collection

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Inventory attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/inventory.py +
56
+57
+58
+59
+60
+61
+62
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Inventory attributes
+    """
+
+    material: List[Material] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, material, notes='', **kwargs) + +

+ + +
+ +

Instantiate an inventory node

+ + + +

Examples:

+
material_1 = cript.Material(
+    name="material 1",
+    identifiers=[{"alternative_names": "material 1 alternative name"}],
+)
+
+material_2 = cript.Material(
+    name="material 2",
+    identifiers=[{"alternative_names": "material 2 alternative name"}],
+)
+
+# instantiate inventory node
+my_inventory = cript.Inventory(
+    name="my inventory name", material=[material_1, material_2]
+)
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
material + List[Material] + +
+

list of materials in this inventory

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate an inventory node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/inventory.py +
@beartype
+def __init__(self, name: str, material: List[Material], notes: str = "", **kwargs) -> None:
+    """
+    Instantiate an inventory node
+
+    Examples
+    --------
+    ```python
+    material_1 = cript.Material(
+        name="material 1",
+        identifiers=[{"alternative_names": "material 1 alternative name"}],
+    )
+
+    material_2 = cript.Material(
+        name="material 2",
+        identifiers=[{"alternative_names": "material 2 alternative name"}],
+    )
+
+    # instantiate inventory node
+    my_inventory = cript.Inventory(
+        name="my inventory name", material=[material_1, material_2]
+    )
+    ```
+
+    Parameters
+    ----------
+    material: List[Material]
+        list of materials in this inventory
+
+    Returns
+    -------
+    None
+        instantiate an inventory node
+    """
+
+    if material is None:
+        material = []
+
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    self._json_attrs = replace(self._json_attrs, material=material)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/material/index.html b/nodes/primary_nodes/material/index.html new file mode 100644 index 000000000..d7717feea --- /dev/null +++ b/nodes/primary_nodes/material/index.html @@ -0,0 +1,3166 @@ + + + + + + + + + + + + + + + + + + + + + + Material - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+ +
+ + + +
+
+ + + + + + + +

Material

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Material + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

A Material node +is nested inside a Project. +A Material node +is just the materials used within an project/experiment.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
identifierslist[Identifier]material identifiersTrue
componentlist[Material]list of component that make up the mixture
propertylist[Property]material properties
processProcessprocess node that made this material
parent_materialMaterialmaterial node that this node was copied from
computational_ forcefieldComputation Forcefieldcomputation forcefieldConditional
keywordlist[str][thermoplastic, homopolymer, linear, polyolefins]words that classify the materialTrue
+
Navigating to Material
+

Materials can be easily found on the CRIPT home screen in the +under the navigation within the Materials link

+
Available Sub-Objects for Material
+ +
Example
+

water, brine (water + NaCl), polystyrene, polyethylene glycol hydrogels, vulcanized polyisoprene, mcherry (protein), and mica

+
Warnings
+
+

Material names

+

Material names Must be unique within a Project

+
+
  {
+     "node":["Material"],
+     "name":"my unique material name",
+     "uid":"_:9679ff12-f9b4-41f4-be95-080b78fa71fd",
+     "uuid":"9679ff12-f9b4-41f4-be95-080b78fa71fd"
+     "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+  }
+
+ +
+ Source code in src/cript/nodes/primary_nodes/material.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
class Material(PrimaryBaseNode):
+    """
+    ## Definition
+    A [Material node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=10)
+    is nested inside a [Project](../project).
+    A [Material node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=10)
+    is just the materials used within an project/experiment.
+
+    ## Attributes
+    | attribute                 | type                                                                 | example                                           | description                                  | required    | vocab |
+    |---------------------------|----------------------------------------------------------------------|---------------------------------------------------|----------------------------------------------|-------------|-------|
+    | identifiers               | list[Identifier]                                                     |                                                   | material identifiers                         | True        |       |
+    | component                 | list[[Material](./)]                                                 |                                                   | list of component that make up the mixture   |             |       |
+    | property                  | list[[Property](../../subobjects/property)]                          |                                                   | material properties                          |             |       |
+    | process                   | [Process](../process)                                                |                                                   | process node that made this material         |             |       |
+    | parent_material           | [Material](./)                                                       |                                                   | material node that this node was copied from |             |       |
+    | computational_ forcefield | [Computation  Forcefield](../../subobjects/computational_forcefield) |                                                   | computation forcefield                       | Conditional |       |
+    | keyword                   | list[str]                                                            | [thermoplastic, homopolymer, linear, polyolefins] | words that classify the material             |             | True  |
+
+    ## Navigating to Material
+    Materials can be easily found on the [CRIPT](https://criptapp.org) home screen in the
+    under the navigation within the [Materials link](https://criptapp.org/material/)
+
+    ## Available Sub-Objects for Material
+    * [Identifier](../../subobjects/identifier)
+    * [Property](../../subobjects/property)
+    * [Computational_forcefield](../../subobjects/computational_forcefield)
+
+    Example
+    -------
+     water, brine (water + NaCl), polystyrene, polyethylene glycol hydrogels, vulcanized polyisoprene, mcherry (protein), and mica
+
+
+    Warnings
+    -------
+    !!! warning "Material names"
+        Material names Must be unique within a [Project](../project)
+
+    ```json
+      {
+         "node":["Material"],
+         "name":"my unique material name",
+         "uid":"_:9679ff12-f9b4-41f4-be95-080b78fa71fd",
+         "uuid":"9679ff12-f9b4-41f4-be95-080b78fa71fd"
+         "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+      }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Material attributes
+        """
+
+        # identifier sub-object for the material
+        identifiers: List[Dict[str, str]] = field(default_factory=dict)  # type: ignore
+        # TODO add proper typing in future, using Any for now to avoid circular import error
+        component: List["Material"] = field(default_factory=list)
+        process: Optional[Process] = None
+        property: List[Any] = field(default_factory=list)
+        parent_material: Optional["Material"] = None
+        computational_forcefield: Optional[Any] = None
+        keyword: List[str] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        name: str,
+        identifiers: List[Dict[str, str]],
+        component: Optional[List["Material"]] = None,
+        process: Optional[Process] = None,
+        property: Optional[List[Any]] = None,
+        parent_material: Optional["Material"] = None,
+        computational_forcefield: Optional[Any] = None,
+        keyword: Optional[List[str]] = None,
+        notes: str = "",
+        **kwargs
+    ):
+        """
+        create a material node
+
+        Parameters
+        ----------
+        name: str
+        identifiers: List[Dict[str, str]]
+        component: List["Material"], default=None
+        property: Optional[Process], default=None
+        process: List[Process], default=None
+        parent_material: "Material", default=None
+        computational_forcefield: ComputationalForcefield, default=None
+        keyword: List[str], default=None
+
+        Returns
+        -------
+        None
+            Instantiate a material node
+        """
+
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        if component is None:
+            component = []
+
+        if property is None:
+            property = []
+
+        if keyword is None:
+            keyword = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            name=name,
+            identifiers=identifiers,
+            component=component,
+            process=process,
+            property=property,
+            parent_material=parent_material,
+            computational_forcefield=computational_forcefield,
+            keyword=keyword,
+        )
+
+    @property
+    @beartype
+    def name(self) -> str:
+        """
+        material name
+
+        Examples
+        ```python
+        my_material.name = "my new material"
+        ```
+
+        Returns
+        -------
+        str
+            material name
+        """
+        return self._json_attrs.name
+
+    @name.setter
+    @beartype
+    def name(self, new_name: str) -> None:
+        """
+        set the name of the material
+
+        Parameters
+        ----------
+        new_name: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, name=new_name)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def identifiers(self) -> List[Dict[str, str]]:
+        """
+        get the identifiers for this material
+
+        ```python
+        my_material.identifier = {"alternative_names": "my material alternative name"}
+        ```
+
+        Returns
+        -------
+        List[Dict[str, str]]
+            list of dictionary that has identifiers for this material
+        """
+        return self._json_attrs.identifiers.copy()
+
+    @identifiers.setter
+    @beartype
+    def identifiers(self, new_identifiers_list: List[Dict[str, str]]) -> None:
+        """
+        set the list of identifiers for this material
+
+        the identifier keys must come from the
+        material identifiers keyword within the CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_identifiers_list: List[Dict[str, str]]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, identifiers=new_identifiers_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def component(self) -> List["Material"]:
+        """
+        list of component ([material nodes](./)) that make up this material
+
+        Examples
+        --------
+        ```python
+        # material component
+        my_component = [
+            cript.Material(
+                name="my component material 1",
+                identifiers=[{"alternative_names": "component 1 alternative name"}],
+            ),
+            cript.Material(
+                name="my component material 2",
+                identifiers=[{"alternative_names": "component 2 alternative name"}],
+            ),
+        ]
+
+
+        identifiers = [{"alternative_names": "my material alternative name"}]
+        my_material = cript.Material(name="my material", component=my_component, identifiers=identifiers)
+        ```
+
+        Returns
+        -------
+        List[Material]
+            list of component that make up this material
+        """
+        return self._json_attrs.component
+
+    @component.setter
+    @beartype
+    def component(self, new_component_list: List["Material"]) -> None:
+        """
+        set the list of component (material nodes) that make up this material
+
+        Parameters
+        ----------
+        new_component_list: List["Material"]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, component=new_component_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def parent_material(self) -> Optional["Material"]:
+        """
+        List of parent materials
+
+        Returns
+        -------
+        List["Material"]
+            list of parent materials
+        """
+        return self._json_attrs.parent_material
+
+    @parent_material.setter
+    @beartype
+    def parent_material(self, new_parent_material: "Material") -> None:
+        """
+        set the [parent materials](./) for this material
+
+        Parameters
+        ----------
+        new_parent_material: "Material"
+
+        Returns
+        -------
+        None
+        """
+
+        new_attrs = replace(self._json_attrs, parent_material=new_parent_material)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def computational_forcefield(self) -> Any:
+        """
+        list of [computational_forcefield](../../subobjects/computational_forcefield) for this material node
+
+        Returns
+        -------
+        List[ComputationForcefield]
+            list of computational_forcefield that created this material
+        """
+        return self._json_attrs.computational_forcefield
+
+    @computational_forcefield.setter
+    @beartype
+    def computational_forcefield(self, new_computational_forcefield_list: Any) -> None:
+        """
+        sets the list of computational forcefields for this material
+
+        Parameters
+        ----------
+        new_computation_forcefield_list: List[ComputationalForcefield]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, computational_forcefield=new_computational_forcefield_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def keyword(self) -> List[str]:
+        """
+        List of keyword for this material
+
+        the material keyword must come from the
+        [CRIPT controlled vocabulary](https://criptapp.org/keys/material-keyword/)
+
+        ```python
+        identifiers = [{"alternative_names": "my material alternative name"}]
+
+        # keyword
+        material_keyword = ["acetylene", "acrylate", "alternating"]
+
+        my_material = cript.Material(
+            name="my material", keyword=material_keyword, identifiers=identifiers
+        )
+        ```
+
+        Returns
+        -------
+        List[str]
+            list of material keyword
+        """
+        return self._json_attrs.keyword
+
+    @keyword.setter
+    @beartype
+    def keyword(self, new_keyword_list: List[str]) -> None:
+        """
+        set the keyword for this material
+
+        the material keyword must come from the CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_keyword_list
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, keyword=new_keyword_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def process(self) -> Optional[Process]:
+        return self._json_attrs.process  # type: ignore
+
+    @process.setter
+    def process(self, new_process: Process) -> None:
+        new_attrs = replace(self._json_attrs, process=new_process)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    def property(self) -> List[Any]:
+        """
+        list of material [property](../../subobjects/property)
+
+        ```python
+        # property subobject
+        my_property = cript.Property(key="modulus_shear", type="min", value=1.23, unit="gram")
+
+        my_material.property = my_property
+        ```
+
+        Returns
+        -------
+        List[Property]
+            list of property that define this material
+        """
+        return self._json_attrs.property.copy()
+
+    @property.setter
+    @beartype
+    def property(self, new_property_list: List[Any]) -> None:
+        """
+        set the list of properties for this material
+
+        Parameters
+        ----------
+        new_property_list: List[Property]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, property=new_property_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @classmethod
+    @beartype
+    def _from_json(cls, json_dict: Dict):
+        """
+        Create a new instance of a node from a JSON representation.
+
+        Parameters
+        ----------
+        json_dict : Dict
+            A JSON dictionary representing a node
+
+        Returns
+        -------
+        node
+            A new instance of a node.
+
+        Notes
+        -----
+        required fields in JSON:
+        * `name`: The name of the node
+
+        optional fields in JSON:
+        * `identifiers`: A list of material identifiers.
+            * If the `identifiers` property is not present in the JSON dictionary,
+            it will be set to an empty list.
+        """
+        from cript.nodes.util.material_deserialization import (
+            _deserialize_flattened_material_identifiers,
+        )
+
+        json_dict = _deserialize_flattened_material_identifiers(json_dict)
+
+        return super()._from_json(json_dict)
+
+
+ + + +
+ + + + + + + +
+ + + +

+component: List[Material] + + + property + writable + + +

+ + +
+ +

list of component (material nodes) that make up this material

+ + + +

Examples:

+
# material component
+my_component = [
+    cript.Material(
+        name="my component material 1",
+        identifiers=[{"alternative_names": "component 1 alternative name"}],
+    ),
+    cript.Material(
+        name="my component material 2",
+        identifiers=[{"alternative_names": "component 2 alternative name"}],
+    ),
+]
+
+
+identifiers = [{"alternative_names": "my material alternative name"}]
+my_material = cript.Material(name="my material", component=my_component, identifiers=identifiers)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

list of component that make up this material

+
+
+
+ +
+ +
+ + + +

+computational_forcefield: Any + + + property + writable + + +

+ + +
+ +

list of computational_forcefield for this material node

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[ComputationForcefield] + +
+

list of computational_forcefield that created this material

+
+
+
+ +
+ +
+ + + +

+identifiers: List[Dict[str, str]] + + + property + writable + + +

+ + +
+ +

get the identifiers for this material

+
my_material.identifier = {"alternative_names": "my material alternative name"}
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Dict[str, str]] + +
+

list of dictionary that has identifiers for this material

+
+
+
+ +
+ +
+ + + +

+keyword: List[str] + + + property + writable + + +

+ + +
+ +

List of keyword for this material

+

the material keyword must come from the +CRIPT controlled vocabulary

+
identifiers = [{"alternative_names": "my material alternative name"}]
+
+# keyword
+material_keyword = ["acetylene", "acrylate", "alternating"]
+
+my_material = cript.Material(
+    name="my material", keyword=material_keyword, identifiers=identifiers
+)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[str] + +
+

list of material keyword

+
+
+
+ +
+ +
+ + + +

+name: str + + + property + writable + + +

+ + +
+ +

material name

+

Examples +

my_material.name = "my new material"
+

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

material name

+
+
+
+ +
+ +
+ + + +

+parent_material: Optional[Material] + + + property + writable + + +

+ + +
+ +

List of parent materials

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

list of parent materials

+
+
+
+ +
+ +
+ + + +

+property: List[Any] + + + property + writable + + +

+ + +
+ +

list of material property

+
# property subobject
+my_property = cript.Property(key="modulus_shear", type="min", value=1.23, unit="gram")
+
+my_material.property = my_property
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Property] + +
+

list of property that define this material

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Material attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/material.py +
59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Material attributes
+    """
+
+    # identifier sub-object for the material
+    identifiers: List[Dict[str, str]] = field(default_factory=dict)  # type: ignore
+    # TODO add proper typing in future, using Any for now to avoid circular import error
+    component: List["Material"] = field(default_factory=list)
+    process: Optional[Process] = None
+    property: List[Any] = field(default_factory=list)
+    parent_material: Optional["Material"] = None
+    computational_forcefield: Optional[Any] = None
+    keyword: List[str] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, identifiers, component=None, process=None, property=None, parent_material=None, computational_forcefield=None, keyword=None, notes='', **kwargs) + +

+ + +
+ +

create a material node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+ +
+
+ required +
identifiers + List[Dict[str, str]] + +
+ +
+
+ required +
component + Optional[List[Material]] + +
+ +
+
+ None +
property + Optional[List[Any]] + +
+ +
+
+ None +
process + Optional[Process] + +
+ +
+
+ None +
parent_material + Optional[Material] + +
+ +
+
+ None +
computational_forcefield + Optional[Any] + +
+ +
+
+ None +
keyword + Optional[List[str]] + +
+ +
+
+ None +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiate a material node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/material.py +
@beartype
+def __init__(
+    self,
+    name: str,
+    identifiers: List[Dict[str, str]],
+    component: Optional[List["Material"]] = None,
+    process: Optional[Process] = None,
+    property: Optional[List[Any]] = None,
+    parent_material: Optional["Material"] = None,
+    computational_forcefield: Optional[Any] = None,
+    keyword: Optional[List[str]] = None,
+    notes: str = "",
+    **kwargs
+):
+    """
+    create a material node
+
+    Parameters
+    ----------
+    name: str
+    identifiers: List[Dict[str, str]]
+    component: List["Material"], default=None
+    property: Optional[Process], default=None
+    process: List[Process], default=None
+    parent_material: "Material", default=None
+    computational_forcefield: ComputationalForcefield, default=None
+    keyword: List[str], default=None
+
+    Returns
+    -------
+    None
+        Instantiate a material node
+    """
+
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    if component is None:
+        component = []
+
+    if property is None:
+        property = []
+
+    if keyword is None:
+        keyword = []
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        name=name,
+        identifiers=identifiers,
+        component=component,
+        process=process,
+        property=property,
+        parent_material=parent_material,
+        computational_forcefield=computational_forcefield,
+        keyword=keyword,
+    )
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/process/index.html b/nodes/primary_nodes/process/index.html new file mode 100644 index 000000000..51923dabd --- /dev/null +++ b/nodes/primary_nodes/process/index.html @@ -0,0 +1,3852 @@ + + + + + + + + + + + + + + + + + + + + + + Process - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Process

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Process + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

The process node contains a list of ingredients, quantities, and procedure information for an experimental material +transformation (chemical and physical).

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
typestrmixtype of processTrueTrue
ingredientlist[Ingredient]ingredients
descriptionstrTo oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added.explanation of the process
equipmentlist[Equipment]equipment used in the process
productlist[Material]desired material produced from the process
wastelist[Material]material sent to waste
prerequisite_ processeslist[Process]processes that must be completed prior to the start of this process
conditionlist[Condition]global process condition
propertylist[Property]process properties
keywordlist[str]words that classify the processTrue
citationlist[Citation]reference to a book, paper, or scholarly work
+
Available Subobjects
+ +
JSON Representation
+
{
+   "name":"my minimal process name",
+   "node":["Process"],
+   "type":"affinity_pure",
+   "keyword":[],
+   "uid":"_:f8ef33f3-677a-40f3-b24e-65ab2c99d796",
+   "uuid":"f8ef33f3-677a-40f3-b24e-65ab2c99d796"
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/process.py +
  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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+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
+515
+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
+561
+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
class Process(PrimaryBaseNode):
+    """
+    ## Definition
+    The process node contains a list of ingredients, quantities, and procedure information for an experimental material
+    transformation (chemical and physical).
+
+    ## Attributes
+
+    | attribute               | type             | example                                                                         | description                                                         | required | vocab |
+    |-------------------------|------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------|----------|-------|
+    | type                    | str              | mix                                                                             | type of process                                                     | True     | True  |
+    | ingredient              | list[Ingredient] |                                                                                 | ingredients                                                         |          |       |
+    | description             | str              | To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added. | explanation of the process                                          |          |       |
+    | equipment               | list[Equipment]  |                                                                                 | equipment used in the process                                       |          |       |
+    | product                 | list[Material]   |                                                                                 | desired material produced from the process                          |          |       |
+    | waste                   | list[Material]   |                                                                                 | material sent to waste                                              |          |       |
+    | prerequisite_ processes | list[Process]    |                                                                                 | processes that must be completed prior to the start of this process |          |       |
+    | condition               | list[Condition]  |                                                                                 | global process condition                                            |          |       |
+    | property                | list[Property]   |                                                                                 | process properties                                                  |          |       |
+    | keyword                 | list[str]        |                                                                                 | words that classify the process                                     |          | True  |
+    | citation                | list[Citation]   |                                                                                 | reference to a book, paper, or scholarly work                       |          |       |
+
+    ## Available Subobjects
+    * [Ingredient](../../subobjects/ingredient)
+    * [equipment](../../subobjects/equipment)
+    * [Property](../../subobjects/property)
+    * [Condition](../../subobjects/condition)
+    * [Citation](../../subobjects/citation)
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my minimal process name",
+       "node":["Process"],
+       "type":"affinity_pure",
+       "keyword":[],
+       "uid":"_:f8ef33f3-677a-40f3-b24e-65ab2c99d796",
+       "uuid":"f8ef33f3-677a-40f3-b24e-65ab2c99d796"
+    }
+    ```
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Process attributes
+        """
+
+        type: str = ""
+        # TODO add proper typing in future, using Any for now to avoid circular import error
+        ingredient: List[Any] = field(default_factory=list)
+        description: str = ""
+        equipment: List[Any] = field(default_factory=list)
+        product: List[Any] = field(default_factory=list)
+        waste: List[Any] = field(default_factory=list)
+        prerequisite_process: List["Process"] = field(default_factory=list)
+        condition: List[Any] = field(default_factory=list)
+        property: List[Any] = field(default_factory=list)
+        keyword: Optional[List[str]] = None
+        citation: List[Any] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        name: str,
+        type: str,
+        ingredient: Optional[List[Any]] = None,
+        description: str = "",
+        equipment: Optional[List[Any]] = None,
+        product: Optional[List[Any]] = None,
+        waste: Optional[List[Any]] = None,
+        prerequisite_process: Optional[List[Any]] = None,
+        condition: Optional[List[Any]] = None,
+        property: Optional[List[Any]] = None,
+        keyword: Optional[List[str]] = None,
+        citation: Optional[List[Any]] = None,
+        notes: str = "",
+        **kwargs
+    ) -> None:
+        """
+        create a process node
+
+        ```python
+        my_process = cript.Process(name="my process name", type="affinity_pure")
+        ```
+
+        Parameters
+        ----------
+        ingredient: List[Ingredient]
+            [ingredient](../../subobjects/ingredient) used in this process
+        type: str = ""
+            Process type must come from
+            [CRIPT Controlled vocabulary process type](https://criptapp.org/keys/process-type/)
+        description: str = ""
+            description of this process
+        equipment: List[Equipment] = None
+            list of [equipment](../../subobjects/equipment) used in this process
+        product: List[Material] = None
+            product that this process created
+        waste: List[Material] = None
+            waste that this process created
+        condition: List[Condition] = None
+            list of [condition](../../subobjects/condition) that this process was created under
+        property: List[Property] = None
+            list of [properties](../../subobjects/property) for this process
+        keyword: List[str] = None
+            list of keywords for this process must come from
+            [CRIPT process keyword controlled keyword](https://criptapp.org/keys/process-keyword/)
+        citation: List[Citation] = None
+            list of [citation](../../subobjects/citation)
+
+        Returns
+        -------
+        None
+            instantiate a process node
+        """
+
+        if ingredient is None:
+            ingredient = []
+
+        if equipment is None:
+            equipment = []
+
+        if product is None:
+            product = []
+
+        if waste is None:
+            waste = []
+
+        if prerequisite_process is None:
+            prerequisite_process = []
+
+        if condition is None:
+            condition = []
+
+        if property is None:
+            property = []
+
+        if keyword is None:
+            keyword = []
+
+        if citation is None:
+            citation = []
+
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        new_attrs = replace(
+            self._json_attrs,
+            ingredient=ingredient,
+            type=type,
+            description=description,
+            equipment=equipment,
+            product=product,
+            waste=waste,
+            condition=condition,
+            prerequisite_process=prerequisite_process,
+            property=property,
+            keyword=keyword,
+            citation=citation,
+        )
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        Process type must come from the [CRIPT controlled vocabulary](https://criptapp.org/keys/process-type/)
+
+        Examples
+        --------
+        ```python
+        my_process.type = "affinity_pure"
+        ```
+
+        Returns
+        -------
+        str
+            Select a [Process type](https://criptapp.org/keys/process-type/) from CRIPT controlled vocabulary
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_process_type: str) -> None:
+        """
+        set process type from CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_process_type: str
+            new process type from CRIPT controlled vocabulary
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, type=new_process_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def ingredient(self) -> List[Any]:
+        """
+        List of [ingredient](../../subobjects/ingredient) for this process
+
+        Examples
+        ---------
+        ```python
+        my_ingredients = cript.Ingredient(
+            material=simple_material_node,
+            quantities=[simple_quantity_node],
+        )
+
+        my_process.ingredient = [my_ingredients]
+        ```
+
+        Returns
+        -------
+        List[Ingredient]
+            list of ingredients for this process
+        """
+        return self._json_attrs.ingredient.copy()
+
+    @ingredient.setter
+    @beartype
+    def ingredient(self, new_ingredient_list: List[Any]) -> None:
+        """
+        set the list of the ingredients for this process
+
+        Parameters
+        ----------
+        new_ingredient_list
+            list of ingredients to replace the current list
+
+        Returns
+        -------
+        None
+        """
+        # TODO need to validate with CRIPT controlled vocabulary
+        #   and if invalid then raise an error immediately
+        new_attrs = replace(self._json_attrs, ingredient=new_ingredient_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def description(self) -> str:
+        """
+        description of this process
+
+        Examples
+        --------
+        ```python
+        my_process.description = "To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added"
+        ```
+
+        Returns
+        -------
+        str
+            description of this process
+        """
+        return self._json_attrs.description
+
+    @description.setter
+    @beartype
+    def description(self, new_description: str) -> None:
+        """
+        set the description of this process
+
+        Parameters
+        ----------
+        new_description: str
+            new process description to replace the current one
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, description=new_description)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def equipment(self) -> List[Any]:
+        """
+        List of [equipment](../../subobjects/equipment) used for this process
+
+        Returns
+        -------
+        List[Equipment]
+            list of equipment used for this process
+        """
+        return self._json_attrs.equipment.copy()
+
+    @equipment.setter
+    @beartype
+    def equipment(self, new_equipment_list: List[Any]) -> None:
+        """
+        set the list of equipment used for this process
+
+        Parameters
+        ----------
+        new_equipment_list
+            new equipment list to replace the current equipment list for this process
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, equipment=new_equipment_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def product(self) -> List[Any]:
+        """
+        List of product (material nodes) for this process
+
+        Returns
+        -------
+        List[Material]
+            List of process product (Material nodes)
+        """
+        return self._json_attrs.product.copy()
+
+    @product.setter
+    @beartype
+    def product(self, new_product_list: List[Any]) -> None:
+        """
+        set the product list for this process
+
+        Parameters
+        ----------
+        new_product_list: List[Material]
+            replace the current list of process product
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, product=new_product_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def waste(self) -> List[Any]:
+        """
+        List of waste that resulted from this process
+
+        Examples
+        --------
+        ```python
+        my_process.waste = my_waste_material
+        ```
+
+        Returns
+        -------
+        List[Material]
+            list of waste materials that resulted from this product
+        """
+        return self._json_attrs.waste.copy()
+
+    @waste.setter
+    @beartype
+    def waste(self, new_waste_list: List[Any]) -> None:
+        """
+        set the list of waste (Material node) for that resulted from this process
+
+        Parameters
+        ----------
+        new_waste_list: List[Material]
+            replace the list waste that resulted from this process
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, waste=new_waste_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def prerequisite_process(self) -> List["Process"]:
+        """
+        list of prerequisite process nodes
+
+        Examples
+        --------
+        ```python
+
+        my_prerequisite_process = [
+            cript.Process(name="prerequisite processes 1", type="blow_molding"),
+            cript.Process(name="prerequisite processes 2", type="centrifugation"),
+        ]
+
+        my_process.prerequisite_process = my_prerequisite_process
+        ```
+
+        Returns
+        -------
+        List[Process]
+            list of process that had to happen before this process
+        """
+        return self._json_attrs.prerequisite_process.copy()
+
+    @prerequisite_process.setter
+    @beartype
+    def prerequisite_process(self, new_prerequisite_process_list: List["Process"]) -> None:
+        """
+        set the prerequisite_process for the process node
+
+        Parameters
+        ----------
+        new_prerequisite_process_list: List["Process"]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, prerequisite_process=new_prerequisite_process_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def condition(self) -> List[Any]:
+        """
+        List of condition present for this process
+
+        Examples
+        -------
+        ```python
+        # create condition node
+        my_condition = cript.Condition(key="atm", type="min", value=1)
+
+        my_process.condition = [my_condition]
+        ```
+
+        Returns
+        -------
+        List[Condition]
+            list of condition for this process node
+        """
+        return self._json_attrs.condition.copy()
+
+    @condition.setter
+    @beartype
+    def condition(self, new_condition_list: List[Any]) -> None:
+        """
+        set the list of condition for this process
+
+        Parameters
+        ----------
+        new_condition_list: List[Condition]
+            replace the condition list
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, condition=new_condition_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def keyword(self) -> List[str]:
+        """
+        List of keyword for this process
+
+        [Process keyword](https://criptapp.org/keys/process-keyword/) must come from CRIPT controlled vocabulary
+
+        Returns
+        -------
+        List[str]
+            list of keywords for this process nod
+        """
+        return self._json_attrs.keyword.copy()  # type: ignore
+
+    @keyword.setter
+    @beartype
+    def keyword(self, new_keyword_list: List[str]) -> None:
+        """
+        set the list of keyword for this process from CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_keyword_list: List[str]
+            replace the current list of keyword
+
+        Returns
+        -------
+        None
+        """
+        # TODO validate with CRIPT controlled vocabulary
+        new_attrs = replace(self._json_attrs, keyword=new_keyword_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Any]:
+        """
+        List of citation for this process
+
+        Examples
+        --------
+        ```python
+        # crate reference node for this citation
+        my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+        # create citation node
+        my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+        my_process.citation = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of citation for this process node
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation_list: List[Any]) -> None:
+        """
+        set the list of citation for this process
+
+        Parameters
+        ----------
+        new_citation_list: List[Citation]
+            replace the current list of citation
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def property(self) -> List[Any]:
+        """
+        List of [Property nodes](../../subobjects/property) for this process
+
+        Examples
+        --------
+        ```python
+        # create property node
+         my_property = cript.Property(key="modulus_shear", type="min", value=1.23, unit="gram")
+
+         my_process.properties = [my_property]
+        ```
+
+        Returns
+        -------
+        List[Property]
+            list of properties for this process
+        """
+        return self._json_attrs.property.copy()
+
+    @property.setter
+    @beartype
+    def property(self, new_property_list: List[Any]) -> None:
+        """
+        set the list of Property nodes for this process
+
+        Parameters
+        ----------
+        new_property_list: List[Property]
+            replace the current list of properties
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, property=new_property_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Any] + + + property + writable + + +

+ + +
+ +

List of citation for this process

+ + + +

Examples:

+
# crate reference node for this citation
+my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+# create citation node
+my_citation = cript.Citation(type="derived_from", reference=my_reference)
+
+my_process.citation = [my_citation]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Citation] + +
+

list of citation for this process node

+
+
+
+ +
+ +
+ + + +

+condition: List[Any] + + + property + writable + + +

+ + +
+ +

List of condition present for this process

+ + + +

Examples:

+
# create condition node
+my_condition = cript.Condition(key="atm", type="min", value=1)
+
+my_process.condition = [my_condition]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Condition] + +
+

list of condition for this process node

+
+
+
+ +
+ +
+ + + +

+description: str + + + property + writable + + +

+ + +
+ +

description of this process

+ + + +

Examples:

+
my_process.description = "To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

description of this process

+
+
+
+ +
+ +
+ + + +

+equipment: List[Any] + + + property + writable + + +

+ + +
+ +

List of equipment used for this process

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Equipment] + +
+

list of equipment used for this process

+
+
+
+ +
+ +
+ + + +

+ingredient: List[Any] + + + property + writable + + +

+ + +
+ +

List of ingredient for this process

+ + + +

Examples:

+
my_ingredients = cript.Ingredient(
+    material=simple_material_node,
+    quantities=[simple_quantity_node],
+)
+
+my_process.ingredient = [my_ingredients]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Ingredient] + +
+

list of ingredients for this process

+
+
+
+ +
+ +
+ + + +

+keyword: List[str] + + + property + writable + + +

+ + +
+ +

List of keyword for this process

+

Process keyword must come from CRIPT controlled vocabulary

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[str] + +
+

list of keywords for this process nod

+
+
+
+ +
+ +
+ + + +

+prerequisite_process: List[Process] + + + property + writable + + +

+ + +
+ +

list of prerequisite process nodes

+ + + +

Examples:

+
my_prerequisite_process = [
+    cript.Process(name="prerequisite processes 1", type="blow_molding"),
+    cript.Process(name="prerequisite processes 2", type="centrifugation"),
+]
+
+my_process.prerequisite_process = my_prerequisite_process
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Process] + +
+

list of process that had to happen before this process

+
+
+
+ +
+ +
+ + + +

+product: List[Any] + + + property + writable + + +

+ + +
+ +

List of product (material nodes) for this process

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

List of process product (Material nodes)

+
+
+
+ +
+ +
+ + + +

+property: List[Any] + + + property + writable + + +

+ + +
+ +

List of Property nodes for this process

+ + + +

Examples:

+
# create property node
+ my_property = cript.Property(key="modulus_shear", type="min", value=1.23, unit="gram")
+
+ my_process.properties = [my_property]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Property] + +
+

list of properties for this process

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

Process type must come from the CRIPT controlled vocabulary

+ + + +

Examples:

+
my_process.type = "affinity_pure"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Select a Process type from CRIPT controlled vocabulary

+
+
+
+ +
+ +
+ + + +

+waste: List[Any] + + + property + writable + + +

+ + +
+ +

List of waste that resulted from this process

+ + + +

Examples:

+
my_process.waste = my_waste_material
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

list of waste materials that resulted from this product

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Process attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/process.py +
52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Process attributes
+    """
+
+    type: str = ""
+    # TODO add proper typing in future, using Any for now to avoid circular import error
+    ingredient: List[Any] = field(default_factory=list)
+    description: str = ""
+    equipment: List[Any] = field(default_factory=list)
+    product: List[Any] = field(default_factory=list)
+    waste: List[Any] = field(default_factory=list)
+    prerequisite_process: List["Process"] = field(default_factory=list)
+    condition: List[Any] = field(default_factory=list)
+    property: List[Any] = field(default_factory=list)
+    keyword: Optional[List[str]] = None
+    citation: List[Any] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, type, ingredient=None, description='', equipment=None, product=None, waste=None, prerequisite_process=None, condition=None, property=None, keyword=None, citation=None, notes='', **kwargs) + +

+ + +
+ +

create a process node

+
my_process = cript.Process(name="my process name", type="affinity_pure")
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
ingredient + Optional[List[Any]] + +
+

ingredient used in this process

+
+
+ None +
type + str + +
+

Process type must come from +CRIPT Controlled vocabulary process type

+
+
+ required +
description + str + +
+

description of this process

+
+
+ '' +
equipment + Optional[List[Any]] + +
+

list of equipment used in this process

+
+
+ None +
product + Optional[List[Any]] + +
+

product that this process created

+
+
+ None +
waste + Optional[List[Any]] + +
+

waste that this process created

+
+
+ None +
condition + Optional[List[Any]] + +
+

list of condition that this process was created under

+
+
+ None +
property + Optional[List[Any]] + +
+

list of properties for this process

+
+
+ None +
keyword + Optional[List[str]] + +
+

list of keywords for this process must come from +CRIPT process keyword controlled keyword

+
+
+ None +
citation + Optional[List[Any]] + +
+

list of citation

+
+
+ None +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate a process node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/process.py +
@beartype
+def __init__(
+    self,
+    name: str,
+    type: str,
+    ingredient: Optional[List[Any]] = None,
+    description: str = "",
+    equipment: Optional[List[Any]] = None,
+    product: Optional[List[Any]] = None,
+    waste: Optional[List[Any]] = None,
+    prerequisite_process: Optional[List[Any]] = None,
+    condition: Optional[List[Any]] = None,
+    property: Optional[List[Any]] = None,
+    keyword: Optional[List[str]] = None,
+    citation: Optional[List[Any]] = None,
+    notes: str = "",
+    **kwargs
+) -> None:
+    """
+    create a process node
+
+    ```python
+    my_process = cript.Process(name="my process name", type="affinity_pure")
+    ```
+
+    Parameters
+    ----------
+    ingredient: List[Ingredient]
+        [ingredient](../../subobjects/ingredient) used in this process
+    type: str = ""
+        Process type must come from
+        [CRIPT Controlled vocabulary process type](https://criptapp.org/keys/process-type/)
+    description: str = ""
+        description of this process
+    equipment: List[Equipment] = None
+        list of [equipment](../../subobjects/equipment) used in this process
+    product: List[Material] = None
+        product that this process created
+    waste: List[Material] = None
+        waste that this process created
+    condition: List[Condition] = None
+        list of [condition](../../subobjects/condition) that this process was created under
+    property: List[Property] = None
+        list of [properties](../../subobjects/property) for this process
+    keyword: List[str] = None
+        list of keywords for this process must come from
+        [CRIPT process keyword controlled keyword](https://criptapp.org/keys/process-keyword/)
+    citation: List[Citation] = None
+        list of [citation](../../subobjects/citation)
+
+    Returns
+    -------
+    None
+        instantiate a process node
+    """
+
+    if ingredient is None:
+        ingredient = []
+
+    if equipment is None:
+        equipment = []
+
+    if product is None:
+        product = []
+
+    if waste is None:
+        waste = []
+
+    if prerequisite_process is None:
+        prerequisite_process = []
+
+    if condition is None:
+        condition = []
+
+    if property is None:
+        property = []
+
+    if keyword is None:
+        keyword = []
+
+    if citation is None:
+        citation = []
+
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    new_attrs = replace(
+        self._json_attrs,
+        ingredient=ingredient,
+        type=type,
+        description=description,
+        equipment=equipment,
+        product=product,
+        waste=waste,
+        condition=condition,
+        prerequisite_process=prerequisite_process,
+        property=property,
+        keyword=keyword,
+        citation=citation,
+    )
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/project/index.html b/nodes/primary_nodes/project/index.html new file mode 100644 index 000000000..1f33a1a73 --- /dev/null +++ b/nodes/primary_nodes/project/index.html @@ -0,0 +1,2191 @@ + + + + + + + + + + + + + + + + + + + + + + Project - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Project

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Project + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

A Project +is the highest level node that is Not nested inside any other node. +A Project can be thought of as a folder that can contain Collections and +Materials.

+ + + + + + + + + + + + + + + + + + + + +
attributetypedescription
collectionList[Collection]collections that relate to the project
materialsList[Materials]materials owned by the project
+
JSON Representation
+
{
+   "name":"my project name",
+   "node":["Project"],
+   "uid":"_:270168b7-fc29-4c37-aa93-334212e1d962",
+   "uuid":"270168b7-fc29-4c37-aa93-334212e1d962",
+   "collection":[
+      {
+        "name":"my collection name",
+         "node":["Collection"],
+         "uid":"_:c60955a5-4de0-4da5-b2c8-77952b1d9bfa",
+         "uuid":"c60955a5-4de0-4da5-b2c8-77952b1d9bfa",
+         "experiment":[
+            {
+               "name":"my experiment name",
+               "node":["Experiment"],
+               "uid":"_:a8cbc083-506e-45ce-bb8f-5e50917ab361",
+               "uuid":"a8cbc083-506e-45ce-bb8f-5e50917ab361"
+            }
+         ],
+         "inventory":[],
+         "citation":[]
+      }
+   ]
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/project.py +
class Project(PrimaryBaseNode):
+    """
+    ## Definition
+    A [Project](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=7)
+    is the highest level node that is Not nested inside any other node.
+    A Project can be thought of as a folder that can contain [Collections](../collection) and
+    [Materials](../material).
+
+
+    | attribute   | type             | description                            |
+    |-------------|------------------|----------------------------------------|
+    | collection | List[Collection] | collections that relate to the project |
+    | materials   | List[Materials]  | materials owned by the project         |
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"my project name",
+       "node":["Project"],
+       "uid":"_:270168b7-fc29-4c37-aa93-334212e1d962",
+       "uuid":"270168b7-fc29-4c37-aa93-334212e1d962",
+       "collection":[
+          {
+            "name":"my collection name",
+             "node":["Collection"],
+             "uid":"_:c60955a5-4de0-4da5-b2c8-77952b1d9bfa",
+             "uuid":"c60955a5-4de0-4da5-b2c8-77952b1d9bfa",
+             "experiment":[
+                {
+                   "name":"my experiment name",
+                   "node":["Experiment"],
+                   "uid":"_:a8cbc083-506e-45ce-bb8f-5e50917ab361",
+                   "uuid":"a8cbc083-506e-45ce-bb8f-5e50917ab361"
+                }
+             ],
+             "inventory":[],
+             "citation":[]
+          }
+       ]
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all Project attributes
+        """
+
+        member: List[User] = field(default_factory=list)
+        admin: List[User] = field(default_factory=list)
+        collection: List[Collection] = field(default_factory=list)
+        material: List[Material] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, name: str, collection: Optional[List[Collection]] = None, material: Optional[List[Material]] = None, notes: str = "", **kwargs):
+        """
+        Create a Project node with Project name and Group
+
+        Parameters
+        ----------
+        name: str
+            project name
+        collection: List[Collection]
+            list of Collections that belongs to this Project
+         material: List[Material]
+            list of materials that belongs to this project
+        notes: str
+            notes for this project
+
+        Returns
+        -------
+        None
+            instantiate a Project node
+        """
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        if collection is None:
+            collection = []
+
+        if material is None:
+            material = []
+
+        self._json_attrs = replace(self._json_attrs, name=name, collection=collection, material=material)
+        self.validate()
+
+    def validate(self, api=None, is_patch=False):
+        from cript.nodes.exceptions import (
+            CRIPTOrphanedMaterialError,
+            get_orphaned_experiment_exception,
+        )
+
+        # First validate like other nodes
+        super().validate(api=api, is_patch=is_patch)
+
+        # Check graph for orphaned nodes, that should be listed in project
+        # Project.materials should contain all material nodes
+        project_graph_materials = self.find_children({"node": ["Material"]})
+        # Combine all materials listed in the project inventories
+        project_inventory_materials = []
+        for inventory in self.find_children({"node": ["Inventory"]}):
+            for material in inventory.material:
+                project_inventory_materials.append(material)
+        for material in project_graph_materials:
+            if material not in self.material and material not in project_inventory_materials:
+                raise CRIPTOrphanedMaterialError(material)
+
+        # Check graph for orphaned nodes, that should be listed in the experiments
+        project_experiments = self.find_children({"node": ["Experiment"]})
+        # There are 4 different types of nodes Experiments are collecting.
+        node_types = ("Process", "Computation", "ComputationProcess", "Data")
+        # We loop over them with the same logic
+        for node_type in node_types:
+            # All in the graph has to be in at least one experiment
+            project_graph_nodes = self.find_children({"node": [node_type]})
+            node_type_attr = node_type.lower()
+            # Non-consistent naming makes this necessary for Computation Process
+            if node_type == "ComputationProcess":
+                node_type_attr = "computation_process"
+
+            # Concatenation of all experiment attributes (process, computation, etc.)
+            # Every node of the graph must be present somewhere in this concatenated list.
+            experiment_nodes = []
+            for experiment in project_experiments:
+                for ex_node in getattr(experiment, node_type_attr):
+                    experiment_nodes.append(ex_node)
+            for node in project_graph_nodes:
+                if node not in experiment_nodes:
+                    raise get_orphaned_experiment_exception(node)
+
+    @property
+    @beartype
+    def member(self) -> List[User]:
+        return self._json_attrs.member.copy()
+
+    @property
+    @beartype
+    def admin(self) -> List[User]:
+        return self._json_attrs.admin
+
+    @property
+    @beartype
+    def collection(self) -> List[Collection]:
+        """
+        Collection is a Project node's property that can be set during creation in the constructor
+        or later by setting the project's property
+
+        Examples
+        --------
+        ```python
+        my_new_collection = cript.Collection(
+            name="my collection name", experiments=[my_experiment_node]
+        )
+
+        my_project.collection = my_new_collection
+        ```
+
+        Returns
+        -------
+        Collection: List[Collection]
+            the list of collections within this project
+        """
+        return self._json_attrs.collection
+
+    @collection.setter
+    @beartype
+    def collection(self, new_collection: List[Collection]) -> None:
+        """
+        set list of collections for the project node
+
+        Parameters
+        ----------
+        new_collection: List[Collection]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, collection=new_collection)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def material(self) -> List[Material]:
+        """
+        List of Materials that belong to this Project.
+
+        Examples
+        --------
+        ```python
+        identifiers = [{"alternative_names": "my material alternative name"}]
+        my_material = cript.Material(name="my material", identifiers=identifiers)
+
+        my_project.material = [my_material]
+        ```
+
+        Returns
+        -------
+        Material: List[Material]
+            List of materials that belongs to this project
+        """
+        return self._json_attrs.material
+
+    @material.setter
+    @beartype
+    def material(self, new_materials: List[Material]) -> None:
+        """
+        set the list of materials for this project
+
+        Parameters
+        ----------
+        new_materials: List[Material]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, material=new_materials)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+collection: List[Collection] + + + property + writable + + +

+ + +
+ +

Collection is a Project node's property that can be set during creation in the constructor +or later by setting the project's property

+ + + +

Examples:

+
my_new_collection = cript.Collection(
+    name="my collection name", experiments=[my_experiment_node]
+)
+
+my_project.collection = my_new_collection
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
Collection + List[Collection] + +
+

the list of collections within this project

+
+
+
+ +
+ +
+ + + +

+material: List[Material] + + + property + writable + + +

+ + +
+ +

List of Materials that belong to this Project.

+ + + +

Examples:

+
identifiers = [{"alternative_names": "my material alternative name"}]
+my_material = cript.Material(name="my material", identifiers=identifiers)
+
+my_project.material = [my_material]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
Material + List[Material] + +
+

List of materials that belongs to this project

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all Project attributes

+ +
+ Source code in src/cript/nodes/primary_nodes/project.py +
55
+56
+57
+58
+59
+60
+61
+62
+63
+64
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all Project attributes
+    """
+
+    member: List[User] = field(default_factory=list)
+    admin: List[User] = field(default_factory=list)
+    collection: List[Collection] = field(default_factory=list)
+    material: List[Material] = field(default_factory=list)
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, collection=None, material=None, notes='', **kwargs) + +

+ + +
+ +

Create a Project node with Project name and Group

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

project name

+
+
+ required +
collection + Optional[List[Collection]] + +
+

list of Collections that belongs to this Project +material: List[Material] +list of materials that belongs to this project

+
+
+ None +
notes + str + +
+

notes for this project

+
+
+ '' +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate a Project node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/project.py +
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
@beartype
+def __init__(self, name: str, collection: Optional[List[Collection]] = None, material: Optional[List[Material]] = None, notes: str = "", **kwargs):
+    """
+    Create a Project node with Project name and Group
+
+    Parameters
+    ----------
+    name: str
+        project name
+    collection: List[Collection]
+        list of Collections that belongs to this Project
+     material: List[Material]
+        list of materials that belongs to this project
+    notes: str
+        notes for this project
+
+    Returns
+    -------
+    None
+        instantiate a Project node
+    """
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    if collection is None:
+        collection = []
+
+    if material is None:
+        material = []
+
+    self._json_attrs = replace(self._json_attrs, name=name, collection=collection, material=material)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/reference/index.html b/nodes/primary_nodes/reference/index.html new file mode 100644 index 000000000..4d072b0a2 --- /dev/null +++ b/nodes/primary_nodes/reference/index.html @@ -0,0 +1,4254 @@ + + + + + + + + + + + + + + + + + + + + + + Reference - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Reference

+ +
+ + + +
+

+ Bases: UUIDBaseNode

+ + +

Definition

+

The +Reference node

+

contains the metadata for a literature publication, book, or anything external to CRIPT. +The reference node does NOT contain the base attributes.

+

The reference node is always used inside the citation +sub-object to enable users to specify the context of the reference.

+

Attributes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
typestrjournal_articletype of literatureTrueTrue
titlestr'Living' Polymerstitle of publicationTrue
authorlist[str]Michael Szwarclist of authors
journalstrNaturejournal of the publication
publisherstrSpringerpublisher of publication
yearint1956year of publication
volumeint178volume of publication
issueint0issue of publication
pageslist[int][1168, 1169]page range of publication
doistr10.1038/1781168a0DOI: digital object identifierConditionally
issnstr1476-4687ISSN: international standard serial numberConditionally
arxiv_idstr1501arXiv identifier
pmidint########PMID: PubMed ID
websitestrhttps://www.nature.com/artic les/1781168a0website where the publication can be accessed
+

Available Subobjects

+
    +
  • None
  • +
+
+

Reference will always be public

+

Reference node is meant to always be public and static to allow globally link data to the reference

+
+

JSON Representation

+
{
+   "node":["Reference"],
+   "uid":"_:c681a947-0554-4acd-a01c-06ad76e34b87",
+   "uuid":"c681a947-0554-4acd-a01c-06ad76e34b87",
+   "author":["Ludwig Schneider","Marcus Müller"],
+   "doi":"10.1016/j.cpc.2018.08.011",
+   "issn":"0010-4655",
+   "journal":"Computer Physics Communications",
+   "pages":[463,476],
+   "publisher":"Elsevier",
+   "title":"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+   "type":"journal_article",
+   "website":"https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+   "year":2019
+}
+
+ +
+ Source code in src/cript/nodes/primary_nodes/reference.py +
  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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+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
+515
+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
+561
+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
+615
+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
class Reference(UUIDBaseNode):
+    """
+    ## Definition
+
+    The
+    [Reference node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=15)
+
+    contains the metadata for a literature publication, book, or anything external to CRIPT.
+    The reference node does NOT contain the base attributes.
+
+    The reference node is always used inside the citation
+    sub-object to enable users to specify the context of the reference.
+
+    ## Attributes
+    | attribute | type      | example                                    | description                                   | required      | vocab |
+    |-----------|-----------|--------------------------------------------|-----------------------------------------------|---------------|-------|
+    | type      | str       | journal_article                            | type of literature                            | True          | True  |
+    | title     | str       | 'Living' Polymers                          | title of publication                          | True          |       |
+    | author   | list[str] | Michael Szwarc                             | list of authors                               |               |       |
+    | journal   | str       | Nature                                     | journal of the publication                    |               |       |
+    | publisher | str       | Springer                                   | publisher of publication                      |               |       |
+    | year      | int       | 1956                                       | year of publication                           |               |       |
+    | volume    | int       | 178                                        | volume of publication                         |               |       |
+    | issue     | int       | 0                                          | issue of publication                          |               |       |
+    | pages     | list[int] | [1168, 1169]                               | page range of publication                     |               |       |
+    | doi       | str       | 10.1038/1781168a0                          | DOI: digital object identifier                | Conditionally |       |
+    | issn      | str       | 1476-4687                                  | ISSN: international standard serial number    | Conditionally |       |
+    | arxiv_id  | str       | 1501                                       | arXiv identifier                              |               |       |
+    | pmid      | int       | ########                                   | PMID: PubMed ID                               |               |       |
+    | website   | str       | https://www.nature.com/artic les/1781168a0 | website where the publication can be accessed |               |       |
+
+
+    ## Available Subobjects
+    * None
+
+    !!! warning "Reference will always be public"
+        Reference node is meant to always be public and static to allow globally link data to the reference
+
+    ## JSON Representation
+    ```json
+    {
+       "node":["Reference"],
+       "uid":"_:c681a947-0554-4acd-a01c-06ad76e34b87",
+       "uuid":"c681a947-0554-4acd-a01c-06ad76e34b87",
+       "author":["Ludwig Schneider","Marcus Müller"],
+       "doi":"10.1016/j.cpc.2018.08.011",
+       "issn":"0010-4655",
+       "journal":"Computer Physics Communications",
+       "pages":[463,476],
+       "publisher":"Elsevier",
+       "title":"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+       "type":"journal_article",
+       "website":"https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+       "year":2019
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        """
+        all reference nodes attributes
+
+        all int types are also None type in case they are not present it should be properly shown as None
+        instead of a placeholder number such as 0 or -1
+        """
+
+        type: str = ""
+        title: str = ""
+        author: List[str] = field(default_factory=list)
+        journal: str = ""
+        publisher: str = ""
+        year: Optional[int] = None
+        volume: Optional[int] = None
+        issue: Optional[int] = None
+        pages: List[int] = field(default_factory=list)
+        doi: str = ""
+        issn: str = ""
+        arxiv_id: str = ""
+        pmid: Optional[int] = None
+        website: str = ""
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        type: str,
+        title: str,
+        author: Optional[List[str]] = None,
+        journal: str = "",
+        publisher: str = "",
+        year: Optional[int] = None,
+        volume: Optional[int] = None,
+        issue: Optional[int] = None,
+        pages: Optional[List[int]] = None,
+        doi: str = "",
+        issn: str = "",
+        arxiv_id: str = "",
+        pmid: Optional[int] = None,
+        website: str = "",
+        **kwargs,
+    ):
+        """
+        create a reference node
+
+        reference type must come from CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        type: str
+            type of literature.
+            The reference type must come from CRIPT controlled vocabulary
+        title: str
+            title of publication
+        author: List[str] default=""
+            list of authors
+        journal: str default=""
+            journal of publication
+        publisher: str default=""
+            publisher of publication
+        year: int default=None
+            year of publication
+        volume: int default=None
+            volume of publication
+        issue: int default=None
+            issue of publication
+        pages: List[int] default=None
+            page range of publication
+        doi: str default=""
+            DOI: digital object identifier
+        issn: str default=""
+            ISSN: international standard serial number
+        arxiv_id: str default=""
+            arXiv identifier
+        pmid: int default=None
+            PMID: PubMed ID
+        website: str default=""
+            website where the publication can be accessed
+
+
+        Examples
+        --------
+        ```python
+        my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+        ```
+
+        Returns
+        -------
+        None
+            Instantiate a reference node
+        """
+        if author is None:
+            author = []
+
+        if pages is None:
+            pages = []
+
+        super().__init__(**kwargs)
+
+        new_attrs = replace(self._json_attrs, type=type, title=title, author=author, journal=journal, publisher=publisher, year=year, volume=volume, issue=issue, pages=pages, doi=doi, issn=issn, arxiv_id=arxiv_id, pmid=pmid, website=website)
+
+        self._update_json_attrs_if_valid(new_attrs)
+        self.validate()
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        type of reference. The reference type must come from the CRIPT controlled vocabulary
+
+        Examples
+        --------
+        ```python
+        my_reference.type = "journal_article"
+        ```
+
+        Returns
+        -------
+        str
+            reference type
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_reference_type: str) -> None:
+        """
+        set the reference type attribute
+
+        reference type must come from the CRIPT controlled vocabulary
+
+        Parameters
+        ----------
+        new_reference_type: str
+
+        Returns
+        -------
+        None
+        """
+        # TODO validate the reference type with CRIPT controlled vocabulary
+        new_attrs = replace(self._json_attrs, type=new_reference_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def title(self) -> str:
+        """
+        title of publication
+
+        Examples
+        --------
+        ```python
+        my_reference.title = "my new title"
+        ```
+
+        Returns
+        -------
+        str
+            title of publication
+        """
+        return self._json_attrs.title
+
+    @title.setter
+    @beartype
+    def title(self, new_title: str) -> None:
+        """
+        set the title for the reference node
+
+        Parameters
+        ----------
+        new_title: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, title=new_title)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def author(self) -> List[str]:
+        """
+        List of authors for this reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.author = ["Bradley D. Olsen", "Dylan Walsh"]
+        ```
+
+        Returns
+        -------
+        List[str]
+            list of authors
+        """
+        return self._json_attrs.author.copy()
+
+    @author.setter
+    @beartype
+    def author(self, new_author: List[str]) -> None:
+        """
+        set the list of authors for the reference node
+
+        Parameters
+        ----------
+        new_author: List[str]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, author=new_author)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def journal(self) -> str:
+        """
+        journal of publication
+
+        Examples
+        --------
+        ```python
+        my_reference.journal = "my new journal"
+        ```
+
+        Returns
+        -------
+        str
+            journal of publication
+        """
+        return self._json_attrs.journal
+
+    @journal.setter
+    @beartype
+    def journal(self, new_journal: str) -> None:
+        """
+        set the journal attribute for this reference node
+
+        Parameters
+        ----------
+        new_journal: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, journal=new_journal)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def publisher(self) -> str:
+        """
+        publisher for this reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.publisher = "my new publisher"
+        ```
+
+        Returns
+        -------
+        str
+            publisher of this publication
+        """
+        return self._json_attrs.publisher
+
+    @publisher.setter
+    @beartype
+    def publisher(self, new_publisher: str) -> None:
+        """
+        set the publisher for this reference node
+
+        Parameters
+        ----------
+        new_publisher: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, publisher=new_publisher)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def year(self) -> Union[int, None]:
+        """
+        year for the scholarly work
+
+        Examples
+        --------
+        ```python
+        my_reference.year = 2023
+        ```
+
+        Returns
+        -------
+        int
+        """
+        return self._json_attrs.year
+
+    @year.setter
+    @beartype
+    def year(self, new_year: Union[int, None]) -> None:
+        """
+        set the year for the scholarly work within the reference node
+
+        Parameters
+        ----------
+        new_year: int
+
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, year=new_year)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def volume(self) -> Union[int, None]:
+        """
+        Volume of the scholarly work from the reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.volume = 1
+        ```
+
+        Returns
+        -------
+        int
+            volume number of the publishing
+        """
+        return self._json_attrs.volume
+
+    @volume.setter
+    @beartype
+    def volume(self, new_volume: Union[int, None]) -> None:
+        """
+        set the volume of the scholarly work for this reference node
+
+        Parameters
+        ----------
+        new_volume: int
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, volume=new_volume)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def issue(self) -> Union[int, None]:
+        """
+        issue of the scholarly work for the reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.issue = 2
+        ```
+
+        Returns
+        -------
+        None
+        """
+        return self._json_attrs.issue
+
+    @issue.setter
+    @beartype
+    def issue(self, new_issue: Union[int, None]) -> None:
+        """
+        set the issue of the scholarly work
+
+        Parameters
+        ----------
+        new_issue: int
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, issue=new_issue)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def pages(self) -> List[int]:
+        """
+        pages of the scholarly work used in the reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.pages = [123, 456]
+        ```
+
+        Returns
+        -------
+        int
+        """
+        return self._json_attrs.pages.copy()
+
+    @pages.setter
+    @beartype
+    def pages(self, new_pages_list: List[int]) -> None:
+        """
+        set the list of pages of the scholarly work for this reference node
+
+        Parameters
+        ----------
+        new_pages_list: List[int]
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, pages=new_pages_list)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def doi(self) -> str:
+        """
+        get the digital object identifier (DOI) for this reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.doi = "100.1038/1781168a0"
+        ```
+
+        Returns
+        -------
+        str
+            digital object identifier (DOI) for this reference node
+        """
+        return self._json_attrs.doi
+
+    @doi.setter
+    @beartype
+    def doi(self, new_doi: str) -> None:
+        """
+        set the digital object identifier (DOI) for the scholarly work for this reference node
+
+        Parameters
+        ----------
+        new_doi: str
+
+        Examples
+        --------
+        ```python
+        my_reference.doi = "100.1038/1781168a0"
+        ```
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, doi=new_doi)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def issn(self) -> str:
+        """
+        The international standard serial number (ISSN) for this reference node
+
+        Examples
+        ```python
+        my_reference.issn = "1456-4687"
+        ```
+
+        Returns
+        -------
+        str
+            ISSN for this reference node
+        """
+        return self._json_attrs.issn
+
+    @issn.setter
+    @beartype
+    def issn(self, new_issn: str) -> None:
+        """
+        set the international standard serial number (ISSN) for the scholarly work for this reference node
+
+        Parameters
+        ----------
+        new_issn: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, issn=new_issn)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def arxiv_id(self) -> str:
+        """
+        The arXiv identifier for the scholarly work for this reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.arxiv_id = "1501"
+        ```
+
+        Returns
+        -------
+        str
+            arXiv identifier for the scholarly work for this publishing
+        """
+        return self._json_attrs.arxiv_id
+
+    @arxiv_id.setter
+    @beartype
+    def arxiv_id(self, new_arxiv_id: str) -> None:
+        """
+        set the arXiv identifier for the scholarly work for this reference node
+
+        Parameters
+        ----------
+        new_arxiv_id: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, arxiv_id=new_arxiv_id)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def pmid(self) -> Union[int, None]:
+        """
+        The PubMed ID (PMID) for this reference node
+
+        Examples
+        --------
+        ```python
+        my_reference.pmid = 12345678
+        ```
+
+        Returns
+        -------
+        int
+            the PubMedID of this publishing
+        """
+        return self._json_attrs.pmid
+
+    @pmid.setter
+    @beartype
+    def pmid(self, new_pmid: Union[int, None]) -> None:
+        """
+
+        Parameters
+        ----------
+        new_pmid
+
+        Returns
+        -------
+
+        """
+        # TODO can possibly add validations, possibly in forms of length checking
+        #  to be sure its the correct length
+        new_attrs = replace(self._json_attrs, pmid=new_pmid)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def website(self) -> str:
+        """
+        The website URL for the scholarly work
+
+        Examples
+        --------
+        ```python
+        my_reference.website = "https://criptapp.org"
+        ```
+
+        Returns
+        -------
+        str
+            the website URL of this publishing
+        """
+        return self._json_attrs.website
+
+    @website.setter
+    @beartype
+    def website(self, new_website: str) -> None:
+        """
+        set the website URL for the scholarly work
+
+        Parameters
+        ----------
+        new_website: str
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, website=new_website)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+arxiv_id: str + + + property + writable + + +

+ + +
+ +

The arXiv identifier for the scholarly work for this reference node

+ + + +

Examples:

+
my_reference.arxiv_id = "1501"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

arXiv identifier for the scholarly work for this publishing

+
+
+
+ +
+ +
+ + + +

+author: List[str] + + + property + writable + + +

+ + +
+ +

List of authors for this reference node

+ + + +

Examples:

+
my_reference.author = ["Bradley D. Olsen", "Dylan Walsh"]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[str] + +
+

list of authors

+
+
+
+ +
+ +
+ + + +

+doi: str + + + property + writable + + +

+ + +
+ +

get the digital object identifier (DOI) for this reference node

+ + + +

Examples:

+
my_reference.doi = "100.1038/1781168a0"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

digital object identifier (DOI) for this reference node

+
+
+
+ +
+ +
+ + + +

+issn: str + + + property + writable + + +

+ + +
+ +

The international standard serial number (ISSN) for this reference node

+

Examples +

my_reference.issn = "1456-4687"
+

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

ISSN for this reference node

+
+
+
+ +
+ +
+ + + +

+issue: Union[int, None] + + + property + writable + + +

+ + +
+ +

issue of the scholarly work for the reference node

+ + + +

Examples:

+
my_reference.issue = 2
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+
+ +
+ +
+ + + +

+journal: str + + + property + writable + + +

+ + +
+ +

journal of publication

+ + + +

Examples:

+
my_reference.journal = "my new journal"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

journal of publication

+
+
+
+ +
+ +
+ + + +

+pages: List[int] + + + property + writable + + +

+ + +
+ +

pages of the scholarly work used in the reference node

+ + + +

Examples:

+
my_reference.pages = [123, 456]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ int + +
+ +
+
+
+ +
+ +
+ + + +

+pmid: Union[int, None] + + + property + writable + + +

+ + +
+ +

The PubMed ID (PMID) for this reference node

+ + + +

Examples:

+
my_reference.pmid = 12345678
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ int + +
+

the PubMedID of this publishing

+
+
+
+ +
+ +
+ + + +

+publisher: str + + + property + writable + + +

+ + +
+ +

publisher for this reference node

+ + + +

Examples:

+
my_reference.publisher = "my new publisher"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

publisher of this publication

+
+
+
+ +
+ +
+ + + +

+title: str + + + property + writable + + +

+ + +
+ +

title of publication

+ + + +

Examples:

+
my_reference.title = "my new title"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

title of publication

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

type of reference. The reference type must come from the CRIPT controlled vocabulary

+ + + +

Examples:

+
my_reference.type = "journal_article"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

reference type

+
+
+
+ +
+ +
+ + + +

+volume: Union[int, None] + + + property + writable + + +

+ + +
+ +

Volume of the scholarly work from the reference node

+ + + +

Examples:

+
my_reference.volume = 1
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ int + +
+

volume number of the publishing

+
+
+
+ +
+ +
+ + + +

+website: str + + + property + writable + + +

+ + +
+ +

The website URL for the scholarly work

+ + + +

Examples:

+
my_reference.website = "https://criptapp.org"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

the website URL of this publishing

+
+
+
+ +
+ +
+ + + +

+year: Union[int, None] + + + property + writable + + +

+ + +
+ +

year for the scholarly work

+ + + +

Examples:

+
my_reference.year = 2023
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ int + +
+ +
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: UUIDBaseNode.JsonAttributes

+ + +

all reference nodes attributes

+

all int types are also None type in case they are not present it should be properly shown as None +instead of a placeholder number such as 0 or -1

+ +
+ Source code in src/cript/nodes/primary_nodes/reference.py +
67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
@dataclass(frozen=True)
+class JsonAttributes(UUIDBaseNode.JsonAttributes):
+    """
+    all reference nodes attributes
+
+    all int types are also None type in case they are not present it should be properly shown as None
+    instead of a placeholder number such as 0 or -1
+    """
+
+    type: str = ""
+    title: str = ""
+    author: List[str] = field(default_factory=list)
+    journal: str = ""
+    publisher: str = ""
+    year: Optional[int] = None
+    volume: Optional[int] = None
+    issue: Optional[int] = None
+    pages: List[int] = field(default_factory=list)
+    doi: str = ""
+    issn: str = ""
+    arxiv_id: str = ""
+    pmid: Optional[int] = None
+    website: str = ""
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(type, title, author=None, journal='', publisher='', year=None, volume=None, issue=None, pages=None, doi='', issn='', arxiv_id='', pmid=None, website='', **kwargs) + +

+ + +
+ +

create a reference node

+

reference type must come from CRIPT controlled vocabulary

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
type + str + +
+

type of literature. +The reference type must come from CRIPT controlled vocabulary

+
+
+ required +
title + str + +
+

title of publication

+
+
+ required +
author + Optional[List[str]] + +
+

list of authors

+
+
+ None +
journal + str + +
+

journal of publication

+
+
+ '' +
publisher + str + +
+

publisher of publication

+
+
+ '' +
year + Optional[int] + +
+

year of publication

+
+
+ None +
volume + Optional[int] + +
+

volume of publication

+
+
+ None +
issue + Optional[int] + +
+

issue of publication

+
+
+ None +
pages + Optional[List[int]] + +
+

page range of publication

+
+
+ None +
doi + str + +
+

DOI: digital object identifier

+
+
+ '' +
issn + str + +
+

ISSN: international standard serial number

+
+
+ '' +
arxiv_id + str + +
+

arXiv identifier

+
+
+ '' +
pmid + Optional[int] + +
+

PMID: PubMed ID

+
+
+ None +
website + str + +
+

website where the publication can be accessed

+
+
+ '' +
+ + + +

Examples:

+
my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiate a reference node

+
+
+ +
+ Source code in src/cript/nodes/primary_nodes/reference.py +
@beartype
+def __init__(
+    self,
+    type: str,
+    title: str,
+    author: Optional[List[str]] = None,
+    journal: str = "",
+    publisher: str = "",
+    year: Optional[int] = None,
+    volume: Optional[int] = None,
+    issue: Optional[int] = None,
+    pages: Optional[List[int]] = None,
+    doi: str = "",
+    issn: str = "",
+    arxiv_id: str = "",
+    pmid: Optional[int] = None,
+    website: str = "",
+    **kwargs,
+):
+    """
+    create a reference node
+
+    reference type must come from CRIPT controlled vocabulary
+
+    Parameters
+    ----------
+    type: str
+        type of literature.
+        The reference type must come from CRIPT controlled vocabulary
+    title: str
+        title of publication
+    author: List[str] default=""
+        list of authors
+    journal: str default=""
+        journal of publication
+    publisher: str default=""
+        publisher of publication
+    year: int default=None
+        year of publication
+    volume: int default=None
+        volume of publication
+    issue: int default=None
+        issue of publication
+    pages: List[int] default=None
+        page range of publication
+    doi: str default=""
+        DOI: digital object identifier
+    issn: str default=""
+        ISSN: international standard serial number
+    arxiv_id: str default=""
+        arXiv identifier
+    pmid: int default=None
+        PMID: PubMed ID
+    website: str default=""
+        website where the publication can be accessed
+
+
+    Examples
+    --------
+    ```python
+    my_reference = cript.Reference(type="journal_article", title="'Living' Polymers")
+    ```
+
+    Returns
+    -------
+    None
+        Instantiate a reference node
+    """
+    if author is None:
+        author = []
+
+    if pages is None:
+        pages = []
+
+    super().__init__(**kwargs)
+
+    new_attrs = replace(self._json_attrs, type=type, title=title, author=author, journal=journal, publisher=publisher, year=year, volume=volume, issue=issue, pages=pages, doi=doi, issn=issn, arxiv_id=arxiv_id, pmid=pmid, website=website)
+
+    self._update_json_attrs_if_valid(new_attrs)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/primary_nodes/software/index.html b/nodes/primary_nodes/software/index.html new file mode 100644 index 000000000..d50f6a708 --- /dev/null +++ b/nodes/primary_nodes/software/index.html @@ -0,0 +1,2109 @@ + + + + + + + + + + + + + + + + + + + + + + Software - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Software

+ +
+ + + +
+

+ Bases: UUIDBaseNode

+ + +

Definition

+

The Software +node contains metadata for a computation tool, code, programming language, or software package.

+

Similar to the reference node, the software node does not contain the base +attributes and is meant to always be public and static.

+
+

Can Be Added To:

+ +

Available sub-objects

+
    +
  • None
  • +
+
+

Attributes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
namestrLAMMPStype of literatureTrue
versionstr23Jun22software versionTrue
sourcestrlammps.orgsource of software
+

JSON Representation

+
{
+   "name":"SOMA",
+   "node":["Software"],
+   "version":"0.7.0"
+   "source":"https://gitlab.com/InnocentBug/SOMA",
+   "uid":"_:f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b",
+   "uuid":"f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b",
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/software.py +
class Software(UUIDBaseNode):
+    """
+    ## Definition
+
+    The [Software](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=16)
+    node contains metadata for a computation tool, code, programming language, or software package.
+
+    Similar to the [reference](../../primary_nodes/reference) node, the software node does not contain the base
+    attributes and is meant to always be public and static.
+
+    ---
+
+    ## Can Be Added To:
+    * [Software_Configuration](../../subobjects/software_configuration)
+
+    ## Available sub-objects
+    * None
+
+    ---
+
+    ## Attributes
+
+    | attribute | type | example    | description                   | required | vocab |
+    |-----------|------|------------|-------------------------------|----------|-------|
+    | name      | str  | LAMMPS     | type of literature            | True     |       |
+    | version   | str  | 23Jun22    | software version              | True     |       |
+    | source    | str  | lammps.org | source of software            |          |       |
+
+    ## JSON Representation
+    ```json
+    {
+       "name":"SOMA",
+       "node":["Software"],
+       "version":"0.7.0"
+       "source":"https://gitlab.com/InnocentBug/SOMA",
+       "uid":"_:f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b",
+       "uuid":"f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b",
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        name: str = ""
+        version: str = ""
+        source: str = ""
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, name: str, version: str, source: str = "", **kwargs):
+        """
+        create Software node
+
+        Parameters
+        ----------
+        name : str
+            Software name
+        version : str
+            Software version
+        source : str, optional
+            Software source, by default ""
+
+        Examples
+        --------
+        ```python
+        my_software = cript.Software(
+            name="my software name", version="v1.0.0", source="https://myurl.com"
+        )
+        ```
+
+        Returns
+        -------
+        None
+            create Software node
+        """
+        super().__init__(**kwargs)
+
+        self._json_attrs = replace(self._json_attrs, name=name, version=version, source=source)
+        self.validate()
+
+    @property
+    @beartype
+    def name(self) -> str:
+        """
+        Software name
+
+        Examples
+        --------
+        ```python
+        my_software.name = "my software name"
+        ```
+
+        Returns
+        -------
+        str
+            Software name
+        """
+        return self._json_attrs.name
+
+    @name.setter
+    @beartype
+    def name(self, new_name: str) -> None:
+        """
+        set the name of the Software node
+
+        Parameters
+        ----------
+        new_name : str
+            new Software name
+
+        Returns
+        -------
+        None
+        """
+        new_attr = replace(self._json_attrs, name=new_name)
+        self._update_json_attrs_if_valid(new_attr)
+
+    @property
+    @beartype
+    def version(self) -> str:
+        """
+        Software version
+
+        my_software.version = "1.2.3"
+
+        Returns
+        -------
+        str
+            Software version
+        """
+        return self._json_attrs.version
+
+    @version.setter
+    @beartype
+    def version(self, new_version: str) -> None:
+        """
+        set the Software version
+
+        Parameters
+        ----------
+        new_version : str
+            new Software version
+
+        Returns
+        -------
+        None
+        """
+        new_attr = replace(self._json_attrs, version=new_version)
+        self._update_json_attrs_if_valid(new_attr)
+
+    @property
+    @beartype
+    def source(self) -> str:
+        """
+        Software source
+
+        Examples
+        --------
+        ```python
+        my_software.source = "https://mywebsite.com"
+        ```
+
+        Returns
+        -------
+        str
+            Software source
+        """
+        return self._json_attrs.source
+
+    @source.setter
+    @beartype
+    def source(self, new_source: str) -> None:
+        """
+        set the Software source
+
+        Parameters
+        ----------
+        new_source : str
+            new Software source
+
+        Returns
+        -------
+        None
+        """
+        new_attr = replace(self._json_attrs, source=new_source)
+        self._update_json_attrs_if_valid(new_attr)
+
+
+ + + +
+ + + + + + + +
+ + + +

+name: str + + + property + writable + + +

+ + +
+ +

Software name

+ + + +

Examples:

+
my_software.name = "my software name"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Software name

+
+
+
+ +
+ +
+ + + +

+source: str + + + property + writable + + +

+ + +
+ +

Software source

+ + + +

Examples:

+
my_software.source = "https://mywebsite.com"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Software source

+
+
+
+ +
+ +
+ + + +

+version: str + + + property + writable + + +

+ + +
+ +

Software version

+

my_software.version = "1.2.3"

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Software version

+
+
+
+ +
+ + + + +
+ + + +

+__init__(name, version, source='', **kwargs) + +

+ + +
+ +

create Software node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

Software name

+
+
+ required +
version + str + +
+

Software version

+
+
+ required +
source + str + +
+

Software source, by default ""

+
+
+ '' +
+ + + +

Examples:

+
my_software = cript.Software(
+    name="my software name", version="v1.0.0", source="https://myurl.com"
+)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

create Software node

+
+
+ +
+ Source code in src/cript/nodes/subobjects/software.py +
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
@beartype
+def __init__(self, name: str, version: str, source: str = "", **kwargs):
+    """
+    create Software node
+
+    Parameters
+    ----------
+    name : str
+        Software name
+    version : str
+        Software version
+    source : str, optional
+        Software source, by default ""
+
+    Examples
+    --------
+    ```python
+    my_software = cript.Software(
+        name="my software name", version="v1.0.0", source="https://myurl.com"
+    )
+    ```
+
+    Returns
+    -------
+    None
+        create Software node
+    """
+    super().__init__(**kwargs)
+
+    self._json_attrs = replace(self._json_attrs, name=name, version=version, source=source)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/algorithm/index.html b/nodes/subobjects/algorithm/index.html new file mode 100644 index 000000000..e5a484e4b --- /dev/null +++ b/nodes/subobjects/algorithm/index.html @@ -0,0 +1,2365 @@ + + + + + + + + + + + + + + + + + + + + + + Algorithm - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Algorithm

+ +
+ + + +
+

+ Bases: UUIDBaseNode

+ + +

Definition

+

An algorithm sub-object +is a set of instructions that define a computational process. +An algorithm consists of parameters that are used in the computation and the computational process itself.

+

Attributes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeysTypeExampleDescriptionRequiredVocab
keystrensemble, thermo-barostatsystem configuration, algorithms used in a computationTrueTrue
typestrNPT for ensemble, Nose-Hoover for thermostatspecific type of configuration, algorithmTrue
parameterlist[Parameter]setup associated parameters
citationCitationreference to a book, paper, or scholarly work
+

Available sub-objects

+ +

JSON Representation

+
{
+    "node": ["Algorithm"],
+    "key": "mc_barostat",
+    "type": "barostat",
+    "parameter": {
+        "node": ["Parameter"],
+        "key": "update_frequency",
+        "value": 1000.0,
+        "unit": "1/second"
+    },
+    "citation": {
+        "node": ["Citation"],
+        "type": "reference"
+        "reference": {
+                "node": ["Reference"],
+                "type": "journal_article",
+                "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+                "author": ["Ludwig Schneider", "Marcus Müller"],
+                "journal": "Computer Physics Communications",
+                "publisher": "Elsevier",
+                "year": 2019,
+                "pages": [463, 476],
+                "doi": "10.1016/j.cpc.2018.08.011",
+                "issn": "0010-4655",
+                "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        },
+    },
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/algorithm.py +
class Algorithm(UUIDBaseNode):
+    """
+    ## Definition
+
+    An [algorithm sub-object](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=25)
+    is a set of instructions that define a computational process.
+    An algorithm consists of parameters that are used in the computation and the computational process itself.
+
+
+    ## Attributes
+
+    | Keys      | Type            | Example                                      | Description                                            | Required | Vocab |
+    |-----------|-----------------|----------------------------------------------|--------------------------------------------------------|----------|-------|
+    | key       | str             | ensemble, thermo-barostat                    | system configuration, algorithms used in a computation | True     | True  |
+    | type      | str             | NPT for ensemble, Nose-Hoover for thermostat | specific type of configuration, algorithm              | True     |       |
+    | parameter | list[Parameter] |                                              | setup associated parameters                            |          |       |
+    | citation  | Citation        |                                              | reference to a book, paper, or scholarly work          |          |       |
+
+
+    ## Available sub-objects
+    * [Parameter](../parameter)
+    * [Citation](../citation)
+
+    ## JSON Representation
+    ```json
+    {
+        "node": ["Algorithm"],
+        "key": "mc_barostat",
+        "type": "barostat",
+        "parameter": {
+            "node": ["Parameter"],
+            "key": "update_frequency",
+            "value": 1000.0,
+            "unit": "1/second"
+        },
+        "citation": {
+            "node": ["Citation"],
+            "type": "reference"
+            "reference": {
+                    "node": ["Reference"],
+                    "type": "journal_article",
+                    "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+                    "author": ["Ludwig Schneider", "Marcus Müller"],
+                    "journal": "Computer Physics Communications",
+                    "publisher": "Elsevier",
+                    "year": 2019,
+                    "pages": [463, 476],
+                    "doi": "10.1016/j.cpc.2018.08.011",
+                    "issn": "0010-4655",
+                    "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+            },
+        },
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        type: str = ""
+
+        parameter: List[Parameter] = field(default_factory=list)
+        citation: List[Citation] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    def __init__(self, key: str, type: str, parameter: Optional[List[Parameter]] = None, citation: Optional[List[Citation]] = None, **kwargs):  # ignored
+        """
+        create algorithm sub-object
+
+        Parameters
+        ----------
+        key : str
+            algorithm key must come from [CRIPT controlled vocabulary]()
+        type : str
+            algorithm type must come from [CRIPT controlled vocabulary]()
+        parameter : List[Parameter], optional
+            parameter sub-object, by default None
+        citation : List[Citation], optional
+            citation sub-object, by default None
+
+        Examples
+        --------
+        ```python
+        # create algorithm sub-object
+        algorithm = cript.Algorithm(key="mc_barostat", type="barostat")
+        ```
+
+        Returns
+        -------
+        None
+            instantiate an algorithm node
+        """
+        if parameter is None:
+            parameter = []
+        if citation is None:
+            citation = []
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, key=key, type=type, parameter=parameter)
+        self.validate()
+
+    @property
+    def key(self) -> str:
+        """
+        Algorithm key
+
+        > Algorithm key must come from [CRIPT controlled vocabulary]()
+
+        Examples
+        --------
+        ```python
+        algorithm.key = "amorphous_cell_module"
+        ```
+
+        Returns
+        -------
+        str
+            algorithm key
+        """
+        return self._json_attrs.key
+
+    @key.setter
+    def key(self, new_key: str) -> None:
+        """
+        set the algorithm key
+
+        > Algorithm key must come from [CRIPT Controlled Vocabulary]()
+
+        Parameters
+        ----------
+        new_key : str
+            algorithm key
+        """
+        new_attrs = replace(self._json_attrs, key=new_key)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    def type(self) -> str:
+        """
+        Algorithm type
+
+        > Algorithm type must come from [CRIPT controlled vocabulary]()
+
+        Returns
+        -------
+        str
+            algorithm type
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    def type(self, new_type: str) -> None:
+        new_attrs = replace(self._json_attrs, type=new_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    def parameter(self) -> List[Parameter]:
+        """
+        list of [Parameter](../parameter) sub-objects for the algorithm sub-object
+
+        Examples
+        --------
+        ```python
+        # create parameter sub-object
+        my_parameter = [
+            cript.Parameter("update_frequency", 1000.0, "1/second")
+            cript.Parameter("damping_time", 1.0, "second")
+        ]
+
+        # add parameter sub-object to algorithm sub-object
+        algorithm.parameter = my_parameter
+        ```
+
+        Returns
+        -------
+        List[Parameter]
+            list of parameters for the algorithm sub-object
+        """
+        return self._json_attrs.parameter.copy()
+
+    @parameter.setter
+    def parameter(self, new_parameter: List[Parameter]) -> None:
+        """
+        set a list of cript.Parameter sub-objects
+
+        Parameters
+        ----------
+        new_parameter : List[Parameter]
+            list of Parameter sub-objects for the algorithm sub-object
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, parameter=new_parameter)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    def citation(self) -> Citation:
+        """
+        [citation](../citation) subobject for algorithm subobject
+
+        Examples
+        --------
+        ```python
+        title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+        title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+        # create reference node
+        my_reference = cript.Reference(
+            type="journal_article",
+            title=title,
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        # create citation sub-object and add reference to it
+        my_citation = cript.Citation(type="reference, reference==my_reference)
+
+        # add citation to algorithm node
+        algorithm.citation = my_citation
+        ```
+
+        Returns
+        -------
+        citation node: Citation
+            get the algorithm citation node
+        """
+        return self._json_attrs.citation.copy()  # type: ignore
+
+    @citation.setter
+    def citation(self, new_citation: Citation) -> None:
+        """
+        set the algorithm citation subobject
+
+        Parameters
+        ----------
+        new_citation : Citation
+            new citation subobject to replace the current
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: Citation + + + property + writable + + +

+ + +
+ +

citation subobject for algorithm subobject

+ + + +

Examples:

+
title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+# create reference node
+my_reference = cript.Reference(
+    type="journal_article",
+    title=title,
+    author=["Ludwig Schneider", "Marcus Müller"],
+    journal="Computer Physics Communications",
+    publisher="Elsevier",
+    year=2019,
+    pages=[463, 476],
+    doi="10.1016/j.cpc.2018.08.011",
+    issn="0010-4655",
+    website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+)
+
+# create citation sub-object and add reference to it
+my_citation = cript.Citation(type="reference, reference==my_reference)
+
+# add citation to algorithm node
+algorithm.citation = my_citation
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ citation node: Citation + +
+

get the algorithm citation node

+
+
+
+ +
+ +
+ + + +

+key: str + + + property + writable + + +

+ + +
+ +

Algorithm key

+
+

Algorithm key must come from CRIPT controlled vocabulary

+
+ + + +

Examples:

+
algorithm.key = "amorphous_cell_module"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

algorithm key

+
+
+
+ +
+ +
+ + + +

+parameter: List[Parameter] + + + property + writable + + +

+ + +
+ +

list of Parameter sub-objects for the algorithm sub-object

+ + + +

Examples:

+
# create parameter sub-object
+my_parameter = [
+    cript.Parameter("update_frequency", 1000.0, "1/second")
+    cript.Parameter("damping_time", 1.0, "second")
+]
+
+# add parameter sub-object to algorithm sub-object
+algorithm.parameter = my_parameter
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Parameter] + +
+

list of parameters for the algorithm sub-object

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

Algorithm type

+
+

Algorithm type must come from CRIPT controlled vocabulary

+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

algorithm type

+
+
+
+ +
+ + + + +
+ + + +

+__init__(key, type, parameter=None, citation=None, **kwargs) + +

+ + +
+ +

create algorithm sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

algorithm key must come from CRIPT controlled vocabulary

+
+
+ required +
type + str + +
+

algorithm type must come from CRIPT controlled vocabulary

+
+
+ required +
parameter + List[Parameter] + +
+

parameter sub-object, by default None

+
+
+ None +
citation + List[Citation] + +
+

citation sub-object, by default None

+
+
+ None +
+ + + +

Examples:

+
# create algorithm sub-object
+algorithm = cript.Algorithm(key="mc_barostat", type="barostat")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate an algorithm node

+
+
+ +
+ Source code in src/cript/nodes/subobjects/algorithm.py +
def __init__(self, key: str, type: str, parameter: Optional[List[Parameter]] = None, citation: Optional[List[Citation]] = None, **kwargs):  # ignored
+    """
+    create algorithm sub-object
+
+    Parameters
+    ----------
+    key : str
+        algorithm key must come from [CRIPT controlled vocabulary]()
+    type : str
+        algorithm type must come from [CRIPT controlled vocabulary]()
+    parameter : List[Parameter], optional
+        parameter sub-object, by default None
+    citation : List[Citation], optional
+        citation sub-object, by default None
+
+    Examples
+    --------
+    ```python
+    # create algorithm sub-object
+    algorithm = cript.Algorithm(key="mc_barostat", type="barostat")
+    ```
+
+    Returns
+    -------
+    None
+        instantiate an algorithm node
+    """
+    if parameter is None:
+        parameter = []
+    if citation is None:
+        citation = []
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, key=key, type=type, parameter=parameter)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/citation/index.html b/nodes/subobjects/citation/index.html new file mode 100644 index 000000000..453206491 --- /dev/null +++ b/nodes/subobjects/citation/index.html @@ -0,0 +1,2191 @@ + + + + + + + + + + + + + + + + + + + + + + Citation - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Citation

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Citation + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

The Citation sub-object +essentially houses Reference nodes. The citation subobject can then be added to CRIPT Primary nodes.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
typestrderived_fromkey for identifierTrueTrue
referenceReferencereference to a book, paper, or scholarly workTrue
+
Can Be Added To
+
Primary Nodes
+ +
Subobjects
+ +
+
Available Subobjects
+
    +
  • None
  • +
+
JSON Representation
+
"citation": {
+        "node": ["Citation"],
+        "type": "reference",
+        "reference": {
+                "node": ["Reference"],
+                "type": "journal_article",
+                "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+                "author": ["Ludwig Schneider", "Marcus Müller"],
+                "journal": "Computer Physics Communications",
+                "publisher": "Elsevier",
+                "year": 2019,
+                "pages": [463, 476],
+                "doi": "10.1016/j.cpc.2018.08.011",
+                "issn": "0010-4655",
+                "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        },
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/citation.py +
class Citation(UUIDBaseNode):
+    """
+    ## Definition
+    The [Citation sub-object](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=26)
+    essentially houses [Reference nodes](../../primary_nodes/reference). The citation subobject can then be added to CRIPT Primary nodes.
+
+    ## Attributes
+    | attribute | type      | example      | description                                   | required | vocab |
+    |-----------|-----------|--------------|-----------------------------------------------|----------|-------|
+    | type      | str       | derived_from | key for identifier                            | True     | True  |
+    | reference | Reference |              | reference to a book, paper, or scholarly work | True     |       |
+
+    ## Can Be Added To
+    ### Primary Nodes
+    * [Collection node](../../primary_nodes/collection)
+    * [Computation node](../../primary_nodes/computation)
+    * [Computation Process Node](../../primary_nodes/computation_process)
+    * [Data node](../../primary_nodes/data)
+
+    ### Subobjects
+    * [Computational Forcefield subobjects](../computational_forcefield)
+    * [Property subobject](../property)
+    * [Algorithm subobject](../algorithm)
+    * [Equipment subobject](../equipment)
+
+    ---
+
+    ## Available Subobjects
+    * `None`
+
+    ## JSON Representation
+    ```json
+    "citation": {
+            "node": ["Citation"],
+            "type": "reference",
+            "reference": {
+                    "node": ["Reference"],
+                    "type": "journal_article",
+                    "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+                    "author": ["Ludwig Schneider", "Marcus Müller"],
+                    "journal": "Computer Physics Communications",
+                    "publisher": "Elsevier",
+                    "year": 2019,
+                    "pages": [463, 476],
+                    "doi": "10.1016/j.cpc.2018.08.011",
+                    "issn": "0010-4655",
+                    "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+            },
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        type: str = ""
+        reference: Optional[Reference] = None
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, type: str, reference: Reference, **kwargs):
+        """
+        create a Citation subobject
+
+        Parameters
+        ----------
+        type : citation type
+            citation type must come from [CRIPT Controlled Vocabulary]()
+        reference : Reference
+            Reference node
+
+        Examples
+        -------
+        ```python
+        title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+        title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+        # create a Reference node for the Citation subobject
+        my_reference = Reference(
+            "journal_article",
+            title=title,
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        # create Citation subobject
+        my_citation = cript.Citation("reference", my_reference)
+        ```
+
+        Returns
+        -------
+        None
+            Instantiate citation subobject
+        """
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, type=type, reference=reference)
+        self.validate()
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        Citation type subobject
+
+        > Note: Citation type must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_citation.type = "extracted_by_algorithm"
+        ```
+
+        Returns
+        -------
+        str
+            Citation type
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_type: str) -> None:
+        """
+        set the citation subobject type
+
+        > Note: citation subobject must come from [CRIPT Controlled Vocabulary]()
+
+        Parameters
+        ----------
+        new_type : str
+            citation type
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, type=new_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def reference(self) -> Union[Reference, None]:
+        """
+        citation reference node
+
+        Examples
+        --------
+        ```python
+        # create a Reference node for the Citation subobject
+        my_reference = Reference(
+            "journal_article",
+            title="my title",
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        my_citation.reference = my_reference
+        ```
+
+        Returns
+        -------
+        Reference
+            Reference node
+        """
+        return self._json_attrs.reference
+
+    @reference.setter
+    @beartype
+    def reference(self, new_reference: Reference) -> None:
+        """
+        replace the current Reference node for the citation subobject
+
+        Parameters
+        ----------
+        new_reference : Reference
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, reference=new_reference)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+reference: Union[Reference, None] + + + property + writable + + +

+ + +
+ +

citation reference node

+ + + +

Examples:

+
# create a Reference node for the Citation subobject
+my_reference = Reference(
+    "journal_article",
+    title="my title",
+    author=["Ludwig Schneider", "Marcus Müller"],
+    journal="Computer Physics Communications",
+    publisher="Elsevier",
+    year=2019,
+    pages=[463, 476],
+    doi="10.1016/j.cpc.2018.08.011",
+    issn="0010-4655",
+    website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+)
+
+my_citation.reference = my_reference
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Reference + +
+

Reference node

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

Citation type subobject

+
+

Note: Citation type must come from CRIPT Controlled Vocabulary

+
+ + + +

Examples:

+
my_citation.type = "extracted_by_algorithm"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Citation type

+
+
+
+ +
+ + + + +
+ + + +

+__init__(type, reference, **kwargs) + +

+ + +
+ +

create a Citation subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
type + citation type + +
+

citation type must come from CRIPT Controlled Vocabulary

+
+
+ required +
reference + Reference + +
+

Reference node

+
+
+ required +
+ + + +

Examples:

+
title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+# create a Reference node for the Citation subobject
+my_reference = Reference(
+    "journal_article",
+    title=title,
+    author=["Ludwig Schneider", "Marcus Müller"],
+    journal="Computer Physics Communications",
+    publisher="Elsevier",
+    year=2019,
+    pages=[463, 476],
+    doi="10.1016/j.cpc.2018.08.011",
+    issn="0010-4655",
+    website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+)
+
+# create Citation subobject
+my_citation = cript.Citation("reference", my_reference)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiate citation subobject

+
+
+ +
+ Source code in src/cript/nodes/subobjects/citation.py +
@beartype
+def __init__(self, type: str, reference: Reference, **kwargs):
+    """
+    create a Citation subobject
+
+    Parameters
+    ----------
+    type : citation type
+        citation type must come from [CRIPT Controlled Vocabulary]()
+    reference : Reference
+        Reference node
+
+    Examples
+    -------
+    ```python
+    title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+    title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+    # create a Reference node for the Citation subobject
+    my_reference = Reference(
+        "journal_article",
+        title=title,
+        author=["Ludwig Schneider", "Marcus Müller"],
+        journal="Computer Physics Communications",
+        publisher="Elsevier",
+        year=2019,
+        pages=[463, 476],
+        doi="10.1016/j.cpc.2018.08.011",
+        issn="0010-4655",
+        website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+    )
+
+    # create Citation subobject
+    my_citation = cript.Citation("reference", my_reference)
+    ```
+
+    Returns
+    -------
+    None
+        Instantiate citation subobject
+    """
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, type=type, reference=reference)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/computational_forcefield/index.html b/nodes/subobjects/computational_forcefield/index.html new file mode 100644 index 000000000..86b8cd355 --- /dev/null +++ b/nodes/subobjects/computational_forcefield/index.html @@ -0,0 +1,3594 @@ + + + + + + + + + + + + + + + + + + + + + + Computational Forcefield - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + + + + + +
+
+ + + + + + + +

Computational Forcefield

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ ComputationalForcefield + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

A Computational Forcefield Subobject +is a mathematical model that describes the forces between atoms and molecules. +It is used in computational chemistry and molecular dynamics simulations to predict the behavior of materials. +Forcefields are typically based on experimental data or quantum mechanical calculations, +and they are often used to study the properties of materials such as their structure, dynamics, and reactivity.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
keystrCHARMM27type of forcefieldTrueTrue
building_blockstratomtype of building blockTrueTrue
coarse_grained_mappingstrSC3 beads in MARTINI forcefieldatom to beads mapping
implicit_solventstrwaterName of implicit solvent
sourcestrpackage in GROMACSsource of forcefield
descriptionstrOPLS forcefield with partial charges calculated via the LBCC algorithmdescription of the forcefield and any modifications that have been added
dataDatadetails of mapping schema and forcefield parameters
citationlist[Citation]reference to a book, paper, or scholarly work
+
Can be Added To Primary Node:
+
    +
  • Material node
  • +
+
JSON Representation
+
{
+    "node": ["ComputationalForcefield"],
+    "key": "opls_aa",
+    "building_block": "atom",
+    "coarse_grained_mapping": "atom -> atom",
+    "implicit_solvent": "no implicit solvent",
+    "source": "local LigParGen installation",
+    "description": "this is a test forcefield",
+    "data": {
+        "node":["Data"],
+        "name":"my data name",
+        "type":"afm_amp",
+        "file":[
+            {
+                "node":["File"],
+                "type":"calibration",
+                "source":"https://criptapp.org",
+                "extension":".csv",
+                "data_dictionary":"my file's data dictionary"
+            }
+        ]
+    },
+    "citation": {
+        "node": ["Citation"],
+        "type": "reference"
+        "reference": {
+            "node": ["Reference"],
+            "type": "journal_article",
+            "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+            "author": ["Ludwig Schneider", "Marcus Müller"],
+            "journal": "Computer Physics Communications",
+            "publisher": "Elsevier",
+            "year": 2019,
+            "pages": [463, 476],
+            "doi": "10.1016/j.cpc.2018.08.011",
+            "issn": "0010-4655",
+            "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        }
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
class ComputationalForcefield(UUIDBaseNode):
+    """
+    ## Definition
+    A [Computational Forcefield Subobject](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=23)
+    is a mathematical model that describes the forces between atoms and molecules.
+    It is used in computational chemistry and molecular dynamics simulations to predict the behavior of materials.
+    Forcefields are typically based on experimental data or quantum mechanical calculations,
+    and they are often used to study the properties of materials such as their structure, dynamics, and reactivity.
+
+    ## Attributes
+    | attribute              | type           | example                                                                | description                                                              | required | vocab |
+    |------------------------|----------------|------------------------------------------------------------------------|--------------------------------------------------------------------------|----------|-------|
+    | key                    | str            | CHARMM27                                                               | type of forcefield                                                       | True     | True  |
+    | building_block         | str            | atom                                                                   | type of building block                                                   | True     | True  |
+    | coarse_grained_mapping | str            | SC3 beads in MARTINI forcefield                                        | atom to beads mapping                                                    |          |       |
+    | implicit_solvent       | str            | water                                                                  | Name of implicit solvent                                                 |          |       |
+    | source                 | str            | package in GROMACS                                                     | source of forcefield                                                     |          |       |
+    | description            | str            | OPLS forcefield with partial charges calculated via the LBCC algorithm | description of the forcefield and any modifications that have been added |          |       |
+    | data                   | Data           |                                                                        | details of mapping schema and forcefield parameters                      |          |       |
+    | citation               | list[Citation] |                                                                        | reference to a book, paper, or scholarly work                            |          |       |
+
+
+    ## Can be Added To Primary Node:
+    * Material node
+
+    ## JSON Representation
+    ```json
+    {
+        "node": ["ComputationalForcefield"],
+        "key": "opls_aa",
+        "building_block": "atom",
+        "coarse_grained_mapping": "atom -> atom",
+        "implicit_solvent": "no implicit solvent",
+        "source": "local LigParGen installation",
+        "description": "this is a test forcefield",
+        "data": {
+            "node":["Data"],
+            "name":"my data name",
+            "type":"afm_amp",
+            "file":[
+                {
+                    "node":["File"],
+                    "type":"calibration",
+                    "source":"https://criptapp.org",
+                    "extension":".csv",
+                    "data_dictionary":"my file's data dictionary"
+                }
+            ]
+        },
+        "citation": {
+            "node": ["Citation"],
+            "type": "reference"
+            "reference": {
+                "node": ["Reference"],
+                "type": "journal_article",
+                "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
+                "author": ["Ludwig Schneider", "Marcus Müller"],
+                "journal": "Computer Physics Communications",
+                "publisher": "Elsevier",
+                "year": 2019,
+                "pages": [463, 476],
+                "doi": "10.1016/j.cpc.2018.08.011",
+                "issn": "0010-4655",
+                "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+            }
+    }
+
+
+    ```
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        building_block: str = ""
+        coarse_grained_mapping: str = ""
+        implicit_solvent: str = ""
+        source: str = ""
+        description: str = ""
+        data: List[Data] = field(default_factory=list)
+        citation: List[Citation] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, key: str, building_block: str, coarse_grained_mapping: str = "", implicit_solvent: str = "", source: str = "", description: str = "", data: Optional[List[Data]] = None, citation: Optional[List[Citation]] = None, **kwargs):
+        """
+        instantiate a computational_forcefield subobject
+
+        Parameters
+        ----------
+        key : str
+            type of forcefield key must come from [CRIPT Controlled Vocabulary]()
+        building_block : str
+            type of computational_forcefield building_block must come from [CRIPT Controlled Vocabulary]()
+        coarse_grained_mapping : str, optional
+            atom to beads mapping, by default ""
+        implicit_solvent : str, optional
+            Name of implicit solvent, by default ""
+        source : str, optional
+            source of forcefield, by default ""
+        description : str, optional
+            description of the forcefield and any modifications that have been added, by default ""
+        data : List[Data], optional
+            details of mapping schema and forcefield parameters, by default None
+        citation : Union[List[Citation], None], optional
+            reference to a book, paper, or scholarly work, by default None
+
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield = cript.ComputationalForcefield(
+            key="opls_aa",
+            building_block="atom",
+        )
+        ```
+
+        Returns
+        -------
+        None
+            Instantiate a computational_forcefield subobject
+        """
+        if citation is None:
+            citation = []
+        super().__init__(**kwargs)
+
+        if data is None:
+            data = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            key=key,
+            building_block=building_block,
+            coarse_grained_mapping=coarse_grained_mapping,
+            implicit_solvent=implicit_solvent,
+            source=source,
+            description=description,
+            data=data,
+            citation=citation,
+        )
+        self.validate()
+
+    @property
+    @beartype
+    def key(self) -> str:
+        """
+        type of forcefield
+
+        > Computational_Forcefield key must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield.key = "amber"
+        ```
+
+        Returns
+        -------
+        str
+            type of forcefield
+        """
+        return self._json_attrs.key
+
+    @key.setter
+    @beartype
+    def key(self, new_key: str) -> None:
+        """
+        set key for this computational_forcefield
+
+        Parameters
+        ----------
+        new_key : str
+            computational_forcefield key
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, key=new_key)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def building_block(self) -> str:
+        """
+        type of building block
+
+        > Computational_Forcefield building_block must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield.building_block = "atom"
+        ```
+
+        Returns
+        -------
+        str
+            type of building block
+        """
+        return self._json_attrs.building_block
+
+    @building_block.setter
+    @beartype
+    def building_block(self, new_building_block: str) -> None:
+        """
+        type of building block
+
+        Parameters
+        ----------
+        new_building_block : str
+            new type of building block
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, building_block=new_building_block)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def coarse_grained_mapping(self) -> str:
+        """
+        atom to beads mapping
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield.coarse_grained_mapping = "SC3 beads in MARTINI forcefield"
+        ```
+
+        Returns
+        -------
+        str
+            coarse_grained_mapping
+        """
+        return self._json_attrs.coarse_grained_mapping
+
+    @coarse_grained_mapping.setter
+    @beartype
+    def coarse_grained_mapping(self, new_coarse_grained_mapping: str) -> None:
+        """
+        atom to beads mapping
+
+        Parameters
+        ----------
+        new_coarse_grained_mapping : str
+            new coarse_grained_mapping
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, coarse_grained_mapping=new_coarse_grained_mapping)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def implicit_solvent(self) -> str:
+        """
+        Name of implicit solvent
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield.implicit_solvent = "water"
+        ```
+
+        Returns
+        -------
+        str
+            _description_
+        """
+        return self._json_attrs.implicit_solvent
+
+    @implicit_solvent.setter
+    @beartype
+    def implicit_solvent(self, new_implicit_solvent: str) -> None:
+        """
+        set the implicit_solvent
+
+        Parameters
+        ----------
+        new_implicit_solvent : str
+            new implicit_solvent
+        """
+        new_attrs = replace(self._json_attrs, implicit_solvent=new_implicit_solvent)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def source(self) -> str:
+        """
+        source of forcefield
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield.source = "package in GROMACS"
+        ```
+
+        Returns
+        -------
+        str
+            source of forcefield
+        """
+        return self._json_attrs.source
+
+    @source.setter
+    @beartype
+    def source(self, new_source: str) -> None:
+        """
+        set the computational_forcefield
+
+        Parameters
+        ----------
+        new_source : str
+            new source of forcefield
+        """
+        new_attrs = replace(self._json_attrs, source=new_source)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def description(self) -> str:
+        """
+        description of the forcefield and any modifications that have been added
+
+        Examples
+        --------
+        ```python
+        my_computational_forcefield.description = "OPLS forcefield with partial charges calculated via the LBCC algorithm"
+        ```
+
+        Returns
+        -------
+        str
+            description of the forcefield and any modifications that have been added
+        """
+        return self._json_attrs.description
+
+    @description.setter
+    @beartype
+    def description(self, new_description: str) -> None:
+        """
+        set this computational_forcefields description
+
+        Parameters
+        ----------
+        new_description : str
+            new computational_forcefields description
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, description=new_description)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def data(self) -> List[Data]:
+        """
+        details of mapping schema and forcefield parameters
+
+        Examples
+        --------
+        ```python
+        # create file nodes for the data node
+        my_file = cript.File(
+            source="https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf",
+            type="calibration",
+            extension=".pdf",
+        )
+
+        # create data node and add the file node to it
+        my_data = cript.Data(
+            name="my data node name",
+            type="afm_amp",
+            file=my_file,
+        )
+
+        # add data node to computational_forcefield subobject
+        my_computational_forcefield.data = [my_data]
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of data nodes for this computational_forcefield subobject
+        """
+        return self._json_attrs.data.copy()
+
+    @data.setter
+    @beartype
+    def data(self, new_data: List[Data]) -> None:
+        """
+        set the data attribute of this computational_forcefield node
+
+        Parameters
+        ----------
+        new_data : List[Data]
+            new list of data nodes
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, data=new_data)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Citation]:
+        """
+        reference to a book, paper, or scholarly work
+
+        Examples
+        --------
+        ```python
+        # create reference node for the citation node
+        title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+        title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+        my_reference = cript.Reference(
+            "journal_article",
+            title=title,
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        # create citation node and add reference node to it
+        my_citation = cript.Citation(type="reference", reference=my_reference)
+
+        my_computational_forcefield.citation = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            computational_forcefield list of citations
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation: List[Citation]) -> None:
+        """
+        set the citation subobject of the computational_forcefield subobject
+
+        Parameters
+        ----------
+        new_citation : List[Citation]
+            new citation subobject
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(key, building_block, coarse_grained_mapping='', implicit_solvent='', source='', description='', data=None, citation=None, **kwargs) + +

+ + +
+ +

instantiate a computational_forcefield subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

type of forcefield key must come from CRIPT Controlled Vocabulary

+
+
+ required +
building_block + str + +
+

type of computational_forcefield building_block must come from CRIPT Controlled Vocabulary

+
+
+ required +
coarse_grained_mapping + str + +
+

atom to beads mapping, by default ""

+
+
+ '' +
implicit_solvent + str + +
+

Name of implicit solvent, by default ""

+
+
+ '' +
source + str + +
+

source of forcefield, by default ""

+
+
+ '' +
description + str + +
+

description of the forcefield and any modifications that have been added, by default ""

+
+
+ '' +
data + List[Data] + +
+

details of mapping schema and forcefield parameters, by default None

+
+
+ None +
citation + Union[List[Citation], None] + +
+

reference to a book, paper, or scholarly work, by default None

+
+
+ None +
+ + + +

Examples:

+
my_computational_forcefield = cript.ComputationalForcefield(
+    key="opls_aa",
+    building_block="atom",
+)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Instantiate a computational_forcefield subobject

+
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@beartype
+def __init__(self, key: str, building_block: str, coarse_grained_mapping: str = "", implicit_solvent: str = "", source: str = "", description: str = "", data: Optional[List[Data]] = None, citation: Optional[List[Citation]] = None, **kwargs):
+    """
+    instantiate a computational_forcefield subobject
+
+    Parameters
+    ----------
+    key : str
+        type of forcefield key must come from [CRIPT Controlled Vocabulary]()
+    building_block : str
+        type of computational_forcefield building_block must come from [CRIPT Controlled Vocabulary]()
+    coarse_grained_mapping : str, optional
+        atom to beads mapping, by default ""
+    implicit_solvent : str, optional
+        Name of implicit solvent, by default ""
+    source : str, optional
+        source of forcefield, by default ""
+    description : str, optional
+        description of the forcefield and any modifications that have been added, by default ""
+    data : List[Data], optional
+        details of mapping schema and forcefield parameters, by default None
+    citation : Union[List[Citation], None], optional
+        reference to a book, paper, or scholarly work, by default None
+
+
+    Examples
+    --------
+    ```python
+    my_computational_forcefield = cript.ComputationalForcefield(
+        key="opls_aa",
+        building_block="atom",
+    )
+    ```
+
+    Returns
+    -------
+    None
+        Instantiate a computational_forcefield subobject
+    """
+    if citation is None:
+        citation = []
+    super().__init__(**kwargs)
+
+    if data is None:
+        data = []
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        key=key,
+        building_block=building_block,
+        coarse_grained_mapping=coarse_grained_mapping,
+        implicit_solvent=implicit_solvent,
+        source=source,
+        description=description,
+        data=data,
+        citation=citation,
+    )
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+building_block(new_building_block) + +

+ + +
+ +

type of building block

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_building_block + str + +
+

new type of building block

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@building_block.setter
+@beartype
+def building_block(self, new_building_block: str) -> None:
+    """
+    type of building block
+
+    Parameters
+    ----------
+    new_building_block : str
+        new type of building block
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, building_block=new_building_block)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+citation(new_citation) + +

+ + +
+ +

set the citation subobject of the computational_forcefield subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_citation + List[Citation] + +
+

new citation subobject

+
+
+ required +
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@citation.setter
+@beartype
+def citation(self, new_citation: List[Citation]) -> None:
+    """
+    set the citation subobject of the computational_forcefield subobject
+
+    Parameters
+    ----------
+    new_citation : List[Citation]
+        new citation subobject
+    """
+    new_attrs = replace(self._json_attrs, citation=new_citation)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+coarse_grained_mapping(new_coarse_grained_mapping) + +

+ + +
+ +

atom to beads mapping

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_coarse_grained_mapping + str + +
+

new coarse_grained_mapping

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@coarse_grained_mapping.setter
+@beartype
+def coarse_grained_mapping(self, new_coarse_grained_mapping: str) -> None:
+    """
+    atom to beads mapping
+
+    Parameters
+    ----------
+    new_coarse_grained_mapping : str
+        new coarse_grained_mapping
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, coarse_grained_mapping=new_coarse_grained_mapping)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+data(new_data) + +

+ + +
+ +

set the data attribute of this computational_forcefield node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_data + List[Data] + +
+

new list of data nodes

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@data.setter
+@beartype
+def data(self, new_data: List[Data]) -> None:
+    """
+    set the data attribute of this computational_forcefield node
+
+    Parameters
+    ----------
+    new_data : List[Data]
+        new list of data nodes
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, data=new_data)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+description(new_description) + +

+ + +
+ +

set this computational_forcefields description

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_description + str + +
+

new computational_forcefields description

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@description.setter
+@beartype
+def description(self, new_description: str) -> None:
+    """
+    set this computational_forcefields description
+
+    Parameters
+    ----------
+    new_description : str
+        new computational_forcefields description
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, description=new_description)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+implicit_solvent(new_implicit_solvent) + +

+ + +
+ +

set the implicit_solvent

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_implicit_solvent + str + +
+

new implicit_solvent

+
+
+ required +
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@implicit_solvent.setter
+@beartype
+def implicit_solvent(self, new_implicit_solvent: str) -> None:
+    """
+    set the implicit_solvent
+
+    Parameters
+    ----------
+    new_implicit_solvent : str
+        new implicit_solvent
+    """
+    new_attrs = replace(self._json_attrs, implicit_solvent=new_implicit_solvent)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+key(new_key) + +

+ + +
+ +

set key for this computational_forcefield

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_key + str + +
+

computational_forcefield key

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@key.setter
+@beartype
+def key(self, new_key: str) -> None:
+    """
+    set key for this computational_forcefield
+
+    Parameters
+    ----------
+    new_key : str
+        computational_forcefield key
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, key=new_key)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+source(new_source) + +

+ + +
+ +

set the computational_forcefield

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_source + str + +
+

new source of forcefield

+
+
+ required +
+ +
+ Source code in src/cript/nodes/subobjects/computational_forcefield.py +
@source.setter
+@beartype
+def source(self, new_source: str) -> None:
+    """
+    set the computational_forcefield
+
+    Parameters
+    ----------
+    new_source : str
+        new source of forcefield
+    """
+    new_attrs = replace(self._json_attrs, source=new_source)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/condition/index.html b/nodes/subobjects/condition/index.html new file mode 100644 index 000000000..7c315dea6 --- /dev/null +++ b/nodes/subobjects/condition/index.html @@ -0,0 +1,4396 @@ + + + + + + + + + + + + + + + + + + + + + + Condition - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Condition

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Condition + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

A Condition sub-object +is the conditions under which the experiment was conducted. +Some examples include temperature, mixing_rate, stirring, time_duration.

+
+
Can Be Added To:
+
Primary Nodes
+ +
Subobjects
+ +
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
keystrtemptype of conditionTrueTrue
typestrmintype of value stored, 'value' is just the number, 'min', 'max', 'avg', etc. for seriesTrueTrue
descriptorstrupper temperature probefreeform description for condition
valueNumber1.23value or quantityTrue
unitstrgramunit for value
uncertaintyNumber0.1uncertainty of value
uncertainty_typestrstdtype of uncertaintyTrue
set_idint0ID of set (used to link measurements in as series)
measurement _idint0ID for a single measurement (used to link multiple condition at a single instance)
dataList[Data]detailed data associated with the condition
+
JSON Representation
+
{
+    "node": ["Condition"],
+    "key": "temperature",
+    "type": "value",
+    "descriptor": "room temperature of lab",
+    "value": 22,
+    "unit": "C",
+    "uncertainty": 5,
+    "uncertainty_type": "stdev",
+    "set_id": 0,
+    "measurement_id": 2,
+    "data": [{
+        "node":["Data"],
+        "name":"my data name",
+        "type":"afm_amp",
+        "file":[
+            {
+                "node":["File"],
+                "type":"calibration",
+                "source":"https://criptapp.org",
+                "extension":".csv",
+                "data_dictionary":"my file's data dictionary"
+            }
+        ]
+    }],
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+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
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
class Condition(UUIDBaseNode):
+    """
+    ## Definition
+
+    A [Condition](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=21) sub-object
+    is the conditions under which the experiment was conducted.
+    Some examples include temperature, mixing_rate, stirring, time_duration.
+
+    ----
+
+    ## Can Be Added To:
+    ### Primary Nodes
+    * [Process](../../primary_nodes/process)
+    * [Computation_Process](../../primary_nodes/computation_process)
+
+    ### Subobjects
+    * [Property](../property)
+    * [Equipment](../equipment)
+
+    ---
+
+    ## Attributes
+
+    | attribute        | type   | example                 | description                                                                            | required | vocab |
+    |------------------|--------|-------------------------|----------------------------------------------------------------------------------------|----------|-------|
+    | key              | str    | temp                    | type of condition                                                                      | True     | True  |
+    | type             | str    | min                     | type of value stored, 'value' is just the number, 'min', 'max', 'avg', etc. for series | True     | True  |
+    | descriptor       | str    | upper temperature probe | freeform description for condition                                                     |          |       |
+    | value            | Number | 1.23                    | value or quantity                                                                      | True     |       |
+    | unit             | str    | gram                    | unit for value                                                                         |          |       |
+    | uncertainty      | Number | 0.1                     | uncertainty of value                                                                   |          |       |
+    | uncertainty_type | str    | std                     | type of uncertainty                                                                    |          | True  |
+    | set_id           | int    | 0                       | ID of set (used to link measurements in as series)                                     |          |       |
+    | measurement _id  | int    | 0                       | ID for a single measurement (used to link multiple condition at a single instance)     |          |       |
+    | data             | List[Data] |                         | detailed data associated with the condition                                            |          |       |
+
+    ## JSON Representation
+    ```json
+    {
+        "node": ["Condition"],
+        "key": "temperature",
+        "type": "value",
+        "descriptor": "room temperature of lab",
+        "value": 22,
+        "unit": "C",
+        "uncertainty": 5,
+        "uncertainty_type": "stdev",
+        "set_id": 0,
+        "measurement_id": 2,
+        "data": [{
+            "node":["Data"],
+            "name":"my data name",
+            "type":"afm_amp",
+            "file":[
+                {
+                    "node":["File"],
+                    "type":"calibration",
+                    "source":"https://criptapp.org",
+                    "extension":".csv",
+                    "data_dictionary":"my file's data dictionary"
+                }
+            ]
+        }],
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        type: str = ""
+        descriptor: str = ""
+        value: Optional[Union[Number, str]] = None
+        unit: str = ""
+        uncertainty: Optional[Union[Number, str]] = None
+        uncertainty_type: str = ""
+        set_id: Optional[int] = None
+        measurement_id: Optional[int] = None
+        data: List[Data] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        key: str,
+        type: str,
+        value: Union[Number, str],
+        unit: str = "",
+        descriptor: str = "",
+        uncertainty: Optional[Union[Number, str]] = None,
+        uncertainty_type: str = "",
+        set_id: Optional[int] = None,
+        measurement_id: Optional[int] = None,
+        data: Optional[List[Data]] = None,
+        **kwargs
+    ):
+        """
+        create Condition sub-object
+
+        Parameters
+        ----------
+        key : str
+            type of condition
+        type : str
+            type of value stored
+        value : Number
+            value or quantity
+        unit : str, optional
+            unit for value, by default ""
+        descriptor : str, optional
+            freeform description for condition, by default ""
+        uncertainty : Union[Number, None], optional
+           uncertainty of value, by default None
+        uncertainty_type : str, optional
+            type of uncertainty, by default ""
+        set_id : Union[int, None], optional
+            ID of set (used to link measurements in as series), by default None
+        measurement_id : Union[int, None], optional
+            ID for a single measurement (used to link multiple condition at a single instance), by default None
+        data : List[Data], optional
+            detailed data associated with the condition, by default None
+
+
+        Examples
+        --------
+        ```python
+        # instantiate a Condition sub-object
+        my_condition = cript.Condition(
+            key="temperature",
+            type="value",
+            value=22,
+            unit="C",
+        )
+        ```
+
+        Returns
+        -------
+        None
+        """
+        super().__init__(**kwargs)
+
+        if data is None:
+            data = []
+
+        self._json_attrs = replace(
+            self._json_attrs,
+            key=key,
+            type=type,
+            value=value,
+            descriptor=descriptor,
+            unit=unit,
+            uncertainty=uncertainty,
+            uncertainty_type=uncertainty_type,
+            set_id=set_id,
+            measurement_id=measurement_id,
+            data=data,
+        )
+        self.validate()
+
+    @property
+    @beartype
+    def key(self) -> str:
+        """
+        type of condition
+
+        > Condition key must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_condition.key = "energy_threshold"
+        ```
+
+        Returns
+        -------
+        condition key: str
+            type of condition
+        """
+        return self._json_attrs.key
+
+    @key.setter
+    @beartype
+    def key(self, new_key: str) -> None:
+        """
+        set this Condition sub-object key
+
+        > Condition key must come from [CRIPT Controlled Vocabulary]()
+
+        Parameters
+        ----------
+        new_key : str
+            type of condition
+
+        Returns
+        --------
+        None
+        """
+        new_attrs = replace(self._json_attrs, key=new_key)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        description for the value stored for this Condition node
+
+        Examples
+        --------
+        ```python
+        my_condition.type = "min"
+        ```
+
+        Returns
+        -------
+        condition type: str
+            description for the value
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_type: str) -> None:
+        """
+        set the type attribute for this Condition node
+
+        Parameters
+        ----------
+        new_type : str
+            new description of the Condition value
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, type=new_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def descriptor(self) -> str:
+        """
+        freeform description for Condition
+
+        Examples
+        --------
+        ```python
+        my_condition.description = "my condition description"
+        ```
+
+        Returns
+        -------
+        description: str
+            description of this Condition sub-object
+        """
+        return self._json_attrs.descriptor
+
+    @descriptor.setter
+    @beartype
+    def descriptor(self, new_descriptor: str) -> None:
+        """
+        set the description of this Condition sub-object
+
+        Parameters
+        ----------
+        new_descriptor : str
+            new description describing the Condition subobject
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, descriptor=new_descriptor)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def value(self) -> Optional[Union[Number, str]]:
+        """
+        value or quantity
+
+        Examples
+        -------
+        ```python
+        my_condition.value = 10
+        ```
+
+        Returns
+        -------
+        Union[Number, None]
+            new value or quantity
+        """
+        return self._json_attrs.value
+
+    def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:
+        """
+        set the value for this Condition subobject
+
+        Parameters
+        ----------
+        new_value : Number
+            new value
+        new_unit : str
+            units for the new value
+
+        Examples
+        --------
+        ```python
+        my_condition.set_value(new_value=1, new_unit="gram")
+        ```
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def unit(self) -> str:
+        """
+        set units for this Condition subobject
+
+        Examples
+        --------
+        ```python
+        my_condition.unit = "gram"
+        ```
+
+        Returns
+        -------
+        unit: str
+            units
+        """
+        return self._json_attrs.unit
+
+    @property
+    @beartype
+    def uncertainty(self) -> Optional[Union[Number, str]]:
+        """
+        set uncertainty value for this Condition subobject
+
+        Examples
+        --------
+        ```python
+        my_condition.uncertainty = "0.1"
+        ```
+
+        Returns
+        -------
+        uncertainty: Union[Number, None]
+            uncertainty
+        """
+        return self._json_attrs.uncertainty
+
+    @beartype
+    def set_uncertainty(self, new_uncertainty: Union[Number, str], new_uncertainty_type: str) -> None:
+        """
+        set uncertainty and uncertainty type
+
+        Parameters
+        ----------
+        new_uncertainty : Number
+            new uncertainty value
+        new_uncertainty_type : str
+            new uncertainty type
+
+        Examples
+        --------
+        ```python
+        my_condition.set_uncertainty(new_uncertainty="0.2", new_uncertainty_type="std")
+        ```
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def uncertainty_type(self) -> str:
+        """
+        Uncertainty type for the uncertainty value
+
+        Examples
+        --------
+        ```python
+        my_condition.uncertainty_type = "std"
+        ```
+
+        Returns
+        -------
+        uncertainty_type: str
+            uncertainty type
+        """
+        return self._json_attrs.uncertainty_type
+
+    @property
+    @beartype
+    def set_id(self) -> Union[int, None]:
+        """
+        ID of set (used to link measurements in as series)
+
+        Examples
+        --------
+        ```python
+        my_condition.set_id = 0
+        ```
+
+        Returns
+        -------
+        set_id: Union[int, None]
+            ID of set
+        """
+        return self._json_attrs.set_id
+
+    @set_id.setter
+    @beartype
+    def set_id(self, new_set_id: Union[int, None]) -> None:
+        """
+         set this Condition subobjects set_id
+
+        Parameters
+        ----------
+        new_set_id : Union[int, None]
+            ID of set
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, set_id=new_set_id)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def measurement_id(self) -> Union[int, None]:
+        """
+        ID for a single measurement (used to link multiple condition at a single instance)
+
+        Examples
+        --------
+        ```python
+        my_condition.measurement_id = 0
+        ```
+
+        Returns
+        -------
+        measurement_id: Union[int, None]
+            ID for a single measurement
+        """
+        return self._json_attrs.measurement_id
+
+    @measurement_id.setter
+    @beartype
+    def measurement_id(self, new_measurement_id: Union[int, None]) -> None:
+        """
+        set the set_id for this Condition subobject
+
+        Parameters
+        ----------
+        new_measurement_id : Union[int, None]
+            ID for a single measurement
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, measurement_id=new_measurement_id)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def data(self) -> List[Data]:
+        """
+        detailed data associated with the condition
+
+        Examples
+        --------
+        ```python
+        # create file nodes for the data node
+        my_file = cript.File(
+            source="https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf",
+            type="calibration",
+            extension=".pdf",
+        )
+
+        # create data node and add the file node to it
+        my_data = cript.Data(
+            name="my data node name",
+            type="afm_amp",
+            file=my_file,
+        )
+
+        # add data node to Condition subobject
+        my_condition.data = [my_data]
+        ```
+
+        Returns
+        -------
+        Condition: Union[Data, None]
+            detailed data associated with the condition
+        """
+        return self._json_attrs.data.copy()
+
+    @data.setter
+    @beartype
+    def data(self, new_data: List[Data]) -> None:
+        """
+        set the data node for this Condition Subobject
+
+        Parameters
+        ----------
+        new_data : List[Data]
+            new Data node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, data=new_data)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(key, type, value, unit='', descriptor='', uncertainty=None, uncertainty_type='', set_id=None, measurement_id=None, data=None, **kwargs) + +

+ + +
+ +

create Condition sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

type of condition

+
+
+ required +
type + str + +
+

type of value stored

+
+
+ required +
value + Number + +
+

value or quantity

+
+
+ required +
unit + str + +
+

unit for value, by default ""

+
+
+ '' +
descriptor + str + +
+

freeform description for condition, by default ""

+
+
+ '' +
uncertainty + Union[Number, None] + +
+

uncertainty of value, by default None

+
+
+ None +
uncertainty_type + str + +
+

type of uncertainty, by default ""

+
+
+ '' +
set_id + Union[int, None] + +
+

ID of set (used to link measurements in as series), by default None

+
+
+ None +
measurement_id + Union[int, None] + +
+

ID for a single measurement (used to link multiple condition at a single instance), by default None

+
+
+ None +
data + List[Data] + +
+

detailed data associated with the condition, by default None

+
+
+ None +
+ + + +

Examples:

+
# instantiate a Condition sub-object
+my_condition = cript.Condition(
+    key="temperature",
+    type="value",
+    value=22,
+    unit="C",
+)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@beartype
+def __init__(
+    self,
+    key: str,
+    type: str,
+    value: Union[Number, str],
+    unit: str = "",
+    descriptor: str = "",
+    uncertainty: Optional[Union[Number, str]] = None,
+    uncertainty_type: str = "",
+    set_id: Optional[int] = None,
+    measurement_id: Optional[int] = None,
+    data: Optional[List[Data]] = None,
+    **kwargs
+):
+    """
+    create Condition sub-object
+
+    Parameters
+    ----------
+    key : str
+        type of condition
+    type : str
+        type of value stored
+    value : Number
+        value or quantity
+    unit : str, optional
+        unit for value, by default ""
+    descriptor : str, optional
+        freeform description for condition, by default ""
+    uncertainty : Union[Number, None], optional
+       uncertainty of value, by default None
+    uncertainty_type : str, optional
+        type of uncertainty, by default ""
+    set_id : Union[int, None], optional
+        ID of set (used to link measurements in as series), by default None
+    measurement_id : Union[int, None], optional
+        ID for a single measurement (used to link multiple condition at a single instance), by default None
+    data : List[Data], optional
+        detailed data associated with the condition, by default None
+
+
+    Examples
+    --------
+    ```python
+    # instantiate a Condition sub-object
+    my_condition = cript.Condition(
+        key="temperature",
+        type="value",
+        value=22,
+        unit="C",
+    )
+    ```
+
+    Returns
+    -------
+    None
+    """
+    super().__init__(**kwargs)
+
+    if data is None:
+        data = []
+
+    self._json_attrs = replace(
+        self._json_attrs,
+        key=key,
+        type=type,
+        value=value,
+        descriptor=descriptor,
+        unit=unit,
+        uncertainty=uncertainty,
+        uncertainty_type=uncertainty_type,
+        set_id=set_id,
+        measurement_id=measurement_id,
+        data=data,
+    )
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+data(new_data) + +

+ + +
+ +

set the data node for this Condition Subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_data + List[Data] + +
+

new Data node

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@data.setter
+@beartype
+def data(self, new_data: List[Data]) -> None:
+    """
+    set the data node for this Condition Subobject
+
+    Parameters
+    ----------
+    new_data : List[Data]
+        new Data node
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, data=new_data)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+descriptor(new_descriptor) + +

+ + +
+ +

set the description of this Condition sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_descriptor + str + +
+

new description describing the Condition subobject

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@descriptor.setter
+@beartype
+def descriptor(self, new_descriptor: str) -> None:
+    """
+    set the description of this Condition sub-object
+
+    Parameters
+    ----------
+    new_descriptor : str
+        new description describing the Condition subobject
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, descriptor=new_descriptor)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+key(new_key) + +

+ + +
+ +

set this Condition sub-object key

+
+

Condition key must come from CRIPT Controlled Vocabulary

+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_key + str + +
+

type of condition

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@key.setter
+@beartype
+def key(self, new_key: str) -> None:
+    """
+    set this Condition sub-object key
+
+    > Condition key must come from [CRIPT Controlled Vocabulary]()
+
+    Parameters
+    ----------
+    new_key : str
+        type of condition
+
+    Returns
+    --------
+    None
+    """
+    new_attrs = replace(self._json_attrs, key=new_key)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+measurement_id(new_measurement_id) + +

+ + +
+ +

set the set_id for this Condition subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_measurement_id + Union[int, None] + +
+

ID for a single measurement

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@measurement_id.setter
+@beartype
+def measurement_id(self, new_measurement_id: Union[int, None]) -> None:
+    """
+    set the set_id for this Condition subobject
+
+    Parameters
+    ----------
+    new_measurement_id : Union[int, None]
+        ID for a single measurement
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, measurement_id=new_measurement_id)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+set_id(new_set_id) + +

+ + +
+ +

set this Condition subobjects set_id

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_set_id + Union[int, None] + +
+

ID of set

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@set_id.setter
+@beartype
+def set_id(self, new_set_id: Union[int, None]) -> None:
+    """
+     set this Condition subobjects set_id
+
+    Parameters
+    ----------
+    new_set_id : Union[int, None]
+        ID of set
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, set_id=new_set_id)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+set_uncertainty(new_uncertainty, new_uncertainty_type) + +

+ + +
+ +

set uncertainty and uncertainty type

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_uncertainty + Number + +
+

new uncertainty value

+
+
+ required +
new_uncertainty_type + str + +
+

new uncertainty type

+
+
+ required +
+ + + +

Examples:

+
my_condition.set_uncertainty(new_uncertainty="0.2", new_uncertainty_type="std")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@beartype
+def set_uncertainty(self, new_uncertainty: Union[Number, str], new_uncertainty_type: str) -> None:
+    """
+    set uncertainty and uncertainty type
+
+    Parameters
+    ----------
+    new_uncertainty : Number
+        new uncertainty value
+    new_uncertainty_type : str
+        new uncertainty type
+
+    Examples
+    --------
+    ```python
+    my_condition.set_uncertainty(new_uncertainty="0.2", new_uncertainty_type="std")
+    ```
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+set_value(new_value, new_unit) + +

+ + +
+ +

set the value for this Condition subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_value + Number + +
+

new value

+
+
+ required +
new_unit + str + +
+

units for the new value

+
+
+ required +
+ + + +

Examples:

+
my_condition.set_value(new_value=1, new_unit="gram")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:
+    """
+    set the value for this Condition subobject
+
+    Parameters
+    ----------
+    new_value : Number
+        new value
+    new_unit : str
+        units for the new value
+
+    Examples
+    --------
+    ```python
+    my_condition.set_value(new_value=1, new_unit="gram")
+    ```
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+type(new_type) + +

+ + +
+ +

set the type attribute for this Condition node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_type + str + +
+

new description of the Condition value

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@type.setter
+@beartype
+def type(self, new_type: str) -> None:
+    """
+    set the type attribute for this Condition node
+
+    Parameters
+    ----------
+    new_type : str
+        new description of the Condition value
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, type=new_type)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+uncertainty() + +

+ + +
+ +

set uncertainty value for this Condition subobject

+ + + +

Examples:

+
my_condition.uncertainty = "0.1"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
uncertainty + Union[Number, None] + +
+

uncertainty

+
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@property
+@beartype
+def uncertainty(self) -> Optional[Union[Number, str]]:
+    """
+    set uncertainty value for this Condition subobject
+
+    Examples
+    --------
+    ```python
+    my_condition.uncertainty = "0.1"
+    ```
+
+    Returns
+    -------
+    uncertainty: Union[Number, None]
+        uncertainty
+    """
+    return self._json_attrs.uncertainty
+
+
+
+ +
+ + +
+ + + +

+uncertainty_type() + +

+ + +
+ +

Uncertainty type for the uncertainty value

+ + + +

Examples:

+
my_condition.uncertainty_type = "std"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
uncertainty_type + str + +
+

uncertainty type

+
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@property
+@beartype
+def uncertainty_type(self) -> str:
+    """
+    Uncertainty type for the uncertainty value
+
+    Examples
+    --------
+    ```python
+    my_condition.uncertainty_type = "std"
+    ```
+
+    Returns
+    -------
+    uncertainty_type: str
+        uncertainty type
+    """
+    return self._json_attrs.uncertainty_type
+
+
+
+ +
+ + +
+ + + +

+unit() + +

+ + +
+ +

set units for this Condition subobject

+ + + +

Examples:

+
my_condition.unit = "gram"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
unit + str + +
+

units

+
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@property
+@beartype
+def unit(self) -> str:
+    """
+    set units for this Condition subobject
+
+    Examples
+    --------
+    ```python
+    my_condition.unit = "gram"
+    ```
+
+    Returns
+    -------
+    unit: str
+        units
+    """
+    return self._json_attrs.unit
+
+
+
+ +
+ + +
+ + + +

+value() + +

+ + +
+ +

value or quantity

+ + + +

Examples:

+
my_condition.value = 10
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[Number, None] + +
+

new value or quantity

+
+
+ +
+ Source code in src/cript/nodes/subobjects/condition.py +
@property
+@beartype
+def value(self) -> Optional[Union[Number, str]]:
+    """
+    value or quantity
+
+    Examples
+    -------
+    ```python
+    my_condition.value = 10
+    ```
+
+    Returns
+    -------
+    Union[Number, None]
+        new value or quantity
+    """
+    return self._json_attrs.value
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/equipment/index.html b/nodes/subobjects/equipment/index.html new file mode 100644 index 000000000..c22e0b3a0 --- /dev/null +++ b/nodes/subobjects/equipment/index.html @@ -0,0 +1,2925 @@ + + + + + + + + + + + + + + + + + + + + + + Equipment - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Equipment

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Equipment + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

An Equipment +sub-object specifies the physical instruments, tools, glassware, etc. used in a process.

+
+
Can Be Added To:
+ +
Available sub-objects:
+ +
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
keystrhot platematerialTrueTrue
descriptionstrHot plate with silicon oil bath with stir baradditional details about the equipment
conditionlist[Condition]conditions under which the property was measured
fileslist[File]list of file nodes to link to calibration or equipment specification documents
citationlist[Citation]reference to a book, paper, or scholarly work
+
JSON Representation
+
{
+   "node":["Equipment"],
+   "description": "my equipment description",
+   "key":"burner",
+   "uid":"_:19708284-1bd7-42e4-b8b2-da7ea0bc2ac9",
+   "uuid":"19708284-1bd7-42e4-b8b2-da7ea0bc2ac9"
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
class Equipment(UUIDBaseNode):
+    """
+    ## Definition
+    An [Equipment](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=23)
+    sub-object specifies the physical instruments, tools, glassware, etc. used in a process.
+
+    ---
+
+    ## Can Be Added To:
+    * [Process node](../../primary_nodes/process)
+
+    ## Available sub-objects:
+    * [Condition](../condition)
+    * [Citation](../citation)
+
+    ---
+
+    ## Attributes
+
+    | attribute   | type            | example                                       | description                                                                    | required | vocab |
+    |-------------|-----------------|-----------------------------------------------|--------------------------------------------------------------------------------|----------|-------|
+    | key         | str             | hot plate                                     | material                                                                       | True     | True  |
+    | description | str             | Hot plate with silicon oil bath with stir bar | additional details about the equipment                                         |          |       |
+    | condition  | list[Condition] |                                               | conditions under which the property was measured                               |          |       |
+    | files       | list[File]      |                                               | list of file nodes to link to calibration or equipment specification documents |          |       |
+    | citation   | list[Citation]  |                                               | reference to a book, paper, or scholarly work                                  |          |       |
+
+    ## JSON Representation
+    ```json
+    {
+       "node":["Equipment"],
+       "description": "my equipment description",
+       "key":"burner",
+       "uid":"_:19708284-1bd7-42e4-b8b2-da7ea0bc2ac9",
+       "uuid":"19708284-1bd7-42e4-b8b2-da7ea0bc2ac9"
+    }
+    ```
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        description: str = ""
+        condition: List[Condition] = field(default_factory=list)
+        file: List[File] = field(default_factory=list)
+        citation: List[Citation] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, key: str, description: str = "", condition: Union[List[Condition], None] = None, file: Union[List[File], None] = None, citation: Union[List[Citation], None] = None, **kwargs) -> None:
+        """
+        create equipment sub-object
+
+        Parameters
+        ----------
+        key : str
+            Equipment key must come from [CRIPT Controlled Vocabulary]()
+        description : str, optional
+            additional details about the equipment, by default ""
+        condition : Union[List[Condition], None], optional
+            Conditions under which the property was measured, by default None
+        file : Union[List[File], None], optional
+            list of file nodes to link to calibration or equipment specification documents, by default None
+        citation : Union[List[Citation], None], optional
+            reference to a scholarly work, by default None
+
+        Example
+        -------
+        ```python
+        my_equipment = cript.Equipment(key="burner")
+        ```
+
+        Returns
+        -------
+        None
+            instantiate equipment sub-object
+        """
+        if condition is None:
+            condition = []
+        if file is None:
+            file = []
+        if citation is None:
+            citation = []
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, key=key, description=description, condition=condition, file=file, citation=citation)
+        self.validate()
+
+    @property
+    @beartype
+    def key(self) -> str:
+        """
+        scientific instrument
+
+        > Equipment key must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_equipment = cript.Equipment(key="burner")
+        ```
+
+        Returns
+        -------
+        Equipment: str
+
+        """
+        return self._json_attrs.key
+
+    @key.setter
+    @beartype
+    def key(self, new_key: str) -> None:
+        """
+        set the equipment key
+
+        > Equipment key must come from [CRIPT Controlled Vocabulary]()
+
+        Parameters
+        ----------
+        new_key : str
+            equipment sub-object key
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, key=new_key)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def description(self) -> str:
+        """
+        description of the equipment
+
+        Examples
+        --------
+        ```python
+        my_equipment.description = "additional details about the equipment"
+        ```
+
+        Returns
+        -------
+        str
+            additional description of the equipment
+        """
+        return self._json_attrs.description
+
+    @description.setter
+    @beartype
+    def description(self, new_description: str) -> None:
+        """
+        set this equipments description
+
+        Parameters
+        ----------
+        new_description : str
+            equipment description
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, description=new_description)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def condition(self) -> List[Condition]:
+        """
+        conditions under which the property was measured
+
+        Examples
+        --------
+        ```python
+        # create a Condition sub-object
+        my_condition = cript.Condition(
+            key="temperature",
+            type="value",
+            value=22,
+            unit="C",
+        )
+
+        # add Condition sub-object to Equipment sub-object
+        my_equipment.condition = [my_condition]
+        ```
+
+        Returns
+        -------
+        List[Condition]
+            list of Condition sub-objects
+        """
+        return self._json_attrs.condition.copy()
+
+    @condition.setter
+    @beartype
+    def condition(self, new_condition: List[Condition]) -> None:
+        """
+        set a list of Conditions for the equipment sub-object
+
+        Parameters
+        ----------
+        new_condition : List[Condition]
+            list of Condition sub-objects
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, condition=new_condition)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def file(self) -> List[File]:
+        """
+        list of file nodes to link to calibration or equipment specification documents
+
+        Examples
+        --------
+        ```python
+        # create a file node to be added to the equipment sub-object
+        my_file = cript.File(
+            source="https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf",
+            type="calibration",
+            extension=".pdf",
+        )
+
+        # add file node to equipment sub-object
+        my_equipment.file = [my_file]
+
+        ```
+
+        Returns
+        -------
+        List[File]
+            list of file nodes
+        """
+        return self._json_attrs.file.copy()
+
+    @file.setter
+    @beartype
+    def file(self, new_file: List[File]) -> None:
+        """
+        set the file node for the equipment subobject
+
+        Parameters
+        ----------
+        new_file : List[File]
+            list of File nodes
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, file=new_file)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Citation]:
+        """
+        reference to a book, paper, or scholarly work
+
+        Examples
+        --------
+        ```python
+        # create reference node for the citation node
+        title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+        title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+        my_reference = cript.Reference(
+            type="journal_article",
+            title=title,
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        # create citation node and add reference node to it
+        my_citation = cript.Citation(type="reference", reference=my_reference)
+
+        # add citation subobject to equipment
+        my_equipment.citation = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of Citation subobjects
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation: List[Citation]) -> None:
+        """
+        set the citation subobject for this equipment subobject
+
+        Parameters
+        ----------
+        new_citation : List[Citation]
+            list of Citation subobjects
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+__init__(key, description='', condition=None, file=None, citation=None, **kwargs) + +

+ + +
+ +

create equipment sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

Equipment key must come from CRIPT Controlled Vocabulary

+
+
+ required +
description + str + +
+

additional details about the equipment, by default ""

+
+
+ '' +
condition + Union[List[Condition], None] + +
+

Conditions under which the property was measured, by default None

+
+
+ None +
file + Union[List[File], None] + +
+

list of file nodes to link to calibration or equipment specification documents, by default None

+
+
+ None +
citation + Union[List[Citation], None] + +
+

reference to a scholarly work, by default None

+
+
+ None +
+
Example
+
my_equipment = cript.Equipment(key="burner")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

instantiate equipment sub-object

+
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
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
@beartype
+def __init__(self, key: str, description: str = "", condition: Union[List[Condition], None] = None, file: Union[List[File], None] = None, citation: Union[List[Citation], None] = None, **kwargs) -> None:
+    """
+    create equipment sub-object
+
+    Parameters
+    ----------
+    key : str
+        Equipment key must come from [CRIPT Controlled Vocabulary]()
+    description : str, optional
+        additional details about the equipment, by default ""
+    condition : Union[List[Condition], None], optional
+        Conditions under which the property was measured, by default None
+    file : Union[List[File], None], optional
+        list of file nodes to link to calibration or equipment specification documents, by default None
+    citation : Union[List[Citation], None], optional
+        reference to a scholarly work, by default None
+
+    Example
+    -------
+    ```python
+    my_equipment = cript.Equipment(key="burner")
+    ```
+
+    Returns
+    -------
+    None
+        instantiate equipment sub-object
+    """
+    if condition is None:
+        condition = []
+    if file is None:
+        file = []
+    if citation is None:
+        citation = []
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, key=key, description=description, condition=condition, file=file, citation=citation)
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+citation(new_citation) + +

+ + +
+ +

set the citation subobject for this equipment subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_citation + List[Citation] + +
+

list of Citation subobjects

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
@citation.setter
+@beartype
+def citation(self, new_citation: List[Citation]) -> None:
+    """
+    set the citation subobject for this equipment subobject
+
+    Parameters
+    ----------
+    new_citation : List[Citation]
+        list of Citation subobjects
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, citation=new_citation)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+condition(new_condition) + +

+ + +
+ +

set a list of Conditions for the equipment sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_condition + List[Condition] + +
+

list of Condition sub-objects

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
@condition.setter
+@beartype
+def condition(self, new_condition: List[Condition]) -> None:
+    """
+    set a list of Conditions for the equipment sub-object
+
+    Parameters
+    ----------
+    new_condition : List[Condition]
+        list of Condition sub-objects
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, condition=new_condition)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+description(new_description) + +

+ + +
+ +

set this equipments description

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_description + str + +
+

equipment description

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
@description.setter
+@beartype
+def description(self, new_description: str) -> None:
+    """
+    set this equipments description
+
+    Parameters
+    ----------
+    new_description : str
+        equipment description
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, description=new_description)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+file(new_file) + +

+ + +
+ +

set the file node for the equipment subobject

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_file + List[File] + +
+

list of File nodes

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
@file.setter
+@beartype
+def file(self, new_file: List[File]) -> None:
+    """
+    set the file node for the equipment subobject
+
+    Parameters
+    ----------
+    new_file : List[File]
+        list of File nodes
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, file=new_file)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+key(new_key) + +

+ + +
+ +

set the equipment key

+
+

Equipment key must come from CRIPT Controlled Vocabulary

+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_key + str + +
+

equipment sub-object key

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/equipment.py +
@key.setter
+@beartype
+def key(self, new_key: str) -> None:
+    """
+    set the equipment key
+
+    > Equipment key must come from [CRIPT Controlled Vocabulary]()
+
+    Parameters
+    ----------
+    new_key : str
+        equipment sub-object key
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, key=new_key)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/identifier/index.html b/nodes/subobjects/identifier/index.html new file mode 100644 index 000000000..27e331d3c --- /dev/null +++ b/nodes/subobjects/identifier/index.html @@ -0,0 +1,1097 @@ + + + + + + + + + + + + + + + + + + Identifier Subobject - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Identifier Subobject

+ +

Identifier Subobject

+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/ingredient/index.html b/nodes/subobjects/ingredient/index.html new file mode 100644 index 000000000..39067a284 --- /dev/null +++ b/nodes/subobjects/ingredient/index.html @@ -0,0 +1,2422 @@ + + + + + + + + + + + + + + + + + + + + + + Ingredient - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Ingredient

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Ingredient + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

An Ingredient +sub-objects are links to material nodes with the associated quantities.

+
+
Can Be Added To:
+ +
Available sub-objects:
+ +
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
materialMaterialmaterialTrue
quantitylist[Quantity]quantitiesTrue
keywordlist(str)catalystkeyword for ingredientTrue
+
JSON Representation
+
{
+    "node":["Ingredient"],
+    "keyword":["catalyst"],
+    "uid":"_:32f173ab-a98a-449b-a528-1b656f652dd3",
+    "uuid":"32f173ab-a98a-449b-a528-1b656f652dd3"
+   "material":{
+      "name":"my material 1",
+      "node":["Material"],
+      "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+      "uid":"_:029367a8-aee7-493a-bc08-991e0f6939ae",
+      "uuid":"029367a8-aee7-493a-bc08-991e0f6939ae"
+   },
+   "quantity":[
+      {
+         "node":["Quantity"],
+         "key":"mass",
+         "value":11.2
+         "uncertainty":0.2,
+         "uncertainty_type":"stdev",
+         "unit":"kg",
+         "uid":"_:c95ee781-923b-4699-ba3b-923ce186ac5d",
+         "uuid":"c95ee781-923b-4699-ba3b-923ce186ac5d",
+      }
+   ]
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/ingredient.py +
class Ingredient(UUIDBaseNode):
+    """
+    ## Definition
+    An [Ingredient](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=22)
+    sub-objects are links to material nodes with the associated quantities.
+
+    ---
+
+    ## Can Be Added To:
+    * [process](../../primary_nodes/process)
+    * [computation_process](../../primary_nodes/computation_process)
+
+    ## Available sub-objects:
+    * [Quantity](../quantity)
+
+    ---
+
+    ## Attributes
+
+    | attribute  | type           | example  | description            | required | vocab |
+    |------------|----------------|----------|------------------------|----------|-------|
+    | material   | Material       |          | material               | True     |       |
+    | quantity   | list[Quantity] |          | quantities             | True     |       |
+    | keyword    | list(str)      | catalyst | keyword for ingredient |          | True  |
+
+    ## JSON Representation
+    ```json
+    {
+        "node":["Ingredient"],
+        "keyword":["catalyst"],
+        "uid":"_:32f173ab-a98a-449b-a528-1b656f652dd3",
+        "uuid":"32f173ab-a98a-449b-a528-1b656f652dd3"
+       "material":{
+          "name":"my material 1",
+          "node":["Material"],
+          "bigsmiles":"[H]{[>][<]C(C[>])c1ccccc1[]}",
+          "uid":"_:029367a8-aee7-493a-bc08-991e0f6939ae",
+          "uuid":"029367a8-aee7-493a-bc08-991e0f6939ae"
+       },
+       "quantity":[
+          {
+             "node":["Quantity"],
+             "key":"mass",
+             "value":11.2
+             "uncertainty":0.2,
+             "uncertainty_type":"stdev",
+             "unit":"kg",
+             "uid":"_:c95ee781-923b-4699-ba3b-923ce186ac5d",
+             "uuid":"c95ee781-923b-4699-ba3b-923ce186ac5d",
+          }
+       ]
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        material: Optional[Material] = None
+        quantity: List[Quantity] = field(default_factory=list)
+        keyword: List[str] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, material: Material, quantity: List[Quantity], keyword: Optional[List[str]] = None, **kwargs):
+        """
+        create an ingredient sub-object
+
+        Examples
+        --------
+        ```python
+        import cript
+
+        # create material and identifier for the ingredient sub-object
+        my_identifiers = [{"bigsmiles": "123456"}]
+        my_material = cript.Material(name="my material", identifier=my_identifiers)
+
+        # create quantity sub-object
+        my_quantity = cript.Quantity(key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev")
+
+        # create ingredient sub-object and add all appropriate nodes/sub-objects
+        my_ingredient = cript.Ingredient(material=my_material, quantity=my_quantity, keyword="catalyst")
+        ```
+
+        Parameters
+        ----------
+        material : Material
+            material node
+        quantity : List[Quantity]
+            list of quantity sub-objects
+        keyword : List[str], optional
+            ingredient keyword must come from [CRIPT Controlled Vocabulary](), by default ""
+
+        Returns
+        -------
+        None
+            Create new Ingredient sub-object
+        """
+        super().__init__(**kwargs)
+        if keyword is None:
+            keyword = []
+        self._json_attrs = replace(self._json_attrs, material=material, quantity=quantity, keyword=keyword)
+        self.validate()
+
+    @classmethod
+    def _from_json(cls, json_dict: dict):
+        # TODO: remove this temporary fix, once back end is working correctly
+        if isinstance(json_dict["material"], list):
+            assert len(json_dict["material"]) == 1
+            json_dict["material"] = json_dict["material"][0]
+        return super(Ingredient, cls)._from_json(json_dict)
+
+    @property
+    @beartype
+    def material(self) -> Union[Material, None]:
+        """
+        current material in this ingredient sub-object
+
+        Returns
+        -------
+        Material
+            Material node within the ingredient sub-object
+        """
+        return self._json_attrs.material
+
+    @property
+    @beartype
+    def quantity(self) -> List[Quantity]:
+        """
+        quantity for the ingredient sub-object
+
+        Returns
+        -------
+        List[Quantity]
+            list of quantities for the ingredient sub-object
+        """
+        return self._json_attrs.quantity.copy()
+
+    @beartype
+    def set_material(self, new_material: Material, new_quantity: List[Quantity]) -> None:
+        """
+        update ingredient sub-object with new material and new list of quantities
+
+        Examples
+        --------
+        ```python
+        my_identifiers = [{"bigsmiles": "123456"}]
+        my_new_material = cript.Material(name="my material", identifier=my_identifiers)
+
+        my_new_quantity = cript.Quantity(
+            key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
+        )
+
+        # set new material and list of quantities
+        my_ingredient.set_material(new_material=my_new_material, new_quantity=[my_new_quantity])
+
+        ```
+
+        Parameters
+        ----------
+        new_material : Material
+            new material node to replace the current
+        new_quantity : List[Quantity]
+            new list of quantity sub-objects to replace the current quantity subobject on this node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, material=new_material, quantity=new_quantity)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def keyword(self) -> List[str]:
+        """
+        ingredient keyword must come from the [CRIPT controlled vocabulary]()
+
+        Examples
+        --------
+        ```python
+        # set new ingredient keyword
+        my_ingredient.keyword = "computation"
+        ```
+
+        Returns
+        -------
+        str
+            get the current ingredient keyword
+        """
+        return self._json_attrs.keyword.copy()
+
+    @keyword.setter
+    @beartype
+    def keyword(self, new_keyword: List[str]) -> None:
+        """
+        set new ingredient keyword to replace the current
+
+        ingredient keyword must come from the [CRIPT controlled vocabulary]()
+
+        Parameters
+        ----------
+        new_keyword : str
+            new ingredient keyword
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, keyword=new_keyword)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+keyword: List[str] + + + property + writable + + +

+ + +
+ +

ingredient keyword must come from the CRIPT controlled vocabulary

+ + + +

Examples:

+
# set new ingredient keyword
+my_ingredient.keyword = "computation"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

get the current ingredient keyword

+
+
+
+ +
+ +
+ + + +

+material: Union[Material, None] + + + property + + +

+ + +
+ +

current material in this ingredient sub-object

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Material + +
+

Material node within the ingredient sub-object

+
+
+
+ +
+ +
+ + + +

+quantity: List[Quantity] + + + property + + +

+ + +
+ +

quantity for the ingredient sub-object

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Quantity] + +
+

list of quantities for the ingredient sub-object

+
+
+
+ +
+ + + + +
+ + + +

+__init__(material, quantity, keyword=None, **kwargs) + +

+ + +
+ +

create an ingredient sub-object

+ + + +

Examples:

+
import cript
+
+# create material and identifier for the ingredient sub-object
+my_identifiers = [{"bigsmiles": "123456"}]
+my_material = cript.Material(name="my material", identifier=my_identifiers)
+
+# create quantity sub-object
+my_quantity = cript.Quantity(key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev")
+
+# create ingredient sub-object and add all appropriate nodes/sub-objects
+my_ingredient = cript.Ingredient(material=my_material, quantity=my_quantity, keyword="catalyst")
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
material + Material + +
+

material node

+
+
+ required +
quantity + List[Quantity] + +
+

list of quantity sub-objects

+
+
+ required +
keyword + List[str] + +
+

ingredient keyword must come from CRIPT Controlled Vocabulary, by default ""

+
+
+ None +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Create new Ingredient sub-object

+
+
+ +
+ Source code in src/cript/nodes/subobjects/ingredient.py +
@beartype
+def __init__(self, material: Material, quantity: List[Quantity], keyword: Optional[List[str]] = None, **kwargs):
+    """
+    create an ingredient sub-object
+
+    Examples
+    --------
+    ```python
+    import cript
+
+    # create material and identifier for the ingredient sub-object
+    my_identifiers = [{"bigsmiles": "123456"}]
+    my_material = cript.Material(name="my material", identifier=my_identifiers)
+
+    # create quantity sub-object
+    my_quantity = cript.Quantity(key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev")
+
+    # create ingredient sub-object and add all appropriate nodes/sub-objects
+    my_ingredient = cript.Ingredient(material=my_material, quantity=my_quantity, keyword="catalyst")
+    ```
+
+    Parameters
+    ----------
+    material : Material
+        material node
+    quantity : List[Quantity]
+        list of quantity sub-objects
+    keyword : List[str], optional
+        ingredient keyword must come from [CRIPT Controlled Vocabulary](), by default ""
+
+    Returns
+    -------
+    None
+        Create new Ingredient sub-object
+    """
+    super().__init__(**kwargs)
+    if keyword is None:
+        keyword = []
+    self._json_attrs = replace(self._json_attrs, material=material, quantity=quantity, keyword=keyword)
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+set_material(new_material, new_quantity) + +

+ + +
+ +

update ingredient sub-object with new material and new list of quantities

+ + + +

Examples:

+
my_identifiers = [{"bigsmiles": "123456"}]
+my_new_material = cript.Material(name="my material", identifier=my_identifiers)
+
+my_new_quantity = cript.Quantity(
+    key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
+)
+
+# set new material and list of quantities
+my_ingredient.set_material(new_material=my_new_material, new_quantity=[my_new_quantity])
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_material + Material + +
+

new material node to replace the current

+
+
+ required +
new_quantity + List[Quantity] + +
+

new list of quantity sub-objects to replace the current quantity subobject on this node

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/ingredient.py +
@beartype
+def set_material(self, new_material: Material, new_quantity: List[Quantity]) -> None:
+    """
+    update ingredient sub-object with new material and new list of quantities
+
+    Examples
+    --------
+    ```python
+    my_identifiers = [{"bigsmiles": "123456"}]
+    my_new_material = cript.Material(name="my material", identifier=my_identifiers)
+
+    my_new_quantity = cript.Quantity(
+        key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
+    )
+
+    # set new material and list of quantities
+    my_ingredient.set_material(new_material=my_new_material, new_quantity=[my_new_quantity])
+
+    ```
+
+    Parameters
+    ----------
+    new_material : Material
+        new material node to replace the current
+    new_quantity : List[Quantity]
+        new list of quantity sub-objects to replace the current quantity subobject on this node
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, material=new_material, quantity=new_quantity)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/parameter/index.html b/nodes/subobjects/parameter/index.html new file mode 100644 index 000000000..16798a432 --- /dev/null +++ b/nodes/subobjects/parameter/index.html @@ -0,0 +1,2216 @@ + + + + + + + + + + + + + + + + + + + + + + Parameter - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Parameter

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Parameter + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

A parameter +is an input value to an algorithm.

+
+Difference between Parameter and Condition +

For typical computations, the difference between +parameter and condition lies in whether it changes the thermodynamic state of the simulated +system: Variables that are part of defining a thermodynamic state should be defined as a condition +in a parent node.

+

Therefore, number and volume need to be listed as conditions while +boundaries and origin are parameters of ensemble size

+
+
+
Can Be Added To:
+ +
Available sub-objects:
+
    +
  • None
  • +
+
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
keystrkey for identifierTrueTrue
valueAnyvalueTrue
unitstrunit for parameter
+
JSON Representation
+
{
+   "key":"update_frequency",
+   "node":["Parameter"],
+   "unit":"1/second",
+   "value":1000.0
+   "uid":"_:6af3b3aa-1dbc-4ce7-be8b-1896b375001c",
+   "uuid":"6af3b3aa-1dbc-4ce7-be8b-1896b375001c",
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/parameter.py +
class Parameter(UUIDBaseNode):
+    """
+    ## Definition
+
+    A [parameter](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=25)
+    is an input value to an algorithm.
+
+    ??? note "Difference between `Parameter` and `Condition`"
+        For typical computations, the difference between
+        parameter and condition lies in whether it changes the thermodynamic state of the simulated
+        system: Variables that are part of defining a thermodynamic state should be defined as a condition
+        in a parent node.
+
+        Therefore, `number` and `volume` need to be listed as conditions while
+        `boundaries` and `origin` are parameters of ensemble size
+
+    ---
+    ## Can Be Added To:
+    * [Algorithm sub-object](../algorithm)
+
+    ## Available sub-objects:
+    * None
+
+    ---
+
+    ## Attributes
+
+    | attribute | type | example | description        | required | vocab |
+    |-----------|------|---------|--------------------|----------|-------|
+    | key       | str  |         | key for identifier | True     | True  |
+    | value     | Any  |         | value              | True     |       |
+    | unit      | str  |         | unit for parameter |          |       |
+
+
+    ## JSON Representation
+    ```json
+    {
+       "key":"update_frequency",
+       "node":["Parameter"],
+       "unit":"1/second",
+       "value":1000.0
+       "uid":"_:6af3b3aa-1dbc-4ce7-be8b-1896b375001c",
+       "uuid":"6af3b3aa-1dbc-4ce7-be8b-1896b375001c",
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        value: Optional[Number] = None
+        # We explicitly allow None for unit here (instead of empty str),
+        # this presents number without physical unit, like counting
+        # particles or dimensionless numbers.
+        unit: Union[str, None] = None
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    # Note that the key word args are ignored.
+    # They are just here, such that we can feed more kwargs in that we get from the back end.
+    @beartype
+    def __init__(self, key: str, value: Number, unit: Optional[str] = None, **kwargs):
+        """
+        create new Parameter sub-object
+
+        Parameters
+        ----------
+        key : str
+            Parameter key must come from [CRIPT Controlled Vocabulary]()
+        value : Union[int, float]
+            Parameter value
+        unit : Union[str, None], optional
+            Parameter unit, by default None
+
+        Examples
+        --------
+        ```python
+        import cript
+
+        my_parameter = cript.Parameter("update_frequency", 1000.0, "1/second")
+        ```
+
+        Returns
+        -------
+        None
+            create Parameter sub-object
+        """
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit)
+        self.validate()
+
+    @classmethod
+    def _from_json(cls, json_dict: dict):
+        # TODO: remove this temporary fix, once back end is working correctly
+        try:
+            json_dict["value"] = float(json_dict["value"])
+        except KeyError:
+            pass
+        return super(Parameter, cls)._from_json(json_dict)
+
+    @property
+    @beartype
+    def key(self) -> str:
+        """
+        Parameter key must come from the [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_parameter.key = "bond_type"
+        ```
+
+        Returns
+        -------
+        str
+            parameter key
+        """
+        return self._json_attrs.key
+
+    @key.setter
+    @beartype
+    def key(self, new_key: str) -> None:
+        """
+        set new key for the Parameter sub-object
+
+        Parameter key must come from [CRIPT Controlled Vocabulary]()
+
+        Parameters
+        ----------
+        new_key : str
+            new Parameter key
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, key=new_key)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def value(self) -> Optional[Number]:
+        """
+        Parameter value
+
+        Examples
+        --------
+        ```python
+        my_parameter.value = 1
+        ```
+
+        Returns
+        -------
+        Union[int, float, str]
+            parameter value
+        """
+        return self._json_attrs.value
+
+    @value.setter
+    @beartype
+    def value(self, new_value: Number) -> None:
+        """
+        set the Parameter value
+
+        Parameters
+        ----------
+        new_value : Union[int, float, str]
+            new parameter value
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, value=new_value)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def unit(self) -> Union[str, None]:
+        """
+        Parameter unit
+
+        Examples
+        --------
+        ```python
+        my_parameter.unit = "gram"
+        ```
+
+        Returns
+        -------
+        str
+            parameter unit
+        """
+        return self._json_attrs.unit
+
+    @unit.setter
+    @beartype
+    def unit(self, new_unit: str) -> None:
+        """
+        set the unit attribute for the Parameter sub-object
+
+        Parameters
+        ----------
+        new_unit : str
+            new Parameter unit
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, unit=new_unit)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+key: str + + + property + writable + + +

+ + +
+ +

Parameter key must come from the CRIPT Controlled Vocabulary

+ + + +

Examples:

+
my_parameter.key = "bond_type"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

parameter key

+
+
+
+ +
+ +
+ + + +

+unit: Union[str, None] + + + property + writable + + +

+ + +
+ +

Parameter unit

+ + + +

Examples:

+
my_parameter.unit = "gram"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

parameter unit

+
+
+
+ +
+ +
+ + + +

+value: Optional[Number] + + + property + writable + + +

+ + +
+ +

Parameter value

+ + + +

Examples:

+
my_parameter.value = 1
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[int, float, str] + +
+

parameter value

+
+
+
+ +
+ + + + +
+ + + +

+__init__(key, value, unit=None, **kwargs) + +

+ + +
+ +

create new Parameter sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

Parameter key must come from CRIPT Controlled Vocabulary

+
+
+ required +
value + Union[int, float] + +
+

Parameter value

+
+
+ required +
unit + Union[str, None] + +
+

Parameter unit, by default None

+
+
+ None +
+ + + +

Examples:

+
import cript
+
+my_parameter = cript.Parameter("update_frequency", 1000.0, "1/second")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

create Parameter sub-object

+
+
+ +
+ Source code in src/cript/nodes/subobjects/parameter.py +
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
@beartype
+def __init__(self, key: str, value: Number, unit: Optional[str] = None, **kwargs):
+    """
+    create new Parameter sub-object
+
+    Parameters
+    ----------
+    key : str
+        Parameter key must come from [CRIPT Controlled Vocabulary]()
+    value : Union[int, float]
+        Parameter value
+    unit : Union[str, None], optional
+        Parameter unit, by default None
+
+    Examples
+    --------
+    ```python
+    import cript
+
+    my_parameter = cript.Parameter("update_frequency", 1000.0, "1/second")
+    ```
+
+    Returns
+    -------
+    None
+        create Parameter sub-object
+    """
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/property/index.html b/nodes/subobjects/property/index.html new file mode 100644 index 000000000..102d064fa --- /dev/null +++ b/nodes/subobjects/property/index.html @@ -0,0 +1,4790 @@ + + + + + + + + + + + + + + + + + + + + + + Property - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Property

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Property + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

Property sub-objects +are qualities/traits of a material or or Process

+
+
Can Be Added To:
+ +
Available sub-objects:
+ +
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
keystrmodulus_sheartype of propertyTrueTrue
typestrmintype of value storedTrueTrue
valueAny1.23value or quantityTrue
unitstrgramunit for valueTrue
uncertaintyNumber0.1uncertainty of value
uncertainty_typestrstandard_deviationtype of uncertaintyTrue
componentlist[Material]material that the property relates to**
structurestr{[][$][C:1][C:1][$], [$][C:2][C:2]([C:2]) [$][]}specific chemical structure associate with the property with atom mappings**
methodstrsecapproach or source of property dataTrue
sample_preparationProcesssample preparation
conditionlist[Condition]conditions under which the property was measured
dataDatadata node
computationlist[Computation]computation method that produced property
citationlist[Citation]reference to a book, paper, or scholarly work
notesstrmiscellaneous information, or custom data structure (e.g.; JSON)
+
JSON Representation
+
{
+   "key":"modulus_shear",
+   "node":["Property"],
+   "type":"value",
+   "unit":"GPa",
+   "value":5.0
+   "uid":"_:bc3abb68-25b5-4144-aa1b-85d82b7c77e1",
+   "uuid":"bc3abb68-25b5-4144-aa1b-85d82b7c77e1",
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/property.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+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
+515
+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
+561
+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
+615
+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
+687
+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
+749
+750
class Property(UUIDBaseNode):
+    """
+    ## Definition
+    [Property](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=18) sub-objects
+    are qualities/traits of a [material](../../primary_nodes/material) or or [Process](../../primary_nodes/process)
+
+    ---
+
+    ## Can Be Added To:
+    * [Material](../../primary_nodes/material)
+    * [Process](../../primary_nodes/process)
+    * [Computation_Process](../../primary_nodes/Computation_Process)
+
+    ## Available sub-objects:
+    * [Condition](../condition)
+    * [Citation](../citation)
+
+    ---
+
+    ## Attributes
+
+    | attribute          | type              | example                                                                | description                                                                  | required | vocab |
+    |--------------------|-------------------|------------------------------------------------------------------------|------------------------------------------------------------------------------|----------|-------|
+    | key                | str               | modulus_shear                                                          | type of property                                                             | True     | True  |
+    | type               | str               | min                                                                    | type of value stored                                                         | True     | True  |
+    | value              | Any               | 1.23                                                                   | value or quantity                                                            | True     |       |
+    | unit               | str               | gram                                                                   | unit for value                                                               | True     |       |
+    | uncertainty        | Number            | 0.1                                                                    | uncertainty of value                                                         |          |       |
+    | uncertainty_type   | str               | standard_deviation                                                     | type of uncertainty                                                          |          | True  |
+    | component          | list[Material]    |                                                                        | material that the property relates to**                                      |          |       |
+    | structure          | str               | {\[\]\[$\]\[C:1\]\[C:1\]\[$\], \[$\]\[C:2\]\[C:2\](\[C:2\]) \[$\]\[\]} | specific chemical structure associate with the property with atom mappings** |          |       |
+    | method             | str               | sec                                                                    | approach or source of property data                                          |          | True  |
+    | sample_preparation | Process           |                                                                        | sample preparation                                                           |          |       |
+    | condition          | list[Condition]   |                                                                        | conditions under which the property was measured                             |          |       |
+    | data               | Data              |                                                                        | data node                                                                    |          |       |
+    | computation        | list[Computation] |                                                                        | computation method that produced property                                    |          |       |
+    | citation           | list[Citation]    |                                                                        | reference to a book, paper, or scholarly work                                |          |       |
+    | notes              | str               |                                                                        | miscellaneous information, or custom data structure (e.g.; JSON)             |          |       |
+
+
+    ## JSON Representation
+    ```json
+    {
+       "key":"modulus_shear",
+       "node":["Property"],
+       "type":"value",
+       "unit":"GPa",
+       "value":5.0
+       "uid":"_:bc3abb68-25b5-4144-aa1b-85d82b7c77e1",
+       "uuid":"bc3abb68-25b5-4144-aa1b-85d82b7c77e1",
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        type: str = ""
+        value: Union[Number, str, None] = None
+        unit: str = ""
+        uncertainty: Optional[Number] = None
+        uncertainty_type: str = ""
+        component: List[Material] = field(default_factory=list)
+        structure: str = ""
+        method: str = ""
+        sample_preparation: Optional[Process] = None
+        condition: List[Condition] = field(default_factory=list)
+        data: List[Data] = field(default_factory=list)
+        computation: List[Computation] = field(default_factory=list)
+        citation: List[Citation] = field(default_factory=list)
+        notes: str = ""
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(
+        self,
+        key: str,
+        type: str,
+        value: Union[Number, str, None],
+        unit: Union[str, None],
+        uncertainty: Optional[Number] = None,
+        uncertainty_type: str = "",
+        component: Optional[List[Material]] = None,
+        structure: str = "",
+        method: str = "",
+        sample_preparation: Optional[Process] = None,
+        condition: Optional[List[Condition]] = None,
+        data: Optional[List[Data]] = None,
+        computation: Optional[List[Computation]] = None,
+        citation: Optional[List[Citation]] = None,
+        notes: str = "",
+        **kwargs
+    ):
+        """
+        create a property sub-object
+
+        Parameters
+        ----------
+        key : str
+            type of property, Property key must come from the [CRIPT Controlled Vocabulary]()
+        type : str
+            type of value stored, Property type must come from the [CRIPT Controlled Vocabulary]()
+        value : Union[Number, None]
+            value or quantity
+        unit : str
+            unit for value
+        uncertainty : Union[Number, None], optional
+            uncertainty value of the value, by default None
+        uncertainty_type : str, optional
+            type of uncertainty, by default ""
+        component : Union[List[Material], None], optional
+            List of Material nodes, by default None
+        structure : str, optional
+            specific chemical structure associate with the property with atom mappings**, by default ""
+        method : str, optional
+            approach or source of property data, by default ""
+        sample_preparation : Union[Process, None], optional
+            sample preparation, by default None
+        condition : Union[List[Condition], None], optional
+            conditions under which the property was measured, by default None
+        data : Union[List[Data], None], optional
+            Data node, by default None
+        computation : Union[List[Computation], None], optional
+            computation method that produced property, by default None
+        citation : Union[List[Citation], None], optional
+            reference scholarly work, by default None
+        notes : str, optional
+            miscellaneous information, or custom data structure (e.g.; JSON), by default ""
+
+
+        Examples
+        --------
+        ```python
+        import cript
+
+        my_property = cript.Property(key="air_flow", type="min", value=1.00, unit="gram")
+        ```
+
+        Returns
+        -------
+        None
+            create a Property sub-object
+        """
+        if component is None:
+            component = []
+        if condition is None:
+            condition = []
+        if computation is None:
+            computation = []
+        if data is None:
+            data = []
+        if citation is None:
+            citation = []
+
+        super().__init__(**kwargs)
+        self._json_attrs = replace(
+            self._json_attrs,
+            key=key,
+            type=type,
+            value=value,
+            unit=unit,
+            uncertainty=uncertainty,
+            uncertainty_type=uncertainty_type,
+            component=component,
+            structure=structure,
+            method=method,
+            sample_preparation=sample_preparation,
+            condition=condition,
+            data=data,
+            computation=computation,
+            citation=citation,
+            notes=notes,
+        )
+        self.validate()
+
+    @property
+    @beartype
+    def key(self) -> str:
+        """
+        Property key must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_parameter.key = "angle_rdist"
+        ```
+
+        Returns
+        -------
+        str
+            Property Key
+        """
+        return self._json_attrs.key
+
+    @key.setter
+    @beartype
+    def key(self, new_key: str) -> None:
+        """
+        set the key for this Property sub-object
+
+        Parameters
+        ----------
+        new_key : str
+            new Property key
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, key=new_key)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        type of value for this Property sub-object
+
+        Examples
+        ```python
+        my_property.type = "max"
+        ```
+
+        Returns
+        -------
+        str
+            type of value for this Property sub-object
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_type: str) -> None:
+        """
+        set the Property type for this subobject
+
+        Parameters
+        ----------
+        new_type : str
+            new Property type
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, type=new_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def value(self) -> Union[Number, str, None]:
+        """
+        get the Property value
+
+        Returns
+        -------
+        Union[Number, None]
+            Property value
+        """
+        return self._json_attrs.value
+
+    @beartype
+    def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:
+        """
+        set the value attribute of the Property subobject
+
+        Examples
+        ---------
+        ```python
+        my_property.set_value(new_value=1, new_unit="gram")
+        ```
+
+        Parameters
+        ----------
+        new_value : Number
+            new value
+        new_unit : str
+            new unit for the value
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def unit(self) -> str:
+        """
+        get the Property unit for the value
+
+        Returns
+        -------
+        str
+            unit
+        """
+        return self._json_attrs.unit
+
+    @property
+    @beartype
+    def uncertainty(self) -> Union[Number, None]:
+        """
+        get the uncertainty value of the Property node
+
+        Returns
+        -------
+        Union[Number, None]
+            uncertainty value
+        """
+        return self._json_attrs.uncertainty
+
+    @beartype
+    def set_uncertainty(self, new_uncertainty: Number, new_uncertainty_type: str) -> None:
+        """
+        set the uncertainty value and type
+
+        Uncertainty type must come from [CRIPT Controlled Vocabulary]
+
+        Parameters
+        ----------
+        new_uncertainty : Number
+            new uncertainty value
+        new_uncertainty_type : str
+            new uncertainty type
+
+        Examples
+        --------
+        ```python
+        my_property.set_uncertainty(new_uncertainty=2, new_uncertainty_type="fwhm")
+        ```
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def uncertainty_type(self) -> str:
+        """
+        get the uncertainty_type for this Property subobject
+
+        Uncertainty type must come from [CRIPT Controlled Vocabulary]()
+
+        Returns
+        -------
+        str
+            Uncertainty type
+        """
+        return self._json_attrs.uncertainty_type
+
+    @property
+    @beartype
+    def component(self) -> List[Material]:
+        """
+        list of Materials that the Property relates to
+
+        Examples
+        ---------
+        ```python
+
+        my_identifiers = [{"bigsmiles": "123456"}]
+        my_material = cript.Material(name="my material", identifier=my_identifiers)
+
+        # add material node as component to Property subobject
+        my_property.component = my_material
+        ```
+
+        Returns
+        -------
+        List[Material]
+            list of Materials that the Property relates to
+        """
+        return self._json_attrs.component.copy()
+
+    @component.setter
+    @beartype
+    def component(self, new_component: List[Material]) -> None:
+        """
+        set the list of Materials as components for the Property subobject
+
+        Parameters
+        ----------
+        new_component : List[Material]
+            new list of Materials to for the Property subobject
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, component=new_component)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def structure(self) -> str:
+        """
+        specific chemical structure associate with the property with atom mappings
+
+        Examples
+        --------
+        ```python
+        my_property.structure = "{[][$][C:1][C:1][$],[$][C:2][C:2]([C:2])[$][]}"
+        ```
+
+        Returns
+        -------
+        str
+            Property structure string
+        """
+        return self._json_attrs.structure
+
+    @structure.setter
+    @beartype
+    def structure(self, new_structure: str) -> None:
+        """
+        set the this Property's structure
+
+        Parameters
+        ----------
+        new_structure : str
+            new structure
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, structure=new_structure)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def method(self) -> str:
+        """
+        approach or source of property data True sample_preparation Process sample preparation
+
+        Property method must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_property.method = "ASTM_D3574_Test_A"
+        ```
+
+        Returns
+        -------
+        str
+            Property method
+        """
+        return self._json_attrs.method
+
+    @method.setter
+    @beartype
+    def method(self, new_method: str) -> None:
+        """
+        set the Property method
+
+        Property method must come from [CRIPT Controlled Vocabulary]()
+
+        Parameters
+        ----------
+        new_method : str
+            new Property method
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, method=new_method)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def sample_preparation(self) -> Union[Process, None]:
+        """
+        sample_preparation
+
+        Examples
+        --------
+        ```python
+        my_process = cript.Process(name="my process name", type="affinity_pure")
+
+        my_property.sample_preparation = my_process
+        ```
+
+        Returns
+        -------
+        Union[Process, None]
+            Property linking back to the Process that has it as subobject
+        """
+        return self._json_attrs.sample_preparation
+
+    @sample_preparation.setter
+    @beartype
+    def sample_preparation(self, new_sample_preparation: Union[Process, None]) -> None:
+        """
+        set the sample_preparation for the Property subobject
+
+        Parameters
+        ----------
+        new_sample_preparation : Union[Process, None]
+            back link to the Process that has this Property as its subobject
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, sample_preparation=new_sample_preparation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def condition(self) -> List[Condition]:
+        """
+        list of Conditions under which the property was measured
+
+        Examples
+        --------
+        ```python
+        my_condition = cript.Condition(key="atm", type="max", value=1)
+
+        my_property.condition = [my_condition]
+        ```
+
+        Returns
+        -------
+        List[Condition]
+            list of Conditions
+        """
+        return self._json_attrs.condition.copy()
+
+    @condition.setter
+    @beartype
+    def condition(self, new_condition: List[Condition]) -> None:
+        """
+        set the list of Conditions for this property subobject
+
+        Parameters
+        ----------
+        new_condition : List[Condition]
+            new list of Condition Subobjects
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, condition=new_condition)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def data(self) -> List[Data]:
+        """
+        List of Data nodes for this Property subobjects
+
+        Examples
+        --------
+        ```python
+        # create file node for the Data node
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary",
+        )
+
+        # create data node for the property subobject
+        my_data = cript.Data(name="my data name", type="afm_amp", file=[my_file])
+
+        # add data node to Property subobject
+        my_property.data = my_data
+        ```
+
+        Returns
+        -------
+        List[Data]
+            list of Data nodes
+        """
+        return self._json_attrs.data.copy()
+
+    @data.setter
+    @beartype
+    def data(self, new_data: List[Data]) -> None:
+        """
+        set the Data node for the Property subobject
+
+        Parameters
+        ----------
+        new_data : List[Data]
+            new list of Data nodes
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, data=new_data)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def computation(self) -> List[Computation]:
+        """
+        list of Computation nodes that produced this property
+
+        Examples
+        --------
+        ```python
+        my_computation = cript.Computation(name="my computation name", type="analysis")
+
+        my_property.computation = [my_computation]
+        ```
+
+        Returns
+        -------
+        List[Computation]
+            list of Computation nodes
+        """
+        return self._json_attrs.computation.copy()
+
+    @computation.setter
+    @beartype
+    def computation(self, new_computation: List[Computation]) -> None:
+        """
+        set the list of Computation nodes that produced this property
+
+        Parameters
+        ----------
+        new_computation : List[Computation]
+            new list of Computation nodes
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, computation=new_computation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Citation]:
+        """
+        list of Citation subobjects for this Property subobject
+
+        Examples
+        --------
+        ```python
+        # create reference node for the citation node
+        title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+        title += "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+        my_reference = cript.Reference(
+            type="journal_article",
+            title=title,
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        # create citation node and add reference node to it
+        my_citation = cript.Citation(type="reference", reference=my_reference)
+
+        # add citation to Property subobject
+        my_property.citation = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of Citation subobjects for this Property subobject
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation: List[Citation]) -> None:
+        """
+        set the list of Citation subobjects for the Property subobject
+
+        Parameters
+        ----------
+        new_citation : List[Citation]
+            new list of Citation subobjects
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def notes(self) -> str:
+        """
+        notes for this Property subobject
+
+        Examples
+        --------
+        ```python
+        my_property.notes = "these are my notes"
+        ```
+
+        Returns
+        -------
+        str
+            notes for this property subobject
+        """
+        return self._json_attrs.notes
+
+    @notes.setter
+    @beartype
+    def notes(self, new_notes: str) -> None:
+        """
+        set the notes for this Property subobject
+
+        Parameters
+        ----------
+        new_notes : str
+            new notes
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, notes=new_notes)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+citation: List[Citation] + + + property + writable + + +

+ + +
+ +

list of Citation subobjects for this Property subobject

+ + + +

Examples:

+
# create reference node for the citation node
+title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+title += "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+my_reference = cript.Reference(
+    type="journal_article",
+    title=title,
+    author=["Ludwig Schneider", "Marcus Müller"],
+    journal="Computer Physics Communications",
+    publisher="Elsevier",
+    year=2019,
+    pages=[463, 476],
+    doi="10.1016/j.cpc.2018.08.011",
+    issn="0010-4655",
+    website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+)
+
+# create citation node and add reference node to it
+my_citation = cript.Citation(type="reference", reference=my_reference)
+
+# add citation to Property subobject
+my_property.citation = [my_citation]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Citation] + +
+

list of Citation subobjects for this Property subobject

+
+
+
+ +
+ +
+ + + +

+component: List[Material] + + + property + writable + + +

+ + +
+ +

list of Materials that the Property relates to

+ + + +

Examples:

+
my_identifiers = [{"bigsmiles": "123456"}]
+my_material = cript.Material(name="my material", identifier=my_identifiers)
+
+# add material node as component to Property subobject
+my_property.component = my_material
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Material] + +
+

list of Materials that the Property relates to

+
+
+
+ +
+ +
+ + + +

+computation: List[Computation] + + + property + writable + + +

+ + +
+ +

list of Computation nodes that produced this property

+ + + +

Examples:

+
my_computation = cript.Computation(name="my computation name", type="analysis")
+
+my_property.computation = [my_computation]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Computation] + +
+

list of Computation nodes

+
+
+
+ +
+ +
+ + + +

+condition: List[Condition] + + + property + writable + + +

+ + +
+ +

list of Conditions under which the property was measured

+ + + +

Examples:

+
my_condition = cript.Condition(key="atm", type="max", value=1)
+
+my_property.condition = [my_condition]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Condition] + +
+

list of Conditions

+
+
+
+ +
+ +
+ + + +

+data: List[Data] + + + property + writable + + +

+ + +
+ +

List of Data nodes for this Property subobjects

+ + + +

Examples:

+
# create file node for the Data node
+my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary",
+)
+
+# create data node for the property subobject
+my_data = cript.Data(name="my data name", type="afm_amp", file=[my_file])
+
+# add data node to Property subobject
+my_property.data = my_data
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Data] + +
+

list of Data nodes

+
+
+
+ +
+ +
+ + + +

+key: str + + + property + writable + + +

+ + +
+ +

Property key must come from CRIPT Controlled Vocabulary

+ + + +

Examples:

+
my_parameter.key = "angle_rdist"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Property Key

+
+
+
+ +
+ +
+ + + +

+method: str + + + property + writable + + +

+ + +
+ +

approach or source of property data True sample_preparation Process sample preparation

+

Property method must come from CRIPT Controlled Vocabulary

+ + + +

Examples:

+
my_property.method = "ASTM_D3574_Test_A"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Property method

+
+
+
+ +
+ +
+ + + +

+notes: str + + + property + writable + + +

+ + +
+ +

notes for this Property subobject

+ + + +

Examples:

+
my_property.notes = "these are my notes"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

notes for this property subobject

+
+
+
+ +
+ +
+ + + +

+sample_preparation: Union[Process, None] + + + property + writable + + +

+ + +
+ +

sample_preparation

+ + + +

Examples:

+
my_process = cript.Process(name="my process name", type="affinity_pure")
+
+my_property.sample_preparation = my_process
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[Process, None] + +
+

Property linking back to the Process that has it as subobject

+
+
+
+ +
+ +
+ + + +

+structure: str + + + property + writable + + +

+ + +
+ +

specific chemical structure associate with the property with atom mappings

+ + + +

Examples:

+
my_property.structure = "{[][$][C:1][C:1][$],[$][C:2][C:2]([C:2])[$][]}"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Property structure string

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

type of value for this Property sub-object

+

Examples +

my_property.type = "max"
+

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

type of value for this Property sub-object

+
+
+
+ +
+ +
+ + + +

+uncertainty: Union[Number, None] + + + property + + +

+ + +
+ +

get the uncertainty value of the Property node

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[Number, None] + +
+

uncertainty value

+
+
+
+ +
+ +
+ + + +

+uncertainty_type: str + + + property + + +

+ + +
+ +

get the uncertainty_type for this Property subobject

+

Uncertainty type must come from CRIPT Controlled Vocabulary

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

Uncertainty type

+
+
+
+ +
+ +
+ + + +

+unit: str + + + property + + +

+ + +
+ +

get the Property unit for the value

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

unit

+
+
+
+ +
+ +
+ + + +

+value: Union[Number, str, None] + + + property + + +

+ + +
+ +

get the Property value

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[Number, None] + +
+

Property value

+
+
+
+ +
+ + + + +
+ + + +

+__init__(key, type, value, unit, uncertainty=None, uncertainty_type='', component=None, structure='', method='', sample_preparation=None, condition=None, data=None, computation=None, citation=None, notes='', **kwargs) + +

+ + +
+ +

create a property sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

type of property, Property key must come from the CRIPT Controlled Vocabulary

+
+
+ required +
type + str + +
+

type of value stored, Property type must come from the CRIPT Controlled Vocabulary

+
+
+ required +
value + Union[Number, None] + +
+

value or quantity

+
+
+ required +
unit + str + +
+

unit for value

+
+
+ required +
uncertainty + Union[Number, None] + +
+

uncertainty value of the value, by default None

+
+
+ None +
uncertainty_type + str + +
+

type of uncertainty, by default ""

+
+
+ '' +
component + Union[List[Material], None] + +
+

List of Material nodes, by default None

+
+
+ None +
structure + str + +
+

specific chemical structure associate with the property with atom mappings**, by default ""

+
+
+ '' +
method + str + +
+

approach or source of property data, by default ""

+
+
+ '' +
sample_preparation + Union[Process, None] + +
+

sample preparation, by default None

+
+
+ None +
condition + Union[List[Condition], None] + +
+

conditions under which the property was measured, by default None

+
+
+ None +
data + Union[List[Data], None] + +
+

Data node, by default None

+
+
+ None +
computation + Union[List[Computation], None] + +
+

computation method that produced property, by default None

+
+
+ None +
citation + Union[List[Citation], None] + +
+

reference scholarly work, by default None

+
+
+ None +
notes + str + +
+

miscellaneous information, or custom data structure (e.g.; JSON), by default ""

+
+
+ '' +
+ + + +

Examples:

+
import cript
+
+my_property = cript.Property(key="air_flow", type="min", value=1.00, unit="gram")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

create a Property sub-object

+
+
+ +
+ Source code in src/cript/nodes/subobjects/property.py +
@beartype
+def __init__(
+    self,
+    key: str,
+    type: str,
+    value: Union[Number, str, None],
+    unit: Union[str, None],
+    uncertainty: Optional[Number] = None,
+    uncertainty_type: str = "",
+    component: Optional[List[Material]] = None,
+    structure: str = "",
+    method: str = "",
+    sample_preparation: Optional[Process] = None,
+    condition: Optional[List[Condition]] = None,
+    data: Optional[List[Data]] = None,
+    computation: Optional[List[Computation]] = None,
+    citation: Optional[List[Citation]] = None,
+    notes: str = "",
+    **kwargs
+):
+    """
+    create a property sub-object
+
+    Parameters
+    ----------
+    key : str
+        type of property, Property key must come from the [CRIPT Controlled Vocabulary]()
+    type : str
+        type of value stored, Property type must come from the [CRIPT Controlled Vocabulary]()
+    value : Union[Number, None]
+        value or quantity
+    unit : str
+        unit for value
+    uncertainty : Union[Number, None], optional
+        uncertainty value of the value, by default None
+    uncertainty_type : str, optional
+        type of uncertainty, by default ""
+    component : Union[List[Material], None], optional
+        List of Material nodes, by default None
+    structure : str, optional
+        specific chemical structure associate with the property with atom mappings**, by default ""
+    method : str, optional
+        approach or source of property data, by default ""
+    sample_preparation : Union[Process, None], optional
+        sample preparation, by default None
+    condition : Union[List[Condition], None], optional
+        conditions under which the property was measured, by default None
+    data : Union[List[Data], None], optional
+        Data node, by default None
+    computation : Union[List[Computation], None], optional
+        computation method that produced property, by default None
+    citation : Union[List[Citation], None], optional
+        reference scholarly work, by default None
+    notes : str, optional
+        miscellaneous information, or custom data structure (e.g.; JSON), by default ""
+
+
+    Examples
+    --------
+    ```python
+    import cript
+
+    my_property = cript.Property(key="air_flow", type="min", value=1.00, unit="gram")
+    ```
+
+    Returns
+    -------
+    None
+        create a Property sub-object
+    """
+    if component is None:
+        component = []
+    if condition is None:
+        condition = []
+    if computation is None:
+        computation = []
+    if data is None:
+        data = []
+    if citation is None:
+        citation = []
+
+    super().__init__(**kwargs)
+    self._json_attrs = replace(
+        self._json_attrs,
+        key=key,
+        type=type,
+        value=value,
+        unit=unit,
+        uncertainty=uncertainty,
+        uncertainty_type=uncertainty_type,
+        component=component,
+        structure=structure,
+        method=method,
+        sample_preparation=sample_preparation,
+        condition=condition,
+        data=data,
+        computation=computation,
+        citation=citation,
+        notes=notes,
+    )
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+set_uncertainty(new_uncertainty, new_uncertainty_type) + +

+ + +
+ +

set the uncertainty value and type

+

Uncertainty type must come from [CRIPT Controlled Vocabulary]

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_uncertainty + Number + +
+

new uncertainty value

+
+
+ required +
new_uncertainty_type + str + +
+

new uncertainty type

+
+
+ required +
+ + + +

Examples:

+
my_property.set_uncertainty(new_uncertainty=2, new_uncertainty_type="fwhm")
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/property.py +
@beartype
+def set_uncertainty(self, new_uncertainty: Number, new_uncertainty_type: str) -> None:
+    """
+    set the uncertainty value and type
+
+    Uncertainty type must come from [CRIPT Controlled Vocabulary]
+
+    Parameters
+    ----------
+    new_uncertainty : Number
+        new uncertainty value
+    new_uncertainty_type : str
+        new uncertainty type
+
+    Examples
+    --------
+    ```python
+    my_property.set_uncertainty(new_uncertainty=2, new_uncertainty_type="fwhm")
+    ```
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+set_value(new_value, new_unit) + +

+ + +
+ +

set the value attribute of the Property subobject

+ + + +

Examples:

+
my_property.set_value(new_value=1, new_unit="gram")
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_value + Number + +
+

new value

+
+
+ required +
new_unit + str + +
+

new unit for the value

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/property.py +
@beartype
+def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:
+    """
+    set the value attribute of the Property subobject
+
+    Examples
+    ---------
+    ```python
+    my_property.set_value(new_value=1, new_unit="gram")
+    ```
+
+    Parameters
+    ----------
+    new_value : Number
+        new value
+    new_unit : str
+        new unit for the value
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/quantity/index.html b/nodes/subobjects/quantity/index.html new file mode 100644 index 000000000..efbb3ba7a --- /dev/null +++ b/nodes/subobjects/quantity/index.html @@ -0,0 +1,2773 @@ + + + + + + + + + + + + + + + + + + + + + + Quantity - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Quantity

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Quantity + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

The Quantity +sub-objects are the amount of material involved in a process

+
+
Can Be Added To:
+ +
Available sub-objects
+
    +
  • None
  • +
+
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
keystrmasstype of quantityTrueTrue
valueAny1.23amount of materialTrue
unitstrgramunit for quantityTrue
uncertaintyNumber0.1uncertainty of value
uncertainty_typestrstdtype of uncertaintyTrue
+
JSON Representation
+
{
+ "node":["Quantity"],
+ "key":"mass",
+ "value":11.2
+ "uncertainty":0.2,
+ "uncertainty_type":"stdev",
+ "unit":"kg",
+ "uid":"_:c95ee781-923b-4699-ba3b-923ce186ac5d",
+ "uuid":"c95ee781-923b-4699-ba3b-923ce186ac5d",
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/quantity.py +
class Quantity(UUIDBaseNode):
+    """
+    ## Definition
+    The [Quantity](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=22)
+    sub-objects are the amount of material involved in a process
+
+    ---
+
+    ## Can Be Added To:
+    * [Ingredient](../ingredient)
+
+    ## Available sub-objects
+    * None
+
+    ----
+
+    ## Attributes
+
+    | attribute        | type    | example | description          | required | vocab |
+    |------------------|---------|---------|----------------------|----------|-------|
+    | key              | str     | mass    | type of quantity     | True     | True  |
+    | value            | Any     | 1.23    | amount of material   | True     |       |
+    | unit             | str     | gram    | unit for quantity    | True     |       |
+    | uncertainty      | Number  | 0.1     | uncertainty of value |          |       |
+    | uncertainty_type | str     | std     | type of uncertainty  |          | True  |
+
+
+
+
+    ## JSON Representation
+    ```json
+    {
+     "node":["Quantity"],
+     "key":"mass",
+     "value":11.2
+     "uncertainty":0.2,
+     "uncertainty_type":"stdev",
+     "unit":"kg",
+     "uid":"_:c95ee781-923b-4699-ba3b-923ce186ac5d",
+     "uuid":"c95ee781-923b-4699-ba3b-923ce186ac5d",
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        key: str = ""
+        value: Optional[Number] = None
+        unit: str = ""
+        uncertainty: Optional[Number] = None
+        uncertainty_type: str = ""
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, key: str, value: Number, unit: str, uncertainty: Optional[Number] = None, uncertainty_type: str = "", **kwargs):
+        """
+        create Quantity sub-object
+
+        Parameters
+        ----------
+        key : str
+            type of quantity. Quantity key must come from [CRIPT Controlled Vocabulary]()
+        value : Number
+            amount of material
+        unit : str
+            unit for quantity
+        uncertainty : Union[Number, None], optional
+            uncertainty of value, by default None
+        uncertainty_type : str, optional
+            type of uncertainty. Quantity uncertainty type must come from [CRIPT Controlled Vocabulary](), by default ""
+
+        Examples
+        --------
+        ```python
+        import cript
+
+        my_quantity = cript.Quantity(
+            key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
+        )
+        ```
+
+        Returns
+        -------
+        None
+            create Quantity sub-object
+        """
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit, uncertainty=uncertainty, uncertainty_type=uncertainty_type)
+        self.validate()
+
+    @classmethod
+    def _from_json(cls, json_dict: dict):
+        # TODO: remove this temporary fix, once back end is working correctly
+        for key in ["value", "uncertainty"]:
+            try:
+                json_dict[key] = float(json_dict[key])
+            except KeyError:
+                pass
+        return super(Quantity, cls)._from_json(json_dict)
+
+    @beartype
+    def set_key_unit(self, new_key: str, new_unit: str) -> None:
+        """
+        set the Quantity key and unit attributes
+
+        Quantity key must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_quantity.set_key_unit(new_key="mass", new_unit="gram")
+        ```
+
+        Parameters
+        ----------
+        new_key : str
+            new Quantity key. Quantity key must come from [CRIPT Controlled Vocabulary]()
+        new_unit : str
+            new unit
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, key=new_key, unit=new_unit)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def key(self) -> str:
+        """
+        get the Quantity sub-object key attribute
+
+        Returns
+        -------
+        str
+            this Quantity key attribute
+        """
+        return self._json_attrs.key
+
+    @property
+    @beartype
+    def value(self) -> Union[int, float, str]:
+        """
+        amount of Material
+
+        Examples
+        --------
+        ```python
+        my_quantity.value = 1
+        ```
+
+        Returns
+        -------
+        Union[int, float, str]
+            amount of Material
+        """
+        return self._json_attrs.value  # type: ignore
+
+    @value.setter
+    @beartype
+    def value(self, new_value: Union[int, float, str]) -> None:
+        """
+        set the amount of Material
+
+        Parameters
+        ----------
+        new_value : Union[int, float, str]
+            amount of Material
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, value=new_value)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def unit(self) -> str:
+        """
+        get the Quantity unit attribute
+
+        Returns
+        -------
+        str
+            unit for the Quantity value attribute
+        """
+        return self._json_attrs.unit
+
+    @property
+    @beartype
+    def uncertainty(self) -> Number:
+        """
+        get the uncertainty value
+
+        Returns
+        -------
+        Number
+            uncertainty value
+        """
+        return self._json_attrs.uncertainty  # type: ignore
+
+    @property
+    @beartype
+    def uncertainty_type(self) -> str:
+        """
+        get the uncertainty type attribute for the Quantity sub-object
+
+        `uncertainty_type` must come from [CRIPT Controlled Vocabulary]()
+
+        Returns
+        -------
+        str
+            uncertainty type
+        """
+        return self._json_attrs.uncertainty_type
+
+    @beartype
+    def set_uncertainty(self, uncertainty: Number, type: str) -> None:
+        """
+        set the `uncertainty value` and `uncertainty_type`
+
+        Uncertainty and uncertainty type are set at the same time to keep the value and type in sync
+
+        `uncertainty_type` must come from [CRIPT Controlled Vocabulary]()
+
+        Examples
+        --------
+        ```python
+        my_property.set_uncertainty(uncertainty=1, type="stderr")
+        ```
+
+        Parameters
+        ----------
+        uncertainty : Number
+            uncertainty value
+        type : str
+            type of uncertainty, uncertainty_type must come from [CRIPT Controlled Vocabulary]()
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, uncertainty=uncertainty, uncertainty_type=type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+key: str + + + property + + +

+ + +
+ +

get the Quantity sub-object key attribute

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

this Quantity key attribute

+
+
+
+ +
+ +
+ + + +

+uncertainty: Number + + + property + + +

+ + +
+ +

get the uncertainty value

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Number + +
+

uncertainty value

+
+
+
+ +
+ +
+ + + +

+uncertainty_type: str + + + property + + +

+ + +
+ +

get the uncertainty type attribute for the Quantity sub-object

+

uncertainty_type must come from CRIPT Controlled Vocabulary

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

uncertainty type

+
+
+
+ +
+ +
+ + + +

+unit: str + + + property + + +

+ + +
+ +

get the Quantity unit attribute

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

unit for the Quantity value attribute

+
+
+
+ +
+ +
+ + + +

+value: Union[int, float, str] + + + property + writable + + +

+ + +
+ +

amount of Material

+ + + +

Examples:

+
my_quantity.value = 1
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[int, float, str] + +
+

amount of Material

+
+
+
+ +
+ + + + +
+ + + +

+__init__(key, value, unit, uncertainty=None, uncertainty_type='', **kwargs) + +

+ + +
+ +

create Quantity sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

type of quantity. Quantity key must come from CRIPT Controlled Vocabulary

+
+
+ required +
value + Number + +
+

amount of material

+
+
+ required +
unit + str + +
+

unit for quantity

+
+
+ required +
uncertainty + Union[Number, None] + +
+

uncertainty of value, by default None

+
+
+ None +
uncertainty_type + str + +
+

type of uncertainty. Quantity uncertainty type must come from CRIPT Controlled Vocabulary, by default ""

+
+
+ '' +
+ + + +

Examples:

+
import cript
+
+my_quantity = cript.Quantity(
+    key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
+)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

create Quantity sub-object

+
+
+ +
+ Source code in src/cript/nodes/subobjects/quantity.py +
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
@beartype
+def __init__(self, key: str, value: Number, unit: str, uncertainty: Optional[Number] = None, uncertainty_type: str = "", **kwargs):
+    """
+    create Quantity sub-object
+
+    Parameters
+    ----------
+    key : str
+        type of quantity. Quantity key must come from [CRIPT Controlled Vocabulary]()
+    value : Number
+        amount of material
+    unit : str
+        unit for quantity
+    uncertainty : Union[Number, None], optional
+        uncertainty of value, by default None
+    uncertainty_type : str, optional
+        type of uncertainty. Quantity uncertainty type must come from [CRIPT Controlled Vocabulary](), by default ""
+
+    Examples
+    --------
+    ```python
+    import cript
+
+    my_quantity = cript.Quantity(
+        key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
+    )
+    ```
+
+    Returns
+    -------
+    None
+        create Quantity sub-object
+    """
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit, uncertainty=uncertainty, uncertainty_type=uncertainty_type)
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+set_key_unit(new_key, new_unit) + +

+ + +
+ +

set the Quantity key and unit attributes

+

Quantity key must come from CRIPT Controlled Vocabulary

+ + + +

Examples:

+
my_quantity.set_key_unit(new_key="mass", new_unit="gram")
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
new_key + str + +
+

new Quantity key. Quantity key must come from CRIPT Controlled Vocabulary

+
+
+ required +
new_unit + str + +
+

new unit

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/quantity.py +
@beartype
+def set_key_unit(self, new_key: str, new_unit: str) -> None:
+    """
+    set the Quantity key and unit attributes
+
+    Quantity key must come from [CRIPT Controlled Vocabulary]()
+
+    Examples
+    --------
+    ```python
+    my_quantity.set_key_unit(new_key="mass", new_unit="gram")
+    ```
+
+    Parameters
+    ----------
+    new_key : str
+        new Quantity key. Quantity key must come from [CRIPT Controlled Vocabulary]()
+    new_unit : str
+        new unit
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, key=new_key, unit=new_unit)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + +
+ + + +

+set_uncertainty(uncertainty, type) + +

+ + +
+ +

set the uncertainty value and uncertainty_type

+

Uncertainty and uncertainty type are set at the same time to keep the value and type in sync

+

uncertainty_type must come from CRIPT Controlled Vocabulary

+ + + +

Examples:

+
my_property.set_uncertainty(uncertainty=1, type="stderr")
+
+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
uncertainty + Number + +
+

uncertainty value

+
+
+ required +
type + str + +
+

type of uncertainty, uncertainty_type must come from CRIPT Controlled Vocabulary

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/subobjects/quantity.py +
@beartype
+def set_uncertainty(self, uncertainty: Number, type: str) -> None:
+    """
+    set the `uncertainty value` and `uncertainty_type`
+
+    Uncertainty and uncertainty type are set at the same time to keep the value and type in sync
+
+    `uncertainty_type` must come from [CRIPT Controlled Vocabulary]()
+
+    Examples
+    --------
+    ```python
+    my_property.set_uncertainty(uncertainty=1, type="stderr")
+    ```
+
+    Parameters
+    ----------
+    uncertainty : Number
+        uncertainty value
+    type : str
+        type of uncertainty, uncertainty_type must come from [CRIPT Controlled Vocabulary]()
+
+    Returns
+    -------
+    None
+    """
+    new_attrs = replace(self._json_attrs, uncertainty=uncertainty, uncertainty_type=type)
+    self._update_json_attrs_if_valid(new_attrs)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/subobjects/software_configuration/index.html b/nodes/subobjects/software_configuration/index.html new file mode 100644 index 000000000..253acbf8a --- /dev/null +++ b/nodes/subobjects/software_configuration/index.html @@ -0,0 +1,2518 @@ + + + + + + + + + + + + + + + + + + + + + + Software Configuration - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Software Configuration

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ SoftwareConfiguration + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +
Definition
+

The software_configuration +sub-object includes software and the set of algorithms to execute computation or computational_process.

+
+
Can Be Added To:
+ +
Available sub-objects:
+ +
+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
keystypeexampledescriptionrequiredvocab
softwareSoftwaresoftware usedTrue
algorithmslist[Algorithm]algorithms used
notesstrmiscellaneous information, or custom data structure (e.g.; JSON)
citationlist[Citation]reference to a book, paper, or scholarly work
+
JSON Representation
+
{
+   "node":["SoftwareConfiguration"],
+   "uid":"_:f0dc3415-635d-4590-8b1f-cd65ad8ab3fe"
+   "software":{
+      "name":"SOMA",
+      "node":["Software"],
+      "source":"https://gitlab.com/InnocentBug/SOMA",
+      "uid":"_:5bf9cb33-f029-4d1b-ba53-3602036e4f75",
+      "uuid":"5bf9cb33-f029-4d1b-ba53-3602036e4f75",
+      "version":"0.7.0"
+   }
+}
+
+ +
+ Source code in src/cript/nodes/subobjects/software_configuration.py +
class SoftwareConfiguration(UUIDBaseNode):
+    """
+    ## Definition
+
+    The [software_configuration](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=24)
+    sub-object includes software and the set of algorithms to execute computation or computational_process.
+
+    ---
+
+    ## Can Be Added To:
+    * [Computation](../../primary_nodes/computation)
+    * [Computation_Process](../../primary_nodes/computation_process)
+
+    ## Available sub-objects:
+    * [Algorithm](../algorithm)
+    * [Citation](../citation)
+
+    ---
+
+    ## Attributes
+
+    | keys                                             | type            | example | description                                                      | required | vocab |
+    |--------------------------------------------------|-----------------|---------|------------------------------------------------------------------|----------|-------|
+    | software                                         | Software        |         | software used                                                    | True     |       |
+    | algorithms                                       | list[Algorithm] |         | algorithms used                                                  |          |       |
+    | notes                                            | str             |         | miscellaneous information, or custom data structure (e.g.; JSON) |          |       |
+    | citation                                         | list[Citation]  |         | reference to a book, paper, or scholarly work                    |          |       |
+
+
+    ## JSON Representation
+    ```json
+    {
+       "node":["SoftwareConfiguration"],
+       "uid":"_:f0dc3415-635d-4590-8b1f-cd65ad8ab3fe"
+       "software":{
+          "name":"SOMA",
+          "node":["Software"],
+          "source":"https://gitlab.com/InnocentBug/SOMA",
+          "uid":"_:5bf9cb33-f029-4d1b-ba53-3602036e4f75",
+          "uuid":"5bf9cb33-f029-4d1b-ba53-3602036e4f75",
+          "version":"0.7.0"
+       }
+    }
+    ```
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        software: Union[Software, None] = None
+        algorithm: List[Algorithm] = field(default_factory=list)
+        notes: str = ""
+        citation: List[Citation] = field(default_factory=list)
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, software: Software, algorithm: Optional[List[Algorithm]] = None, notes: str = "", citation: Union[List[Citation], None] = None, **kwargs):
+        """
+        Create Software_Configuration sub-object
+
+
+        Parameters
+        ----------
+        software : Software
+            Software node used for the Software_Configuration
+        algorithm : Union[List[Algorithm], None], optional
+            algorithm used for the Software_Configuration, by default None
+        notes : str, optional
+            plain text notes, by default ""
+        citation : Union[List[Citation], None], optional
+            list of Citation sub-object, by default None
+
+        Examples
+        ---------
+        ```python
+        import cript
+
+        my_software = cript.Software(name="LAMMPS", version="23Jun22", source="lammps.org")
+
+        my_software_configuration = cript.SoftwareConfiguration(software=my_software)
+        ```
+
+        Returns
+        -------
+        None
+            Create Software_Configuration sub-object
+        """
+        if algorithm is None:
+            algorithm = []
+        if citation is None:
+            citation = []
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, software=software, algorithm=algorithm, notes=notes, citation=citation)
+        self.validate()
+
+    @property
+    @beartype
+    def software(self) -> Union[Software, None]:
+        """
+        Software used
+
+        Examples
+        --------
+        ```python
+        my_software = cript.Software(
+            name="my software name", version="v1.0.0", source="https://myurl.com"
+        )
+
+        my_software_configuration.software = my_software
+        ```
+
+        Returns
+        -------
+        Union[Software, None]
+            Software node used
+        """
+        return self._json_attrs.software
+
+    @software.setter
+    @beartype
+    def software(self, new_software: Union[Software, None]) -> None:
+        """
+        set the Software used
+
+        Parameters
+        ----------
+        new_software : Union[Software, None]
+            new Software node
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, software=new_software)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def algorithm(self) -> List[Algorithm]:
+        """
+        list of Algorithms used
+
+        Examples
+        --------
+        ```python
+        my_algorithm = cript.Algorithm(key="mc_barostat", type="barostat")
+
+        my_software_configuration.algorithm = [my_algorithm]
+        ```
+
+        Returns
+        -------
+        List[Algorithm]
+            list of algorithms used
+        """
+        return self._json_attrs.algorithm.copy()
+
+    @algorithm.setter
+    @beartype
+    def algorithm(self, new_algorithm: List[Algorithm]) -> None:
+        """
+        set the list of Algorithms
+
+        Parameters
+        ----------
+        new_algorithm : List[Algorithm]
+            list of algorithms
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, algorithm=new_algorithm)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def notes(self) -> str:
+        """
+        miscellaneous information, or custom data structure (e.g.; JSON). Notes can be written in plain text or JSON
+
+        Examples
+        --------
+        ### Plain Text
+        ```json
+        my_software_configuration.notes = "these are my awesome notes!"
+        ```
+
+        ### JSON Notes
+        ```python
+        my_software_configuration.notes = "{'notes subject': 'notes contents'}"
+        ```
+
+        Returns
+        -------
+        str
+            notes
+        """
+        return self._json_attrs.notes
+
+    @notes.setter
+    @beartype
+    def notes(self, new_notes: str) -> None:
+        """
+        set notes for Software_configuration
+
+        Parameters
+        ----------
+        new_notes : str
+            new notes in plain text or JSON
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, notes=new_notes)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def citation(self) -> List[Citation]:
+        """
+        list of Citation sub-objects for the Software_Configuration
+
+        Examples
+        --------
+        ```python
+        title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+        title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+        # create reference node
+        my_reference = cript.Reference(
+            type"journal_article",
+            title=title,
+            author=["Ludwig Schneider", "Marcus Müller"],
+            journal="Computer Physics Communications",
+            publisher="Elsevier",
+            year=2019,
+            pages=[463, 476],
+            doi="10.1016/j.cpc.2018.08.011",
+            issn="0010-4655",
+            website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+        )
+
+        # create citation sub-object and add reference to it
+        my_citation = Citation("reference", my_reference)
+
+        # add citation to algorithm node
+        my_software_configuration.citation = [my_citation]
+        ```
+
+        Returns
+        -------
+        List[Citation]
+            list of Citations
+        """
+        return self._json_attrs.citation.copy()
+
+    @citation.setter
+    @beartype
+    def citation(self, new_citation: List[Citation]) -> None:
+        """
+        set the Citation sub-object
+
+        Parameters
+        ----------
+        new_citation : List[Citation]
+            new list of Citation sub-objects
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, citation=new_citation)
+        self._update_json_attrs_if_valid(new_attrs)
+
+
+ + + +
+ + + + + + + +
+ + + +

+algorithm: List[Algorithm] + + + property + writable + + +

+ + +
+ +

list of Algorithms used

+ + + +

Examples:

+
my_algorithm = cript.Algorithm(key="mc_barostat", type="barostat")
+
+my_software_configuration.algorithm = [my_algorithm]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Algorithm] + +
+

list of algorithms used

+
+
+
+ +
+ +
+ + + +

+citation: List[Citation] + + + property + writable + + +

+ + +
+ +

list of Citation sub-objects for the Software_Configuration

+ + + +

Examples:

+
title = "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
+title += "SOft coarse grained Monte-Carlo Acceleration (SOMA)"
+
+# create reference node
+my_reference = cript.Reference(
+    type"journal_article",
+    title=title,
+    author=["Ludwig Schneider", "Marcus Müller"],
+    journal="Computer Physics Communications",
+    publisher="Elsevier",
+    year=2019,
+    pages=[463, 476],
+    doi="10.1016/j.cpc.2018.08.011",
+    issn="0010-4655",
+    website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
+)
+
+# create citation sub-object and add reference to it
+my_citation = Citation("reference", my_reference)
+
+# add citation to algorithm node
+my_software_configuration.citation = [my_citation]
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Citation] + +
+

list of Citations

+
+
+
+ +
+ +
+ + + +

+notes: str + + + property + writable + + +

+ + +
+ +

miscellaneous information, or custom data structure (e.g.; JSON). Notes can be written in plain text or JSON

+ + + +

Examples:

+
Plain Text
+
my_software_configuration.notes = "these are my awesome notes!"
+
+
JSON Notes
+
my_software_configuration.notes = "{'notes subject': 'notes contents'}"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ str + +
+

notes

+
+
+
+ +
+ +
+ + + +

+software: Union[Software, None] + + + property + writable + + +

+ + +
+ +

Software used

+ + + +

Examples:

+
my_software = cript.Software(
+    name="my software name", version="v1.0.0", source="https://myurl.com"
+)
+
+my_software_configuration.software = my_software
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Union[Software, None] + +
+

Software node used

+
+
+
+ +
+ + + + +
+ + + +

+__init__(software, algorithm=None, notes='', citation=None, **kwargs) + +

+ + +
+ +

Create Software_Configuration sub-object

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
software + Software + +
+

Software node used for the Software_Configuration

+
+
+ required +
algorithm + Union[List[Algorithm], None] + +
+

algorithm used for the Software_Configuration, by default None

+
+
+ None +
notes + str + +
+

plain text notes, by default ""

+
+
+ '' +
citation + Union[List[Citation], None] + +
+

list of Citation sub-object, by default None

+
+
+ None +
+ + + +

Examples:

+
import cript
+
+my_software = cript.Software(name="LAMMPS", version="23Jun22", source="lammps.org")
+
+my_software_configuration = cript.SoftwareConfiguration(software=my_software)
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+

Create Software_Configuration sub-object

+
+
+ +
+ Source code in src/cript/nodes/subobjects/software_configuration.py +
@beartype
+def __init__(self, software: Software, algorithm: Optional[List[Algorithm]] = None, notes: str = "", citation: Union[List[Citation], None] = None, **kwargs):
+    """
+    Create Software_Configuration sub-object
+
+
+    Parameters
+    ----------
+    software : Software
+        Software node used for the Software_Configuration
+    algorithm : Union[List[Algorithm], None], optional
+        algorithm used for the Software_Configuration, by default None
+    notes : str, optional
+        plain text notes, by default ""
+    citation : Union[List[Citation], None], optional
+        list of Citation sub-object, by default None
+
+    Examples
+    ---------
+    ```python
+    import cript
+
+    my_software = cript.Software(name="LAMMPS", version="23Jun22", source="lammps.org")
+
+    my_software_configuration = cript.SoftwareConfiguration(software=my_software)
+    ```
+
+    Returns
+    -------
+    None
+        Create Software_Configuration sub-object
+    """
+    if algorithm is None:
+        algorithm = []
+    if citation is None:
+        citation = []
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, software=software, algorithm=algorithm, notes=notes, citation=citation)
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/supporting_nodes/file/index.html b/nodes/supporting_nodes/file/index.html new file mode 100644 index 000000000..0e7cdab95 --- /dev/null +++ b/nodes/supporting_nodes/file/index.html @@ -0,0 +1,3171 @@ + + + + + + + + + + + + + + + + + + + + + + File - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

File

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ File + + +

+ + +
+

+ Bases: PrimaryBaseNode

+ + +
Definition
+

The File node provides a link to scholarly work and allows users to specify in what way the work relates to that +data. More specifically, users can specify that the data was directly extracted from, inspired by, derived from, +etc.

+

The file node is held in the Data node.

+
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeTypeExampleDescriptionRequired
sourcestr"path/to/my/file" or "https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system"source to the file can be URL or local pathTrue
typestr"logs"Pick from CRIPT File TypesTrue
extensionstr".csv"file extensionFalse
data_dictionarystr"my extra info in my data dictionary"set of information describing the contents, format, and structure of a fileFalse
+
JSON
+
{
+    "node": "File",
+    "source": "https://criptapp.org",
+    "type": "calibration",
+    "extension": ".csv",
+    "data_dictionary": "my file's data dictionary",
+}
+
+ +
+ Source code in src/cript/nodes/supporting_nodes/file.py +
 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
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
class File(PrimaryBaseNode):
+    """
+    ## Definition
+
+    The [File node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001
+    .pdf#page=28) provides a link to  scholarly work and allows users to specify in what way the work relates to that
+    data. More specifically, users can specify that the data was directly extracted from, inspired by, derived from,
+    etc.
+
+    The file node is held in the [Data node](../../primary_nodes/data).
+
+    ## Attributes
+
+    | Attribute       | Type | Example                                                                                               | Description                                                                 | Required |
+    |-----------------|------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|----------|
+    | source          | str  | `"path/to/my/file"` or `"https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system"` | source to the file can be URL or local path                                 | True     |
+    | type            | str  | `"logs"`                                                                                              | Pick from [CRIPT File Types](https://criptapp.org/keys/file-type/)          | True     |
+    | extension       | str  | `".csv"`                                                                                              | file extension                                                              | False    |
+    | data_dictionary | str  | `"my extra info in my data dictionary"`                                                               | set of information describing the contents, format, and structure of a file | False    |
+
+    ## JSON
+    ``` json
+    {
+        "node": "File",
+        "source": "https://criptapp.org",
+        "type": "calibration",
+        "extension": ".csv",
+        "data_dictionary": "my file's data dictionary",
+    }
+    ```
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+        """
+        all file attributes
+        """
+
+        source: str = ""
+        type: str = ""
+        extension: str = ""
+        data_dictionary: str = ""
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, name: str, source: str, type: str, extension: str = "", data_dictionary: str = "", notes: str = "", **kwargs):
+        """
+        create a File node
+
+        Parameters
+        ----------
+        name: str
+            File node name
+        source: str
+            link or path to local file
+        type: str
+            Pick a file type from CRIPT controlled vocabulary [File types]()
+        extension:str
+            file extension
+        data_dictionary:str
+            extra information describing the file
+        notes: str
+            notes for the file node
+        **kwargs:dict
+            for internal use. Any extra data needed to create this file node
+            when deserializing the JSON response from the API
+
+        Examples
+        --------
+        ??? Example "Minimal File Node"
+            ```python
+            my_file = cript.File(
+                source="https://criptapp.org",
+                type="calibration",
+            )
+            ```
+
+        ??? Example "Maximal File Node"
+            ```python
+            my_file = cript.File(
+                source="https://criptapp.org",
+                type="calibration",
+                extension=".csv",
+                data_dictionary="my file's data dictionary"
+                notes="my notes for this file"
+            )
+            ```
+        """
+
+        super().__init__(name=name, notes=notes, **kwargs)
+
+        # TODO check if vocabulary is valid or not
+        # is_vocab_valid("file type", type)
+
+        # setting every attribute except for source, which will be handled via setter
+        self._json_attrs = replace(
+            self._json_attrs,
+            type=type,
+            # always giving the function the required str regardless if the input `Path` or `str`
+            source=str(source),
+            extension=extension,
+            data_dictionary=data_dictionary,
+        )
+
+        self.validate()
+
+    def ensure_uploaded(self, api=None):
+        """
+        Ensure that a local file is being uploaded into CRIPT accessible cloud storage.
+        After this call, non-local files (file names that do not start with `http`) are uploaded.
+        It is not necessary to call this function manually.
+        A saved project automatically ensures uploaded files, it is recommend to rely on the automatic upload.
+
+        Parameters:
+        -----------
+
+        api: cript.API, optional
+           API object that performs the upload.
+           If None, the globally cached object is being used.
+
+        Examples
+        --------
+        ??? Example "Minimal File Node"
+            ```python
+            my_file = cript.File(source="/local/path/to/file", type="calibration")
+            my_file.ensure_uploaded()
+            my_file.source # Starts with http now
+            ```
+
+        """
+
+        if _is_local_file(file_source=self.source):
+            # upload file source if local file
+            self.source = _upload_file_and_get_object_name(source=self.source)
+
+    # TODO can be made into a function
+
+    # --------------- Properties ---------------
+    @property
+    @beartype
+    def source(self) -> str:
+        """
+        The File node source can be set to be either a path to a local file on disk
+        or a URL path to a file on the web.
+
+        Example
+        --------
+        URL File Source
+        ```python
+        url_source = "https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf"
+        my_file.source = url_source
+        ```
+        Local File Path
+        ```python
+        my_file.source = "/home/user/project/my_file.csv"
+        ```
+
+        Returns
+        -------
+        source: str
+            A string representing the file source.
+        """
+        return self._json_attrs.source
+
+    @source.setter
+    @beartype
+    def source(self, new_source: str) -> None:
+        """
+        sets the source of the file node
+        the source can either be a path to a file on local storage or a link to a file
+
+        1. checks if the file source is a link or a local file path
+        2. if the source is a link such as `https://wikipedia.com` then it sets the URL as the file source
+        3. if the file source is a local file path such as
+                `C:\\Users\\my_username\\Desktop\\cript\\file.txt`
+            1. then it opens the file and reads it
+            2. uploads it to the cloud storage
+            3. gets back a URL from where in the cloud the file is found
+            4. sets that as the source
+
+        Parameters
+        ----------
+        new_source: str
+
+        Example
+        -------
+        ```python
+        my_file.source = "https://pubs.acs.org/doi/10.1021/acscentsci.3c00011"
+        ```
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, source=new_source)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def type(self) -> str:
+        """
+        The [File type]() must come from [CRIPT controlled vocabulary]()
+
+        Example
+        -------
+        ```python
+        my_file.type = "calibration"
+        ```
+
+        Returns
+        -------
+        file type: str
+            file type must come from [CRIPT controlled vocabulary]()
+        """
+        return self._json_attrs.type
+
+    @type.setter
+    @beartype
+    def type(self, new_type: str) -> None:
+        """
+        set the file type
+
+        file type must come from CRIPT controlled vocabulary
+
+        Parameters
+        -----------
+        new_type: str
+
+        Example
+        -------
+        ```python
+        my_file.type = "computation_config"
+        ```
+
+        Returns
+        -------
+        None
+        """
+        # TODO check vocabulary is valid
+        # is_vocab_valid("file type", self._json_attrs.type)
+        new_attrs = replace(self._json_attrs, type=new_type)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def extension(self) -> str:
+        """
+        The file extension property explicitly states what is the file extension of the file node.
+
+        Example
+        -------
+        ```python
+        my_file_node.extension = ".csv"`
+        ```
+
+        Returns
+        -------
+        extension: str
+            file extension
+        """
+        return self._json_attrs.extension
+
+    @extension.setter
+    @beartype
+    def extension(self, new_extension) -> None:
+        """
+        sets the new file extension
+
+        Parameters
+        ----------
+        new_extension: str
+            new file extension to overwrite the current file extension
+
+        Example
+        -------
+        ```python
+        my_file.extension = ".pdf"
+        ```
+
+        Returns
+        -------
+            None
+        """
+        new_attrs = replace(self._json_attrs, extension=new_extension)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @property
+    @beartype
+    def data_dictionary(self) -> str:
+        # TODO data dictionary needs documentation describing it and how to use it
+        """
+        The data dictionary contains additional information
+        that the scientist needs to describe their file.
+
+        Notes
+        ------
+        It is advised for this field to be written in JSON format
+
+        Examples
+        -------
+        ```python
+        my_file.data_dictionary = "{'notes': 'This is something that describes my file node.'}"
+        ```
+
+        Returns
+        -------
+        data_dictionary: str
+            the file data dictionary attribute
+        """
+        return self._json_attrs.data_dictionary
+
+    @data_dictionary.setter
+    @beartype
+    def data_dictionary(self, new_data_dictionary: str) -> None:
+        """
+        Sets the data dictionary for the file node.
+
+        Parameters
+        ----------
+        new_data_dictionary: str
+            The new data dictionary to be set.
+
+        Returns
+        -------
+        None
+        """
+        new_attrs = replace(self._json_attrs, data_dictionary=new_data_dictionary)
+        self._update_json_attrs_if_valid(new_attrs)
+
+    @beartype
+    def download(
+        self,
+        destination_directory_path: Union[str, Path] = ".",
+    ) -> None:
+        """
+        download this file to current working directory or a specific destination.
+        The file name will come from the file_node.name and the extension will come from file_node.extension
+
+        Notes
+        -----
+        Whether the file extension is written like `.csv` or `csv` the program will work correctly
+
+        Parameters
+        ----------
+        destination_directory_path: Union[str, Path]
+            where you want the file to be stored and what you want the name to be
+            by default it is the current working directory
+
+        Returns
+        -------
+        None
+        """
+        from cript.api.api import _get_global_cached_api
+
+        api = _get_global_cached_api()
+
+        # convert the path from str to Path in case it was given as a str and resolve it to get the absolute path
+        existing_folder_path = Path(destination_directory_path).resolve()
+
+        # stripping dot from extension to make all extensions uniform, in case a user puts `.csv` or `csv` it will work
+        file_name = f"{self.name}.{self.extension.lstrip('.')}"
+
+        absolute_file_path = str((existing_folder_path / file_name).resolve())
+
+        api.download_file(file_source=self.source, destination_path=absolute_file_path)
+
+
+ + + +
+ + + + + + + +
+ + + +

+data_dictionary: str + + + property + writable + + +

+ + +
+ +

The data dictionary contains additional information +that the scientist needs to describe their file.

+
Notes
+

It is advised for this field to be written in JSON format

+ + + +

Examples:

+
my_file.data_dictionary = "{'notes': 'This is something that describes my file node.'}"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
data_dictionary + str + +
+

the file data dictionary attribute

+
+
+
+ +
+ +
+ + + +

+extension: str + + + property + writable + + +

+ + +
+ +

The file extension property explicitly states what is the file extension of the file node.

+
Example
+
my_file_node.extension = ".csv"`
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
extension + str + +
+

file extension

+
+
+
+ +
+ +
+ + + +

+source: str + + + property + writable + + +

+ + +
+ +

The File node source can be set to be either a path to a local file on disk +or a URL path to a file on the web.

+
Example
+

URL File Source +

url_source = "https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf"
+my_file.source = url_source
+
+Local File Path +
my_file.source = "/home/user/project/my_file.csv"
+

+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
source + str + +
+

A string representing the file source.

+
+
+
+ +
+ +
+ + + +

+type: str + + + property + writable + + +

+ + +
+ +

The File type must come from CRIPT controlled vocabulary

+
Example
+
my_file.type = "calibration"
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ file type: str + +
+

file type must come from CRIPT controlled vocabulary

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: PrimaryBaseNode.JsonAttributes

+ + +

all file attributes

+ +
+ Source code in src/cript/nodes/supporting_nodes/file.py +
@dataclass(frozen=True)
+class JsonAttributes(PrimaryBaseNode.JsonAttributes):
+    """
+    all file attributes
+    """
+
+    source: str = ""
+    type: str = ""
+    extension: str = ""
+    data_dictionary: str = ""
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(name, source, type, extension='', data_dictionary='', notes='', **kwargs) + +

+ + +
+ +

create a File node

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str + +
+

File node name

+
+
+ required +
source + str + +
+

link or path to local file

+
+
+ required +
type + str + +
+

Pick a file type from CRIPT controlled vocabulary File types

+
+
+ required +
extension + str + +
+

file extension

+
+
+ '' +
data_dictionary + str + +
+

extra information describing the file

+
+
+ '' +
notes + str + +
+

notes for the file node

+
+
+ '' +
**kwargs + +
+

for internal use. Any extra data needed to create this file node +when deserializing the JSON response from the API

+
+
+ {} +
+ + + +

Examples:

+
+Minimal File Node +
my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+)
+
+
+
+Maximal File Node +
my_file = cript.File(
+    source="https://criptapp.org",
+    type="calibration",
+    extension=".csv",
+    data_dictionary="my file's data dictionary"
+    notes="my notes for this file"
+)
+
+
+ +
+ Source code in src/cript/nodes/supporting_nodes/file.py +
@beartype
+def __init__(self, name: str, source: str, type: str, extension: str = "", data_dictionary: str = "", notes: str = "", **kwargs):
+    """
+    create a File node
+
+    Parameters
+    ----------
+    name: str
+        File node name
+    source: str
+        link or path to local file
+    type: str
+        Pick a file type from CRIPT controlled vocabulary [File types]()
+    extension:str
+        file extension
+    data_dictionary:str
+        extra information describing the file
+    notes: str
+        notes for the file node
+    **kwargs:dict
+        for internal use. Any extra data needed to create this file node
+        when deserializing the JSON response from the API
+
+    Examples
+    --------
+    ??? Example "Minimal File Node"
+        ```python
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+        )
+        ```
+
+    ??? Example "Maximal File Node"
+        ```python
+        my_file = cript.File(
+            source="https://criptapp.org",
+            type="calibration",
+            extension=".csv",
+            data_dictionary="my file's data dictionary"
+            notes="my notes for this file"
+        )
+        ```
+    """
+
+    super().__init__(name=name, notes=notes, **kwargs)
+
+    # TODO check if vocabulary is valid or not
+    # is_vocab_valid("file type", type)
+
+    # setting every attribute except for source, which will be handled via setter
+    self._json_attrs = replace(
+        self._json_attrs,
+        type=type,
+        # always giving the function the required str regardless if the input `Path` or `str`
+        source=str(source),
+        extension=extension,
+        data_dictionary=data_dictionary,
+    )
+
+    self.validate()
+
+
+
+ +
+ + +
+ + + +

+download(destination_directory_path='.') + +

+ + +
+ +

download this file to current working directory or a specific destination. +The file name will come from the file_node.name and the extension will come from file_node.extension

+
Notes
+

Whether the file extension is written like .csv or csv the program will work correctly

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
destination_directory_path + Union[str, Path] + +
+

where you want the file to be stored and what you want the name to be +by default it is the current working directory

+
+
+ '.' +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ None + +
+ +
+
+ +
+ Source code in src/cript/nodes/supporting_nodes/file.py +
@beartype
+def download(
+    self,
+    destination_directory_path: Union[str, Path] = ".",
+) -> None:
+    """
+    download this file to current working directory or a specific destination.
+    The file name will come from the file_node.name and the extension will come from file_node.extension
+
+    Notes
+    -----
+    Whether the file extension is written like `.csv` or `csv` the program will work correctly
+
+    Parameters
+    ----------
+    destination_directory_path: Union[str, Path]
+        where you want the file to be stored and what you want the name to be
+        by default it is the current working directory
+
+    Returns
+    -------
+    None
+    """
+    from cript.api.api import _get_global_cached_api
+
+    api = _get_global_cached_api()
+
+    # convert the path from str to Path in case it was given as a str and resolve it to get the absolute path
+    existing_folder_path = Path(destination_directory_path).resolve()
+
+    # stripping dot from extension to make all extensions uniform, in case a user puts `.csv` or `csv` it will work
+    file_name = f"{self.name}.{self.extension.lstrip('.')}"
+
+    absolute_file_path = str((existing_folder_path / file_name).resolve())
+
+    api.download_file(file_source=self.source, destination_path=absolute_file_path)
+
+
+
+ +
+ + +
+ + + +

+ensure_uploaded(api=None) + +

+ + +
+ +

Ensure that a local file is being uploaded into CRIPT accessible cloud storage. +After this call, non-local files (file names that do not start with http) are uploaded. +It is not necessary to call this function manually. +A saved project automatically ensures uploaded files, it is recommend to rely on the automatic upload.

+
Parameters:
+

api: cript.API, optional + API object that performs the upload. + If None, the globally cached object is being used.

+ + + +

Examples:

+
+Minimal File Node +
my_file = cript.File(source="/local/path/to/file", type="calibration")
+my_file.ensure_uploaded()
+my_file.source # Starts with http now
+
+
+ +
+ Source code in src/cript/nodes/supporting_nodes/file.py +
def ensure_uploaded(self, api=None):
+    """
+    Ensure that a local file is being uploaded into CRIPT accessible cloud storage.
+    After this call, non-local files (file names that do not start with `http`) are uploaded.
+    It is not necessary to call this function manually.
+    A saved project automatically ensures uploaded files, it is recommend to rely on the automatic upload.
+
+    Parameters:
+    -----------
+
+    api: cript.API, optional
+       API object that performs the upload.
+       If None, the globally cached object is being used.
+
+    Examples
+    --------
+    ??? Example "Minimal File Node"
+        ```python
+        my_file = cript.File(source="/local/path/to/file", type="calibration")
+        my_file.ensure_uploaded()
+        my_file.source # Starts with http now
+        ```
+
+    """
+
+    if _is_local_file(file_source=self.source):
+        # upload file source if local file
+        self.source = _upload_file_and_get_object_name(source=self.source)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/supporting_nodes/group/index.html b/nodes/supporting_nodes/group/index.html new file mode 100644 index 000000000..7669bc086 --- /dev/null +++ b/nodes/supporting_nodes/group/index.html @@ -0,0 +1,1097 @@ + + + + + + + + + + + + + + + + + + Group Node - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Group Node

+ +

Group Node

+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nodes/supporting_nodes/user/index.html b/nodes/supporting_nodes/user/index.html new file mode 100644 index 000000000..91e63f7cd --- /dev/null +++ b/nodes/supporting_nodes/user/index.html @@ -0,0 +1,2125 @@ + + + + + + + + + + + + + + + + + + + + + + User - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

User

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ User + + +

+ + +
+

+ Bases: UUIDBaseNode

+ + +

The User node +represents any researcher or individual who interacts with the CRIPT platform. +It serves two main purposes: +1. It plays a core role in permissions (access control) +1. It provides a traceable link to the individual who has contributed or edited data within the database

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
attributetypeexampledescriptionrequiredvocab
urlstrunique ID of the nodeTrue
usernamestr"john_doe"User’s nameTrue
emailstr"user@cript.com"email of the userTrue
orcidstr"0000-0000-0000-0000"ORCID ID of the userTrue
updated_atdatetime*2023-03-06 18:45:23.450248last date the node was modified (UTC time)True
created_atdatetime*2023-03-06 18:45:23.450248date it was created (UTC time)True
+
JSON
+
{
+    "node": "User",
+    "username": "my username",
+    "email": "user@email.com",
+    "orcid": "0000-0000-0000-0001",
+}
+
+
Warnings
+
    +
  • A User cannot be created or modified using the Python SDK.
  • +
  • A User node is a read-only node that can only be deserialized from API JSON response to Python node.
  • +
  • The User node cannot be instantiated and within the Python SDK.
  • +
  • Attempting to edit the user node will result in an Attribute Error
  • +
+ +
+ Source code in src/cript/nodes/supporting_nodes/user.py +
class User(UUIDBaseNode):
+    """
+    The [User node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=27)
+    represents any researcher or individual who interacts with the CRIPT platform.
+    It serves two main purposes:
+    1. It plays a core role in permissions (access control)
+    1. It provides a traceable link to the individual who has contributed or edited data within the database
+
+
+    | attribute  | type        | example                    | description                                | required | vocab |
+    |------------|-------------|----------------------------|--------------------------------------------|----------|-------|
+    | url        | str         |                            | unique ID of the node                      | True     |       |
+    | username   | str         | "john_doe"                 | User’s name                                | True     |       |
+    | email      | str         | "user@cript.com"           | email of the user                          | True     |       |
+    | orcid      | str         | "0000-0000-0000-0000"      | ORCID ID of the user                       | True     |       |
+    | updated_at | datetime*   | 2023-03-06 18:45:23.450248 | last date the node was modified (UTC time) | True     |       |
+    | created_at | datetime*   | 2023-03-06 18:45:23.450248 | date it was created (UTC time)             | True     |       |
+
+
+    ## JSON
+    ```json
+    {
+        "node": "User",
+        "username": "my username",
+        "email": "user@email.com",
+        "orcid": "0000-0000-0000-0001",
+    }
+    ```
+
+    Warnings
+    -------
+    * A User cannot be created or modified using the Python SDK.
+    * A User node is a **read-only** node that can only be deserialized from API JSON response to Python node.
+    * The User node cannot be instantiated and within the Python SDK.
+    * Attempting to edit the user node will result in an `Attribute Error`
+
+    """
+
+    @dataclass(frozen=True)
+    class JsonAttributes(UUIDBaseNode.JsonAttributes):
+        """
+        all User attributes
+        """
+
+        email: Optional[str] = ""
+        model_version: str = ""
+        orcid: Optional[str] = ""
+        picture: str = ""
+        username: str = ""
+
+    _json_attrs: JsonAttributes = JsonAttributes()
+
+    @beartype
+    def __init__(self, username: str, email: Optional[str] = "", orcid: Optional[str] = "", **kwargs):
+        """
+        Json from CRIPT API to be converted to a node
+        optionally the group can be None if the user doesn't have a group
+
+        Parameters
+        ----------
+        username: str
+            user username
+        email: str
+            user email
+        orcid: str
+            user ORCID
+        """
+        super().__init__(**kwargs)
+        self._json_attrs = replace(self._json_attrs, username=username, email=email, orcid=orcid)
+
+        self.validate()
+
+    @property
+    @beartype
+    def created_at(self) -> str:
+        return self._json_attrs.created_at
+
+    @property
+    @beartype
+    def email(self) -> Union[str, None]:
+        """
+        user's email
+
+        Raises
+        ------
+        AttributeError
+
+        Returns
+        -------
+        user email: str
+            User node email
+        """
+        return self._json_attrs.email
+
+    @property
+    @beartype
+    def model_version(self) -> str:
+        return self._json_attrs.model_version
+
+    @property
+    @beartype
+    def orcid(self) -> Union[str, None]:
+        """
+        users [ORCID](https://orcid.org/)
+
+        Raises
+        ------
+        AttributeError
+
+        Returns
+        -------
+        ORCID: str
+            user's ORCID
+        """
+        return self._json_attrs.orcid
+
+    @property
+    @beartype
+    def picture(self) -> str:
+        return self._json_attrs.picture
+
+    @property
+    @beartype
+    def updated_at(self) -> str:
+        return self._json_attrs.updated_at
+
+    @property
+    @beartype
+    def username(self) -> str:
+        """
+        username of the User node
+
+        Raises
+        ------
+        AttributeError
+
+        Returns
+        -------
+        username: str
+            username of the User node
+        """
+        return self._json_attrs.username
+
+
+ + + +
+ + + + + + + +
+ + + +

+email: Union[str, None] + + + property + + +

+ + +
+ +

user's email

+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ AttributeError + +
+ +
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ user email: str + +
+

User node email

+
+
+
+ +
+ +
+ + + +

+orcid: Union[str, None] + + + property + + +

+ + +
+ +

users ORCID

+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ AttributeError + +
+ +
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
ORCID + str + +
+

user's ORCID

+
+
+
+ +
+ +
+ + + +

+username: str + + + property + + +

+ + +
+ +

username of the User node

+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ AttributeError + +
+ +
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
Name TypeDescription
username + str + +
+

username of the User node

+
+
+
+ +
+ + +
+ + + +

+ JsonAttributes + + + + dataclass + + +

+ + +
+

+ Bases: UUIDBaseNode.JsonAttributes

+ + +

all User attributes

+ +
+ Source code in src/cript/nodes/supporting_nodes/user.py +
47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
@dataclass(frozen=True)
+class JsonAttributes(UUIDBaseNode.JsonAttributes):
+    """
+    all User attributes
+    """
+
+    email: Optional[str] = ""
+    model_version: str = ""
+    orcid: Optional[str] = ""
+    picture: str = ""
+    username: str = ""
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+__init__(username, email='', orcid='', **kwargs) + +

+ + +
+ +

Json from CRIPT API to be converted to a node +optionally the group can be None if the user doesn't have a group

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
username + str + +
+

user username

+
+
+ required +
email + Optional[str] + +
+

user email

+
+
+ '' +
orcid + Optional[str] + +
+

user ORCID

+
+
+ '' +
+ +
+ Source code in src/cript/nodes/supporting_nodes/user.py +
61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
@beartype
+def __init__(self, username: str, email: Optional[str] = "", orcid: Optional[str] = "", **kwargs):
+    """
+    Json from CRIPT API to be converted to a node
+    optionally the group can be None if the user doesn't have a group
+
+    Parameters
+    ----------
+    username: str
+        user username
+    email: str
+        user email
+    orcid: str
+        user ORCID
+    """
+    super().__init__(**kwargs)
+    self._json_attrs = replace(self._json_attrs, username=username, email=email, orcid=orcid)
+
+    self.validate()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 000000000..dba024eca Binary files /dev/null and b/objects.inv differ diff --git a/search/search_index.json b/search/search_index.json new file mode 100644 index 000000000..888862b32 --- /dev/null +++ b/search/search_index.json @@ -0,0 +1 @@ +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":"

CRIPT (the Community Resource for Innovation in Polymer Technology) is a web-based platform for capturing and sharing polymer data. In addition to a user interface, CRIPT enables programmatic access to the platform through the CRIPT Python SDK, which interfaces with a REST API.

CRIPT offers multiple options to upload data, and scientists can pick the method that best suits them. Using the SDK to upload is a great choice if you have a large amount of data, stored it in an unconventional way, and know some python programming. You can easily use a library such as Pandas or Numpy to parse your data, create the needed CRIPT objects/nodes and upload them into CRIPT.

Another great option can be the Excel Uploader for scientists that do not have past Python experience or would rather easily input their data into the CRIPT Excel Template.

"},{"location":"#resources","title":"Resources","text":"CRIPT Resources
  • CRIPT Data Model
    • The CRIPT Data Model is the back bone of the whole CRIPT project. Understanding it will make it a lot easier to use any part of the system
  • CRIPT Scripts Research paper
    • Learn about the CRIPT platform
  • CRIPTScripts
    • CRIPT Scripts is a curated list of examples and tools for interacting with the CRIPT platform.
  • CRIPT Python SDK Internal Documentation
    • Learn more about the internal workings of the CRIPT Python SDK
  • CRIPT Python SDK Discussions Tab
    • Communicate with the CRIPT Python SDK team
  • CRIPT Python SDK Contributing Guidelines
    • Learn how to contribute to the CRIPT Python SDK open-source project
  • CRIPT Python SDK Contributors
"},{"location":"faq/","title":"FAQ","text":""},{"location":"faq/#frequently-asked-questions","title":"Frequently Asked Questions","text":"

Q: Where can I find more information about the CRIPT data model?

A: Please feel free to review the CRIPT data model document and the CRIPT research paper

Q: What does this error mean?

A: Please visit the Exceptions documentation

Q: Where do I report an issue that I encountered?

A: Please feel free to report issues to our GitHub repository. We are always looking for ways to improve and create software that is a joy to use!

Q: Where can I find more CRIPT examples?

A: Please visit CRIPT Scripts where there are many CRIPT examples ranging from CRIPT graphs drawn out from research papers, Python scripts, TypeScript scripts, and more!

Q: Where can I find more example code?

A: We have written a lot of tests for our software, and if needed, those tests can be referred to as example code to work with the Python SDK software. The Python SDK tests are located within the GitHub repository/tests, and there they are broken down to different kinds of tests

Q: How can I contribute to this project?

A: We would love to have you contribute. Please read theGitHub repository wiki to understand more and get started. Feel free to contribute to any bugs you find, any issues within the GitHub repository, or any features you want.

Q: This repository is awesome, how can I build a plugin to add to it?

A: We have built this code with plugins in mind! Please visit the CRIPT Python SDK GitHub repository Wiki tab for developer documentation.

Q: I have this question that is not covered anywhere, where can I ask it?

A: Please visit the CRIPT Python SDK repository and ask your question within the discussions tab Q/A section

Q: Where is the best place where I can contact the CRIPT Python SDK team for questions or support?

A: We would love to hear from you! Please visit our CRIPT Python SDK Repository GitHub Discussions to easily send us questions. Our repository's issue page is also another good way to let us know about any issues or suggestions you might have. A GitHub account is required.

Q: How can I report security issues?

A: Please visit the CRIPT Python SDK GitHub repository security tab for any security issues.

Q: Besides the user documentation are there any developer documentation that I can read through on how the code is written to get a better grasp of it?

A: You bet! There are documentation for developers within the CRIPT Python SDK Wiki. There you will find documentation on everything from how our code is structure, how we aim to write our documentation, CI/CD, and more.

We try to also have type hinting, comments, and docstrings for all the code that we work on so it is clear and easy for anyone reading it to easily understand.

if all else fails, contact us on our GitHub Repository.

"},{"location":"utility_functions/","title":"Utility Functions","text":""},{"location":"utility_functions/#cript.nodes.util.NodeEncoder","title":"NodeEncoder","text":"

Bases: json.JSONEncoder

Source code in src/cript/nodes/util/__init__.py
class NodeEncoder(json.JSONEncoder):\nhandled_ids: Set[str] = set()\nknown_uuid: Set[str] = set()\ncondense_to_uuid: Set[str] = set()\nsuppress_attributes: Optional[Dict[str, Set[str]]] = None\ndef default(self, obj):\nif isinstance(obj, uuid.UUID):\nreturn str(obj)\nif isinstance(obj, BaseNode):\ntry:\nuid = obj.uid\nexcept AttributeError:\npass\nelse:\nif uid in NodeEncoder.handled_ids:\nreturn {\"node\": obj._json_attrs.node, \"uid\": uid}\n# When saving graphs, some nodes can be pre-saved.\n# If that happens, we want to represent them as a UUID edge only\ntry:\nuuid_str = str(obj.uuid)\nexcept AttributeError:\npass\nelse:\nif uuid_str in NodeEncoder.known_uuid:\nreturn {\"uuid\": uuid_str}\ndefault_values = asdict(obj.JsonAttributes())\nserialize_dict = {}\n# Remove default values from serialization\nfor key in default_values:\nif key in obj._json_attrs.__dataclass_fields__:\nif getattr(obj._json_attrs, key) != default_values[key]:\nserialize_dict[key] = copy.copy(getattr(obj._json_attrs, key))\nserialize_dict[\"node\"] = obj._json_attrs.node\n# check if further modifications to the dict is needed before considering it done\nserialize_dict, condensed_uid = self._apply_modifications(serialize_dict)\nif uid not in condensed_uid:  # We can uid (node) as handled if we don't condense it to uuid\nNodeEncoder.handled_ids.add(uid)\n# Remove suppressed attributes\nif NodeEncoder.suppress_attributes is not None and str(obj.uuid) in NodeEncoder.suppress_attributes:\nfor attr in NodeEncoder.suppress_attributes[str(obj.uuid)]:\ndel serialize_dict[attr]\nreturn serialize_dict\nreturn json.JSONEncoder.default(self, obj)\ndef _apply_modifications(self, serialize_dict):\n\"\"\"\n        Checks the serialize_dict to see if any other operations are required before it\n        can be considered done. If other operations are required, then it passes it to the other operations\n        and at the end returns the fully finished dict.\n        This function is essentially a big switch case that checks the node type\n        and determines what other operations are required for it.\n        Parameters\n        ----------\n        serialize_dict: dict\n        Returns\n        -------\n        serialize_dict: dict\n        \"\"\"\ndef process_attribute(attribute):\ndef strip_to_edge_uuid(element):\n# Extracts UUID and UID information from the element\ntry:\nuuid = getattr(element, \"uuid\")\nexcept AttributeError:\nuuid = element[\"uuid\"]\nif len(element) == 1:  # Already a condensed element\nreturn element, None\ntry:\nuid = getattr(element, \"uid\")\nexcept AttributeError:\nuid = element[\"uid\"]\nelement = {\"uuid\": str(uuid)}\nreturn element, uid\n# Processes an attribute based on its type (list or single element)\nif isinstance(attribute, list):\nprocessed_elements = []\nfor element in attribute:\nprocessed_element, uid = strip_to_edge_uuid(element)\nif uid is not None:\nuid_of_condensed.append(uid)\nprocessed_elements.append(processed_element)\nreturn processed_elements\nelse:\nprocessed_attribute, uid = strip_to_edge_uuid(attribute)\nif uid is not None:\nuid_of_condensed.append(uid)\nreturn processed_attribute\nuid_of_condensed = []\nnodes_to_condense = serialize_dict[\"node\"]\nfor node_type in nodes_to_condense:\nif node_type in self.condense_to_uuid:\nattributes_to_process = self.condense_to_uuid[node_type]\nfor attribute in attributes_to_process:\nif attribute in serialize_dict:\nattribute_to_condense = serialize_dict[attribute]\nprocessed_attribute = process_attribute(attribute_to_condense)\nserialize_dict[attribute] = processed_attribute\n# Check if the node is \"Material\" and convert the identifiers list to JSON fields\nif serialize_dict[\"node\"] == [\"Material\"]:\nserialize_dict = _material_identifiers_list_to_json_fields(serialize_dict)\nreturn serialize_dict, uid_of_condensed\n
"},{"location":"utility_functions/#cript.nodes.util.add_orphaned_nodes_to_project","title":"add_orphaned_nodes_to_project(project, active_experiment, max_iteration=-1)","text":"

Helper function that adds all orphaned material nodes of the project graph to the project.materials attribute. Material additions only is permissible with active_experiment is None. This function also adds all orphaned data, process, computation and computational process nodes of the project graph to the active_experiment. This functions call project.validate and might raise Exceptions from there.

Source code in src/cript/nodes/util/__init__.py
def add_orphaned_nodes_to_project(project: Project, active_experiment: Experiment, max_iteration: int = -1):\n\"\"\"\n    Helper function that adds all orphaned material nodes of the project graph to the\n    `project.materials` attribute.\n    Material additions only is permissible with `active_experiment is None`.\n    This function also adds all orphaned data, process, computation and computational process nodes\n    of the project graph to the `active_experiment`.\n    This functions call `project.validate` and might raise Exceptions from there.\n    \"\"\"\nif active_experiment is not None and active_experiment not in project.find_children({\"node\": [\"Experiment\"]}):\nraise RuntimeError(f\"The provided active experiment {active_experiment} is not part of the project graph. Choose an active experiment that is part of a collection of this project.\")\ncounter = 0\nwhile True:\nif counter > max_iteration >= 0:\nbreak  # Emergency stop\ntry:\nproject.validate()\nexcept CRIPTOrphanedMaterialError as exc:\n# because calling the setter calls `validate` we have to force add the material.\nproject._json_attrs.material.append(exc.orphaned_node)\nexcept CRIPTOrphanedDataError as exc:\nactive_experiment.data += [exc.orphaned_node]\nexcept CRIPTOrphanedProcessError as exc:\nactive_experiment.process += [exc.orphaned_node]\nexcept CRIPTOrphanedComputationError as exc:\nactive_experiment.computation += [exc.orphaned_node]\nexcept CRIPTOrphanedComputationalProcessError as exc:\nactive_experiment.computation_process += [exc.orphaned_node]\nelse:\nbreak\ncounter += 1\n
"},{"location":"utility_functions/#cript.nodes.util.load_nodes_from_json","title":"load_nodes_from_json(nodes_json)","text":"

User facing function, that return a node and all its children from a json input.

Source code in src/cript/nodes/util/__init__.py
def load_nodes_from_json(nodes_json: str):\n\"\"\"\n    User facing function, that return a node and all its children from a json input.\n    \"\"\"\nnode_json_hook = _NodeDecoderHook()\njson_nodes = json.loads(nodes_json, object_hook=node_json_hook)\n# TODO: enable this logic to replace proxies, once beartype is OK with that.\n# def recursive_proxy_replacement(node, handled_nodes):\n#     if isinstance(node, _UIDProxy):\n#         try:\n#             node = node_json_hook._uid_cache[node.uid]\n#         except KeyError as exc:\n#             raise CRIPTDeserializationUIDError(node.node_type, node.uid)\n#         return node\n#     handled_nodes.add(node.uid)\n#     for field in node._json_attrs.__dict__:\n#         child_node = getattr(node._json_attrs, field)\n#         if not isinstance(child_node, list):\n#             if hasattr(cn, \"__bases__\") and BaseNode in child_node.__bases__:\n#                 child_node = recursive_proxy_replacement(child_node, handled_nodes)\n#                 node._json_attrs = replace(node._json_attrs, field=child_node)\n#         else:\n#             for i, cn in enumerate(child_node):\n#                 if hasattr(cn, \"__bases__\") and BaseNode in cn.__bases__:\n#                     if cn.uid not in handled_nodes:\n#                         child_node[i] = recursive_proxy_replacement(cn, handled_nodes)\n#     return node\n# handled_nodes = set()\n# recursive_proxy_replacement(json_nodes, handled_nodes)\nreturn json_nodes\n
"},{"location":"api/api/","title":"API","text":""},{"location":"api/api/#cript.api.api.API","title":"API","text":""},{"location":"api/api/#cript.api.api.API--definition","title":"Definition","text":"

API Client class to communicate with the CRIPT API

Attributes:

Name Type Description verbose bool

A boolean flag that controls whether verbose logging is enabled or not.

When verbose is set to True, the class will provide additional detailed logging to the terminal. This can be useful for debugging and understanding the internal workings of the class.

When verbose is set to False, the class will only provide essential and concise logging information, making the terminal output less cluttered and more user-friendly.

# turn off the terminal logs\napi.verbose = False\n
Source code in src/cript/api/api.py
class API:\n\"\"\"\n    ## Definition\n    API Client class to communicate with the CRIPT API\n    Attributes\n    ----------\n    verbose : bool\n        A boolean flag that controls whether verbose logging is enabled or not.\n        When `verbose` is set to `True`, the class will provide additional detailed logging\n        to the terminal. This can be useful for debugging and understanding the internal\n        workings of the class.\n        When `verbose` is set to `False`, the class will only provide essential and concise\n        logging information, making the terminal output less cluttered and more user-friendly.\n        ```python\n        # turn off the terminal logs\n        api.verbose = False\n        ```\n    \"\"\"\n# dictates whether the user wants to see terminal log statements or not\nverbose: bool = True\n_host: str = \"\"\n_api_token: str = \"\"\n_storage_token: str = \"\"\n_http_headers: dict = {}\n_vocabulary: dict = {}\n_db_schema: dict = {}\n_api_handle: str = \"api\"\n_api_version: str = \"v1\"\n# trunk-ignore-begin(cspell)\n# AWS S3 constants\n_REGION_NAME: str = \"us-east-1\"\n_IDENTITY_POOL_ID: str = \"us-east-1:555e15fe-05c1-4f63-9f58-c84d8fd6dc99\"\n_COGNITO_LOGIN_PROVIDER: str = \"cognito-idp.us-east-1.amazonaws.com/us-east-1_VinmyZ0zW\"\n_BUCKET_NAME: str = \"cript-development-user-data\"\n_BUCKET_DIRECTORY_NAME: str = \"python_sdk_files\"\n_internal_s3_client: Any = None  # type: ignore\n# trunk-ignore-end(cspell)\n@beartype\ndef __init__(self, host: Union[str, None] = None, api_token: Union[str, None] = None, storage_token: Union[str, None] = None, config_file_path: Union[str, Path] = \"\"):\n\"\"\"\n        Initialize CRIPT API client with host and token.\n        Additionally, you can  use a config.json file and specify the file path.\n        !!! note \"api client context manager\"\n            It is necessary to use a `with` context manager for the API\n        Examples\n        --------\n        ### Create API client with host and token\n        ```Python\n        with cript.API('https://criptapp.org', 'secret_token') as api:\n           # node creation, api.save(), etc.\n        ```\n        ---\n        ### Creating API Client\n        !!! Warning \"Token Security\"\n            It is **highly** recommended that you store your API tokens in a safe location and read it into your code\n            Hard-coding API tokens directly into the code can pose security risks,\n            as the token might be exposed if the code is shared or stored in a version control system.\n            Anyone that has access to your tokens can impersonate you on the CRIPT platform\n        ### Create API Client with [Environment Variables](https://www.atatus.com/blog/python-environment-variables/)\n        Another great way to keep sensitive information secure is by using\n        [environment variables](https://www.atatus.com/blog/python-environment-variables/).\n        Sensitive information can be securely stored in environment variables and loaded into the code using\n        [os.getenv()](https://docs.python.org/3/library/os.html#os.getenv).\n        #### Example\n        ```python\n        import os\n        # securely load sensitive data into the script\n        cript_host = os.getenv(\"cript_host\")\n        cript_api_token = os.getenv(\"cript_api_token\")\n        cript_storage_token = os.getenv(\"cript_storage_token\")\n        with cript.API(host=cript_host, api_token=cript_api_token, storage_token=cript_storage_token) as api:\n            # write your script\n            pass\n        ```\n        ### Create API Client with `None`\n        Alternatively you can configure your system to have an environment variable of\n        `CRIPT_TOKEN` for the API token and `CRIPT_STORAGE_TOKEN` for the storage token, then\n        initialize `cript.API` `api_token` and `storage_token` with `None`.\n        The CRIPT Python SDK will try to read the API Token and Storage token from your system's environment variables.\n        ```python\n        with cript.API(host=cript_host, api_token=None, storage_token=None) as api:\n            # write your script\n            pass\n        ```\n        ### Create API client with config.json\n        `config.json`\n        ```json\n        {\n            \"host\": \"https://criptapp.org\",\n            \"token\": \"I am token\"\n        }\n        ```\n        `my_script.py`\n        ```python\n        from pathlib import Path\n        # create a file path object of where the config file is\n        config_file_path = Path(__file__) / Path('./config.json')\n        with cript.API(config_file_path=config_file_path) as api:\n            # node creation, api.save(), etc.\n        ```\n        Parameters\n        ----------\n        host : str, None\n            CRIPT host for the Python SDK to connect to such as `https://criptapp.org`\n            This host address is the same address used to login to cript website.\n            If `None` is specified, the host is inferred from the environment variable `CRIPT_HOST`.\n        api_token : str, None\n            CRIPT API Token used to connect to CRIPT and upload all data with the exception to file upload that needs\n            a different token.\n            You can find your personal token on the cript website at User > Security Settings.\n            The user icon is in the top right.\n            If `None` is specified, the token is inferred from the environment variable `CRIPT_TOKEN`.\n        storage_token: str\n            This token is used to upload local files to CRIPT cloud storage when needed\n        config_file_path: str\n            the file path to the config.json file where the token and host can be found\n        Notes\n        -----\n        * if `host=None` and `token=None`\n            then the Python SDK will grab the host from the users environment variable of `\"CRIPT_HOST\"`\n            and `\"CRIPT_TOKEN\"`\n        Warns\n        -----\n        UserWarning\n            If `host` is using \"http\" it gives the user a warning that HTTP is insecure and the user should use HTTPS\n        Raises\n        ------\n        CRIPTConnectionError\n            If it cannot connect to CRIPT with the provided host and token a CRIPTConnectionError is thrown.\n        Returns\n        -------\n        None\n            Instantiate a new CRIPT API object\n        \"\"\"\n# if there is a config.json file or any of the parameters are None, then get the variables from file or env vars\nif config_file_path or (host is None or api_token is None or storage_token is None):\nauthentication_dict: Dict[str, str] = resolve_host_and_token(host, api_token=api_token, storage_token=storage_token, config_file_path=config_file_path)\nhost = authentication_dict[\"host\"]\napi_token = authentication_dict[\"api_token\"]\nstorage_token = authentication_dict[\"storage_token\"]\nself._host = self._prepare_host(host=host)  # type: ignore\nself._api_token = api_token  # type: ignore\nself._storage_token = storage_token  # type: ignore\n# add Bearer to token for HTTP requests\nself._http_headers = {\"Authorization\": f\"Bearer {self._api_token}\", \"Content-Type\": \"application/json\"}\n# check that api can connect to CRIPT with host and token\nself._check_initial_host_connection()\nself._get_db_schema()\n@beartype\ndef _prepare_host(self, host: str) -> str:\n# strip ending slash to make host always uniform\nhost = host.rstrip(\"/\")\nhost = f\"{host}/{self._api_handle}/{self._api_version}\"\n# if host is using unsafe \"http://\" then give a warning\nif host.startswith(\"http://\"):\nwarnings.warn(\"HTTP is an unsafe protocol please consider using HTTPS.\")\nif not host.startswith(\"http\"):\nraise InvalidHostError()\nreturn host\n# Use a property to ensure delayed init of s3_client\n@property\ndef _s3_client(self) -> boto3.client:  # type: ignore\n\"\"\"\n        creates or returns a fully authenticated and ready s3 client\n        Returns\n        -------\n        s3_client: boto3.client\n            fully prepared and authenticated s3 client ready to be used throughout the script\n        \"\"\"\nif self._internal_s3_client is None:\nauth = boto3.client(\"cognito-identity\", region_name=self._REGION_NAME)\nidentity_id = auth.get_id(IdentityPoolId=self._IDENTITY_POOL_ID, Logins={self._COGNITO_LOGIN_PROVIDER: self._storage_token})\n# TODO remove this temporary fix to the token, by getting is from back end.\naws_token = self._storage_token\naws_credentials = auth.get_credentials_for_identity(IdentityId=identity_id[\"IdentityId\"], Logins={self._COGNITO_LOGIN_PROVIDER: aws_token})\naws_credentials = aws_credentials[\"Credentials\"]\ns3_client = boto3.client(\n\"s3\",\naws_access_key_id=aws_credentials[\"AccessKeyId\"],\naws_secret_access_key=aws_credentials[\"SecretKey\"],\naws_session_token=aws_credentials[\"SessionToken\"],\n)\nself._internal_s3_client = s3_client\nreturn self._internal_s3_client\ndef __enter__(self):\nself.connect()\nreturn self\n@beartype\ndef __exit__(self, type, value, traceback):\nself.disconnect()\ndef connect(self):\n\"\"\"\n        Connect this API globally as the current active access point.\n        It is not necessary to call this function manually if a context manager is used.\n        A context manager is preferred where possible.\n        Jupyter notebooks are a use case where this connection can be handled manually.\n        If this function is called manually, the `API.disconnect` function has to be called later.\n        For manual connection: nested API object are discouraged.\n        \"\"\"\n# Store the last active global API (might be None)\nglobal _global_cached_api\nself._previous_global_cached_api = copy.copy(_global_cached_api)\n_global_cached_api = self\nreturn self\ndef disconnect(self):\n\"\"\"\n        Disconnect this API from the active access point.\n        It is not necessary to call this function manually if a context manager is used.\n        A context manager is preferred where possible.\n        Jupyter notebooks are a use case where this connection can be handled manually.\n        This function has to be called manually if  the `API.connect` function has to be called before.\n        For manual connection: nested API object are discouraged.\n        \"\"\"\n# Restore the previously active global API (might be None)\nglobal _global_cached_api\n_global_cached_api = self._previous_global_cached_api\n@property\ndef schema(self):\n\"\"\"\n        Access the CRIPT Database Schema that is associated with this API connection.\n        The CRIPT Database Schema is used  to validate a node's JSON so that it is compatible with the CRIPT API.\n        \"\"\"\nreturn self._db_schema\n@property\ndef host(self):\n\"\"\"\n        Read only access to the currently connected host.\n        Examples\n        --------\n        ```python\n        print(cript_api.host)\n        ```\n        Output\n        ```Python\n        https://criptapp.org/api/v1\n        ```\n        \"\"\"\nreturn self._host\ndef _check_initial_host_connection(self) -> None:\n\"\"\"\n        tries to create a connection with host and if the host does not respond or is invalid it raises an error\n        Raises\n        -------\n        CRIPTConnectionError\n            raised when the host does not give the expected response\n        Returns\n        -------\n        None\n        \"\"\"\ntry:\npass\nexcept Exception as exc:\nraise CRIPTConnectionError(self.host, self._api_token) from exc\ndef _get_vocab(self) -> dict:\n\"\"\"\n        gets the entire CRIPT controlled vocabulary and stores it in _vocabulary\n        1. loops through all controlled vocabulary categories\n            1. if the category already exists in the controlled vocabulary then skip that category and continue\n            1. if the category does not exist in the `_vocabulary` dict,\n            then request it from the API and append it to the `_vocabulary` dict\n        1. at the end the `_vocabulary` should have all the controlled vocabulary and that will be returned\n           Examples\n           --------\n           The vocabulary looks like this\n           ```json\n           {'algorithm_key':\n                [\n                    {\n                    'description': \"Velocity-Verlet integration algorithm. Parameters: 'integration_timestep'.\",\n                    'name': 'velocity_verlet'\n                    },\n            }\n           ```\n        \"\"\"\n# loop through all vocabulary categories and make a request to each vocabulary category\n# and put them all inside of self._vocab with the keys being the vocab category name\nfor category in ControlledVocabularyCategories:\nif category in self._vocabulary:\ncontinue\nself._vocabulary[category.value] = self.get_vocab_by_category(category)\nreturn self._vocabulary\n@beartype\ndef get_vocab_by_category(self, category: ControlledVocabularyCategories) -> List[dict]:\n\"\"\"\n        get the CRIPT controlled vocabulary by category\n        Parameters\n        ----------\n        category: str\n            category of\n        Returns\n        -------\n        List[dict]\n            list of JSON containing the controlled vocabulary\n        \"\"\"\n# check if the vocabulary category is already cached\nif category.value in self._vocabulary:\nreturn self._vocabulary[category.value]\n# if vocabulary category is not in cache, then get it from API and cache it\nresponse = requests.get(f\"{self.host}/cv/{category.value}\").json()\nif response[\"code\"] != 200:\n# TODO give a better CRIPT custom Exception\nraise Exception(f\"while getting controlled vocabulary from CRIPT for {category}, \" f\"the API responded with http {response} \")\n# add to cache\nself._vocabulary[category.value] = response[\"data\"]\nreturn self._vocabulary[category.value]\n@beartype\ndef _is_vocab_valid(self, vocab_category: ControlledVocabularyCategories, vocab_word: str) -> bool:\n\"\"\"\n        checks if the vocabulary is valid within the CRIPT controlled vocabulary.\n        Either returns True or InvalidVocabulary Exception\n        1. if the vocabulary is custom (starts with \"+\")\n            then it is automatically valid\n        2. if vocabulary is not custom, then it is checked against its category\n            if the word cannot be found in the category then it returns False\n        Parameters\n        ----------\n        vocab_category: ControlledVocabularyCategories\n            ControlledVocabularyCategories enums\n        vocab_word: str\n            the vocabulary word e.g. \"CAS\", \"SMILES\", \"BigSmiles\", \"+my_custom_key\"\n        Returns\n        -------\n        a boolean of if the vocabulary is valid\n        Raises\n        ------\n        InvalidVocabulary\n            If the vocabulary is invalid then the error gets raised\n        \"\"\"\n# check if vocab is custom\n# This is deactivated currently, no custom vocab allowed.\nif vocab_word.startswith(\"+\"):\nreturn True\n# get the entire vocabulary\ncontrolled_vocabulary = self._get_vocab()\n# get just the category needed\ncontrolled_vocabulary = controlled_vocabulary[vocab_category.value]\n# TODO this can be faster with a dict of dicts that can do o(1) look up\n#  looping through an unsorted list is an O(n) look up which is slow\n# loop through the list\nfor vocab_dict in controlled_vocabulary:\n# check the name exists within the dict\nif vocab_dict.get(\"name\") == vocab_word:\nreturn True\nraise InvalidVocabulary(vocab=vocab_word, possible_vocab=list(controlled_vocabulary))\ndef _get_db_schema(self) -> dict:\n\"\"\"\n        Sends a GET request to CRIPT to get the database schema and returns it.\n        The database schema can be used for validating the JSON request\n        before submitting it to CRIPT.\n        1. checks if the db schema is already set\n            * if already exists then it skips fetching it from the API and just returns what it already has\n        2. if db schema has not been set yet, then it fetches it from the API\n            * after getting it from the API it saves it in the `_schema` class variable,\n            so it can be easily and efficiently gotten next time\n        \"\"\"\n# check if db schema is already saved\nif bool(self._db_schema):\nreturn self._db_schema\n# fetch db_schema from API\nelse:\n# fetch db schema, get the JSON body of it, and get the data of that JSON\nresponse = requests.get(url=f\"{self.host}/schema/\").json()\nif response[\"code\"] != 200:\nraise APIError(api_error=response.json())\n# get the data from the API JSON response\nself._db_schema = response[\"data\"]\nreturn self._db_schema\n@beartype\ndef _is_node_schema_valid(self, node_json: str, is_patch: bool = False) -> bool:\n\"\"\"\n        checks a node JSON schema against the db schema to return if it is valid or not.\n        1. get db schema\n        1. convert node_json str to dict\n        1. take out the node type from the dict\n            1. \"node\": [\"material\"]\n        1. use the node type from dict to tell the db schema which node schema to validate against\n            1. Manipulates the string to be title case to work with db schema\n        Parameters\n        ----------\n        node_json: str\n            a node in JSON form string\n        is_patch: bool\n            a boolean flag checking if it needs to validate against `NodePost` or `NodePatch`\n        Notes\n        -----\n        This function does not take into consideration vocabulary validation.\n            For vocabulary validation please check `is_vocab_valid`\n        Raises\n        ------\n        CRIPTNodeSchemaError\n            in case a node is invalid\n        Returns\n        -------\n        bool\n            whether the node JSON is valid or not\n        \"\"\"\ndb_schema = self._get_db_schema()\nnode_type: str = _get_node_type_from_json(node_json=node_json)\nnode_dict = json.loads(node_json)\nif self.verbose:\n# logging out info to the terminal for the user feedback\n# (improve UX because the program is currently slow)\nlogging.basicConfig(format=\"%(levelname)s: %(message)s\", level=logging.INFO)\nlogging.info(f\"Validating {node_type} graph...\")\n# set the schema to test against http POST or PATCH of DB Schema\nschema_http_method: str\nif is_patch:\nschema_http_method = \"Patch\"\nelse:\nschema_http_method = \"Post\"\n# set which node you are using schema validation for\ndb_schema[\"$ref\"] = f\"#/$defs/{node_type}{schema_http_method}\"\ntry:\njsonschema.validate(instance=node_dict, schema=db_schema)\nexcept jsonschema.exceptions.ValidationError as error:\nraise CRIPTNodeSchemaError(node_type=node_dict[\"node\"], json_schema_validation_error=str(error)) from error\n# if validation goes through without any problems return True\nreturn True\ndef save(self, project: Project) -> None:\n\"\"\"\n        This method takes a project node, serializes the class into JSON\n        and then sends the JSON to be saved to the API.\n        It takes Project node because everything is connected to the Project node,\n        and it can be used to send either a POST or PATCH request to API\n        Parameters\n        ----------\n        project: Project\n            the Project Node that the user wants to save\n        Raises\n        ------\n        CRIPTAPISaveError\n            If the API responds with anything other than an HTTP of `200`, the API error is displayed to the user\n        Returns\n        -------\n        A set of extra saved node UUIDs.\n            Just sends a `POST` or `Patch` request to the API\n        \"\"\"\ntry:\nself._internal_save(project)\nexcept CRIPTAPISaveError as exc:\nif exc.pre_saved_nodes:\nfor node_uuid in exc.pre_saved_nodes:\n# TODO remove all pre-saved nodes by their uuid.\npass\nraise exc from exc\ndef _internal_save(self, node, save_values: Optional[_InternalSaveValues] = None) -> _InternalSaveValues:\n\"\"\"\n        Internal helper function that handles the saving of different nodes (not just project).\n        If a \"Bad UUID\" error happens, we find that node with the UUID and save it first.\n        Then we recursively call the _internal_save again.\n        Because it is recursive, this repeats until no \"Bad UUID\" error happen anymore.\n        This works, because we keep track of \"Bad UUID\" handled nodes, and represent them in the JSON only as the UUID.\n        \"\"\"\nif save_values is None:\nsave_values = _InternalSaveValues()\n# saves all the local files to cloud storage right before saving the Project node\n# Ensure that all file nodes have uploaded there payload before actual save.\nfor file_node in node.find_children({\"node\": [\"File\"]}):\nfile_node.ensure_uploaded(api=self)\nnode.validate()\n# Dummy response to have a virtual do-while loop, instead of while loop.\nresponse = {\"code\": -1}\n# TODO remove once get works properly\nforce_patch = False\nwhile response[\"code\"] != 200:\n# Keep a record of how the state was before the loop\nold_save_values = copy.deepcopy(save_values)\n# We assemble the JSON to be saved to back end.\n# Note how we exclude pre-saved uuid nodes.\njson_data = node.get_json(known_uuid=save_values.saved_uuid, suppress_attributes=save_values.suppress_attributes).json\n# This checks if the current node exists on the back end.\n# if it does exist we use `patch` if it doesn't `post`.\ntest_get_response: Dict = requests.get(url=f\"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}\", headers=self._http_headers).json()\npatch_request = test_get_response[\"code\"] == 200\n# TODO remove once get works properly\nif not patch_request and force_patch:\npatch_request = True\nforce_patch = False\n# TODO activate patch validation\n# node.validate(is_patch=patch_request)\n# If all that is left is a UUID, we don't need to save it, we can just exit the loop.\nif patch_request and len(json.loads(json_data)) == 1:\nresponse = {\"code\": 200}\nbreak\nif patch_request:\nresponse: Dict = requests.patch(url=f\"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}\", headers=self._http_headers, data=json_data).json()  # type: ignore\nelse:\nresponse: Dict = requests.post(url=f\"{self._host}/{node.node_type_snake_case}\", headers=self._http_headers, data=json_data).json()  # type: ignore\n# If we get an error we may be able to fix, we to handle this extra and save the bad node first.\n# Errors with this code, may be fixable\nif response[\"code\"] in (400, 409):\nreturned_save_values = _fix_node_save(self, node, response, save_values)\nsave_values += returned_save_values\n# Handle errors from patching with too many attributes\nif patch_request and response[\"code\"] in (400,):\nsuppress_attributes = _identify_suppress_attributes(node, response)\nnew_save_values = _InternalSaveValues(save_values.saved_uuid, suppress_attributes)\nsave_values += new_save_values\n# It is only worthwhile repeating the attempted save loop if our state has improved.\n# Aka we did something to fix the occurring error\nif not save_values > old_save_values:\n# TODO remove once get works properly\nif not patch_request and response[\"code\"] == 409 and response[\"error\"].strip().startswith(\"Duplicate uuid:\"):  # type: ignore\nduplicate_uuid = _get_uuid_from_error_message(response[\"error\"])  # type: ignore\nif str(node.uuid) == duplicate_uuid:\nprint(\"force_patch\", node.uuid)\nforce_patch = True\ncontinue\nbreak\nif response[\"code\"] != 200:\nraise CRIPTAPISaveError(api_host_domain=self._host, http_code=response[\"code\"], api_response=response[\"error\"], patch_request=patch_request, pre_saved_nodes=save_values.saved_uuid, json_data=json_data)  # type: ignore\nsave_values.saved_uuid.add(str(node.uuid))\nreturn save_values\ndef upload_file(self, file_path: Union[Path, str]) -> str:\n# trunk-ignore-begin(cspell)\n\"\"\"\n        uploads a file to AWS S3 bucket and returns a URL of the uploaded file in AWS S3\n        The URL is has no expiration time limit and is available forever\n        1. take a file path of type path or str to the file on local storage\n            * see Example for more details\n        1. convert the file path to pathlib object, so it is versatile and\n            always uniform regardless if the user passes in a str or path object\n        1. get the file\n        1. rename the file to avoid clash or overwriting of previously uploaded files\n            * change file name to `original_name_uuid4.extension`\n                *  `document_42926a201a624fdba0fd6271defc9e88.txt`\n        1. upload file to AWS S3\n        1. get the link of the uploaded file and return it\n        Parameters\n        ----------\n        file_path: Union[str, Path]\n            file path as str or Path object. Path Object is recommended\n        Examples\n        --------\n        ```python\n        import cript\n        api = cript.API(host, token)\n        # programmatically create the absolute path of your file, so the program always works correctly\n        my_file_path = (Path(__file__) / Path('../upload_files/my_file.txt')).resolve()\n        my_file_s3_url = api.upload_file(absolute_file_path=my_file_path)\n        ```\n        Raises\n        ------\n        FileNotFoundError\n            In case the CRIPT Python SDK cannot find the file on your computer because the file does not exist\n            or the path to it is incorrect it raises\n            [FileNotFoundError](https://docs.python.org/3/library/exceptions.html#FileNotFoundError)\n        Returns\n        -------\n        object_name: str\n            object_name of the AWS S3 uploaded file to be put into the File node source attribute\n        \"\"\"\n# trunk-ignore-end(cspell)\n# TODO consider using a new variable when converting `file_path` from parameter\n#  to a Path object with a new type\n# convert file path from whatever the user passed in to a pathlib object\nfile_path = Path(file_path).resolve()\n# get file_name and file_extension from absolute file path\n# file_extension includes the dot, e.g. \".txt\"\nfile_name, file_extension = os.path.splitext(os.path.basename(file_path))\n# generate a UUID4 string without dashes, making a cleaner file name\nuuid_str: str = str(uuid.uuid4().hex)\nnew_file_name: str = f\"{file_name}_{uuid_str}{file_extension}\"\n# e.g. \"directory/file_name_uuid.extension\"\nobject_name: str = f\"{self._BUCKET_DIRECTORY_NAME}/{new_file_name}\"\n# upload file to AWS S3\nself._s3_client.upload_file(Filename=file_path, Bucket=self._BUCKET_NAME, Key=object_name)  # type: ignore\n# return the object_name within AWS S3 for easy retrieval\nreturn object_name\n@beartype\ndef download_file(self, file_source: str, destination_path: str = \".\") -> None:\n\"\"\"\n        Download a file from CRIPT Cloud Storage (AWS S3) and save it to the specified path.\n        ??? Info \"Cloud Storage vs Web URL File Download\"\n            If the `object_name` does not starts with `http` then the program assumes the file is in AWS S3 storage,\n            and attempts to retrieve it via\n            [boto3 client](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html).\n            If the `object_name` starts with `http` then the program knows that\n            it is a file stored on the web. The program makes a simple\n            [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request to get the file,\n            then writes the contents of it to the specified destination.\n            > Note: The current version of the program is designed to download files from the web in a straightforward\n            manner. However, please be aware that the program may encounter limitations when dealing with URLs that\n            require JavaScript or a session to be enabled. In such cases, the download method may fail.\n            > We acknowledge these limitations and plan to enhance the method in future versions to ensure compatibility\n            with a wider range of web file URLs. Our goal is to develop a robust solution capable of handling any and\n            all web file URLs.\n        Parameters\n        ----------\n        file_source: str\n            object_name: within AWS S3 the extension e.g. \"my_file_name.txt\n            the file is then searched within \"Data/{file_name}\" and saved to local storage\n            URL file source: In case of the file source is a URL then it is the file source URL\n                starting with \"https://\"\n                example: `https://criptscripts.org/cript_graph_json/JSON/cao_protein.json`\n        destination_path: str\n            please provide a path with file name of where you would like the file to be saved\n            on local storage.\n            > If no path is specified, then by default it will download the file\n            to the current working directory.\n            > The destination path must include a file name and file extension\n                e.g.: `~/Desktop/my_example_file_name.extension`\n        Examples\n        --------\n        ```python\n        from pathlib import Path\n        desktop_path = (Path(__file__).parent / \"cript_downloads\" / \"my_downloaded_file.txt\").resolve()\n        cript_api.download_file(file_url=my_file_source, destination_path=desktop_path)\n        ```\n        Raises\n        ------\n        FileNotFoundError\n            In case the file could not be found because the file does not exist or the path given is incorrect\n        Returns\n        -------\n        None\n            Simply downloads the file\n        \"\"\"\n# if the file source is a URL\nif file_source.startswith(\"http\"):\ndownload_file_from_url(url=file_source, destination_path=Path(destination_path).resolve())\nreturn\n# the file is stored in cloud storage and must be retrieved via object_name\nself._s3_client.download_file(Bucket=self._BUCKET_NAME, Key=file_source, Filename=destination_path)  # type: ignore\n@beartype\ndef search(\nself,\nnode_type,\nsearch_mode: SearchModes,\nvalue_to_search: Union[None, str],\n) -> Paginator:\n\"\"\"\n        This method is used to perform search on the CRIPT platform.\n        Examples\n        --------\n        ```python\n        # search by node type\n        materials_paginator = cript_api.search(\n            node_type=cript.Material,\n            search_mode=cript.SearchModes.NODE_TYPE,\n            value_to_search=None,\n        )\n        ```\n        Parameters\n        ----------\n        node_type : PrimaryBaseNode\n            Type of node that you are searching for.\n        search_mode : SearchModes\n            Type of search you want to do. You can search by name, `UUID`, `EXACT_NAME`, etc.\n            Refer to [valid search modes](../search_modes)\n        value_to_search : Union[str, None]\n            What you are searching for can be either a value, and if you are only searching for\n            a `NODE_TYPE`, then this value can be empty or `None`\n        Returns\n        -------\n        Paginator\n            paginator object for the user to use to flip through pages of search results\n        \"\"\"\n# get node typ from class\nnode_type = node_type.node_type_snake_case\nprint(node_type)\n# always putting a page parameter of 0 for all search URLs\npage_number = 0\napi_endpoint: str = \"\"\n# requesting a page of some primary node\nif search_mode == SearchModes.NODE_TYPE:\napi_endpoint = f\"{self._host}/{node_type}\"\nelif search_mode == SearchModes.CONTAINS_NAME:\napi_endpoint = f\"{self._host}/search/{node_type}\"\nelif search_mode == SearchModes.EXACT_NAME:\napi_endpoint = f\"{self._host}/search/exact/{node_type}\"\nelif search_mode == SearchModes.UUID:\napi_endpoint = f\"{self._host}/{node_type}/{value_to_search}\"\n# putting the value_to_search in the URL instead of a query\nvalue_to_search = None\nassert api_endpoint != \"\"\n# TODO error handling if none of the API endpoints got hit\nreturn Paginator(http_headers=self._http_headers, api_endpoint=api_endpoint, query=value_to_search, current_page_number=page_number)\n
"},{"location":"api/api/#cript.api.api.API.host","title":"host property","text":"

Read only access to the currently connected host.

Examples:

print(cript_api.host)\n
Output
https://criptapp.org/api/v1\n

"},{"location":"api/api/#cript.api.api.API.schema","title":"schema property","text":"

Access the CRIPT Database Schema that is associated with this API connection. The CRIPT Database Schema is used to validate a node's JSON so that it is compatible with the CRIPT API.

"},{"location":"api/api/#cript.api.api.API.__init__","title":"__init__(host=None, api_token=None, storage_token=None, config_file_path='')","text":"

Initialize CRIPT API client with host and token. Additionally, you can use a config.json file and specify the file path.

api client context manager

It is necessary to use a with context manager for the API

Examples:

"},{"location":"api/api/#cript.api.api.API.__init__--create-api-client-with-host-and-token","title":"Create API client with host and token","text":"
with cript.API('https://criptapp.org', 'secret_token') as api:\n# node creation, api.save(), etc.\n
"},{"location":"api/api/#cript.api.api.API.__init__--creating-api-client","title":"Creating API Client","text":"

Token Security

It is highly recommended that you store your API tokens in a safe location and read it into your code Hard-coding API tokens directly into the code can pose security risks, as the token might be exposed if the code is shared or stored in a version control system. Anyone that has access to your tokens can impersonate you on the CRIPT platform

"},{"location":"api/api/#cript.api.api.API.__init__--create-api-client-with-environment-variables","title":"Create API Client with Environment Variables","text":"

Another great way to keep sensitive information secure is by using environment variables. Sensitive information can be securely stored in environment variables and loaded into the code using os.getenv().

"},{"location":"api/api/#cript.api.api.API.__init__--example","title":"Example","text":"
import os\n# securely load sensitive data into the script\ncript_host = os.getenv(\"cript_host\")\ncript_api_token = os.getenv(\"cript_api_token\")\ncript_storage_token = os.getenv(\"cript_storage_token\")\nwith cript.API(host=cript_host, api_token=cript_api_token, storage_token=cript_storage_token) as api:\n# write your script\npass\n
"},{"location":"api/api/#cript.api.api.API.__init__--create-api-client-with-none","title":"Create API Client with None","text":"

Alternatively you can configure your system to have an environment variable of CRIPT_TOKEN for the API token and CRIPT_STORAGE_TOKEN for the storage token, then initialize cript.API api_token and storage_token with None.

The CRIPT Python SDK will try to read the API Token and Storage token from your system's environment variables.

with cript.API(host=cript_host, api_token=None, storage_token=None) as api:\n# write your script\npass\n
"},{"location":"api/api/#cript.api.api.API.__init__--create-api-client-with-configjson","title":"Create API client with config.json","text":"

config.json

{\n\"host\": \"https://criptapp.org\",\n\"token\": \"I am token\"\n}\n

my_script.py

from pathlib import Path\n# create a file path object of where the config file is\nconfig_file_path = Path(__file__) / Path('./config.json')\nwith cript.API(config_file_path=config_file_path) as api:\n# node creation, api.save(), etc.\n

Parameters:

Name Type Description Default host (str, None)

CRIPT host for the Python SDK to connect to such as https://criptapp.org This host address is the same address used to login to cript website. If None is specified, the host is inferred from the environment variable CRIPT_HOST.

None api_token (str, None)

CRIPT API Token used to connect to CRIPT and upload all data with the exception to file upload that needs a different token. You can find your personal token on the cript website at User > Security Settings. The user icon is in the top right. If None is specified, the token is inferred from the environment variable CRIPT_TOKEN.

None storage_token Union[str, None]

This token is used to upload local files to CRIPT cloud storage when needed

None config_file_path Union[str, Path]

the file path to the config.json file where the token and host can be found

''"},{"location":"api/api/#cript.api.api.API.__init__--notes","title":"Notes","text":"
  • if host=None and token=None then the Python SDK will grab the host from the users environment variable of \"CRIPT_HOST\" and \"CRIPT_TOKEN\"

Warns:

Type Description UserWarning

If host is using \"http\" it gives the user a warning that HTTP is insecure and the user should use HTTPS

Raises:

Type Description CRIPTConnectionError

If it cannot connect to CRIPT with the provided host and token a CRIPTConnectionError is thrown.

Returns:

Type Description None

Instantiate a new CRIPT API object

Source code in src/cript/api/api.py
@beartype\ndef __init__(self, host: Union[str, None] = None, api_token: Union[str, None] = None, storage_token: Union[str, None] = None, config_file_path: Union[str, Path] = \"\"):\n\"\"\"\n    Initialize CRIPT API client with host and token.\n    Additionally, you can  use a config.json file and specify the file path.\n    !!! note \"api client context manager\"\n        It is necessary to use a `with` context manager for the API\n    Examples\n    --------\n    ### Create API client with host and token\n    ```Python\n    with cript.API('https://criptapp.org', 'secret_token') as api:\n       # node creation, api.save(), etc.\n    ```\n    ---\n    ### Creating API Client\n    !!! Warning \"Token Security\"\n        It is **highly** recommended that you store your API tokens in a safe location and read it into your code\n        Hard-coding API tokens directly into the code can pose security risks,\n        as the token might be exposed if the code is shared or stored in a version control system.\n        Anyone that has access to your tokens can impersonate you on the CRIPT platform\n    ### Create API Client with [Environment Variables](https://www.atatus.com/blog/python-environment-variables/)\n    Another great way to keep sensitive information secure is by using\n    [environment variables](https://www.atatus.com/blog/python-environment-variables/).\n    Sensitive information can be securely stored in environment variables and loaded into the code using\n    [os.getenv()](https://docs.python.org/3/library/os.html#os.getenv).\n    #### Example\n    ```python\n    import os\n    # securely load sensitive data into the script\n    cript_host = os.getenv(\"cript_host\")\n    cript_api_token = os.getenv(\"cript_api_token\")\n    cript_storage_token = os.getenv(\"cript_storage_token\")\n    with cript.API(host=cript_host, api_token=cript_api_token, storage_token=cript_storage_token) as api:\n        # write your script\n        pass\n    ```\n    ### Create API Client with `None`\n    Alternatively you can configure your system to have an environment variable of\n    `CRIPT_TOKEN` for the API token and `CRIPT_STORAGE_TOKEN` for the storage token, then\n    initialize `cript.API` `api_token` and `storage_token` with `None`.\n    The CRIPT Python SDK will try to read the API Token and Storage token from your system's environment variables.\n    ```python\n    with cript.API(host=cript_host, api_token=None, storage_token=None) as api:\n        # write your script\n        pass\n    ```\n    ### Create API client with config.json\n    `config.json`\n    ```json\n    {\n        \"host\": \"https://criptapp.org\",\n        \"token\": \"I am token\"\n    }\n    ```\n    `my_script.py`\n    ```python\n    from pathlib import Path\n    # create a file path object of where the config file is\n    config_file_path = Path(__file__) / Path('./config.json')\n    with cript.API(config_file_path=config_file_path) as api:\n        # node creation, api.save(), etc.\n    ```\n    Parameters\n    ----------\n    host : str, None\n        CRIPT host for the Python SDK to connect to such as `https://criptapp.org`\n        This host address is the same address used to login to cript website.\n        If `None` is specified, the host is inferred from the environment variable `CRIPT_HOST`.\n    api_token : str, None\n        CRIPT API Token used to connect to CRIPT and upload all data with the exception to file upload that needs\n        a different token.\n        You can find your personal token on the cript website at User > Security Settings.\n        The user icon is in the top right.\n        If `None` is specified, the token is inferred from the environment variable `CRIPT_TOKEN`.\n    storage_token: str\n        This token is used to upload local files to CRIPT cloud storage when needed\n    config_file_path: str\n        the file path to the config.json file where the token and host can be found\n    Notes\n    -----\n    * if `host=None` and `token=None`\n        then the Python SDK will grab the host from the users environment variable of `\"CRIPT_HOST\"`\n        and `\"CRIPT_TOKEN\"`\n    Warns\n    -----\n    UserWarning\n        If `host` is using \"http\" it gives the user a warning that HTTP is insecure and the user should use HTTPS\n    Raises\n    ------\n    CRIPTConnectionError\n        If it cannot connect to CRIPT with the provided host and token a CRIPTConnectionError is thrown.\n    Returns\n    -------\n    None\n        Instantiate a new CRIPT API object\n    \"\"\"\n# if there is a config.json file or any of the parameters are None, then get the variables from file or env vars\nif config_file_path or (host is None or api_token is None or storage_token is None):\nauthentication_dict: Dict[str, str] = resolve_host_and_token(host, api_token=api_token, storage_token=storage_token, config_file_path=config_file_path)\nhost = authentication_dict[\"host\"]\napi_token = authentication_dict[\"api_token\"]\nstorage_token = authentication_dict[\"storage_token\"]\nself._host = self._prepare_host(host=host)  # type: ignore\nself._api_token = api_token  # type: ignore\nself._storage_token = storage_token  # type: ignore\n# add Bearer to token for HTTP requests\nself._http_headers = {\"Authorization\": f\"Bearer {self._api_token}\", \"Content-Type\": \"application/json\"}\n# check that api can connect to CRIPT with host and token\nself._check_initial_host_connection()\nself._get_db_schema()\n
"},{"location":"api/api/#cript.api.api.API.connect","title":"connect()","text":"

Connect this API globally as the current active access point. It is not necessary to call this function manually if a context manager is used. A context manager is preferred where possible. Jupyter notebooks are a use case where this connection can be handled manually. If this function is called manually, the API.disconnect function has to be called later.

For manual connection: nested API object are discouraged.

Source code in src/cript/api/api.py
def connect(self):\n\"\"\"\n    Connect this API globally as the current active access point.\n    It is not necessary to call this function manually if a context manager is used.\n    A context manager is preferred where possible.\n    Jupyter notebooks are a use case where this connection can be handled manually.\n    If this function is called manually, the `API.disconnect` function has to be called later.\n    For manual connection: nested API object are discouraged.\n    \"\"\"\n# Store the last active global API (might be None)\nglobal _global_cached_api\nself._previous_global_cached_api = copy.copy(_global_cached_api)\n_global_cached_api = self\nreturn self\n
"},{"location":"api/api/#cript.api.api.API.disconnect","title":"disconnect()","text":"

Disconnect this API from the active access point. It is not necessary to call this function manually if a context manager is used. A context manager is preferred where possible. Jupyter notebooks are a use case where this connection can be handled manually. This function has to be called manually if the API.connect function has to be called before.

For manual connection: nested API object are discouraged.

Source code in src/cript/api/api.py
def disconnect(self):\n\"\"\"\n    Disconnect this API from the active access point.\n    It is not necessary to call this function manually if a context manager is used.\n    A context manager is preferred where possible.\n    Jupyter notebooks are a use case where this connection can be handled manually.\n    This function has to be called manually if  the `API.connect` function has to be called before.\n    For manual connection: nested API object are discouraged.\n    \"\"\"\n# Restore the previously active global API (might be None)\nglobal _global_cached_api\n_global_cached_api = self._previous_global_cached_api\n
"},{"location":"api/api/#cript.api.api.API.download_file","title":"download_file(file_source, destination_path='.')","text":"

Download a file from CRIPT Cloud Storage (AWS S3) and save it to the specified path.

Cloud Storage vs Web URL File Download

If the object_name does not starts with http then the program assumes the file is in AWS S3 storage, and attempts to retrieve it via boto3 client.

If the object_name starts with http then the program knows that it is a file stored on the web. The program makes a simple GET request to get the file, then writes the contents of it to the specified destination.

Note: The current version of the program is designed to download files from the web in a straightforward manner. However, please be aware that the program may encounter limitations when dealing with URLs that require JavaScript or a session to be enabled. In such cases, the download method may fail.

We acknowledge these limitations and plan to enhance the method in future versions to ensure compatibility with a wider range of web file URLs. Our goal is to develop a robust solution capable of handling any and all web file URLs.

Parameters:

Name Type Description Default file_source str

object_name: within AWS S3 the extension e.g. \"my_file_name.txt the file is then searched within \"Data/{file_name}\" and saved to local storage URL file source: In case of the file source is a URL then it is the file source URL starting with \"https://\" example: https://criptscripts.org/cript_graph_json/JSON/cao_protein.json

required destination_path str

please provide a path with file name of where you would like the file to be saved on local storage.

If no path is specified, then by default it will download the file to the current working directory.

The destination path must include a file name and file extension e.g.: ~/Desktop/my_example_file_name.extension

'.'

Examples:

from pathlib import Path\ndesktop_path = (Path(__file__).parent / \"cript_downloads\" / \"my_downloaded_file.txt\").resolve()\ncript_api.download_file(file_url=my_file_source, destination_path=desktop_path)\n

Raises:

Type Description FileNotFoundError

In case the file could not be found because the file does not exist or the path given is incorrect

Returns:

Type Description None

Simply downloads the file

Source code in src/cript/api/api.py
@beartype\ndef download_file(self, file_source: str, destination_path: str = \".\") -> None:\n\"\"\"\n    Download a file from CRIPT Cloud Storage (AWS S3) and save it to the specified path.\n    ??? Info \"Cloud Storage vs Web URL File Download\"\n        If the `object_name` does not starts with `http` then the program assumes the file is in AWS S3 storage,\n        and attempts to retrieve it via\n        [boto3 client](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html).\n        If the `object_name` starts with `http` then the program knows that\n        it is a file stored on the web. The program makes a simple\n        [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request to get the file,\n        then writes the contents of it to the specified destination.\n        > Note: The current version of the program is designed to download files from the web in a straightforward\n        manner. However, please be aware that the program may encounter limitations when dealing with URLs that\n        require JavaScript or a session to be enabled. In such cases, the download method may fail.\n        > We acknowledge these limitations and plan to enhance the method in future versions to ensure compatibility\n        with a wider range of web file URLs. Our goal is to develop a robust solution capable of handling any and\n        all web file URLs.\n    Parameters\n    ----------\n    file_source: str\n        object_name: within AWS S3 the extension e.g. \"my_file_name.txt\n        the file is then searched within \"Data/{file_name}\" and saved to local storage\n        URL file source: In case of the file source is a URL then it is the file source URL\n            starting with \"https://\"\n            example: `https://criptscripts.org/cript_graph_json/JSON/cao_protein.json`\n    destination_path: str\n        please provide a path with file name of where you would like the file to be saved\n        on local storage.\n        > If no path is specified, then by default it will download the file\n        to the current working directory.\n        > The destination path must include a file name and file extension\n            e.g.: `~/Desktop/my_example_file_name.extension`\n    Examples\n    --------\n    ```python\n    from pathlib import Path\n    desktop_path = (Path(__file__).parent / \"cript_downloads\" / \"my_downloaded_file.txt\").resolve()\n    cript_api.download_file(file_url=my_file_source, destination_path=desktop_path)\n    ```\n    Raises\n    ------\n    FileNotFoundError\n        In case the file could not be found because the file does not exist or the path given is incorrect\n    Returns\n    -------\n    None\n        Simply downloads the file\n    \"\"\"\n# if the file source is a URL\nif file_source.startswith(\"http\"):\ndownload_file_from_url(url=file_source, destination_path=Path(destination_path).resolve())\nreturn\n# the file is stored in cloud storage and must be retrieved via object_name\nself._s3_client.download_file(Bucket=self._BUCKET_NAME, Key=file_source, Filename=destination_path)  # type: ignore\n
"},{"location":"api/api/#cript.api.api.API.get_vocab_by_category","title":"get_vocab_by_category(category)","text":"

get the CRIPT controlled vocabulary by category

Parameters:

Name Type Description Default category ControlledVocabularyCategories

category of

required

Returns:

Type Description List[dict]

list of JSON containing the controlled vocabulary

Source code in src/cript/api/api.py
@beartype\ndef get_vocab_by_category(self, category: ControlledVocabularyCategories) -> List[dict]:\n\"\"\"\n    get the CRIPT controlled vocabulary by category\n    Parameters\n    ----------\n    category: str\n        category of\n    Returns\n    -------\n    List[dict]\n        list of JSON containing the controlled vocabulary\n    \"\"\"\n# check if the vocabulary category is already cached\nif category.value in self._vocabulary:\nreturn self._vocabulary[category.value]\n# if vocabulary category is not in cache, then get it from API and cache it\nresponse = requests.get(f\"{self.host}/cv/{category.value}\").json()\nif response[\"code\"] != 200:\n# TODO give a better CRIPT custom Exception\nraise Exception(f\"while getting controlled vocabulary from CRIPT for {category}, \" f\"the API responded with http {response} \")\n# add to cache\nself._vocabulary[category.value] = response[\"data\"]\nreturn self._vocabulary[category.value]\n
"},{"location":"api/api/#cript.api.api.API.save","title":"save(project)","text":"

This method takes a project node, serializes the class into JSON and then sends the JSON to be saved to the API. It takes Project node because everything is connected to the Project node, and it can be used to send either a POST or PATCH request to API

Parameters:

Name Type Description Default project Project

the Project Node that the user wants to save

required

Raises:

Type Description CRIPTAPISaveError

If the API responds with anything other than an HTTP of 200, the API error is displayed to the user

Returns:

Type Description A set of extra saved node UUIDs.

Just sends a POST or Patch request to the API

Source code in src/cript/api/api.py
def save(self, project: Project) -> None:\n\"\"\"\n    This method takes a project node, serializes the class into JSON\n    and then sends the JSON to be saved to the API.\n    It takes Project node because everything is connected to the Project node,\n    and it can be used to send either a POST or PATCH request to API\n    Parameters\n    ----------\n    project: Project\n        the Project Node that the user wants to save\n    Raises\n    ------\n    CRIPTAPISaveError\n        If the API responds with anything other than an HTTP of `200`, the API error is displayed to the user\n    Returns\n    -------\n    A set of extra saved node UUIDs.\n        Just sends a `POST` or `Patch` request to the API\n    \"\"\"\ntry:\nself._internal_save(project)\nexcept CRIPTAPISaveError as exc:\nif exc.pre_saved_nodes:\nfor node_uuid in exc.pre_saved_nodes:\n# TODO remove all pre-saved nodes by their uuid.\npass\nraise exc from exc\n
"},{"location":"api/api/#cript.api.api.API.search","title":"search(node_type, search_mode, value_to_search)","text":"

This method is used to perform search on the CRIPT platform.

Examples:

# search by node type\nmaterials_paginator = cript_api.search(\nnode_type=cript.Material,\nsearch_mode=cript.SearchModes.NODE_TYPE,\nvalue_to_search=None,\n)\n

Parameters:

Name Type Description Default node_type PrimaryBaseNode

Type of node that you are searching for.

required search_mode SearchModes

Type of search you want to do. You can search by name, UUID, EXACT_NAME, etc. Refer to valid search modes

required value_to_search Union[str, None]

What you are searching for can be either a value, and if you are only searching for a NODE_TYPE, then this value can be empty or None

required

Returns:

Type Description Paginator

paginator object for the user to use to flip through pages of search results

Source code in src/cript/api/api.py
@beartype\ndef search(\nself,\nnode_type,\nsearch_mode: SearchModes,\nvalue_to_search: Union[None, str],\n) -> Paginator:\n\"\"\"\n    This method is used to perform search on the CRIPT platform.\n    Examples\n    --------\n    ```python\n    # search by node type\n    materials_paginator = cript_api.search(\n        node_type=cript.Material,\n        search_mode=cript.SearchModes.NODE_TYPE,\n        value_to_search=None,\n    )\n    ```\n    Parameters\n    ----------\n    node_type : PrimaryBaseNode\n        Type of node that you are searching for.\n    search_mode : SearchModes\n        Type of search you want to do. You can search by name, `UUID`, `EXACT_NAME`, etc.\n        Refer to [valid search modes](../search_modes)\n    value_to_search : Union[str, None]\n        What you are searching for can be either a value, and if you are only searching for\n        a `NODE_TYPE`, then this value can be empty or `None`\n    Returns\n    -------\n    Paginator\n        paginator object for the user to use to flip through pages of search results\n    \"\"\"\n# get node typ from class\nnode_type = node_type.node_type_snake_case\nprint(node_type)\n# always putting a page parameter of 0 for all search URLs\npage_number = 0\napi_endpoint: str = \"\"\n# requesting a page of some primary node\nif search_mode == SearchModes.NODE_TYPE:\napi_endpoint = f\"{self._host}/{node_type}\"\nelif search_mode == SearchModes.CONTAINS_NAME:\napi_endpoint = f\"{self._host}/search/{node_type}\"\nelif search_mode == SearchModes.EXACT_NAME:\napi_endpoint = f\"{self._host}/search/exact/{node_type}\"\nelif search_mode == SearchModes.UUID:\napi_endpoint = f\"{self._host}/{node_type}/{value_to_search}\"\n# putting the value_to_search in the URL instead of a query\nvalue_to_search = None\nassert api_endpoint != \"\"\n# TODO error handling if none of the API endpoints got hit\nreturn Paginator(http_headers=self._http_headers, api_endpoint=api_endpoint, query=value_to_search, current_page_number=page_number)\n
"},{"location":"api/api/#cript.api.api.API.upload_file","title":"upload_file(file_path)","text":"

uploads a file to AWS S3 bucket and returns a URL of the uploaded file in AWS S3 The URL is has no expiration time limit and is available forever

  1. take a file path of type path or str to the file on local storage
    • see Example for more details
  2. convert the file path to pathlib object, so it is versatile and always uniform regardless if the user passes in a str or path object
  3. get the file
  4. rename the file to avoid clash or overwriting of previously uploaded files
    • change file name to original_name_uuid4.extension
      • document_42926a201a624fdba0fd6271defc9e88.txt
  5. upload file to AWS S3
  6. get the link of the uploaded file and return it

Parameters:

Name Type Description Default file_path Union[Path, str]

file path as str or Path object. Path Object is recommended

required

Examples:

import cript\napi = cript.API(host, token)\n# programmatically create the absolute path of your file, so the program always works correctly\nmy_file_path = (Path(__file__) / Path('../upload_files/my_file.txt')).resolve()\nmy_file_s3_url = api.upload_file(absolute_file_path=my_file_path)\n

Raises:

Type Description FileNotFoundError

In case the CRIPT Python SDK cannot find the file on your computer because the file does not exist or the path to it is incorrect it raises FileNotFoundError

Returns:

Name Type Description object_name str

object_name of the AWS S3 uploaded file to be put into the File node source attribute

Source code in src/cript/api/api.py
def upload_file(self, file_path: Union[Path, str]) -> str:\n# trunk-ignore-begin(cspell)\n\"\"\"\n    uploads a file to AWS S3 bucket and returns a URL of the uploaded file in AWS S3\n    The URL is has no expiration time limit and is available forever\n    1. take a file path of type path or str to the file on local storage\n        * see Example for more details\n    1. convert the file path to pathlib object, so it is versatile and\n        always uniform regardless if the user passes in a str or path object\n    1. get the file\n    1. rename the file to avoid clash or overwriting of previously uploaded files\n        * change file name to `original_name_uuid4.extension`\n            *  `document_42926a201a624fdba0fd6271defc9e88.txt`\n    1. upload file to AWS S3\n    1. get the link of the uploaded file and return it\n    Parameters\n    ----------\n    file_path: Union[str, Path]\n        file path as str or Path object. Path Object is recommended\n    Examples\n    --------\n    ```python\n    import cript\n    api = cript.API(host, token)\n    # programmatically create the absolute path of your file, so the program always works correctly\n    my_file_path = (Path(__file__) / Path('../upload_files/my_file.txt')).resolve()\n    my_file_s3_url = api.upload_file(absolute_file_path=my_file_path)\n    ```\n    Raises\n    ------\n    FileNotFoundError\n        In case the CRIPT Python SDK cannot find the file on your computer because the file does not exist\n        or the path to it is incorrect it raises\n        [FileNotFoundError](https://docs.python.org/3/library/exceptions.html#FileNotFoundError)\n    Returns\n    -------\n    object_name: str\n        object_name of the AWS S3 uploaded file to be put into the File node source attribute\n    \"\"\"\n# trunk-ignore-end(cspell)\n# TODO consider using a new variable when converting `file_path` from parameter\n#  to a Path object with a new type\n# convert file path from whatever the user passed in to a pathlib object\nfile_path = Path(file_path).resolve()\n# get file_name and file_extension from absolute file path\n# file_extension includes the dot, e.g. \".txt\"\nfile_name, file_extension = os.path.splitext(os.path.basename(file_path))\n# generate a UUID4 string without dashes, making a cleaner file name\nuuid_str: str = str(uuid.uuid4().hex)\nnew_file_name: str = f\"{file_name}_{uuid_str}{file_extension}\"\n# e.g. \"directory/file_name_uuid.extension\"\nobject_name: str = f\"{self._BUCKET_DIRECTORY_NAME}/{new_file_name}\"\n# upload file to AWS S3\nself._s3_client.upload_file(Filename=file_path, Bucket=self._BUCKET_NAME, Key=object_name)  # type: ignore\n# return the object_name within AWS S3 for easy retrieval\nreturn object_name\n
"},{"location":"api/controlled_vocabulary_categories/","title":"Controlled Vocabulary Categories","text":"

Bases: Enum

All available CRIPT controlled vocabulary categories

Controlled vocabulary categories are used to classify data.

Attributes:

Name Type Description ALGORITHM_KEY str

Algorithm key.

ALGORITHM_TYPE str

Algorithm type.

BUILDING_BLOCK str

Building block.

CITATION_TYPE str

Citation type.

COMPUTATION_TYPE str

Computation type.

COMPUTATIONAL_FORCEFIELD_KEY str

Computational forcefield key.

COMPUTATIONAL_PROCESS_PROPERTY_KEY str

Computational process property key.

COMPUTATIONAL_PROCESS_TYPE str

Computational process type.

CONDITION_KEY str

Condition key.

DATA_LICENSE str

Data license.

DATA_TYPE str

Data type.

EQUIPMENT_KEY str

Equipment key.

FILE_TYPE str

File type.

INGREDIENT_KEYWORD str

Ingredient keyword.

MATERIAL_IDENTIFIER_KEY str

Material identifier key.

MATERIAL_KEYWORD str

Material keyword.

MATERIAL_PROPERTY_KEY str

Material property key.

PARAMETER_KEY str

Parameter key.

PROCESS_KEYWORD str

Process keyword.

PROCESS_PROPERTY_KEY str

Process property key.

PROCESS_TYPE str

Process type.

PROPERTY_METHOD str

Property method.

QUANTITY_KEY str

Quantity key.

REFERENCE_TYPE str

Reference type.

SET_TYPE str

Set type.

UNCERTAINTY_TYPE str

Uncertainty type.

Examples:

algorithm_vocabulary = api.get_vocabulary_by_category(\nControlledVocabularyCategories.ALGORITHM_KEY\n)\n
Source code in src/cript/api/vocabulary_categories.py
class ControlledVocabularyCategories(Enum):\n\"\"\"\n    All available CRIPT controlled vocabulary categories\n    Controlled vocabulary categories are used to classify data.\n    Attributes\n    ----------\n    ALGORITHM_KEY: str\n        Algorithm key.\n    ALGORITHM_TYPE: str\n        Algorithm type.\n    BUILDING_BLOCK: str\n        Building block.\n    CITATION_TYPE: str\n        Citation type.\n    COMPUTATION_TYPE: str\n       Computation type.\n    COMPUTATIONAL_FORCEFIELD_KEY: str\n        Computational forcefield key.\n    COMPUTATIONAL_PROCESS_PROPERTY_KEY: str\n        Computational process property key.\n    COMPUTATIONAL_PROCESS_TYPE: str\n        Computational process type.\n    CONDITION_KEY: str\n        Condition key.\n    DATA_LICENSE: str\n        Data license.\n    DATA_TYPE: str\n        Data type.\n    EQUIPMENT_KEY: str\n        Equipment key.\n    FILE_TYPE: str\n        File type.\n    INGREDIENT_KEYWORD: str\n        Ingredient keyword.\n    MATERIAL_IDENTIFIER_KEY: str\n        Material identifier key.\n    MATERIAL_KEYWORD: str\n        Material keyword.\n    MATERIAL_PROPERTY_KEY: str\n        Material property key.\n    PARAMETER_KEY: str\n        Parameter key.\n    PROCESS_KEYWORD: str\n        Process keyword.\n    PROCESS_PROPERTY_KEY: str\n        Process property key.\n    PROCESS_TYPE: str\n        Process type.\n    PROPERTY_METHOD: str\n        Property method.\n    QUANTITY_KEY: str\n        Quantity key.\n    REFERENCE_TYPE: str\n        Reference type.\n    SET_TYPE: str\n        Set type.\n    UNCERTAINTY_TYPE: str\n        Uncertainty type.\n    Examples\n    --------\n    ```python\n    algorithm_vocabulary = api.get_vocabulary_by_category(\n        ControlledVocabularyCategories.ALGORITHM_KEY\n        )\n    ```\n    \"\"\"\nALGORITHM_KEY: str = \"algorithm_key\"\nALGORITHM_TYPE: str = \"algorithm_type\"\nBUILDING_BLOCK: str = \"building_block\"\nCITATION_TYPE: str = \"citation_type\"\nCOMPUTATION_TYPE: str = \"computation_type\"\nCOMPUTATIONAL_FORCEFIELD_KEY: str = \"computational_forcefield_key\"\nCOMPUTATIONAL_PROCESS_PROPERTY_KEY: str = \"computational_process_property_key\"\nCOMPUTATIONAL_PROCESS_TYPE: str = \"computational_process_type\"\nCONDITION_KEY: str = \"condition_key\"\nDATA_LICENSE: str = \"data_license\"\nDATA_TYPE: str = \"data_type\"\nEQUIPMENT_KEY: str = \"equipment_key\"\nFILE_TYPE: str = \"file_type\"\nINGREDIENT_KEYWORD: str = \"ingredient_keyword\"\nMATERIAL_IDENTIFIER_KEY: str = \"material_identifier_key\"\nMATERIAL_KEYWORD: str = \"material_keyword\"\nMATERIAL_PROPERTY_KEY: str = \"material_property_key\"\nPARAMETER_KEY: str = \"parameter_key\"\nPROCESS_KEYWORD: str = \"process_keyword\"\nPROCESS_PROPERTY_KEY: str = \"process_property_key\"\nPROCESS_TYPE: str = \"process_type\"\nPROPERTY_METHOD: str = \"property_method\"\nQUANTITY_KEY: str = \"quantity_key\"\nREFERENCE_TYPE: str = \"reference_type\"\nSET_TYPE: str = \"set_type\"\nUNCERTAINTY_TYPE: str = \"uncertainty_type\"\n
"},{"location":"api/paginator/","title":"Paginator","text":""},{"location":"api/paginator/#cript.api.paginator.Paginator","title":"Paginator","text":"

Paginator is used to flip through different pages of data that the API returns when searching

When conducting any kind of search the API returns pages of data and each page contains 10 results. This is equivalent to conducting a Google search when Google returns a limited number of links on the first page and all other results are on the next pages.

Using the Paginator object, the user can simply and easily flip through the pages of data the API provides.

Do not create paginator objects

Please note that you are not required or advised to create a paginator object, and instead the Python SDK API object will create a paginator for you, return it, and let you simply use it

Source code in src/cript/api/paginator.py
class Paginator:\n\"\"\"\n    Paginator is used to flip through different pages of data that the API returns when searching\n    When conducting any kind of search the API returns pages of data and each page contains 10 results.\n    This is equivalent to conducting a Google search when Google returns a limited number of links on the first page\n    and all other results are on the next pages.\n    Using the Paginator object, the user can simply and easily flip through the pages of data the API provides.\n    !!! Warning \"Do not create paginator objects\"\n        Please note that you are not required or advised to create a paginator object, and instead the\n        Python SDK API object will create a paginator for you, return it, and let you simply use it\n    \"\"\"\n_http_headers: dict\napi_endpoint: str\n# if query or page number are None, then it means that api_endpoint does not allow for whatever that is None\n# and that is not added to the URL\n# by default the page_number and query are `None` and they can get filled in\nquery: Union[str, None]\n_current_page_number: int\ncurrent_page_results: List[dict]\n@beartype\ndef __init__(\nself,\nhttp_headers: dict,\napi_endpoint: str,\nquery: Optional[str] = None,\ncurrent_page_number: int = 0,\n):\n\"\"\"\n        create a paginator\n        1. set all the variables coming into constructor\n        1. then prepare any variable as needed e.g. strip extra spaces or url encode query\n        Parameters\n        ----------\n        http_headers: dict\n            get already created http headers from API and just use them in paginator\n        api_endpoint: str\n            api endpoint to send the search requests to\n            it already contains what node the user is looking for\n        current_page_number: int\n            page number to start from. Keep track of current page for user to flip back and forth between pages of data\n        query: str\n            the value the user is searching for\n        Returns\n        -------\n        None\n            instantiate a paginator\n        \"\"\"\nself._http_headers = http_headers\nself.api_endpoint = api_endpoint\nself.query = query\nself._current_page_number = current_page_number\n# check if it is a string and not None to avoid AttributeError\nif api_endpoint is not None:\n# strip the ending slash \"/\" to make URL uniform and any trailing spaces from either side\nself.api_endpoint = api_endpoint.rstrip(\"/\").strip()\n# check if it is a string and not None to avoid AttributeError\nif query is not None:\n# URL encode query\nself.query = quote(query)\nself.fetch_page_from_api()\ndef next_page(self):\n\"\"\"\n        flip to the next page of data.\n        Examples\n        --------\n        ```python\n        my_paginator.next_page()\n        ```\n        \"\"\"\nself.current_page_number += 1\ndef previous_page(self):\n\"\"\"\n        flip to the next page of data.\n        Examples\n        --------\n        ```python\n        my_paginator.previous_page()\n        ```\n        \"\"\"\nself.current_page_number -= 1\n@property\n@beartype\ndef current_page_number(self) -> int:\n\"\"\"\n        get the current page number that you are on.\n        Setting the page will take you to that specific page of results\n        Examples\n        --------\n        ```python\n        my_paginator.current_page = 10\n        ```\n        Returns\n        -------\n        current page number: int\n            the current page number of the data\n        \"\"\"\nreturn self._current_page_number\n@current_page_number.setter\n@beartype\ndef current_page_number(self, new_page_number: int) -> None:\n\"\"\"\n        flips to a specific page of data that has been requested\n        sets the current_page_number and then sends the request to the API and gets the results of this page number\n        Parameters\n        ----------\n        new_page_number (int): specific page of data that the user wants to go to\n        Examples\n        --------\n        requests.get(\"https://criptapp.org/api?page=2)\n        requests.get(f\"{self.query}?page={self.current_page_number - 1}\")\n        Raises\n        --------\n        InvalidPageRequest, in case the user tries to get a negative page or a page that doesn't exist\n        \"\"\"\nif new_page_number < 0:\nerror_message: str = f\"Paginator current page number is invalid because it is negative: \" f\"{self.current_page_number} please set paginator.current_page_number \" f\"to a positive page number\"\n# TODO replace with custom error\nraise Exception(error_message)\nelse:\nself._current_page_number = new_page_number\n# when new page number is set, it is then fetched from the API\nself.fetch_page_from_api()\n@beartype\ndef fetch_page_from_api(self) -> List[dict]:\n\"\"\"\n        1. builds the URL from the query and page number\n        1. makes the request to the API\n        1. API responds with a JSON that has data or JSON that has data and result\n            1. parses it and correctly sets the current_page_results property\n        Raises\n        ------\n        InvalidSearchRequest\n            In case the API responds with an error\n        Returns\n        -------\n        current page results: List[dict]\n            makes a request to the API and gets a page of data\n        \"\"\"\n# temporary variable to not overwrite api_endpoint\ntemp_api_endpoint: str = self.api_endpoint\nif self.query is not None:\ntemp_api_endpoint = f\"{temp_api_endpoint}/?q={self.query}\"\nelif self.query is None:\ntemp_api_endpoint = f\"{temp_api_endpoint}/?q=\"\ntemp_api_endpoint = f\"{temp_api_endpoint}&page={self.current_page_number}\"\nresponse = requests.get(\nurl=temp_api_endpoint,\nheaders=self._http_headers,\n).json()\n# handling both cases in case there is result inside of data or just data\ntry:\nself.current_page_results = response[\"data\"][\"result\"]\nexcept KeyError:\nself.current_page_results = response[\"data\"]\nexcept TypeError:\nself.current_page_results = response[\"data\"]\nif response[\"code\"] == 404 and response[\"error\"] == \"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\":\nself.current_page_results = []\nreturn self.current_page_results\n# TODO give a CRIPT error if HTTP response is anything other than 200\nif response[\"code\"] != 200:\nraise Exception(f\"API responded with: {response['error']}\")\nreturn self.current_page_results\n
"},{"location":"api/paginator/#cript.api.paginator.Paginator.current_page_number","title":"current_page_number: int property writable","text":"

get the current page number that you are on.

Setting the page will take you to that specific page of results

Examples:

my_paginator.current_page = 10\n

Returns:

Type Description current page number: int

the current page number of the data

"},{"location":"api/paginator/#cript.api.paginator.Paginator.__init__","title":"__init__(http_headers, api_endpoint, query=None, current_page_number=0)","text":"

create a paginator

  1. set all the variables coming into constructor
  2. then prepare any variable as needed e.g. strip extra spaces or url encode query

Parameters:

Name Type Description Default http_headers dict

get already created http headers from API and just use them in paginator

required api_endpoint str

api endpoint to send the search requests to it already contains what node the user is looking for

required current_page_number int

page number to start from. Keep track of current page for user to flip back and forth between pages of data

0 query Optional[str]

the value the user is searching for

None

Returns:

Type Description None

instantiate a paginator

Source code in src/cript/api/paginator.py
@beartype\ndef __init__(\nself,\nhttp_headers: dict,\napi_endpoint: str,\nquery: Optional[str] = None,\ncurrent_page_number: int = 0,\n):\n\"\"\"\n    create a paginator\n    1. set all the variables coming into constructor\n    1. then prepare any variable as needed e.g. strip extra spaces or url encode query\n    Parameters\n    ----------\n    http_headers: dict\n        get already created http headers from API and just use them in paginator\n    api_endpoint: str\n        api endpoint to send the search requests to\n        it already contains what node the user is looking for\n    current_page_number: int\n        page number to start from. Keep track of current page for user to flip back and forth between pages of data\n    query: str\n        the value the user is searching for\n    Returns\n    -------\n    None\n        instantiate a paginator\n    \"\"\"\nself._http_headers = http_headers\nself.api_endpoint = api_endpoint\nself.query = query\nself._current_page_number = current_page_number\n# check if it is a string and not None to avoid AttributeError\nif api_endpoint is not None:\n# strip the ending slash \"/\" to make URL uniform and any trailing spaces from either side\nself.api_endpoint = api_endpoint.rstrip(\"/\").strip()\n# check if it is a string and not None to avoid AttributeError\nif query is not None:\n# URL encode query\nself.query = quote(query)\nself.fetch_page_from_api()\n
"},{"location":"api/paginator/#cript.api.paginator.Paginator.fetch_page_from_api","title":"fetch_page_from_api()","text":"
  1. builds the URL from the query and page number
  2. makes the request to the API
  3. API responds with a JSON that has data or JSON that has data and result
    1. parses it and correctly sets the current_page_results property

Raises:

Type Description InvalidSearchRequest

In case the API responds with an error

Returns:

Type Description current page results: List[dict]

makes a request to the API and gets a page of data

Source code in src/cript/api/paginator.py
@beartype\ndef fetch_page_from_api(self) -> List[dict]:\n\"\"\"\n    1. builds the URL from the query and page number\n    1. makes the request to the API\n    1. API responds with a JSON that has data or JSON that has data and result\n        1. parses it and correctly sets the current_page_results property\n    Raises\n    ------\n    InvalidSearchRequest\n        In case the API responds with an error\n    Returns\n    -------\n    current page results: List[dict]\n        makes a request to the API and gets a page of data\n    \"\"\"\n# temporary variable to not overwrite api_endpoint\ntemp_api_endpoint: str = self.api_endpoint\nif self.query is not None:\ntemp_api_endpoint = f\"{temp_api_endpoint}/?q={self.query}\"\nelif self.query is None:\ntemp_api_endpoint = f\"{temp_api_endpoint}/?q=\"\ntemp_api_endpoint = f\"{temp_api_endpoint}&page={self.current_page_number}\"\nresponse = requests.get(\nurl=temp_api_endpoint,\nheaders=self._http_headers,\n).json()\n# handling both cases in case there is result inside of data or just data\ntry:\nself.current_page_results = response[\"data\"][\"result\"]\nexcept KeyError:\nself.current_page_results = response[\"data\"]\nexcept TypeError:\nself.current_page_results = response[\"data\"]\nif response[\"code\"] == 404 and response[\"error\"] == \"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\":\nself.current_page_results = []\nreturn self.current_page_results\n# TODO give a CRIPT error if HTTP response is anything other than 200\nif response[\"code\"] != 200:\nraise Exception(f\"API responded with: {response['error']}\")\nreturn self.current_page_results\n
"},{"location":"api/paginator/#cript.api.paginator.Paginator.next_page","title":"next_page()","text":"

flip to the next page of data.

Examples:

my_paginator.next_page()\n
Source code in src/cript/api/paginator.py
def next_page(self):\n\"\"\"\n    flip to the next page of data.\n    Examples\n    --------\n    ```python\n    my_paginator.next_page()\n    ```\n    \"\"\"\nself.current_page_number += 1\n
"},{"location":"api/paginator/#cript.api.paginator.Paginator.previous_page","title":"previous_page()","text":"

flip to the next page of data.

Examples:

my_paginator.previous_page()\n
Source code in src/cript/api/paginator.py
def previous_page(self):\n\"\"\"\n    flip to the next page of data.\n    Examples\n    --------\n    ```python\n    my_paginator.previous_page()\n    ```\n    \"\"\"\nself.current_page_number -= 1\n
"},{"location":"api/search_modes/","title":"Search Modes","text":"

Bases: Enum

Available search modes to use with the CRIPT API search

Attributes:

Name Type Description NODE_TYPE str

Search by node type.

EXACT_NAME str

Search by exact node name.

CONTAINS_NAME str

Search by node name containing a given string.

UUID str

Search by node UUID.

Examples:

# search by node type\nmaterials_paginator = cript_api.search(\nnode_type=cript.Material,\nsearch_mode=cript.SearchModes.NODE_TYPE,\nvalue_to_search=None,\n)\n
Source code in src/cript/api/valid_search_modes.py
class SearchModes(Enum):\n\"\"\"\n    Available search modes to use with the CRIPT API search\n    Attributes\n    ----------\n    NODE_TYPE : str\n        Search by node type.\n    EXACT_NAME : str\n        Search by exact node name.\n    CONTAINS_NAME : str\n        Search by node name containing a given string.\n    UUID : str\n        Search by node UUID.\n    Examples\n    -------\n    ```python\n    # search by node type\n    materials_paginator = cript_api.search(\n        node_type=cript.Material,\n        search_mode=cript.SearchModes.NODE_TYPE,\n        value_to_search=None,\n    )\n    ```\n    \"\"\"\nNODE_TYPE: str = \"\"\nEXACT_NAME: str = \"exact_name\"\nCONTAINS_NAME: str = \"contains_name\"\nUUID: str = \"uuid\"\n
"},{"location":"examples/simulation/","title":"Simulation","text":"

Abstract

This tutorial guides you through an example material synthesis workflow using the CRIPT Python SDK.

"},{"location":"examples/simulation/#installation","title":"Installation","text":"

Before you start, be sure the cript python package is installed.

pip install cript\n
"},{"location":"examples/simulation/#connect-to-cript","title":"Connect to CRIPT","text":"

To connect to CRIPT, you must enter a host and an API Token. For most users, host will be https://criptapp.org.

Keep API Token Secure

To ensure security, avoid storing sensitive information like tokens directly in your code. Instead, use environment variables. Storing tokens in code shared on platforms like GitHub can lead to security incidents. Anyone that possesses your token can impersonate you on the CRIPT platform. Consider alternative methods for loading tokens with the CRIPT API Client. In case your token is exposed be sure to immediately generate a new token to revoke the access of the old one and keep the new token safe.

import cript\nwith cript.API(host=\"http://development.api.mycriptapp.org/\", api_token=\"123456\", storage_token=\"987654\") as api:\npass\n

Note

You may notice, that we are not executing any code inside the context manager block. If you were to write a python script, compared to a jupyter notebook, you would add all the following code inside that block. Here in a jupyter notebook, we need to connect manually. We just have to remember to disconnect at the end.

api = cript.API(host=\"http://development.api.mycriptapp.org/\", api_token=None, storage_token=\"123456\")\napi = api.connect()\n
"},{"location":"examples/simulation/#create-a-project","title":"Create a Project","text":"

All data uploaded to CRIPT must be associated with a Project node. Project can be thought of as an overarching research goal. For example, finding a replacement for an existing material from a sustainable feedstock.

# create a new project in the CRIPT database\nproject = cript.Project(name=\"My simulation project.\")\n
"},{"location":"examples/simulation/#create-a-collection-node","title":"Create a Collection node","text":"

For this project, you can create multiple collections, which represent a set of experiments. For example, you can create a collection for a specific manuscript, or you can create a collection for initial screening of candidates and one for later refinements etc.

So, let's create a collection node and add it to the project.

collection = cript.Collection(name=\"Initial simulation screening\")\n# We add this collection to the project as a list.\nproject.collection += [collection]\n

Viewing CRIPT JSON

Note, that if you are interested into the inner workings of CRIPT, you can obtain a JSON representation of your data graph at any time to see what is being sent to the API.

print(project.json)\nprint(\"\\nOr more pretty\\n\")\nprint(project.get_json(indent=2).json)\n
"},{"location":"examples/simulation/#create-an-experiment-node","title":"Create an Experiment node","text":"

The Collection node holds a series of Experiment nodes nodes.

And we can add this experiment to the collection of the project.

experiment = cript.Experiment(name=\"Simulation for the first candidate\")\ncollection.experiment += [experiment]\n
"},{"location":"examples/simulation/#create-relevant-software-nodes","title":"Create relevant Software nodes","text":"

Software nodes refer to software that you use during your simulation experiment. In general Software nodes can be shared between project, and it is encouraged to do so if the software you are using is already present in the CRIPT project use it.

If They are not, you can create them as follows:

python = cript.Software(name=\"python\", version=\"3.9\")\nrdkit = cript.Software(name=\"rdkit\", version=\"2020.9\")\nstage = cript.Software(name=\"stage\", source=\"https://doi.org/10.1021/jp505332p\", version=\"N/A\")\npackmol = cript.Software(name=\"Packmol\", source=\"http://m3g.iqm.unicamp.br/packmol\", version=\"N/A\")\nopenmm = cript.Software(name=\"openmm\", version=\"7.5\")\n

Generally, provide as much information about the software as possible this helps to make your results reproducible. Even a software is not publicly available, like an in-house code, we encourage you to specify them in CRIPT. If a version is not available, consider using git-hashes.

"},{"location":"examples/simulation/#create-software-configurations","title":"Create Software Configurations","text":"

Now that we have our Software nodes, we can create SoftwareConfiguration nodes. SoftwareConfigurations nodes are designed to let you specify details, about which algorithms from the software package you are using and log parameters for these algorithms.

The SoftwareConfigurations are then used for constructing our Computation node, which describe the actual computation you are performing.

We can also attach Algorithm nodes to a SoftwareConfiguration node. The Algorithm nodes may contain nested Parameter nodes, as shown in the example below.

# create some software configuration nodes\npython_config = cript.SoftwareConfiguration(software=python)\nrdkit_config = cript.SoftwareConfiguration(software=rdkit)\nstage_config = cript.SoftwareConfiguration(software=stage)\n# create a software configuration node with a child Algorithm node\nopenmm_config = cript.SoftwareConfiguration(\nsoftware=openmm,\nalgorithm=[\ncript.Algorithm(\nkey=\"energy_minimization\",\ntype=\"initialization\",\n),\n],\n)\npackmol_config = cript.SoftwareConfiguration(software=packmol)\n

Algorithm keys

The allowed Algorithm keys are listed under algorithm keys in the CRIPT controlled vocabulary.

Parameter keys

The allowed Parameter keys are listed under parameter keys in the CRIPT controlled vocabulary.

"},{"location":"examples/simulation/#create-computations","title":"Create Computations","text":"

Now that we've created some SoftwareConfiguration nodes, we can used them to build full Computation nodes. In some cases, we may also want to add Condition nodes to our computation, to specify the conditions at which the computation was carried out. An example of this is shown below.

# Create a ComputationNode\n# This block of code represents the computation involved in generating forces.\n# It also details the initial placement of molecules within a simulation box.\ninit = cript.Computation(\nname=\"Initial snapshot and force-field generation\",\ntype=\"initialization\",\nsoftware_configuration=[\npython_config,\nrdkit_config,\nstage_config,\npackmol_config,\nopenmm_config,\n],\n)\n# Initiate the simulation equilibration using a separate node.\n# The equilibration process is governed by specific conditions and a set equilibration time.\n# Given this is an NPT (Number of particles, Pressure, Temperature) simulation, conditions such as the number of chains, temperature, and pressure are specified.\nequilibration = cript.Computation(\nname=\"Equilibrate data prior to measurement\",\ntype=\"MD\",\nsoftware_configuration=[python_config, openmm_config],\ncondition=[\ncript.Condition(key=\"time_duration\", type=\"value\", value=100.0, unit=\"ns\"),\ncript.Condition(key=\"temperature\", type=\"value\", value=450.0, unit=\"K\"),\ncript.Condition(key=\"pressure\", type=\"value\", value=1.0, unit=\"bar\"),\ncript.Condition(key=\"number\", type=\"value\", value=31),\n],\nprerequisite_computation=init,\n)\n# This section involves the actual data measurement.\n# Note that we use the previously computed data as a prerequisite. Additionally, we incorporate the input data at a later stage.\nbulk = cript.Computation(\nname=\"Bulk simulation for measurement\",\ntype=\"MD\",\nsoftware_configuration=[python_config, openmm_config],\ncondition=[\ncript.Condition(key=\"time_duration\", type=\"value\", value=50.0, unit=\"ns\"),\ncript.Condition(key=\"temperature\", type=\"value\", value=450.0, unit=\"K\"),\ncript.Condition(key=\"pressure\", type=\"value\", value=1.0, unit=\"bar\"),\ncript.Condition(key=\"number\", type=\"value\", value=31),\n],\nprerequisite_computation=equilibration,\n)\n# The following step involves analyzing the data from the measurement run to ascertain a specific property.\nana = cript.Computation(\nname=\"Density analysis\",\ntype=\"analysis\",\nsoftware_configuration=[python_config],\nprerequisite_computation=bulk,\n)\n# Add all these computations to the experiment.\nexperiment.computation += [init, equilibration, bulk, ana]\n

Computation types

The allowed Computation types are listed under computation types in the CRIPT controlled vocabulary.

Condition keys

The allowed Condition keys are listed under condition keys in the CRIPT controlled vocabulary.

"},{"location":"examples/simulation/#create-and-upload-files","title":"Create and Upload Files","text":"

New we'd like to upload files associated with our simulation. First, we'll instantiate our File nodes under a specific project.

packing_file = cript.File(\"Initial simulation box snapshot with roughly packed molecules\", type=\"computation_snapshot\", source=\"path/to/local/file\")\nforcefield_file = cript.File(name=\"Forcefield definition file\", type=\"data\", source=\"path/to/local/file\")\nsnap_file = cript.File(\"Bulk measurement initial system snap shot\", type=\"computation_snapshot\", source=\"path/to/local/file\")\nfinal_file = cript.File(\"Final snapshot of the system at the end the simulations\", type=\"computation_snapshot\", source=\"path/to/local/file\")\n

Note

The source field should point to any file on your local filesystem.

Info

Depending on the file size, there could be a delay while the checksum is generated.

Note, that we haven't uploaded the files to CRIPT yet, this is automatically performed, when the project is uploaded via api.save(project).

"},{"location":"examples/simulation/#create-data","title":"Create Data","text":"

Next, we'll create a Data node which helps organize our File nodes and links back to our Computation objects.

packing_data = cript.Data(\nname=\"Loosely packed chains\",\ntype=\"computation_config\",\nfile=[packing_file],\ncomputation=[init],\nnotes=\"PDB file without topology describing an initial system.\",\n)\nforcefield_data = cript.Data(\nname=\"OpenMM forcefield\",\ntype=\"computation_forcefield\",\nfile=[forcefield_file],\ncomputation=[init],\nnotes=\"Full forcefield definition and topology.\",\n)\nequilibration_snap = cript.Data(\nname=\"Equilibrated simulation snapshot\",\ntype=\"computation_config\",\nfile=[snap_file],\ncomputation=[equilibration],\n)\nfinal_data = cript.Data(\nname=\"Logged volume during simulation\",\ntype=\"computation_trajectory\",\nfile=[final_file],\ncomputation=[bulk],\n)\n

Data types

The allowed Data types are listed under the data types in the CRIPT controlled vocabulary.

Next, we'll link these Data nodes to the appropriate Computation nodes.

# Observe how this step also forms a continuous graph, enabling data to flow from one computation to the next.\n# The sequence initiates with the computation process and culminates with the determination of the material property.\ninit.output_data = [packing_data, forcefield_data]\nequilibration.input_data = [packing_data, forcefield_data]\nequilibration.output_data = [equilibration_snap]\nana.input_data = [final_data]\nbulk.output_data = [final_data]\n
"},{"location":"examples/simulation/#create-a-virtual-material","title":"Create a virtual Material","text":"

Finally, we'll create a virtual material and link it to the Computation nodes that we've built.

\n

Next, let's add some Identifiers nodes to the material to make it easier to identify and search.

names = cript.Identifier(\nkey=\"names\",\nvalue=[\"poly(styrene)\", \"poly(vinylbenzene)\"],\n)\nbigsmiles = cript.Identifier(\nkey=\"bigsmiles\",\nvalue=\"[H]{[>][<]C(C[>])c1ccccc1[<]}C(C)CC\",\n)\nchem_repeat = cript.Identifier(\nkey=\"chem_repeat\",\nvalue=\"C8H8\",\n)\npolystyrene.add_identifier(names)\npolystyrene.add_identifier(chem_repeat)\npolystyrene.add_identifier(bigsmiles)\n

Identifier keys

The allowed Identifiers keys are listed in the material identifier keys in the CRIPT controlled vocabulary.

Let's also add some Property nodes to the Material, which represent its physical or virtual (in the case of a simulated material) properties.

phase = cript.Property(key=\"phase\", value=\"solid\")\ncolor = cript.Property(key=\"color\", value=\"white\")\npolystyrene.add_property(phase)\npolystyrene.add_property(color)\n

Material property keys

The allowed material Property keys are listed in the material property keys in the CRIPT controlled vocabulary.

identifiers = [{\"names\": [\"poly(styrene)\", \"poly(vinylbenzene)\"]}]\nidentifiers += [{\"bigsmiles\": \"[H]{[>][<]C(C[>])c1ccccc1[<]}C(C)CC\"}]\nidentifiers += [{\"chem_repeat\": [\"C8H8\"]}]\npolystyrene = cript.Material(name=\"virtual polystyrene\", identifiers=identifiers)\n

Finally, we'll create a ComputationalForcefield node and link it to the Material.

forcefield = cript.ComputationalForcefield(\nkey=\"opls_aa\",\nbuilding_block=\"atom\",\nsource=\"Custom determination via STAGE\",\ndata=[forcefield_data],\n)\npolystyrene.computational_forcefield = forcefield\n

Computational forcefield keys

The allowed ComputationalForcefield keys are listed under the computational forcefield keys in the CRIPT controlled vocabulary.

Now we can save the project to CRIPT (and upload the files) or inspect the JSON output

# Before we can save it, we should add all the orphaned nodes to the experiments.\n# It is important to do this for every experiment separately, but here we only have one.\ncript.add_orphaned_nodes_to_project(project, active_experiment=experiment)\nproject.validate()\n# api.save(project)\nprint(project.get_json(indent=2).json)\n# Let's not forget to close the API connection after everything is done.\napi.disconnect()\n
"},{"location":"examples/simulation/#conclusion","title":"Conclusion","text":"

You made it! We hope this tutorial has been helpful.

Please let us know how you think it could be improved. Feel free to reach out to us on our CRIPT Python SDK GitHub. We'd love your inputs and contributions!

"},{"location":"examples/synthesis/","title":"Synthesis","text":"

Abstract

This tutorial guides you through an example material synthesis workflow using the CRIPT Python SDK.

"},{"location":"examples/synthesis/#installation","title":"Installation","text":"

Before you start, be sure the cript python package is installed.

pip install cript\n
"},{"location":"examples/synthesis/#connect-to-cript","title":"Connect to CRIPT","text":"

To connect to CRIPT, you must enter a host and an API Token. For most users, host will be https://criptapp.org.

Keep API Token Secure

To ensure security, avoid storing sensitive information like tokens directly in your code. Instead, use environment variables. Storing tokens in code shared on platforms like GitHub can lead to security incidents. Anyone that possesses your token can impersonate you on the CRIPT platform. Consider alternative methods for loading tokens with the CRIPT API Client. In case your token is exposed be sure to immediately generate a new token to revoke the access of the old one and keep the new token safe.

import cript\nwith cript.API(host=\"http://development.api.mycriptapp.org/\", api_token=\"123456\", storage_token=\"987654\") as api:\npass\n

Note

You may notice, that we are not executing any code inside the context manager block. If you were to write a python script, compared to a jupyter notebook, you would add all the following code inside that block. Here in a jupyter notebook, we need to connect manually. We just have to remember to disconnect at the end.

api = cript.API(host=\"http://development.api.mycriptapp.org/\", api_token=None, storage_token=\"123456\")\napi = api.connect()\n
"},{"location":"examples/synthesis/#create-a-project","title":"Create a Project","text":"

All data uploaded to CRIPT must be associated with a project node. Project can be thought of as an overarching research goal. For example, finding a replacement for an existing material from a sustainable feedstock.

# create a new project in the CRIPT database\nproject = cript.Project(name=\"My first project.\")\n
"},{"location":"examples/synthesis/#create-a-collection-node","title":"Create a Collection node","text":"

For this project, you can create multiple collections, which represent a set of experiments. For example, you can create a collection for a specific manuscript, or you can create a collection for initial screening of candidates and one for later refinements etc.

So, let's create a collection node and add it to the project.

collection = cript.Collection(name=\"Initial screening\")\n# We add this collection to the project as a list.\nproject.collection += [collection]\n

Viewing CRIPT JSON

Note, that if you are interested into the inner workings of CRIPT, you can obtain a JSON representation of your data graph at any time to see what is being sent to the API.

print(project.json)\nprint(\"\\nOr more pretty\\n\")\nprint(project.get_json(indent=2).json)\n
"},{"location":"examples/synthesis/#create-an-experiment-node","title":"Create an Experiment node","text":"

The collection node holds a series of Experiment nodes nodes.

And we can add this experiment to the collection of the project.

experiment = cript.Experiment(name=\"Anionic Polymerization of Styrene with SecBuLi\")\ncollection.experiment += [experiment]\n
"},{"location":"examples/synthesis/#create-an-inventory","title":"Create an Inventory","text":"

An Inventory contains materials, that are well known and usually not of polymeric nature. They are for example the chemical you buy commercially and use as input into your synthesis.

For this we create this inventory by adding the Material we need one by one.

# create a list of identifiers as dictionaries to\n# identify your material to the community and your team\nmy_solution_material_identifiers = [\n{\"chemical_id\": \"598-30-1\"}\n]\nsolution = cript.Material(\nname=\"SecBuLi solution 1.4M cHex\",\nidentifiers=my_solution_material_identifiers\n)\n

These materials are simple, notice how we use the SMILES notation here as an identifier for the material. Similarly, we can create more initial materials.

toluene = cript.Material(name=\"toluene\", identifiers=[{\"smiles\": \"Cc1ccccc1\"}, {\"pubchem_id\": 1140}])\nstyrene = cript.Material(name=\"styrene\", identifiers=[{\"smiles\": \"c1ccccc1C=C\"}, {\"inchi\": \"InChI=1S/C8H8/c1-2-8-6-4-3-5-7-8/h2-7H,1H2\"}])\nbutanol = cript.Material(name=\"1-butanol\", identifiers=[{\"smiles\": \"OCCCC\"}, {\"inchi_key\": \"InChIKey=LRHPLDYGYMQRHN-UHFFFAOYSA-N\"}])\nmethanol = cript.Material(name=\"methanol\", identifiers=[{\"smiles\": \"CO\"}, {\"names\": [\"Butan-1-ol\", \"Butyric alcohol\", \"Methylolpropane\", \"n-Butan-1-ol\", \"methanol\"]}])\n

Now that we defined those materials, we can combine them into an inventory for easy access and sharing between experiments/projects.

inventory = cript.Inventory(\nname=\"Common chemicals for poly-styrene synthesis\",\nmaterial=[solution, toluene, styrene, butanol, methanol],\n)\ncollection.inventory += [inventory]\n
"},{"location":"examples/synthesis/#create-a-process-node","title":"Create a Process node","text":"

A Process is a step in an experiment. You decide how many Process are required for your experiment, so you can list details for your experiment as fine-grained as desired. Here we use just one step to describe the entire synthesis.

process = cript.Process(\nname=\"Anionic of Synthesis Poly-Styrene\",\ntype=\"multistep\",\ndescription=\"In an argon filled glove box, a round bottom flask was filled with 216 ml of dried toluene. The \"\n\"solution of secBuLi (3 ml, 3.9 mmol) was added next, followed by styrene (22.3 g, 176 mmol) to \"\n\"initiate the polymerization. The reaction mixture immediately turned orange. After 30 min, \"\n\"the reaction was quenched with the addition of 3 ml of methanol. The polymer was isolated by \"\n\"precipitation in methanol 3 times and dried under vacuum.\",\n)\nexperiment.process += [process]\n
"},{"location":"examples/synthesis/#add-ingredients-to-a-process","title":"Add Ingredients to a Process","text":"

From a chemistry standpoint, most experimental processes, regardless of whether they are carried out in the lab or simulated using computer code, consist of input ingredients that are transformed in some way. Let's add ingredients to the Process that we just created. For this we use the materials from the inventory. Next, define Quantities nodes indicating the amount of each Ingredient that we will use in the Process.

initiator_qty = cript.Quantity(key=\"volume\", value=1.7e-8, unit=\"m**3\")\nsolvent_qty = cript.Quantity(key=\"volume\", value=1e-4, unit=\"m**3\")\nmonomer_qty = cript.Quantity(key=\"mass\", value=0.455e-3, unit=\"kg\")\nquench_qty = cript.Quantity(key=\"volume\", value=5e-3, unit=\"m**3\")\nworkup_qty = cript.Quantity(key=\"volume\", value=0.1, unit=\"m**3\")\n

Now we can create an Ingredient node for each ingredient using the Material and quantities attributes.

initiator = cript.Ingredient(\nkeyword=[\"initiator\"], material=solution, quantity=[initiator_qty]\n)\nsolvent = cript.Ingredient(\nkeyword=[\"solvent\"], material=toluene, quantity=[solvent_qty]\n)\nmonomer = cript.Ingredient(\nkeyword=[\"monomer\"], material=styrene, quantity=[monomer_qty]\n)\nquench = cript.Ingredient(\nkeyword=[\"quench\"], material=butanol, quantity=[quench_qty]\n)\nworkup = cript.Ingredient(\nkeyword=[\"workup\"], material=methanol, quantity=[workup_qty]\n)\n

Finally, we can add the Ingredient nodes to the Process node.

process.ingredient += [initiator, solvent, monomer, quench, workup]\n
"},{"location":"examples/synthesis/#add-conditions-to-the-process","title":"Add Conditions to the Process","text":"

Its possible that our Process was carried out under specific physical conditions. We can codify this by adding Condition nodes to the process.

temp = cript.Condition(key=\"temperature\", type=\"value\", value=25, unit=\"celsius\")\ntime = cript.Condition(key=\"time_duration\", type=\"value\", value=60, unit=\"min\")\nprocess.condition = [temp, time]\n
"},{"location":"examples/synthesis/#add-a-property-to-a-process","title":"Add a Property to a Process","text":"

We may also want to associate our process with certain properties. We can do this by adding Property nodes to the process.

yield_mass = cript.Property(key=\"yield_mass\", type=\"number\", value=47e-5, unit=\"kilogram\", method=\"scale\")\nprocess.property += [yield_mass]\n
"},{"location":"examples/synthesis/#create-a-material-node-process-product","title":"Create a Material node (process product)","text":"

Along with input Ingredients, our Process may also produce product materials.

First, let's create the Material that will serve as our product. We give the material a name attribute and add it to our [Project]((../../nodes/primary_nodes/project).

polystyrene = cript.Material(name=\"polystyrene\", identifiers=[])\nproject.material += [polystyrene]\n

Let's add some Identifiers to the material to make it easier to identify and search.

# create a name identifier\npolystyrene.identifiers += [{\"names\": [\"poly(styrene)\", \"poly(vinylbenzene)\"]}]\n# create a BigSMILES identifier\npolystyrene.identifiers += [{\"bigsmiles\": \"[H]{[>][<]C(C[>])c1ccccc1[<]}C(C)CC\"}]\n# create a chemical repeat unit identifier\npolystyrene.identifiers += [{\"chem_repeat\": [\"C8H8\"]}]\n

Next, we'll add some Property nodes to the Material , which represent its physical or virtual (in the case of a simulated material) properties.

# create a phase property\nphase = cript.Property(key=\"phase\", value=\"solid\", type=\"none\", unit=None)\n# create a color property\ncolor = cript.Property(key=\"color\", value=\"white\", type=\"none\", unit=None)\n# add the properties to the material\npolystyrene.property += [phase, color]\n

Congratulations! You've just created a process that represents the polymerization reaction of Polystyrene, starting with a set of input ingredients in various quantities, and ending with a new polymer with specific identifiers and physical properties.

Now we can save the project to CRIPT via the api object.

project.validate()\nprint(project.get_json(indent=2, condense_to_uuid={}).json)\n# api.save(project)\n
# Don't forget to disconnect once everything is done\napi.disconnect()\n
"},{"location":"exceptions/api_exceptions/","title":"API Exceptions","text":""},{"location":"exceptions/api_exceptions/#api-client-exceptions","title":"API Client Exceptions","text":""},{"location":"exceptions/api_exceptions/#cript.api.exceptions.APIError","title":"APIError","text":"

Bases: CRIPTException

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.APIError--definition","title":"Definition","text":"

This is a generic error made to display API errors to the user to troubleshoot.

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.APIError--how-to-fix","title":"How to Fix","text":"

Please keep in mind that the CRIPT Python SDK turns the Project node into a giant JSON and sends that to the API to be processed. If there are any errors while processing the giant JSON generated by the CRIPT Python SDK, then the API will return an error about the http request and the JSON sent to it. Therefore, the error shown might be an error within the JSON and not particular within the Python code that was created

The best way to trouble shoot this is to figure out what the API error means and figure out where in the Python SDK this error occurred and what have been the reason under the hood.

Source code in src/cript/api/exceptions.py
class APIError(CRIPTException):\n\"\"\"\n    ## Definition\n    This is a generic error made to display API errors to the user to troubleshoot.\n    ## How to Fix\n    Please keep in mind that the CRIPT Python SDK turns the [Project](../../nodes/primary_nodes/project)\n    node into a giant JSON and sends that to the API to be processed. If there are any errors while processing\n    the giant JSON generated by the CRIPT Python SDK, then the API will return an error about the http request\n    and the JSON sent to it. Therefore, the error shown might be an error within the JSON and not particular\n    within the Python code that was created\n    The best way to trouble shoot this is to figure out what the API error means and figure out where\n    in the Python SDK this error occurred and what have been the reason under the hood.\n    \"\"\"\napi_error: str = \"\"\ndef __init__(self, api_error: str) -> None:\nself.api_error = api_error\ndef __str__(self) -> str:\nerror_message: str = f\"The API responded with {self.api_error}\"\nreturn error_message\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTAPIRequiredError","title":"CRIPTAPIRequiredError","text":"

Bases: CRIPTException

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTAPIRequiredError--definition","title":"Definition","text":"

Exception to be raised when the API object is requested, but no cript.API object exists yet.

The CRIPT Python SDK relies on a cript.API object for creation, validation, and modification of nodes. The cript.API object may be explicitly called by the user to perform operations to the API, or implicitly called by the Python SDK under the hood to perform some sort of validation.

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTAPIRequiredError--how-to-fix","title":"How to Fix","text":"

To fix this error please instantiate an api object

import cript\nmy_host = \"https://criptapp.org\"\nmy_token = \"123456\" # To use your token securely, please consider using environment variables\nmy_api = cript.API(host=my_host, token=my_token)\n
Source code in src/cript/api/exceptions.py
class CRIPTAPIRequiredError(CRIPTException):\n\"\"\"\n    ## Definition\n    Exception to be raised when the API object is requested, but no cript.API object exists yet.\n    The CRIPT Python SDK relies on a cript.API object for creation, validation, and modification of nodes.\n    The cript.API object may be explicitly called by the user to perform operations to the API, or\n    implicitly called by the Python SDK under the hood to perform some sort of validation.\n    ## How to Fix\n    To fix this error please instantiate an api object\n    ```python\n    import cript\n    my_host = \"https://criptapp.org\"\n    my_token = \"123456\" # To use your token securely, please consider using environment variables\n    my_api = cript.API(host=my_host, token=my_token)\n    ```\n    \"\"\"\ndef __init__(self):\npass\ndef __str__(self) -> str:\nerror_message = \"cript.API object is required for an operation, but it does not exist.\" \"Please instantiate a cript.API object to continue.\" \"See the documentation for more details.\"\nreturn error_message\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTAPISaveError","title":"CRIPTAPISaveError","text":"

Bases: CRIPTException

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTAPISaveError--definition","title":"Definition","text":"

CRIPTAPISaveError is raised when the API responds with a http status code that is anything other than 200. The status code and API response is shown to the user to help them debug the issue.

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTAPISaveError--how-to-fix","title":"How to Fix","text":"

This error is more of a case by case basis, but the best way to approach it to understand that the CRIPT Python SDK sent an HTTP POST request with a giant JSON in the request body to the CRIPT API. The API then read that request, and it responded with some sort of error either to the that JSON or how the request was sent.

Source code in src/cript/api/exceptions.py
class CRIPTAPISaveError(CRIPTException):\n\"\"\"\n    ## Definition\n    CRIPTAPISaveError is raised when the API responds with a http status code that is anything other than 200.\n    The status code and API response is shown to the user to help them debug the issue.\n    ## How to Fix\n    This error is more of a case by case basis, but the best way to approach it to understand that the\n    CRIPT Python SDK sent an HTTP POST request with a giant JSON in the request body\n    to the CRIPT API. The API then read that request, and it responded with some sort of error either\n    to the that JSON or how the request was sent.\n    \"\"\"\napi_host_domain: str\nhttp_code: str\napi_response: str\ndef __init__(self, api_host_domain: str, http_code: str, api_response: str, patch_request: bool, pre_saved_nodes: Optional[Set[str]] = None, json_data: Optional[str] = None):\nself.api_host_domain = api_host_domain\nself.http_code = http_code\nself.api_response = api_response\nself.patch_request = patch_request\nself.pre_saved_nodes = pre_saved_nodes\nself.json_data = json_data\ndef __str__(self) -> str:\ntype = \"POST\"\nif self.patch_request:\ntype = \"PATCH\"\nerror_message = f\"API responded to {type} with 'http:{self.http_code} {self.api_response}'\"\nif self.json_data:\nerror_message += f\" data: {self.json_data}\"\nreturn error_message\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTConnectionError","title":"CRIPTConnectionError","text":"

Bases: CRIPTException

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTConnectionError--definition","title":"Definition","text":"

Raised when the cript.API object cannot connect to CRIPT with the given host and token

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.CRIPTConnectionError--how-to-fix","title":"How to Fix","text":"

The best way to fix this error is to check that your host and token are written and used correctly within the cript.API object. This error could also be shown if the API is unresponsive and the cript.API object just cannot successfully connect to it.

Source code in src/cript/api/exceptions.py
class CRIPTConnectionError(CRIPTException):\n\"\"\"\n    ## Definition\n    Raised when the cript.API object cannot connect to CRIPT with the given host and token\n    ## How to Fix\n    The best way to fix this error is to check that your host and token are written and used correctly within\n    the cript.API object. This error could also be shown if the API is unresponsive and the cript.API object\n    just cannot successfully connect to it.\n    \"\"\"\ndef __init__(self, host, token):\nself.host = host\n# Do not store full token in stack trace for security reasons\nuncovered_chars = len(token) // 4\nself.token = token[:uncovered_chars]\nself.token += \"*\" * (len(token) - 2 * uncovered_chars)\nself.token += token[-uncovered_chars:]\ndef __str__(self) -> str:\nerror_message = f\"Could not connect to CRIPT with the given host ({self.host}) and token ({self.token}). \" f\"Please be sure both host and token are entered correctly.\"\nreturn error_message\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.FileDownloadError","title":"FileDownloadError","text":"

Bases: CRIPTException

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.FileDownloadError--definition","title":"Definition","text":"

This error is raised when the API wants to download a file from an AWS S3 URL via the cript.API.download_file() method, but the status is something other than 200.

Source code in src/cript/api/exceptions.py
class FileDownloadError(CRIPTException):\n\"\"\"\n    ## Definition\n    This error is raised when the API wants to download a file from an AWS S3 URL\n    via the `cript.API.download_file()` method, but the status is something other than 200.\n    \"\"\"\nerror_message: str = \"\"\ndef __init__(self, error_message: str) -> None:\nself.error_message = error_message\ndef __str__(self) -> str:\nreturn self.error_message\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidHostError","title":"InvalidHostError","text":"

Bases: CRIPTException

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidHostError--definition","title":"Definition","text":"

Exception is raised when the host given to the API is invalid

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidHostError--how-to-fix","title":"How to Fix","text":"

This is a simple error to fix, simply put http:// or preferably https:// in front of your domain when passing in the host to the cript.API class such as https://criptapp.org

Currently, the only web protocol that is supported with the CRIPT Python SDK is HTTP.

"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidHostError--example","title":"Example","text":"
import cript\nmy_valid_host = \"https://criptapp.org\"\nmy_token = \"123456\" # To use your token securely, please consider using environment variables\nmy_api = cript.API(host=my_valid_host, token=my_token)\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidHostError--warnings","title":"Warnings","text":"

Please consider always using HTTPS as that is a secure protocol and avoid using HTTP as it is insecure. The CRIPT Python SDK will give a warning in the terminal when it detects a host with HTTP

Source code in src/cript/api/exceptions.py
class InvalidHostError(CRIPTException):\n\"\"\"\n    ## Definition\n    Exception is raised when the host given to the API is invalid\n    ## How to Fix\n    This is a simple error to fix, simply put `http://` or preferably `https://` in front of your domain\n    when passing in the host to the cript.API class such as `https://criptapp.org`\n    Currently, the only web protocol that is supported with the CRIPT Python SDK is `HTTP`.\n    ### Example\n    ```python\n    import cript\n    my_valid_host = \"https://criptapp.org\"\n    my_token = \"123456\" # To use your token securely, please consider using environment variables\n    my_api = cript.API(host=my_valid_host, token=my_token)\n    ```\n    Warnings\n    --------\n    Please consider always using [HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS)\n    as that is a secure protocol and avoid using `HTTP` as it is insecure.\n    The CRIPT Python SDK will give a warning in the terminal when it detects a host with `HTTP`\n    \"\"\"\ndef __init__(self) -> None:\npass\ndef __str__(self) -> str:\nreturn \"The host must start with http or https\"\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidVocabulary","title":"InvalidVocabulary","text":"

Bases: CRIPTException

Raised when the CRIPT controlled vocabulary is invalid

Source code in src/cript/api/exceptions.py
class InvalidVocabulary(CRIPTException):\n\"\"\"\n    Raised when the CRIPT controlled vocabulary is invalid\n    \"\"\"\nvocab: str = \"\"\npossible_vocab: List[str] = []\ndef __init__(self, vocab: str, possible_vocab: List[str]) -> None:\nself.vocab = vocab\nself.possible_vocab = possible_vocab\ndef __str__(self) -> str:\nerror_message = f\"The vocabulary '{self.vocab}' entered does not exist within the CRIPT controlled vocabulary.\" f\" Please pick a valid CRIPT vocabulary from {self.possible_vocab}\"\nreturn error_message\n
"},{"location":"exceptions/api_exceptions/#cript.api.exceptions.InvalidVocabularyCategory","title":"InvalidVocabularyCategory","text":"

Bases: CRIPTException

Raised when the CRIPT controlled vocabulary category is unknown and gives the user a list of all valid vocabulary categories

Source code in src/cript/api/exceptions.py
class InvalidVocabularyCategory(CRIPTException):\n\"\"\"\n    Raised when the CRIPT controlled vocabulary category is unknown\n    and gives the user a list of all valid vocabulary categories\n    \"\"\"\ndef __init__(self, vocab_category: str, valid_vocab_category: List[str]):\nself.vocab_category = vocab_category\nself.valid_vocab_category = valid_vocab_category\ndef __str__(self) -> str:\nerror_message = f\"The vocabulary category {self.vocab_category} does not exist within the CRIPT controlled vocabulary. \" f\"Please pick a valid CRIPT vocabulary category from {self.valid_vocab_category}.\"\nreturn error_message\n
"},{"location":"exceptions/node_exceptions/","title":"Node Exceptions","text":""},{"location":"exceptions/node_exceptions/#node-exceptions","title":"Node Exceptions","text":""},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTAttributeModificationError","title":"CRIPTAttributeModificationError","text":"

Bases: CRIPTException

Exception that is thrown when a node attribute is modified, that wasn't intended to be modified.

Source code in src/cript/nodes/exceptions.py
class CRIPTAttributeModificationError(CRIPTException):\n\"\"\"\n    Exception that is thrown when a node attribute is modified, that wasn't intended to be modified.\n    \"\"\"\ndef __init__(self, name, key, value):\nself.name = name\nself.key = key\nself.value = value\ndef __str__(self):\nreturn (\nf\"Attempt to modify an attribute of a node ({self.name}) that wasn't intended to be modified.\\n\"\nf\"Here the non-existing attribute {self.key} of {self.name} was attempted to be modified.\\n\"\n\"Most likely this is due to a typo in the attribute that was intended to be modified i.e. `project.materials` instead of `project.material`.\\n\"\n\"To ensure compatibility with the underlying CRIPT data model we do not allow custom attributes.\\n\"\n)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTDeserializationUIDError","title":"CRIPTDeserializationUIDError","text":"

Bases: CRIPTException

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTDeserializationUIDError--definition","title":"Definition","text":"

This exception is raised when converting a node from JSON to Python class fails, because a node is specified with its UID only, but not part of the data graph elsewhere.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTDeserializationUIDError--error-example","title":"Error Example","text":"

Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node

{\n\"node\": [\"Algorithm\"],\n\"key\": \"mc_barostat\",\n\"type\": \"barostat\",\n\"parameter\": {\"node\": [\"Parameter\"], \"uid\": \"uid-string\"}\n}\n
Here the algorithm has a parameter attribute, but the parameter is specified as uid only.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTDeserializationUIDError--valid-example","title":"Valid Example","text":"

Valid JSON that can be deserialized to a CRIPT Python SDK Node

{\n\"node\": [\"Algorithm\"],\n\"key\": \"mc_barostat\",\n\"type\": \"barostat\",\n\"parameter\": {\"node\": [\"Parameter\"], \"uid\": \"uid-string\",\n\"key\": \"update_frequency\", \"value\":1, \"unit\": \"1/second\"}\n}\n
Now the node is fully specified.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTDeserializationUIDError--how-to-fix","title":"How to Fix","text":"

Specify the full node instead. This error might appear if you try to partially load previously generated JSON.

Source code in src/cript/nodes/exceptions.py
class CRIPTDeserializationUIDError(CRIPTException):\n\"\"\"\n    ## Definition\n    This exception is raised when converting a node from JSON to Python class fails,\n    because a node is specified with its UID only, but not part of the data graph elsewhere.\n    ### Error Example\n    Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node\n    ```json\n    {\n    \"node\": [\"Algorithm\"],\n    \"key\": \"mc_barostat\",\n    \"type\": \"barostat\",\n    \"parameter\": {\"node\": [\"Parameter\"], \"uid\": \"uid-string\"}\n    }\n    ```\n    Here the algorithm has a parameter attribute, but the parameter is specified as uid only.\n    ### Valid Example\n    Valid JSON that can be deserialized to a CRIPT Python SDK Node\n    ```json\n    {\n    \"node\": [\"Algorithm\"],\n    \"key\": \"mc_barostat\",\n    \"type\": \"barostat\",\n    \"parameter\": {\"node\": [\"Parameter\"], \"uid\": \"uid-string\",\n                  \"key\": \"update_frequency\", \"value\":1, \"unit\": \"1/second\"}\n    }\n    ```\n    Now the node is fully specified.\n    ## How to Fix\n    Specify the full node instead. This error might appear if you try to partially load previously generated JSON.\n    \"\"\"\ndef __init__(self, node_type: str, uid: str) -> None:\nself.node_type = node_type\nself.uid = uid\ndef __str__(self) -> str:\nreturn f\"JSON deserialization failed for node type {self.node_type} with unknown UID: {self.uid}\"\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonDeserializationError","title":"CRIPTJsonDeserializationError","text":"

Bases: CRIPTException

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonDeserializationError--definition","title":"Definition","text":"

This exception is raised when converting a node from JSON to Python class fails. This process fails when the attributes within the JSON does not match the node's class attributes within the JsonAttributes of that specific node

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonDeserializationError--error-example","title":"Error Example","text":"

Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonDeserializationError--valid-example","title":"Valid Example","text":"

Valid JSON that can be deserialized to a CRIPT Python SDK Node

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonDeserializationError--how-to-fix","title":"How to Fix","text":"Source code in src/cript/nodes/exceptions.py
class CRIPTJsonDeserializationError(CRIPTException):\n\"\"\"\n    ## Definition\n    This exception is raised when converting a node from JSON to Python class fails.\n    This process fails when the attributes within the JSON does not match the node's class\n    attributes within the `JsonAttributes` of that specific node\n    ### Error Example\n    Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node\n    ```json\n    ```\n    ### Valid Example\n    Valid JSON that can be deserialized to a CRIPT Python SDK Node\n    ```json\n    ```\n    ## How to Fix\n    \"\"\"\ndef __init__(self, node_type: str, json_str: str) -> None:\nself.node_type = node_type\nself.json_str = json_str\ndef __str__(self) -> str:\nreturn f\"JSON deserialization failed for node type {self.node_type} with JSON str: {self.json_str}\"\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonNodeError","title":"CRIPTJsonNodeError","text":"

Bases: CRIPTJsonDeserializationError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonNodeError--definition","title":"Definition","text":"

This exception is raised if a node attribute is present in JSON, but the list has more or less than exactly one type of node type.

Note: It is expected that there is only a single node type per JSON object.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonNodeError--example","title":"Example","text":"

Valid JSON representation of a Material node

{\n\"node\": [\n\"Material\"\n],\n\"name\": \"Whey protein isolate\",\n\"uid\": \"_:Whey protein isolate\"\n},\n
Invalid JSON representation of a Material node
{\n\"node\": [\n\"Material\",\n\"Property\"\n],\n\"name\": \"Whey protein isolate\",\n\"uid\": \"_:Whey protein isolate\"\n},\n
{\n\"node\": [],\n\"name\": \"Whey protein isolate\",\n\"uid\": \"_:Whey protein isolate\"\n},\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonNodeError--how-to-fix","title":"How to Fix","text":"

Debugging skills are most helpful here as there is no one-size-fits-all approach.

It is best to identify whether the invalid JSON was created in the Python SDK or if the invalid JSON was given from the API.

If the Python SDK created invalid JSON during serialization, then it is helpful to track down and identify the point where the invalid JSON was started.

You may consider, inspecting the python objects to see if the node type are written incorrectly in python and the issue is only being caught during serialization or if the Python node is written correctly and the issue is created during serialization.

If the problem is with the Python SDK or API, it is best to leave an issue or create a discussion within the Python SDK GitHub repository for one of the members of the CRIPT team to look into any issues that there could have been.

Source code in src/cript/nodes/exceptions.py
class CRIPTJsonNodeError(CRIPTJsonDeserializationError):\n\"\"\"\n    ## Definition\n    This exception is raised if a `node` attribute is present in JSON,\n    but the list has more or less than exactly one type of node type.\n    > Note: It is expected that there is only a single node type per JSON object.\n    ### Example\n    !!! Example \"Valid JSON representation of a Material node\"\n        ```json\n        {\n          \"node\": [\n            \"Material\"\n          ],\n          \"name\": \"Whey protein isolate\",\n          \"uid\": \"_:Whey protein isolate\"\n        },\n        ```\n    ??? Example \"Invalid JSON representation of a Material node\"\n        ```json\n        {\n          \"node\": [\n            \"Material\",\n            \"Property\"\n          ],\n          \"name\": \"Whey protein isolate\",\n          \"uid\": \"_:Whey protein isolate\"\n        },\n        ```\n        ---\n        ```json\n        {\n          \"node\": [],\n          \"name\": \"Whey protein isolate\",\n          \"uid\": \"_:Whey protein isolate\"\n        },\n        ```\n    ## How to Fix\n    Debugging skills are most helpful here as there is no one-size-fits-all approach.\n    It is best to identify whether the invalid JSON was created in the Python SDK\n    or if the invalid JSON was given from the API.\n    If the Python SDK created invalid JSON during serialization, then it is helpful to track down and\n    identify the point where the invalid JSON was started.\n    You may consider, inspecting the python objects to see if the node type are written incorrectly in python\n    and the issue is only being caught during serialization or if the Python node is written correctly\n    and the issue is created during serialization.\n    If the problem is with the Python SDK or API, it is best to leave an issue or create a discussion within the\n    [Python SDK GitHub repository](https://github.com/C-Accel-CRIPT/Python-SDK) for one of the members of the\n    CRIPT team to look into any issues that there could have been.\n    \"\"\"\ndef __init__(self, node_list: List, json_str: str) -> None:\nself.node_list = node_list\nself.json_str = json_str\ndef __str__(self) -> str:\nerror_message: str = f\"The 'node' attribute in the JSON string must be a single element list with the node name \" f\" such as `'node: ['Material']`. The `node` attribute provided was: `{self.node_list}`\" f\"The full JSON was: {self.json_str}.\"\nreturn error_message\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonSerializationError","title":"CRIPTJsonSerializationError","text":"

Bases: CRIPTException

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonSerializationError--definition","title":"Definition","text":"

This Exception is raised if serialization of node from JSON to Python Object fails.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTJsonSerializationError--how-to-fix","title":"How to Fix","text":"Source code in src/cript/nodes/exceptions.py
class CRIPTJsonSerializationError(CRIPTException):\n\"\"\"\n    ## Definition\n    This Exception is raised if serialization of node from JSON to Python Object fails.\n    ## How to Fix\n    \"\"\"\ndef __init__(self, node_type: str, json_dict: str) -> None:\nself.node_type = node_type\nself.json_str = str(json_dict)\ndef __str__(self) -> str:\nreturn f\"JSON Serialization failed for node type {self.node_type} with JSON dict: {self.json_str}\"\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTNodeSchemaError","title":"CRIPTNodeSchemaError","text":"

Bases: CRIPTException

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTNodeSchemaError--definition","title":"Definition","text":"

This error is raised when the CRIPT json database schema validation fails for a node.

Please keep in mind that the CRIPT Python SDK converts all the Python nodes inside the Project into a giant JSON and sends an HTTP POST or PATCH request to the API to be processed.

However, before a request is sent to the API, the JSON is validated against API database schema via the JSON Schema library, and if the database schema validation fails for whatever reason this error is shown.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTNodeSchemaError--possible-reasons","title":"Possible Reasons","text":"
  1. There was a mistake in nesting of the nodes
  2. There was a mistake in creating the nodes
  3. Nodes are missing
  4. Nodes have invalid vocabulary
    • The database schema wants something a different controlled vocabulary than what is provided
  5. There was an error with the way the JSON was created within the Python SDK
    • The format of the JSON the CRIPT Python SDK created was invalid
  6. There is something wrong with the database schema
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTNodeSchemaError--how-to-fix","title":"How to Fix","text":"

The easiest way to troubleshoot this is to examine the JSON that the SDK created via printing out the Project node's JSON and checking the place that the schema validation says failed

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTNodeSchemaError--example","title":"Example","text":"
print(my_project.json)\n
Source code in src/cript/nodes/exceptions.py
class CRIPTNodeSchemaError(CRIPTException):\n\"\"\"\n    ## Definition\n    This error is raised when the CRIPT [json database schema](https://json-schema.org/)\n    validation fails for a node.\n    Please keep in mind that the CRIPT Python SDK converts all the Python nodes inside the\n    [Project](../../nodes/primary_nodes/project) into a giant JSON\n    and sends an HTTP `POST` or `PATCH` request to the API to be processed.\n    However, before a request is sent to the API, the JSON is validated against API database schema\n    via the [JSON Schema library](https://python-jsonschema.readthedocs.io/en/stable/),\n    and if the database schema validation fails for whatever reason this error is shown.\n    ### Possible Reasons\n    1. There was a mistake in nesting of the nodes\n    1. There was a mistake in creating the nodes\n    1. Nodes are missing\n    1. Nodes have invalid vocabulary\n        * The database schema wants something a different controlled vocabulary than what is provided\n    1. There was an error with the way the JSON was created within the Python SDK\n        * The format of the JSON the CRIPT Python SDK created was invalid\n    1. There is something wrong with the database schema\n    ## How to Fix\n    The easiest way to troubleshoot this is to examine the JSON that the SDK created via printing out the\n    [Project](../../nodes/primary_nodes/project) node's JSON and checking the place that the schema validation\n    says failed\n    ### Example\n    ```python\n    print(my_project.json)\n    ```\n    \"\"\"\nnode_type: str = \"\"\njson_schema_validation_error: str = \"\"\ndef __init__(self, node_type: str, json_schema_validation_error: str) -> None:\nself.json_schema_validation_error: str = json_schema_validation_error\nself.node_type = node_type\ndef __str__(self) -> str:\nerror_message: str = f\"JSON database schema validation for node {self.node_type} failed.\"\nerror_message += f\"Error: {self.json_schema_validation_error}\"\nreturn error_message\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationError","title":"CRIPTOrphanedComputationError","text":"

Bases: CRIPTOrphanedExperimentError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationError--definition","title":"Definition","text":"

CRIPTOrphanedExperimentError, but specific for orphaned Computation node that should be listed in one of the experiments.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationError--how-to-fix","title":"How To Fix","text":"

Handle this error by adding the orphaned node into one the parent project's experiments Computation attribute.

Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedComputationError(CRIPTOrphanedExperimentError):\n\"\"\"\n    ## Definition\n    CRIPTOrphanedExperimentError, but specific for orphaned Computation node that should be\n    listed in one of the experiments.\n    ## How To Fix\n    Handle this error by adding the orphaned node into one the parent project's experiments\n    `Computation` attribute.\n    \"\"\"\ndef __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.computation import Computation\nassert isinstance(orphaned_node, Computation)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationError.__init__","title":"__init__(orphaned_node)","text":"Source code in src/cript/nodes/exceptions.py
def __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.computation import Computation\nassert isinstance(orphaned_node, Computation)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationalProcessError","title":"CRIPTOrphanedComputationalProcessError","text":"

Bases: CRIPTOrphanedExperimentError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationalProcessError--definition","title":"Definition","text":"

CRIPTOrphanedExperimentError, but specific for orphaned ComputationalProcess node that should be listed in one of the experiments.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationalProcessError--how-to-fix","title":"How To Fix","text":"

Handle this error by adding the orphaned node into one the parent project's experiments ComputationalProcess attribute.

Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedComputationalProcessError(CRIPTOrphanedExperimentError):\n\"\"\"\n    ## Definition\n    CRIPTOrphanedExperimentError, but specific for orphaned ComputationalProcess\n    node that should be listed in one of the experiments.\n    ## How To Fix\n    Handle this error by adding the orphaned node into one the parent project's experiments\n    `ComputationalProcess` attribute.\n    \"\"\"\ndef __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.computation_process import ComputationProcess\nassert isinstance(orphaned_node, ComputationProcess)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedComputationalProcessError.__init__","title":"__init__(orphaned_node)","text":"Source code in src/cript/nodes/exceptions.py
def __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.computation_process import ComputationProcess\nassert isinstance(orphaned_node, ComputationProcess)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedDataError","title":"CRIPTOrphanedDataError","text":"

Bases: CRIPTOrphanedExperimentError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedDataError--definition","title":"Definition","text":"

CRIPTOrphanedExperimentError, but specific for orphaned Data node that should be listed in one of the experiments.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedDataError--how-to-fix","title":"How To Fix","text":"

Handle this error by adding the orphaned node into one the parent project's experiments data attribute.

Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedDataError(CRIPTOrphanedExperimentError):\n\"\"\"\n    ## Definition\n    CRIPTOrphanedExperimentError, but specific for orphaned Data node that should be listed in one of the experiments.\n    ## How To Fix\n    Handle this error by adding the orphaned node into one the parent project's experiments `data` attribute.\n    \"\"\"\ndef __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.data import Data\nassert isinstance(orphaned_node, Data)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedDataError.__init__","title":"__init__(orphaned_node)","text":"Source code in src/cript/nodes/exceptions.py
def __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.data import Data\nassert isinstance(orphaned_node, Data)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedExperimentError","title":"CRIPTOrphanedExperimentError","text":"

Bases: CRIPTOrphanedNodesError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedExperimentError--definition","title":"Definition","text":"

CRIPTOrphanedNodesError, but specific for orphaned nodes that should be listed in one of the experiments.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedExperimentError--how-to-fix","title":"How To Fix","text":"

Handle this error by adding the orphaned node into one the parent project's experiments.

Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedExperimentError(CRIPTOrphanedNodesError):\n\"\"\"\n    ## Definition\n    CRIPTOrphanedNodesError, but specific for orphaned nodes that should be listed in one of the experiments.\n    ## How To Fix\n    Handle this error by adding the orphaned node into one the parent project's experiments.\n    \"\"\"\ndef __init__(self, orphaned_node):\nsuper().__init__(orphaned_node)\ndef __str__(self) -> str:\nnode_name = self.orphaned_node.node_type.lower()\nret_string = f\"While validating a project graph, an orphaned {node_name} node was found. \"\nret_string += f\"This {node_name} node is present in the graph, but not listed in any of the experiments of the  project. \"\nret_string += f\"Please add the node like: `your_experiment.{node_name} += [orphaned_{node_name}]`. \"\nret_string += f\"The orphaned {node_name} was {self.orphaned_node}.\"\nreturn ret_string\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedMaterialError","title":"CRIPTOrphanedMaterialError","text":"

Bases: CRIPTOrphanedNodesError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedMaterialError--definition","title":"Definition","text":"

CRIPTOrphanedNodesError, but specific for orphaned materials.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedMaterialError--how-to-fix","title":"How To Fix","text":"

Handle this error by adding the orphaned materials into the parent project or its inventories.

Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedMaterialError(CRIPTOrphanedNodesError):\n\"\"\"\n    ## Definition\n    CRIPTOrphanedNodesError, but specific for orphaned materials.\n    ## How To Fix\n    Handle this error by adding the orphaned materials into the parent project or its inventories.\n    \"\"\"\ndef __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.material import Material\nassert isinstance(orphaned_node, Material)\nsuper().__init__(orphaned_node)\ndef __str__(self):\nret_string = \"While validating a project graph, an orphaned material node was found. \"\nret_string += \"This material is present in the graph, but not listed in the project. \"\nret_string += \"Please add the node like: `my_project.material += [orphaned_material]`. \"\nret_string += f\"The orphaned material was {self.orphaned_node}.\"\nreturn ret_string\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedMaterialError.__init__","title":"__init__(orphaned_node)","text":"Source code in src/cript/nodes/exceptions.py
def __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.material import Material\nassert isinstance(orphaned_node, Material)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedNodesError","title":"CRIPTOrphanedNodesError","text":"

Bases: CRIPTException, ABC

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedNodesError--definition","title":"Definition","text":"

This error is raised when a child node is not attached to the appropriate parent node. For example, all material nodes used within a project must belong to the project inventory or are explicitly listed as material of that project. If there is a material node that is used within a project but not a part of the inventory and the validation code finds it then it raises an CRIPTOrphanedNodeError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedNodesError--how-to-fix","title":"How To Fix","text":"

Fixing this is simple and easy, just take the node that CRIPT Python SDK found a problem with and associate it with the appropriate parent via

my_project.material += my_orphaned_material_node\n
Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedNodesError(CRIPTException, ABC):\n\"\"\"\n    ## Definition\n    This error is raised when a child node is not attached to the\n    appropriate parent node. For example, all material nodes used\n    within a project must belong to the project inventory or are explicitly listed as material of that project.\n    If there is a material node that is used within a project but not a part of the\n    inventory and the validation code finds it then it raises an `CRIPTOrphanedNodeError`\n    ## How To Fix\n    Fixing this is simple and easy, just take the node that CRIPT Python SDK\n    found a problem with and associate it with the appropriate parent via\n    ```\n    my_project.material += my_orphaned_material_node\n    ```\n    \"\"\"\ndef __init__(self, orphaned_node):\nself.orphaned_node = orphaned_node\n@abstractmethod\ndef __str__(self):\npass\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedProcessError","title":"CRIPTOrphanedProcessError","text":"

Bases: CRIPTOrphanedExperimentError

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedProcessError--definition","title":"Definition","text":"

CRIPTOrphanedExperimentError, but specific for orphaned Process node that should be listed in one of the experiments.

"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedProcessError--how-to-fix","title":"How To Fix","text":"

Handle this error by adding the orphaned node into one the parent project's experiments process attribute.

Source code in src/cript/nodes/exceptions.py
class CRIPTOrphanedProcessError(CRIPTOrphanedExperimentError):\n\"\"\"\n    ## Definition\n    CRIPTOrphanedExperimentError, but specific for orphaned Process node that should be\n    listed in one of the experiments.\n    ## How To Fix\n    Handle this error by adding the orphaned node into one the parent project's experiments\n    `process` attribute.\n    \"\"\"\ndef __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.process import Process\nassert isinstance(orphaned_node, Process)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.CRIPTOrphanedProcessError.__init__","title":"__init__(orphaned_node)","text":"Source code in src/cript/nodes/exceptions.py
def __init__(self, orphaned_node):\nfrom cript.nodes.primary_nodes.process import Process\nassert isinstance(orphaned_node, Process)\nsuper().__init__(orphaned_node)\n
"},{"location":"exceptions/node_exceptions/#cript.nodes.exceptions.get_orphaned_experiment_exception","title":"get_orphaned_experiment_exception(orphaned_node)","text":"

Return the correct specific Exception based in the orphaned node type for nodes not correctly listed in experiment.

Source code in src/cript/nodes/exceptions.py
def get_orphaned_experiment_exception(orphaned_node):\n\"\"\"\n    Return the correct specific Exception based in the orphaned node type for nodes not correctly listed in experiment.\n    \"\"\"\nfrom cript.nodes.primary_nodes.computation import Computation\nfrom cript.nodes.primary_nodes.computation_process import ComputationProcess\nfrom cript.nodes.primary_nodes.data import Data\nfrom cript.nodes.primary_nodes.process import Process\nif isinstance(orphaned_node, Data):\nreturn CRIPTOrphanedDataError(orphaned_node)\nif isinstance(orphaned_node, Process):\nreturn CRIPTOrphanedProcessError(orphaned_node)\nif isinstance(orphaned_node, Computation):\nreturn CRIPTOrphanedComputationError(orphaned_node)\nif isinstance(orphaned_node, ComputationProcess):\nreturn CRIPTOrphanedComputationalProcessError(orphaned_node)\n# Base case raise the parent exception. TODO add bug warning.\nreturn CRIPTOrphanedExperimentError(orphaned_node)\n
"},{"location":"nodes/primary_nodes/base_node/","title":"Base node","text":""},{"location":"nodes/primary_nodes/base_node/#base-node","title":"Base node","text":""},{"location":"nodes/primary_nodes/collection/","title":"Collection","text":""},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection","title":"Collection","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection--definition","title":"Definition","text":"

A Collection node is nested inside a Project node.

A Collection node can be thought as a folder/bucket that can hold experiment or Inventories node.

attribute type example description experiment list[Experiment] experiment that relate to the collection inventory list[Inventory] inventory owned by the collection doi str 10.1038/1781168a0 DOI: digital object identifier for a published collection; CRIPT generated DOI citation list[Citation] reference to a book, paper, or scholarly work"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection--json-representation","title":"JSON Representation","text":"
{\n\"name\": \"my collection JSON\",\n\"node\":[\"Collection\"],\n\"uid\":\"_:fccd3549-07cb-4e23-ba79-323597ec9bfd\",\n\"uuid\":\"fccd3549-07cb-4e23-ba79-323597ec9bfd\"\n\"experiment\":[\n{\n\"name\":\"my experiment name\",\n\"node\":[\"Experiment\"],\n\"uid\":\"_:8256b75b-1f4e-4f69-9fe6-3bcb2298e470\",\n\"uuid\":\"8256b75b-1f4e-4f69-9fe6-3bcb2298e470\"\n}\n],\n\"inventory\":[],\n\"citation\":[],\n}\n
Source code in src/cript/nodes/primary_nodes/collection.py
class Collection(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    A\n    [Collection node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=8)\n    is nested inside a [Project](../project) node.\n    A Collection node can be thought as a folder/bucket that can hold [experiment](../experiment)\n    or [Inventories](../inventory) node.\n    | attribute  | type             | example             | description                                                                    |\n    |------------|------------------|---------------------|--------------------------------------------------------------------------------|\n    | experiment | list[Experiment] |                     | experiment that relate to the collection                                       |\n    | inventory  | list[Inventory]  |                     | inventory owned by the collection                                              |\n    | doi        | str              | `10.1038/1781168a0` | DOI: digital object identifier for a published collection; CRIPT generated DOI |\n    | citation   | list[Citation]   |                     | reference to a book, paper, or scholarly work                                  |\n    ## JSON Representation\n    ```json\n    {\n    \"name\": \"my collection JSON\",\n     \"node\":[\"Collection\"],\n     \"uid\":\"_:fccd3549-07cb-4e23-ba79-323597ec9bfd\",\n     \"uuid\":\"fccd3549-07cb-4e23-ba79-323597ec9bfd\"\n     \"experiment\":[\n        {\n           \"name\":\"my experiment name\",\n           \"node\":[\"Experiment\"],\n           \"uid\":\"_:8256b75b-1f4e-4f69-9fe6-3bcb2298e470\",\n           \"uuid\":\"8256b75b-1f4e-4f69-9fe6-3bcb2298e470\"\n        }\n     ],\n     \"inventory\":[],\n     \"citation\":[],\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Collection attributes\n        \"\"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\nmember: List[User] = field(default_factory=list)\nadmin: List[User] = field(default_factory=list)\nexperiment: Optional[List[Any]] = None\ninventory: Optional[List[Any]] = None\ndoi: str = \"\"\ncitation: Optional[List[Any]] = None\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, name: str, experiment: Optional[List[Any]] = None, inventory: Optional[List[Any]] = None, doi: str = \"\", citation: Optional[List[Any]] = None, notes: str = \"\", **kwargs) -> None:\n\"\"\"\n        create a Collection with a name\n        add list of experiment, inventory, citation, doi, and notes if available.\n        Parameters\n        ----------\n        name: str\n            name of the Collection you want to make\n        experiment: Optional[List[Experiment]], default=None\n            list of experiment within the Collection\n        inventory: Optional[List[Inventory]], default=None\n            list of inventories within this collection\n        doi: str = \"\", default=\"\"\n            cript doi\n        citation: Optional[List[Citation]], default=None\n            List of citations for this collection\n        Returns\n        -------\n        None\n            Instantiates a Collection node\n        \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif experiment is None:\nexperiment = []\nif inventory is None:\ninventory = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\nname=name,\nexperiment=experiment,\ninventory=inventory,\ndoi=doi,\ncitation=citation,\n)\nself.validate()\n@property\n@beartype\ndef member(self) -> List[User]:\nreturn self._json_attrs.member.copy()\n@property\n@beartype\ndef admin(self) -> List[User]:\nreturn self._json_attrs.admin\n@property\n@beartype\ndef experiment(self) -> List[Any]:\n\"\"\"\n        List of all [experiment](../experiment) within this Collection\n        Examples\n        --------\n        ```python\n        my_collection.experiment = [my_first_experiment]\n        ```\n        Returns\n        -------\n        List[Experiment]\n            list of all [experiment](../experiment) within this Collection\n        \"\"\"\nreturn self._json_attrs.experiment.copy()  # type: ignore\n@experiment.setter\n@beartype\ndef experiment(self, new_experiment: List[Any]) -> None:\n\"\"\"\n        sets the Experiment list within this collection\n        Parameters\n        ----------\n        new_experiment: List[Experiment]\n            list of experiment\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, experiment=new_experiment)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef inventory(self) -> List[Any]:\n\"\"\"\n        List of [inventory](../inventory) that belongs to this collection\n        Examples\n        --------\n        ```python\n        material_1 = cript.Material(\n            name=\"material 1\",\n            identifiers=[{\"alternative_names\": \"material 1 alternative name\"}],\n        )\n        material_2 = cript.Material(\n            name=\"material 2\",\n            identifiers=[{\"alternative_names\": \"material 2 alternative name\"}],\n        )\n        my_inventory = cript.Inventory(\n            name=\"my inventory name\", materials_list=[material_1, material_2]\n        )\n        my_collection.inventory = [my_inventory]\n        ```\n        Returns\n        -------\n        inventory: List[Inventory]\n            list of inventories in this collection\n        \"\"\"\nreturn self._json_attrs.inventory.copy()  # type: ignore\n@inventory.setter\n@beartype\ndef inventory(self, new_inventory: List[Any]) -> None:\n\"\"\"\n        Sets the List of inventories within this collection to a new list\n        Parameters\n        ----------\n        new_inventory: List[Inventory]\n            new list of inventories for the collection to overwrite the current list\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, inventory=new_inventory)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef doi(self) -> str:\n\"\"\"\n        The CRIPT DOI for this collection\n        ```python\n        my_collection.doi = \"10.1038/1781168a0\"\n        ```\n        Returns\n        -------\n        doi: str\n            the CRIPT DOI e.g. `10.1038/1781168a0`\n        \"\"\"\nreturn self._json_attrs.doi\n@doi.setter\n@beartype\ndef doi(self, new_doi: str) -> None:\n\"\"\"\n        set the CRIPT DOI for this collection to new CRIPT DOI\n        Parameters\n        ----------\n        new_doi: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, doi=new_doi)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Any]:\n\"\"\"\n        List of Citations within this Collection\n        Examples\n        --------\n        ```python\n        my_citation = cript.Citation(type=\"derived_from\", reference=simple_reference_node)\n        my_collections.citation = my_citations\n        ```\n        Returns\n        -------\n        citation: List[Citation]:\n            list of Citations within this Collection\n        \"\"\"\nreturn self._json_attrs.citation.copy()  # type: ignore\n@citation.setter\n@beartype\ndef citation(self, new_citation: List[Any]) -> None:\n\"\"\"\n        set the list of citations for this Collection\n        Parameters\n        ----------\n        new_citation: List[Citation]\n            set the list of citations for this Collection\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection.citation","title":"citation: List[Any] property writable","text":"

List of Citations within this Collection

Examples:

my_citation = cript.Citation(type=\"derived_from\", reference=simple_reference_node)\nmy_collections.citation = my_citations\n

Returns:

Name Type Description citation List[Citation]:

list of Citations within this Collection

"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection.doi","title":"doi: str property writable","text":"

The CRIPT DOI for this collection

my_collection.doi = \"10.1038/1781168a0\"\n

Returns:

Name Type Description doi str

the CRIPT DOI e.g. 10.1038/1781168a0

"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection.experiment","title":"experiment: List[Any] property writable","text":"

List of all experiment within this Collection

Examples:

my_collection.experiment = [my_first_experiment]\n

Returns:

Type Description List[Experiment]

list of all experiment within this Collection

"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection.inventory","title":"inventory: List[Any] property writable","text":"

List of inventory that belongs to this collection

Examples:

material_1 = cript.Material(\nname=\"material 1\",\nidentifiers=[{\"alternative_names\": \"material 1 alternative name\"}],\n)\nmaterial_2 = cript.Material(\nname=\"material 2\",\nidentifiers=[{\"alternative_names\": \"material 2 alternative name\"}],\n)\nmy_inventory = cript.Inventory(\nname=\"my inventory name\", materials_list=[material_1, material_2]\n)\nmy_collection.inventory = [my_inventory]\n

Returns:

Name Type Description inventory List[Inventory]

list of inventories in this collection

"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Collection attributes

Source code in src/cript/nodes/primary_nodes/collection.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Collection attributes\n    \"\"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\nmember: List[User] = field(default_factory=list)\nadmin: List[User] = field(default_factory=list)\nexperiment: Optional[List[Any]] = None\ninventory: Optional[List[Any]] = None\ndoi: str = \"\"\ncitation: Optional[List[Any]] = None\n
"},{"location":"nodes/primary_nodes/collection/#cript.nodes.primary_nodes.collection.Collection.__init__","title":"__init__(name, experiment=None, inventory=None, doi='', citation=None, notes='', **kwargs)","text":"

create a Collection with a name add list of experiment, inventory, citation, doi, and notes if available.

Parameters:

Name Type Description Default name str

name of the Collection you want to make

required experiment Optional[List[Any]]

list of experiment within the Collection

None inventory Optional[List[Any]]

list of inventories within this collection

None doi str

cript doi

'' citation Optional[List[Any]]

List of citations for this collection

None

Returns:

Type Description None

Instantiates a Collection node

Source code in src/cript/nodes/primary_nodes/collection.py
@beartype\ndef __init__(self, name: str, experiment: Optional[List[Any]] = None, inventory: Optional[List[Any]] = None, doi: str = \"\", citation: Optional[List[Any]] = None, notes: str = \"\", **kwargs) -> None:\n\"\"\"\n    create a Collection with a name\n    add list of experiment, inventory, citation, doi, and notes if available.\n    Parameters\n    ----------\n    name: str\n        name of the Collection you want to make\n    experiment: Optional[List[Experiment]], default=None\n        list of experiment within the Collection\n    inventory: Optional[List[Inventory]], default=None\n        list of inventories within this collection\n    doi: str = \"\", default=\"\"\n        cript doi\n    citation: Optional[List[Citation]], default=None\n        List of citations for this collection\n    Returns\n    -------\n    None\n        Instantiates a Collection node\n    \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif experiment is None:\nexperiment = []\nif inventory is None:\ninventory = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\nname=name,\nexperiment=experiment,\ninventory=inventory,\ndoi=doi,\ncitation=citation,\n)\nself.validate()\n
"},{"location":"nodes/primary_nodes/computation/","title":"Computation","text":""},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation","title":"Computation","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation--definition","title":"Definition","text":"

The Computation node describes the transformation of data or the creation of a computational data set.

Common computations for simulations are energy minimization, annealing, quenching, or NPT/NVT (isothermal-isobaric/canonical ensemble) simulations.

Common computations for experimental data include fitting a reaction model to kinetic data to determine rate constants, a plateau modulus from a time-temperature-superposition, or calculating radius of gyration with the Debye function from small angle scattering data.

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation--attributes","title":"Attributes","text":"attribute type example description required vocab type str general molecular dynamics simulation category of computation True True input_data list[Data] input data nodes output_data list[Data] output data nodes software_ configurations list[Software Configuration] software and algorithms used condition list[Condition] setup information prerequisite_computation Computation prior computation method in chain citation list[Citation] reference to a book, paper, or scholarly work notes str additional description of the step"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my computation name\",\n\"node\":[\"Computation\"],\n\"type\":\"analysis\",\n\"uid\":\"_:69f29bec-e30a-4932-b78d-2e4585b37d74\",\n\"uuid\":\"69f29bec-e30a-4932-b78d-2e4585b37d74\"\n\"citation\":[],\n}\n
"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation--available-subobjects","title":"Available Subobjects","text":"
  • Software Configuration
  • Condition
  • Citation
Source code in src/cript/nodes/primary_nodes/computation.py
class Computation(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    The\n    [Computation node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=14)\n    describes the transformation of data or the creation of a computational data\n    set.\n    **Common computations for simulations** are energy minimization, annealing, quenching, or\n    NPT/NVT (isothermal-isobaric/canonical ensemble) simulations.\n    **Common computations for experimental** data include fitting a reaction model to kinetic data\n    to determine rate constants, a plateau modulus from a time-temperature-superposition, or calculating radius of\n    gyration with the Debye function from small angle scattering data.\n    ## Attributes\n    | attribute                | type                          | example                               | description                                   | required | vocab |\n    |--------------------------|-------------------------------|---------------------------------------|-----------------------------------------------|----------|-------|\n    | type                     | str                           | general molecular dynamics simulation | category of computation                       | True     | True  |\n    | input_data               | list[Data]                    |                                       | input data nodes                              |          |       |\n    | output_data              | list[Data]                    |                                       | output data nodes                             |          |       |\n    | software_ configurations | list[Software  Configuration] |                                       | software and algorithms used                  |          |       |\n    | condition                | list[Condition]               |                                       | setup information                             |          |       |\n    | prerequisite_computation | Computation                   |                                       | prior computation method in chain             |          |       |\n    | citation                | list[Citation]                |                                       | reference to a book, paper, or scholarly work |          |       |\n    | notes                    | str                           |                                       | additional description of the step            |          |       |\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my computation name\",\n       \"node\":[\"Computation\"],\n       \"type\":\"analysis\",\n       \"uid\":\"_:69f29bec-e30a-4932-b78d-2e4585b37d74\",\n       \"uuid\":\"69f29bec-e30a-4932-b78d-2e4585b37d74\"\n       \"citation\":[],\n    }\n    ```\n    ## Available Subobjects\n    * [Software Configuration](../../subobjects/software_configuration)\n    * [Condition](../../subobjects/condition)\n    * [Citation](../../subobjects/citation)\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all computation nodes attributes\n        \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\ninput_data: List[Any] = field(default_factory=list)\noutput_data: List[Any] = field(default_factory=list)\nsoftware_configuration: List[Any] = field(default_factory=list)\ncondition: List[Any] = field(default_factory=list)\nprerequisite_computation: Optional[\"Computation\"] = None\ncitation: Optional[List[Any]] = None\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\ninput_data: Optional[List[Any]] = None,\noutput_data: Optional[List[Any]] = None,\nsoftware_configuration: Optional[List[Any]] = None,\ncondition: Optional[List[Any]] = None,\nprerequisite_computation: Optional[\"Computation\"] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n) -> None:\n\"\"\"\n        create a computation node\n        Parameters\n        ----------\n        name: str\n            name of computation node\n        type: str\n            type of computation node. Computation type must come from CRIPT controlled vocabulary\n        input_data: List[Data] default=None\n            input data (data node)\n        output_data: List[Data] default=None\n            output data (data node)\n        software_configuration: List[SoftwareConfiguration] default=None\n            software configuration of computation node\n        condition: List[Condition] default=None\n            condition for the computation node\n        prerequisite_computation: Computation default=None\n            prerequisite computation\n        citation: List[Citation] default=None\n            list of citations\n        notes: str = \"\"\n            any notes for this computation node\n        **kwargs\n            for internal use of deserialize JSON from API to node\n        Examples\n        --------\n        ```python\n        my_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\n        ```\n        Returns\n        -------\n        None\n            instantiate a computation node\n        \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif input_data is None:\ninput_data = []\nif output_data is None:\noutput_data = []\nif software_configuration is None:\nsoftware_configuration = []\nif condition is None:\ncondition = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\ninput_data=input_data,\noutput_data=output_data,\nsoftware_configuration=software_configuration,\ncondition=condition,\nprerequisite_computation=prerequisite_computation,\ncitation=citation,\n)\nself.validate()\n# ------------------ Properties ------------------\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        The type of computation\n        the computation type must come from CRIPT controlled vocabulary\n        Examples\n        --------\n        ```python\n        my_computation.type = \"type=\"analysis\"\n        ```\n        Returns\n        -------\n        str\n            type of computation\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_computation_type: str) -> None:\n\"\"\"\n        set the computation type\n        the computation type must come from CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_computation_type: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, type=new_computation_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef input_data(self) -> List[Any]:\n\"\"\"\n        List of input data (data nodes) for this node\n        Examples\n        --------\n        ```python\n        # create file node\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n        )\n        # create a data node\n        my_input_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[my_file])\n        my_computation.input_data = [my_input_data]\n        ```\n        Returns\n        -------\n        List[Data]\n            list of input data for this computation\n        \"\"\"\nreturn self._json_attrs.input_data.copy()\n@input_data.setter\n@beartype\ndef input_data(self, new_input_data_list: List[Any]) -> None:\n\"\"\"\n        set the input data list\n        Parameters\n        ----------\n        new_input_data_list: List[Data]\n            list of input data (data nodes) to replace the current\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, input_data=new_input_data_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef output_data(self) -> List[Any]:\n\"\"\"\n        List of output data (data nodes)\n        Examples\n        --------\n        ```python\n        # create file node\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n        )\n        # create a data node\n        my_output_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[my_file])\n        my_computation.output_data = [my_output_data]\n        ```\n        Returns\n        -------\n        List[Data]\n            list of output data for this computation\n        \"\"\"\nreturn self._json_attrs.output_data.copy()\n@output_data.setter\n@beartype\ndef output_data(self, new_output_data_list: List[Any]) -> None:\n\"\"\"\n        set the list of output data (data nodes) for this node\n        Parameters\n        ----------\n        new_output_data_list: List[Data]\n            replace the current list of output data for this node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, output_data=new_output_data_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef software_configuration(self) -> List[Any]:\n\"\"\"\n        List of software_configuration for this computation node\n        Examples\n        --------\n        ```python\n        # create software configuration node\n        my_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)\n        my_computation.software_configuration = my_software_configuration\n        ```\n        Returns\n        -------\n        List[SoftwareConfiguration]\n            list of software configurations\n        \"\"\"\nreturn self._json_attrs.software_configuration.copy()\n@software_configuration.setter\n@beartype\ndef software_configuration(self, new_software_configuration_list: List[Any]) -> None:\n\"\"\"\n        set the list of software_configuration for this computation node\n        Parameters\n        ----------\n        new_software_configuration_list: List[software_configuration]\n            new_software_configuration_list to replace the current one\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, software_configuration=new_software_configuration_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef condition(self) -> List[Any]:\n\"\"\"\n        List of condition for this computation node\n        Examples\n        --------\n        ```python\n        # create a condition node\n        my_condition = cript.Condition(key=\"atm\", type=\"min\", value=1)\n        my_computation.condition = my_condition\n        ```\n        Returns\n        -------\n        List[Condition]\n            list of condition for the computation node\n        \"\"\"\nreturn self._json_attrs.condition.copy()\n@condition.setter\n@beartype\ndef condition(self, new_condition_list: List[Any]) -> None:\n\"\"\"\n        set the list of condition for this node\n        Parameters\n        ----------\n        new_condition_list: List[Condition]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, condition=new_condition_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef prerequisite_computation(self) -> Optional[\"Computation\"]:\n\"\"\"\n        prerequisite computation\n        Examples\n        --------\n        ```python\n        # create computation node for prerequisite_computation\n        my_prerequisite_computation = cript.Computation(name=\"my prerequisite computation name\", type=\"data_fit\")\n        my_computation.prerequisite_computation = my_prerequisite_computation\n        ```\n        Returns\n        -------\n        Computation\n            prerequisite computation\n        \"\"\"\nreturn self._json_attrs.prerequisite_computation\n@prerequisite_computation.setter\n@beartype\ndef prerequisite_computation(self, new_prerequisite_computation: Optional[\"Computation\"]) -> None:\n\"\"\"\n        set new prerequisite_computation\n        Parameters\n        ----------\n        new_prerequisite_computation: \"Computation\"\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, prerequisite_computation=new_prerequisite_computation)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Any]:\n\"\"\"\n        List of citations\n         Examples\n         --------\n         ```python\n         # create a reference node for the citation\n         my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n         # create a reference\n         my_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\n         my_computation.citation = [my_citation]\n         ```\n         Returns\n         -------\n         List[Citation]\n             list of citations for this computation node\n        \"\"\"\nreturn self._json_attrs.citation.copy()  # type: ignore\n@citation.setter\n@beartype\ndef citation(self, new_citation_list: List[Any]) -> None:\n\"\"\"\n        set the List of citations\n        Parameters\n        ----------\n        new_citation_list: List[Citation]\n            list of citations for this computation node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation_list)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.citation","title":"citation: List[Any] property writable","text":"

List of citations

Examples

# create a reference node for the citation\nmy_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n# create a reference\nmy_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\nmy_computation.citation = [my_citation]\n

Returns

List[Citation] list of citations for this computation node

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.condition","title":"condition: List[Any] property writable","text":"

List of condition for this computation node

Examples:

# create a condition node\nmy_condition = cript.Condition(key=\"atm\", type=\"min\", value=1)\nmy_computation.condition = my_condition\n

Returns:

Type Description List[Condition]

list of condition for the computation node

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.input_data","title":"input_data: List[Any] property writable","text":"

List of input data (data nodes) for this node

Examples:

# create file node\nmy_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\n)\n# create a data node\nmy_input_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[my_file])\nmy_computation.input_data = [my_input_data]\n

Returns:

Type Description List[Data]

list of input data for this computation

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.output_data","title":"output_data: List[Any] property writable","text":"

List of output data (data nodes)

Examples:

# create file node\nmy_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\n)\n# create a data node\nmy_output_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[my_file])\nmy_computation.output_data = [my_output_data]\n

Returns:

Type Description List[Data]

list of output data for this computation

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.prerequisite_computation","title":"prerequisite_computation: Optional[Computation] property writable","text":"

prerequisite computation

Examples:

# create computation node for prerequisite_computation\nmy_prerequisite_computation = cript.Computation(name=\"my prerequisite computation name\", type=\"data_fit\")\nmy_computation.prerequisite_computation = my_prerequisite_computation\n

Returns:

Type Description Computation

prerequisite computation

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.software_configuration","title":"software_configuration: List[Any] property writable","text":"

List of software_configuration for this computation node

Examples:

# create software configuration node\nmy_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)\nmy_computation.software_configuration = my_software_configuration\n

Returns:

Type Description List[SoftwareConfiguration]

list of software configurations

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.type","title":"type: str property writable","text":"

The type of computation

the computation type must come from CRIPT controlled vocabulary

Examples:

my_computation.type = \"type=\"analysis\"\n

Returns:

Type Description str

type of computation

"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all computation nodes attributes

Source code in src/cript/nodes/primary_nodes/computation.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all computation nodes attributes\n    \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\ninput_data: List[Any] = field(default_factory=list)\noutput_data: List[Any] = field(default_factory=list)\nsoftware_configuration: List[Any] = field(default_factory=list)\ncondition: List[Any] = field(default_factory=list)\nprerequisite_computation: Optional[\"Computation\"] = None\ncitation: Optional[List[Any]] = None\n
"},{"location":"nodes/primary_nodes/computation/#cript.nodes.primary_nodes.computation.Computation.__init__","title":"__init__(name, type, input_data=None, output_data=None, software_configuration=None, condition=None, prerequisite_computation=None, citation=None, notes='', **kwargs)","text":"

create a computation node

Parameters:

Name Type Description Default name str

name of computation node

required type str

type of computation node. Computation type must come from CRIPT controlled vocabulary

required input_data Optional[List[Any]]

input data (data node)

None output_data Optional[List[Any]]

output data (data node)

None software_configuration Optional[List[Any]]

software configuration of computation node

None condition Optional[List[Any]]

condition for the computation node

None prerequisite_computation Optional[Computation]

prerequisite computation

None citation Optional[List[Any]]

list of citations

None notes str

any notes for this computation node

'' **kwargs

for internal use of deserialize JSON from API to node

{}

Examples:

my_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\n

Returns:

Type Description None

instantiate a computation node

Source code in src/cript/nodes/primary_nodes/computation.py
@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\ninput_data: Optional[List[Any]] = None,\noutput_data: Optional[List[Any]] = None,\nsoftware_configuration: Optional[List[Any]] = None,\ncondition: Optional[List[Any]] = None,\nprerequisite_computation: Optional[\"Computation\"] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n) -> None:\n\"\"\"\n    create a computation node\n    Parameters\n    ----------\n    name: str\n        name of computation node\n    type: str\n        type of computation node. Computation type must come from CRIPT controlled vocabulary\n    input_data: List[Data] default=None\n        input data (data node)\n    output_data: List[Data] default=None\n        output data (data node)\n    software_configuration: List[SoftwareConfiguration] default=None\n        software configuration of computation node\n    condition: List[Condition] default=None\n        condition for the computation node\n    prerequisite_computation: Computation default=None\n        prerequisite computation\n    citation: List[Citation] default=None\n        list of citations\n    notes: str = \"\"\n        any notes for this computation node\n    **kwargs\n        for internal use of deserialize JSON from API to node\n    Examples\n    --------\n    ```python\n    my_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\n    ```\n    Returns\n    -------\n    None\n        instantiate a computation node\n    \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif input_data is None:\ninput_data = []\nif output_data is None:\noutput_data = []\nif software_configuration is None:\nsoftware_configuration = []\nif condition is None:\ncondition = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\ninput_data=input_data,\noutput_data=output_data,\nsoftware_configuration=software_configuration,\ncondition=condition,\nprerequisite_computation=prerequisite_computation,\ncitation=citation,\n)\nself.validate()\n
"},{"location":"nodes/primary_nodes/computation_process/","title":"Computation Process","text":""},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess","title":"ComputationProcess","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess--definition","title":"Definition","text":"

A Computational_Process is a simulation that processes or changes a virtual material. Examples include simulations of chemical reactions, chain scission, cross-linking, strong shear, etc. A computational process may also encapsulate any computation that dramatically changes the materials properties, molecular topology, and physical aspects like molecular orientation, etc. The computation_forcefield of a simulation is associated with a material. As a consequence, if the forcefield changes or gets refined via a computational procedure (density functional theory, iterative Boltzmann inversion for coarse-graining etc.) this forcefield changing step must be described as a computational_process and a new material node with a different computation_forcefield needs to be created.

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess--attributes","title":"Attributes","text":"attribute type example description required vocab type str general molecular dynamics simulation category of computation True True input_data list[Data] input data nodes True output_data list[Data] output data nodes ingredient list[Ingredient] ingredients True software_ configurations list[Software Configuration] software and algorithms used condition list[Condition] setup information property list[Property] computation process properties citation list[Citation] reference to a book, paper, or scholarly work notes str additional description of the step"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess--available-subobjects","title":"Available Subobjects","text":"
  • ingredient
  • software_configuration
  • property
  • condition
  • citation
"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my computational process node name\",\n\"node\":[\"ComputationProcess\"],\n\"type\":\"cross_linking\",\n\"uid\":\"_:b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6\",\n\"uuid\":\"b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6\"\n\"ingredient\":[\n{\n\"node\":[\"Ingredient\"],\n\"uid\":\"_:f68d6fff-9327-48b1-9249-33ce498005e8\",\n\"uuid\":\"f68d6fff-9327-48b1-9249-33ce498005e8\"\n\"keyword\":[\"catalyst\"],\n\"material\":{\n\"name\":\"my material name\",\n\"node\":[\"Material\"],\n\"uid\":\"_:3b12f92c-2121-4520-920e-b4c5622de34a\",\n\"uuid\":\"3b12f92c-2121-4520-920e-b4c5622de34a\",\n\"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n},\n\"quantity\":[\n{\n\"key\":\"mass\",\n\"node\":[\"Quantity\"],\n\"uid\":\"_:07c4a6a9-9385-4505-a30a-ca3549cedcd8\",\n\"uuid\":\"07c4a6a9-9385-4505-a30a-ca3549cedcd8\",\n\"uncertainty\":0.2,\n\"uncertainty_type\":\"stdev\",\n\"unit\":\"kg\",\n\"value\":11.2\n}\n]\n}\n],\n\"input_data\":[\n{\n\"name\":\"my data name\",\n\"node\":[\"Data\"],\n\"type\":\"afm_amp\",\n\"uid\":\"_:3c16bb05-ded1-4f52-9d02-c88c1a1de915\",\n\"uuid\":\"3c16bb05-ded1-4f52-9d02-c88c1a1de915\"\n\"file\":[\n{\n\"name\":\"my file node name\",\n\"node\":[\"File\"],\n\"source\":\"https://criptapp.org\",\n\"type\":\"calibration\",\n\"data_dictionary\":\"my file's data dictionary\",\n\"extension\":\".csv\",\n\"uid\":\"_:ee8153db-4108-49e4-8c5b-ffc26d4e6f71\",\n\"uuid\":\"ee8153db-4108-49e4-8c5b-ffc26d4e6f71\"\n}\n],\n}\n],\n}\n
Source code in src/cript/nodes/primary_nodes/computation_process.py
class ComputationProcess(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    A\n    [Computational_Process](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=15)\n    is a simulation that processes or changes a virtual material. Examples\n    include simulations of chemical reactions, chain scission, cross-linking, strong shear, etc. A\n    computational process may also encapsulate any computation that dramatically changes the\n    materials properties, molecular topology, and physical aspects like molecular orientation, etc. The\n    computation_forcefield of a simulation is associated with a material. As a consequence, if the\n    forcefield changes or gets refined via a computational procedure (density functional theory,\n    iterative Boltzmann inversion for coarse-graining etc.) this forcefield changing step must be\n    described as a computational_process and a new material node with a different\n    computation_forcefield needs to be created.\n    ## Attributes\n    | attribute                | type                          | example                               | description                                     | required | vocab |\n    |--------------------------|-------------------------------|---------------------------------------|-------------------------------------------------|----------|-------|\n    | type                     | str                           | general molecular dynamics simulation | category of computation                         | True     | True  |\n    | input_data               | list[Data]                    |                                       | input data nodes                                | True     |       |\n    | output_data              | list[Data]                    |                                       | output data nodes                               |          |       |\n    | ingredient              | list[Ingredient]              |                                       | ingredients                                     | True     |       |\n    | software_ configurations | list[Software  Configuration] |                                       | software and algorithms used                    |          |       |\n    | condition                | list[Condition]               |                                       | setup information                               |          |       |\n    | property               | list[Property]                |                                       | computation process properties                  |          |       |\n    | citation                | list[Citation]                |                                       | reference to a book, paper, or scholarly work   |          |       |\n    | notes                    | str                           |                                       | additional description of the step              |          |       |\n    ## Available Subobjects\n    * [ingredient](../../subobjects/ingredient)\n    * [software_configuration](../../subobjects/software_configuration)\n    * [property](../../subobjects/property)\n    * [condition](../../subobjects/condition)\n    * [citation](../../subobjects/citation)\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my computational process node name\",\n       \"node\":[\"ComputationProcess\"],\n       \"type\":\"cross_linking\",\n       \"uid\":\"_:b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6\",\n       \"uuid\":\"b88ac0a5-b5c0-4197-a63d-b37e1fe8c6c6\"\n       \"ingredient\":[\n          {\n            \"node\":[\"Ingredient\"],\n            \"uid\":\"_:f68d6fff-9327-48b1-9249-33ce498005e8\",\n             \"uuid\":\"f68d6fff-9327-48b1-9249-33ce498005e8\"\n             \"keyword\":[\"catalyst\"],\n             \"material\":{\n                \"name\":\"my material name\",\n                \"node\":[\"Material\"],\n                \"uid\":\"_:3b12f92c-2121-4520-920e-b4c5622de34a\",\n                \"uuid\":\"3b12f92c-2121-4520-920e-b4c5622de34a\",\n                \"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n             },\n             \"quantity\":[\n                {\n                   \"key\":\"mass\",\n                   \"node\":[\"Quantity\"],\n                   \"uid\":\"_:07c4a6a9-9385-4505-a30a-ca3549cedcd8\",\n                   \"uuid\":\"07c4a6a9-9385-4505-a30a-ca3549cedcd8\",\n                   \"uncertainty\":0.2,\n                   \"uncertainty_type\":\"stdev\",\n                   \"unit\":\"kg\",\n                   \"value\":11.2\n                }\n             ]\n          }\n       ],\n       \"input_data\":[\n          {\n            \"name\":\"my data name\",\n             \"node\":[\"Data\"],\n             \"type\":\"afm_amp\",\n             \"uid\":\"_:3c16bb05-ded1-4f52-9d02-c88c1a1de915\",\n             \"uuid\":\"3c16bb05-ded1-4f52-9d02-c88c1a1de915\"\n             \"file\":[\n                {\n                   \"name\":\"my file node name\",\n                   \"node\":[\"File\"],\n                   \"source\":\"https://criptapp.org\",\n                   \"type\":\"calibration\",\n                    \"data_dictionary\":\"my file's data dictionary\",\n                   \"extension\":\".csv\",\n                   \"uid\":\"_:ee8153db-4108-49e4-8c5b-ffc26d4e6f71\",\n                   \"uuid\":\"ee8153db-4108-49e4-8c5b-ffc26d4e6f71\"\n                }\n             ],\n          }\n       ],\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all computational_process nodes attributes\n        \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\ninput_data: List[Any] = field(default_factory=list)\noutput_data: List[Any] = field(default_factory=list)\ningredient: List[Any] = field(default_factory=list)\nsoftware_configuration: List[Any] = field(default_factory=list)\ncondition: List[Any] = field(default_factory=list)\nproperty: List[Any] = field(default_factory=list)\ncitation: List[Any] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\ninput_data: List[Any],\ningredient: List[Any],\noutput_data: Optional[List[Any]] = None,\nsoftware_configuration: Optional[List[Any]] = None,\ncondition: Optional[List[Any]] = None,\nproperty: Optional[List[Any]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n        create a computational_process node\n        Examples\n        --------\n        ```python\n        # create file node for input data node\n        data_files = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n        )\n        # create input data node\n        input_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[data_files])\n        # Material node for Quantity node\n        my_material = cript.Material(\n            name=\"my material\",\n            identifiers=[{\"alternative_names\": \"my material alternative name\"}]\n            )\n        # create quantity node\n        my_quantity = cript.Quantity(key=\"mass\", value=1.23, unit=\"gram\")\n        # create ingredient node\n        ingredient = cript.Ingredient(\n            material=my_material,\n            quantities=[my_quantity],\n        )\n        # create computational process node\n        my_computational_process = cript.ComputationalProcess(\n            name=\"my computational process name\",\n            type=\"cross_linking\",\n            input_data=[input_data],\n            ingredient=[ingredient],\n        )\n        ```\n        Parameters\n        ----------\n        name: str\n            computational process name\n        type: str\n            type of computation process from CRIPT controlled vocabulary\n        input_data: List[Data]\n            list of input data for computational process\n        ingredient: List[Ingredient]\n            list of ingredients for this computational process node\n        output_data: List[Data] default=None\n            list of output data for this computational process node\n        software_configuration: List[SoftwareConfiguration] default=None\n            list of software configurations for this computational process node\n        condition: List[Condition] default=None\n            list of condition for this computational process node\n        property: List[Property] default=None\n            list of properties for this computational process node\n        citation: List[Citation] default=None\n            list of citation for this computational process node\n        notes: str default=\"\"\n            optional notes for the computational process node\n        Returns\n        -------\n        None\n            instantiate computationalProcess node\n        \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\n# TODO validate type from vocab\nif input_data is None:\ninput_data = []\nif ingredient is None:\ningredient = []\nif output_data is None:\noutput_data = []\nif software_configuration is None:\nsoftware_configuration = []\nif condition is None:\ncondition = []\nif property is None:\nproperty = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\ninput_data=input_data,\ningredient=ingredient,\noutput_data=output_data,\nsoftware_configuration=software_configuration,\ncondition=condition,\nproperty=property,\ncitation=citation,\n)\n# self.validate()\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        The computational process type must come from CRIPT Controlled vocabulary\n        Examples\n        --------\n        ```python\n        my_computational_process.type = \"DPD\"\n        ```\n        Returns\n        -------\n        str\n            computational process type\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_type: str) -> None:\n\"\"\"\n        set the computational_process type\n        computational_process type must come from CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_type: str\n            new computational process type.\n            computational process type must come from CRIPT controlled vocabulary\n        Returns\n        -------\n        None\n        \"\"\"\n# TODO check computational_process type with CRIPT controlled vocabulary\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef input_data(self) -> List[Any]:\n\"\"\"\n        List of input data for the computational process node\n        Examples\n        --------\n        ```python\n        # create file node for the data node\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n        )\n        # create input data node\n        my_input_data = cript.Data(name=\"my input data name\", type=\"afm_amp\", files=[my_file])\n        # set computational process data node\n        my_computation.input_data = my_input_data\n        ```\n        Returns\n        -------\n        List[Data]\n            list of input data for this computational process node\n        \"\"\"\nreturn self._json_attrs.input_data.copy()\n@input_data.setter\n@beartype\ndef input_data(self, new_input_data_list: List[Any]) -> None:\n\"\"\"\n        set the input data for this computational process\n        Parameters\n        ----------\n        new_input_data_list: List[Data]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, input_data=new_input_data_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef output_data(self) -> List[Any]:\n\"\"\"\n        List of the output data for the computational_process\n        Examples\n        --------\n        ```python\n        # create file node for the data node\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n        )\n        # create input data node\n        my_output_data = cript.Data(name=\"my output data name\", type=\"afm_amp\", files=[my_file])\n        # set computational process data node\n        my_computation.output_data = my_input_data\n        ```\n        Returns\n        -------\n        List[Data]\n            list of output data from this computational process node\n        \"\"\"\nreturn self._json_attrs.output_data.copy()\n@output_data.setter\n@beartype\ndef output_data(self, new_output_data_list: List[Any]) -> None:\n\"\"\"\n        set the output_data list for the computational_process\n        Parameters\n        ----------\n        new_output_data_list: List[Data]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, output_data=new_output_data_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef ingredient(self) -> List[Any]:\n\"\"\"\n        List of ingredients for the computational_process\n        Examples\n        --------\n        ```python\n        # create ingredient node\n        ingredient = cript.Ingredient(\n            material=simple_material_node,\n            quantities=[simple_quantity_node],\n        )\n        my_computational_process.ingredient =\n        ```\n        Returns\n        -------\n        List[Ingredient]\n            list of ingredients for this computational process\n        \"\"\"\nreturn self._json_attrs.ingredient.copy()\n@ingredient.setter\n@beartype\ndef ingredient(self, new_ingredient_list: List[Any]) -> None:\n\"\"\"\n        set the ingredients list for this computational process\n        Parameters\n        ----------\n        new_ingredient_list: List[Ingredient]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, ingredient=new_ingredient_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef software_configuration(self) -> List[Any]:\n\"\"\"\n        List of software_configuration for the computational process\n        Examples\n        --------\n        ```python\n        # create software configuration node\n        my_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)\n        my_computational_process.software_configuration = my_software_configuration\n        ```\n        Returns\n        -------\n        List[SoftwareConfiguration]\n            List of software configurations used for this computational process node\n        \"\"\"\nreturn self._json_attrs.software_configuration.copy()\n@software_configuration.setter\n@beartype\ndef software_configuration(self, new_software_configuration_list: List[Any]) -> None:\n\"\"\"\n        set the list of software_configuration for the computational process\n        Parameters\n        ----------\n        new_software_configuration_list: List[SoftwareConfiguration]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, software_configuration=new_software_configuration_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef condition(self) -> List[Any]:\n\"\"\"\n        List of condition for the computational process\n        Examples\n        --------\n        ```python\n        # create condition node\n         my_condition = cript.Condition(key=\"atm\", type=\"min\", value=1)\n         my_computational_process.condition = [my_condition]\n        ```\n        Returns\n        -------\n        List[Condition]\n            list of condition for this computational process node\n        \"\"\"\nreturn self._json_attrs.condition.copy()\n@condition.setter\n@beartype\ndef condition(self, new_condition: List[Any]) -> None:\n\"\"\"\n        set the condition for the computational process\n        Parameters\n        ----------\n        new_condition: List[Condition]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, condition=new_condition)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Any]:\n\"\"\"\n        List of citation for the computational process\n        Examples\n        --------\n        ```python\n        # create a reference node for the citation\n        my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n        # create a reference\n        my_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\n        my_computational_process.citation = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of citation for this computational process\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation_list: List[Any]) -> None:\n\"\"\"\n        set the citation list for the computational process node\n        Parameters\n        ----------\n        new_citation_list: List[Citation]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef property(self) -> List[Any]:\n\"\"\"\n        List of properties\n        Examples\n        --------\n        ```python\n        # create a property node\n        my_property = cript.Property(key=\"modulus_shear\", type=\"min\", value=1.23, unit=\"gram\")\n        my_computational_process.property = [my_property]\n        ```\n        Returns\n        -------\n        List[Property]\n            list of properties for this computational process node\n        \"\"\"\nreturn self._json_attrs.property.copy()\n@property.setter\n@beartype\ndef property(self, new_property_list: List[Any]) -> None:\n\"\"\"\n        set the properties list for the computational process\n        Parameters\n        ----------\n        new_property_list: List[Property]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, property=new_property_list)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.citation","title":"citation: List[Any] property writable","text":"

List of citation for the computational process

Examples:

# create a reference node for the citation\nmy_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n# create a reference\nmy_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\nmy_computational_process.citation = [my_citation]\n

Returns:

Type Description List[Citation]

list of citation for this computational process

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.condition","title":"condition: List[Any] property writable","text":"

List of condition for the computational process

Examples:

# create condition node\nmy_condition = cript.Condition(key=\"atm\", type=\"min\", value=1)\nmy_computational_process.condition = [my_condition]\n

Returns:

Type Description List[Condition]

list of condition for this computational process node

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.ingredient","title":"ingredient: List[Any] property writable","text":"

List of ingredients for the computational_process

Examples:

# create ingredient node\ningredient = cript.Ingredient(\nmaterial=simple_material_node,\nquantities=[simple_quantity_node],\n)\nmy_computational_process.ingredient =\n

Returns:

Type Description List[Ingredient]

list of ingredients for this computational process

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.input_data","title":"input_data: List[Any] property writable","text":"

List of input data for the computational process node

Examples:

# create file node for the data node\nmy_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\n)\n# create input data node\nmy_input_data = cript.Data(name=\"my input data name\", type=\"afm_amp\", files=[my_file])\n# set computational process data node\nmy_computation.input_data = my_input_data\n

Returns:

Type Description List[Data]

list of input data for this computational process node

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.output_data","title":"output_data: List[Any] property writable","text":"

List of the output data for the computational_process

Examples:

# create file node for the data node\nmy_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\n)\n# create input data node\nmy_output_data = cript.Data(name=\"my output data name\", type=\"afm_amp\", files=[my_file])\n# set computational process data node\nmy_computation.output_data = my_input_data\n

Returns:

Type Description List[Data]

list of output data from this computational process node

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.property","title":"property: List[Any] property writable","text":"

List of properties

Examples:

# create a property node\nmy_property = cript.Property(key=\"modulus_shear\", type=\"min\", value=1.23, unit=\"gram\")\nmy_computational_process.property = [my_property]\n

Returns:

Type Description List[Property]

list of properties for this computational process node

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.software_configuration","title":"software_configuration: List[Any] property writable","text":"

List of software_configuration for the computational process

Examples:

# create software configuration node\nmy_software_configuration = cript.SoftwareConfiguration(software=simple_software_node)\nmy_computational_process.software_configuration = my_software_configuration\n

Returns:

Type Description List[SoftwareConfiguration]

List of software configurations used for this computational process node

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.type","title":"type: str property writable","text":"

The computational process type must come from CRIPT Controlled vocabulary

Examples:

my_computational_process.type = \"DPD\"\n

Returns:

Type Description str

computational process type

"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all computational_process nodes attributes

Source code in src/cript/nodes/primary_nodes/computation_process.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all computational_process nodes attributes\n    \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\ninput_data: List[Any] = field(default_factory=list)\noutput_data: List[Any] = field(default_factory=list)\ningredient: List[Any] = field(default_factory=list)\nsoftware_configuration: List[Any] = field(default_factory=list)\ncondition: List[Any] = field(default_factory=list)\nproperty: List[Any] = field(default_factory=list)\ncitation: List[Any] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/computation_process/#cript.nodes.primary_nodes.computation_process.ComputationProcess.__init__","title":"__init__(name, type, input_data, ingredient, output_data=None, software_configuration=None, condition=None, property=None, citation=None, notes='', **kwargs)","text":"

create a computational_process node

Examples:

# create file node for input data node\ndata_files = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\n)\n# create input data node\ninput_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[data_files])\n# Material node for Quantity node\nmy_material = cript.Material(\nname=\"my material\",\nidentifiers=[{\"alternative_names\": \"my material alternative name\"}]\n)\n# create quantity node\nmy_quantity = cript.Quantity(key=\"mass\", value=1.23, unit=\"gram\")\n# create ingredient node\ningredient = cript.Ingredient(\nmaterial=my_material,\nquantities=[my_quantity],\n)\n# create computational process node\nmy_computational_process = cript.ComputationalProcess(\nname=\"my computational process name\",\ntype=\"cross_linking\",\ninput_data=[input_data],\ningredient=[ingredient],\n)\n

Parameters:

Name Type Description Default name str

computational process name

required type str

type of computation process from CRIPT controlled vocabulary

required input_data List[Any]

list of input data for computational process

required ingredient List[Any]

list of ingredients for this computational process node

required output_data Optional[List[Any]]

list of output data for this computational process node

None software_configuration Optional[List[Any]]

list of software configurations for this computational process node

None condition Optional[List[Any]]

list of condition for this computational process node

None property Optional[List[Any]]

list of properties for this computational process node

None citation Optional[List[Any]]

list of citation for this computational process node

None notes str

optional notes for the computational process node

''

Returns:

Type Description None

instantiate computationalProcess node

Source code in src/cript/nodes/primary_nodes/computation_process.py
@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\ninput_data: List[Any],\ningredient: List[Any],\noutput_data: Optional[List[Any]] = None,\nsoftware_configuration: Optional[List[Any]] = None,\ncondition: Optional[List[Any]] = None,\nproperty: Optional[List[Any]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n    create a computational_process node\n    Examples\n    --------\n    ```python\n    # create file node for input data node\n    data_files = cript.File(\n        source=\"https://criptapp.org\",\n        type=\"calibration\",\n        extension=\".csv\",\n        data_dictionary=\"my file's data dictionary\"\n    )\n    # create input data node\n    input_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[data_files])\n    # Material node for Quantity node\n    my_material = cript.Material(\n        name=\"my material\",\n        identifiers=[{\"alternative_names\": \"my material alternative name\"}]\n        )\n    # create quantity node\n    my_quantity = cript.Quantity(key=\"mass\", value=1.23, unit=\"gram\")\n    # create ingredient node\n    ingredient = cript.Ingredient(\n        material=my_material,\n        quantities=[my_quantity],\n    )\n    # create computational process node\n    my_computational_process = cript.ComputationalProcess(\n        name=\"my computational process name\",\n        type=\"cross_linking\",\n        input_data=[input_data],\n        ingredient=[ingredient],\n    )\n    ```\n    Parameters\n    ----------\n    name: str\n        computational process name\n    type: str\n        type of computation process from CRIPT controlled vocabulary\n    input_data: List[Data]\n        list of input data for computational process\n    ingredient: List[Ingredient]\n        list of ingredients for this computational process node\n    output_data: List[Data] default=None\n        list of output data for this computational process node\n    software_configuration: List[SoftwareConfiguration] default=None\n        list of software configurations for this computational process node\n    condition: List[Condition] default=None\n        list of condition for this computational process node\n    property: List[Property] default=None\n        list of properties for this computational process node\n    citation: List[Citation] default=None\n        list of citation for this computational process node\n    notes: str default=\"\"\n        optional notes for the computational process node\n    Returns\n    -------\n    None\n        instantiate computationalProcess node\n    \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\n# TODO validate type from vocab\nif input_data is None:\ninput_data = []\nif ingredient is None:\ningredient = []\nif output_data is None:\noutput_data = []\nif software_configuration is None:\nsoftware_configuration = []\nif condition is None:\ncondition = []\nif property is None:\nproperty = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\ninput_data=input_data,\ningredient=ingredient,\noutput_data=output_data,\nsoftware_configuration=software_configuration,\ncondition=condition,\nproperty=property,\ncitation=citation,\n)\n
"},{"location":"nodes/primary_nodes/data/","title":"Data","text":""},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data","title":"Data","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data--definition","title":"Definition","text":"

A Data node node contains the meta-data to describe raw data that is beyond a single value, (i.e. n-dimensional data). Each Data node must be linked to a single Experiment node.

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data--available-sub-objects","title":"Available Sub-Objects","text":"
  • Citation
"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data--attributes","title":"Attributes","text":"Attribute Type Example Description Required experiment Experiment Experiment the data belongs to True name str \"my_data_name\" Name of the data node True type str \"nmr_h1\" Pick from CRIPT data type controlled vocabulary True file List[File] [file_1, file_2, file_3] list of file nodes False sample_preparation Process False computation List[Computation] data produced from this Computation method False computation_process Computational Process data was produced from this computation process False material List[Material] materials with attributes associated with the data node False process List[Process] processes with attributes associated with the data node False citation Citation reference to a book, paper, or scholarly work False"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data--example","title":"Example","text":"
# list of file nodes\nmy_files_list = [\n# create file node\ncript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\n)\n]\n# create data node with required arguments\nmy_data = cript.Data(name=\"my data name\", type=\"afm_amp\", file=[simple_file_node])\n
"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my data name\",\n\"node\":[\"Data\"],\n\"type\":\"afm_amp\",\n\"uid\":\"_:80b02470-73d0-416e-8d93-12fdf69e481a\",\n\"uuid\":\"80b02470-73d0-416e-8d93-12fdf69e481a\"\n\"file\":[\n{\n\"node\":[\"File\"],\n\"name\":\"my file node name\",\n\"uid\":\"_:535779ea-0d1f-4b23-b3e8-60052f717307\",\n\"uuid\":\"535779ea-0d1f-4b23-b3e8-60052f717307\"\n\"type\":\"calibration\",\n\"source\":\"https://criptapp.org\",\n\"extension\":\".csv\",\n\"data_dictionary\":\"my file's data dictionary\",\n}\n]\n}\n
Source code in src/cript/nodes/primary_nodes/data.py
class Data(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    A  [Data node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=13)\n     node contains the meta-data to describe raw data that is beyond a single value, (i.e. n-dimensional data).\n     Each `Data` node must be linked to a single `Experiment` node.\n    ## Available Sub-Objects\n    * [Citation](../../subobjects/citation)\n    ## Attributes\n    | Attribute           | Type                                              | Example                    | Description                                                                             | Required |\n    |---------------------|---------------------------------------------------|----------------------------|-----------------------------------------------------------------------------------------|----------|\n    | experiment          | [Experiment](experiment.md)                       |                            | Experiment the data belongs to                                                          | True     |\n    | name                | str                                               | `\"my_data_name\"`           | Name of the data node                                                                   | True     |\n    | type                | str                                               | `\"nmr_h1\"`                 | Pick from [CRIPT data type controlled vocabulary](https://criptapp.org/keys/data-type/) | True     |\n    | file                | List[[File](../supporting_nodes/file.md)]         | `[file_1, file_2, file_3]` | list of file nodes                                                                      | False    |\n    | sample_preparation  | [Process](process.md)                             |                            |                                                                                         | False    |\n    | computation         | List[[Computation](computation.md)]               |                            | data produced from this Computation method                                              | False    |\n    | computation_process | [Computational Process](./computation_process.md) |                            | data was produced from this computation process                                         | False    |\n    | material            | List[[Material](./material.md)]                   |                            | materials with attributes associated with the data node                                 | False    |\n    | process             | List[[Process](./process.md)]                     |                            | processes with attributes associated with the data node                                 | False    |\n    | citation            | [Citation](../subobjects/citation.md)             |                            | reference to a book, paper, or scholarly work                                           | False    |\n    Example\n    --------\n    ```python\n    # list of file nodes\n    my_files_list = [\n        # create file node\n        cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n        )\n    ]\n    # create data node with required arguments\n    my_data = cript.Data(name=\"my data name\", type=\"afm_amp\", file=[simple_file_node])\n    ```\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my data name\",\n       \"node\":[\"Data\"],\n       \"type\":\"afm_amp\",\n       \"uid\":\"_:80b02470-73d0-416e-8d93-12fdf69e481a\",\n       \"uuid\":\"80b02470-73d0-416e-8d93-12fdf69e481a\"\n       \"file\":[\n          {\n            \"node\":[\"File\"],\n            \"name\":\"my file node name\",\n             \"uid\":\"_:535779ea-0d1f-4b23-b3e8-60052f717307\",\n             \"uuid\":\"535779ea-0d1f-4b23-b3e8-60052f717307\"\n             \"type\":\"calibration\",\n             \"source\":\"https://criptapp.org\",\n             \"extension\":\".csv\",\n             \"data_dictionary\":\"my file's data dictionary\",\n          }\n       ]\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Data attributes\n        \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\nfile: List[Any] = field(default_factory=list)\nsample_preparation: Any = field(default_factory=list)\ncomputation: List[Any] = field(default_factory=list)\ncomputation_process: Any = field(default_factory=list)\nmaterial: List[Any] = field(default_factory=list)\nprocess: List[Any] = field(default_factory=list)\ncitation: List[Any] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\nfile: List[Any],\nsample_preparation: Any = None,\ncomputation: Optional[List[Any]] = None,\ncomputation_process: Optional[Any] = None,\nmaterial: Optional[List[Any]] = None,\nprocess: Optional[List[Any]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n):\nsuper().__init__(name=name, notes=notes, **kwargs)\nif file is None:\nfile = []\nif sample_preparation is None:\nsample_preparation = []\nif computation is None:\ncomputation = []\nif computation_process is None:\ncomputation_process = []\nif material is None:\nmaterial = []\nif process is None:\nprocess = []\nif citation is None:\ncitation = []\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\nfile=file,\nsample_preparation=sample_preparation,\ncomputation=computation,\ncomputation_process=computation_process,\nmaterial=material,\nprocess=process,\ncitation=citation,\n)\nself.validate()\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        Type of data node. The data type must come from [CRIPT data type vocabulary]()\n        Example\n        -------\n        ```python\n        data.type = \"afm_height\"\n        ```\n        Returns\n        -------\n        data type: str\n            data type for the data node must come from CRIPT controlled vocabulary\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_data_type: str) -> None:\n\"\"\"\n        set the data type.\n        The data type must come from [CRIPT data type vocabulary]()\n        Parameters\n        ----------\n        new_data_type: str\n            new data type to replace the current data type\n        Returns\n        -------\n        None\n        \"\"\"\n# TODO validate that the data type is valid from CRIPT controlled vocabulary\nnew_attrs = replace(self._json_attrs, type=new_data_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef file(self) -> List[Any]:\n\"\"\"\n        get the list of files for this data node\n        Examples\n        --------\n        ```python\n        create a list of file nodes\n        my_new_files = [\n            # file with link source\n            cript.File(\n                source=\"https://pubs.acs.org/doi/10.1021/acscentsci.3c00011\",\n                type=\"computation_config\",\n                extension=\".pdf\",\n                data_dictionary=\"my second file data dictionary\",\n            ),\n        ]\n        data_node.file = my_new_files\n        ```\n        Returns\n        -------\n        List[File]\n            list of files for this data node\n        \"\"\"\nreturn self._json_attrs.file.copy()\n@file.setter\n@beartype\ndef file(self, new_file_list: List[Any]) -> None:\n\"\"\"\n        set the list of file for this data node\n        Parameters\n        ----------\n        new_files_list: List[File]\n            new list of file nodes to replace the current list\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, file=new_file_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef sample_preparation(self) -> Union[Any, None]:\n\"\"\"\n        The sample preparation for this data node\n        Returns\n        -------\n        sample_preparation: Process\n            sample preparation for this data node\n        \"\"\"\nreturn self._json_attrs.sample_preparation\n@sample_preparation.setter\n@beartype\ndef sample_preparation(self, new_sample_preparation: Union[Any, None]) -> None:\n\"\"\"\n        set sample_preparation\n        Parameters\n        ----------\n        new_sample_preparation: Process\n            new_sample_preparation to replace the current one for this node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, sample_preparation=new_sample_preparation)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef computation(self) -> List[Any]:\n\"\"\"\n        list of computation nodes for this material node\n        Returns\n        -------\n        None\n            list of computation nodes\n        \"\"\"\nreturn self._json_attrs.computation.copy()\n@computation.setter\n@beartype\ndef computation(self, new_computation_list: List[Any]) -> None:\n\"\"\"\n        set list of computation  for this data node\n        Parameters\n        ----------\n        new_computation_list: List[Computation]\n            new computation list to replace the current one\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, computation=new_computation_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef computation_process(self) -> Union[Any, None]:\n\"\"\"\n        The computation_process for this data node\n        Returns\n        -------\n        ComputationalProcess\n            computational process node for this data node\n        \"\"\"\nreturn self._json_attrs.computation_process\n@computation_process.setter\n@beartype\ndef computation_process(self, new_computation_process: Union[Any, None]) -> None:\n\"\"\"\n        set the computational process\n        Parameters\n        ----------\n        new_computation_process: ComputationalProcess\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, computation_process=new_computation_process)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef material(self) -> List[Any]:\n\"\"\"\n        List of materials for this node\n        Returns\n        -------\n        List[Material]\n            list of material\n        \"\"\"\nreturn self._json_attrs.material.copy()\n@material.setter\n@beartype\ndef material(self, new_material_list: List[Any]) -> None:\n\"\"\"\n        set the list of materials for this data node\n        Parameters\n        ----------\n        new_material_list: List[Material]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, material=new_material_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef process(self) -> List[Any]:\n\"\"\"\n        list of [Process nodes](./process.md) for this data node\n        Notes\n        -----\n        Please note that while the process attribute of the data node is currently set to `Any`\n        the software still expects a Process node in the data's process attribute\n        > It is currently set to `Any` to avoid the circular import error\n        Returns\n        -------\n        List[Process]\n            list of process for the data node\n        \"\"\"\nreturn self._json_attrs.process.copy()\n@process.setter\n@beartype\ndef process(self, new_process_list: List[Any]) -> None:\n\"\"\"\n        set the list of process for this data node\n        Parameters\n        ----------\n        new_process_list: List[Process]\n            new list of Process\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, process=new_process_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Any]:\n\"\"\"\n        List of [citation](../../subobjects/citation) within the data node\n        Example\n        -------\n        ```python\n        # create a reference node\n        my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n        # create a citation list to house all the reference nodes\n        my_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\n        # add citations to data node\n        my_data.citation = my_citations\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of citations for this data node\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation_list: List[Any]) -> None:\n\"\"\"\n        set the list of citation\n        Parameters\n        ----------\n        new_citation_list: List[Citation]\n            new list of citation to replace the current one\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation_list)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.citation","title":"citation: List[Any] property writable","text":"

List of citation within the data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.citation--example","title":"Example","text":"
# create a reference node\nmy_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n# create a citation list to house all the reference nodes\nmy_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\n# add citations to data node\nmy_data.citation = my_citations\n

Returns:

Type Description List[Citation]

list of citations for this data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.computation","title":"computation: List[Any] property writable","text":"

list of computation nodes for this material node

Returns:

Type Description None

list of computation nodes

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.computation_process","title":"computation_process: Union[Any, None] property writable","text":"

The computation_process for this data node

Returns:

Type Description ComputationalProcess

computational process node for this data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.file","title":"file: List[Any] property writable","text":"

get the list of files for this data node

Examples:

create a list of file nodes\nmy_new_files = [\n# file with link source\ncript.File(\nsource=\"https://pubs.acs.org/doi/10.1021/acscentsci.3c00011\",\ntype=\"computation_config\",\nextension=\".pdf\",\ndata_dictionary=\"my second file data dictionary\",\n),\n]\ndata_node.file = my_new_files\n

Returns:

Type Description List[File]

list of files for this data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.material","title":"material: List[Any] property writable","text":"

List of materials for this node

Returns:

Type Description List[Material]

list of material

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.process","title":"process: List[Any] property writable","text":"

list of Process nodes for this data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.process--notes","title":"Notes","text":"

Please note that while the process attribute of the data node is currently set to Any the software still expects a Process node in the data's process attribute

It is currently set to Any to avoid the circular import error

Returns:

Type Description List[Process]

list of process for the data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.sample_preparation","title":"sample_preparation: Union[Any, None] property writable","text":"

The sample preparation for this data node

Returns:

Name Type Description sample_preparation Process

sample preparation for this data node

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.type","title":"type: str property writable","text":"

Type of data node. The data type must come from CRIPT data type vocabulary

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.type--example","title":"Example","text":"
data.type = \"afm_height\"\n

Returns:

Type Description data type: str

data type for the data node must come from CRIPT controlled vocabulary

"},{"location":"nodes/primary_nodes/data/#cript.nodes.primary_nodes.data.Data.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Data attributes

Source code in src/cript/nodes/primary_nodes/data.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Data attributes\n    \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\nfile: List[Any] = field(default_factory=list)\nsample_preparation: Any = field(default_factory=list)\ncomputation: List[Any] = field(default_factory=list)\ncomputation_process: Any = field(default_factory=list)\nmaterial: List[Any] = field(default_factory=list)\nprocess: List[Any] = field(default_factory=list)\ncitation: List[Any] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/experiment/","title":"Experiment","text":""},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment","title":"Experiment","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment--definition","title":"Definition","text":"

An Experiment node is nested inside a Collection node.

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment--attributes","title":"Attributes","text":"attribute type description required collection Collection collection associated with the experiment True process List[Process] process nodes associated with this experiment False computations List[Computation] computation method nodes associated with this experiment False computation_process List[Computational Process] computation process nodes associated with this experiment False data List[Data] data nodes associated with this experiment False funding List[str] funding source for experiment False citation List[Citation] reference to a book, paper, or scholarly work False"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment--subobjects","title":"Subobjects","text":"

An Experiment node can be thought as a folder/bucket that can hold:

  • Process
  • Computations
  • Computation_Process
  • Data
  • Funding
  • Citation
"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment--warnings","title":"Warnings","text":"

Experiment names

Experiment names MUST be unique within a Collection

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my experiment name\",\n\"node\":[\"Experiment\"],\n\"uid\":\"_:886c4deb-2186-4f11-8134-a37111200b83\",\n\"uuid\":\"886c4deb-2186-4f11-8134-a37111200b83\"\n}\n
Source code in src/cript/nodes/primary_nodes/experiment.py
class Experiment(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    An\n    [Experiment node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)\n    is nested inside a [Collection](../collection) node.\n    ## Attributes\n    | attribute           | type                         | description                                               | required |\n    |---------------------|------------------------------|-----------------------------------------------------------|----------|\n    | collection          | Collection                   | collection associated with the experiment                 | True     |\n    | process             | List[Process]                | process nodes associated with this experiment             | False    |\n    | computations        | List[Computation]            | computation method nodes associated with this experiment  | False    |\n    | computation_process | List[Computational  Process] | computation process nodes associated with this experiment | False    |\n    | data                | List[Data]                   | data nodes associated with this experiment                | False    |\n    | funding             | List[str]                    | funding source for experiment                             | False    |\n    | citation            | List[Citation]               | reference to a book, paper, or scholarly work             | False    |\n    ## Subobjects\n    An\n    [Experiment node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)\n    can be thought as a folder/bucket that can hold:\n    * [Process](../process)\n    * [Computations](../computation)\n    * [Computation_Process](../computation_process)\n    * [Data](../data)\n    * [Funding](./#cript.nodes.primary_nodes.experiment.Experiment.funding)\n    * [Citation](../../subobjects/citation)\n    Warnings\n    --------\n    !!! warning \"Experiment names\"\n        Experiment names **MUST** be unique within a [Collection](../collection)\n    ---\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my experiment name\",\n       \"node\":[\"Experiment\"],\n       \"uid\":\"_:886c4deb-2186-4f11-8134-a37111200b83\",\n       \"uuid\":\"886c4deb-2186-4f11-8134-a37111200b83\"\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Collection attributes\n        \"\"\"\nprocess: List[Any] = field(default_factory=list)\ncomputation: List[Any] = field(default_factory=list)\ncomputation_process: List[Any] = field(default_factory=list)\ndata: List[Any] = field(default_factory=list)\nfunding: List[str] = field(default_factory=list)\ncitation: List[Any] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nname: str,\nprocess: Optional[List[Any]] = None,\ncomputation: Optional[List[Any]] = None,\ncomputation_process: Optional[List[Any]] = None,\ndata: Optional[List[Any]] = None,\nfunding: Optional[List[str]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n        create an Experiment node\n        Parameters\n        ----------\n        name: str\n            name of Experiment\n        process: List[Process]\n            list of Process nodes for this Experiment\n        computation: List[Computation]\n            list of computation nodes for this Experiment\n        computation_process: List[ComputationalProcess]\n            list of computational_process nodes for this Experiment\n        data: List[Data]\n            list of data nodes for this experiment\n        funding: List[str]\n            list of the funders names for this Experiment\n        citation: List[Citation]\n            list of Citation nodes for this experiment\n        notes: str default=\"\"\n            notes for the experiment node\n        Examples\n        --------\n        ```python\n        # create an experiment node with all possible arguments\n        my_experiment = cript.Experiment(name=\"my experiment name\")\n        ```\n        Returns\n        -------\n        None\n            Instantiate an Experiment node\n        \"\"\"\nif process is None:\nprocess = []\nif computation is None:\ncomputation = []\nif computation_process is None:\ncomputation_process = []\nif data is None:\ndata = []\nif funding is None:\nfunding = []\nif citation is None:\ncitation = []\nsuper().__init__(name=name, notes=notes, **kwargs)\nself._json_attrs = replace(\nself._json_attrs,\nname=name,\nprocess=process,\ncomputation=computation,\ncomputation_process=computation_process,\ndata=data,\nfunding=funding,\ncitation=citation,\nnotes=notes,\n)\n# check if the code is still valid\nself.validate()\n@property\n@beartype\ndef process(self) -> List[Any]:\n\"\"\"\n        List of process for experiment\n        ```python\n        # create a simple process node\n        my_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\n        my_experiment.process = [my_process]\n        ```\n        Returns\n        -------\n        List[Process]\n            List of process that were performed in this experiment\n        \"\"\"\nreturn self._json_attrs.process.copy()\n@process.setter\n@beartype\ndef process(self, new_process_list: List[Any]) -> None:\n\"\"\"\n        set the list of process for this experiment\n        Parameters\n        ----------\n        new_process_list: List[Process]\n            new process list to replace the current process list\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, process=new_process_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef computation(self) -> List[Any]:\n\"\"\"\n        List of the [computations](../computation) in this experiment\n        Examples\n        --------\n        ```python\n        # create computation node\n        my_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\n        # add computation node to experiment node\n        simple_experiment_node.computation = [simple_computation_node]\n        ```\n        Returns\n        -------\n        List[Computation]\n            List of [computations](../computation) for this experiment\n        \"\"\"\nreturn self._json_attrs.computation.copy()\n@computation.setter\n@beartype\ndef computation(self, new_computation_list: List[Any]) -> None:\n\"\"\"\n        set the list of computations for this experiment\n        Parameters\n        ----------\n        new_computation_list: List[Computation]\n            new list of computations to replace the current list of experiments\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, computation=new_computation_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef computation_process(self) -> List[Any]:\n\"\"\"\n        List of [computation_process](../computation_process) for this experiment\n        Examples\n        --------\n        ```python\n        my_computation_process = cript.ComputationalProcess(\n            name=\"my computational process name\",\n            type=\"cross_linking\",       # must come from CRIPT Controlled Vocabulary\n            input_data=[input_data],    # input data is another data node\n            ingredients=[ingredients],  # output data is another data node\n        )\n        # add computation_process node to experiment node\n        my_experiment.computation_process = [my_computational_process]\n        ```\n        Returns\n        -------\n        List[ComputationalProcess]\n            computational process that were performed in this experiment\n        \"\"\"\nreturn self._json_attrs.computation_process.copy()\n@computation_process.setter\n@beartype\ndef computation_process(self, new_computation_process_list: List[Any]) -> None:\n\"\"\"\n        set the list of computation_process for this experiment\n        Parameters\n        ----------\n        new_computation_process_list: List[ComputationalProcess]\n            new list of computations to replace the current for the experiment\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, computation_process=new_computation_process_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef data(self) -> List[Any]:\n\"\"\"\n        List of [data nodes](../data) for this experiment\n        Examples\n        --------\n        ```python\n        # create a simple file node\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\",\n        )\n        # create a simple data node\n        my_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[my_file])\n        my_experiment.data = my_data\n        ```\n        Returns\n        -------\n        List[Data]\n            list of [data nodes](../data) that belong to this experiment\n        \"\"\"\nreturn self._json_attrs.data.copy()\n@data.setter\n@beartype\ndef data(self, new_data_list: List[Any]) -> None:\n\"\"\"\n        set the list of data for this experiment\n        Parameters\n        ----------\n        new_data_list: List[Data]\n            new list of data to replace the current list for this experiment\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, data=new_data_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef funding(self) -> List[str]:\n\"\"\"\n        List of strings of all the funders for this experiment\n        Examples\n        --------\n        ```python\n        my_experiment.funding = [\"National Science Foundation\", \"IRIS\", \"NIST\"]\n        ```\n        Returns\n        -------\n        List[str]\n            List of funders for this experiment\n        \"\"\"\nreturn self._json_attrs.funding.copy()\n@funding.setter\n@beartype\ndef funding(self, new_funding_list: List[str]) -> None:\n\"\"\"\n        set the list of funders for this experiment\n        Parameters\n        ----------\n        new_funding_list: List[str]\n            replace the current list of funders\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, funding=new_funding_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Any]:\n\"\"\"\n        List of [citation](../../subobjects/citation) for this experiment\n        Examples\n        --------\n        ```python\n        # create citation node\n        my_citation = cript.Citation(type=\"derived_from\", reference=simple_reference_node)\n        # add citation to experiment\n        my_experiment.citations = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of citations of scholarly work that was used in this experiment\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation_list: List[Any]) -> None:\n\"\"\"\n        set the list of citations for this experiment\n        Parameters\n        ----------\n        new_citations_list: List[Citation]\n            replace the list of citations for this experiment with a new list of citations\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation_list)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.citation","title":"citation: List[Any] property writable","text":"

List of citation for this experiment

Examples:

# create citation node\nmy_citation = cript.Citation(type=\"derived_from\", reference=simple_reference_node)\n# add citation to experiment\nmy_experiment.citations = [my_citation]\n

Returns:

Type Description List[Citation]

list of citations of scholarly work that was used in this experiment

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.computation","title":"computation: List[Any] property writable","text":"

List of the computations in this experiment

Examples:

# create computation node\nmy_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\n# add computation node to experiment node\nsimple_experiment_node.computation = [simple_computation_node]\n

Returns:

Type Description List[Computation]

List of computations for this experiment

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.computation_process","title":"computation_process: List[Any] property writable","text":"

List of computation_process for this experiment

Examples:

my_computation_process = cript.ComputationalProcess(\nname=\"my computational process name\",\ntype=\"cross_linking\",       # must come from CRIPT Controlled Vocabulary\ninput_data=[input_data],    # input data is another data node\ningredients=[ingredients],  # output data is another data node\n)\n# add computation_process node to experiment node\nmy_experiment.computation_process = [my_computational_process]\n

Returns:

Type Description List[ComputationalProcess]

computational process that were performed in this experiment

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.data","title":"data: List[Any] property writable","text":"

List of data nodes for this experiment

Examples:

# create a simple file node\nmy_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\",\n)\n# create a simple data node\nmy_data = cript.Data(name=\"my data name\", type=\"afm_amp\", files=[my_file])\nmy_experiment.data = my_data\n

Returns:

Type Description List[Data]

list of data nodes that belong to this experiment

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.funding","title":"funding: List[str] property writable","text":"

List of strings of all the funders for this experiment

Examples:

my_experiment.funding = [\"National Science Foundation\", \"IRIS\", \"NIST\"]\n

Returns:

Type Description List[str]

List of funders for this experiment

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.process","title":"process: List[Any] property writable","text":"

List of process for experiment

# create a simple process node\nmy_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\nmy_experiment.process = [my_process]\n

Returns:

Type Description List[Process]

List of process that were performed in this experiment

"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Collection attributes

Source code in src/cript/nodes/primary_nodes/experiment.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Collection attributes\n    \"\"\"\nprocess: List[Any] = field(default_factory=list)\ncomputation: List[Any] = field(default_factory=list)\ncomputation_process: List[Any] = field(default_factory=list)\ndata: List[Any] = field(default_factory=list)\nfunding: List[str] = field(default_factory=list)\ncitation: List[Any] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/experiment/#cript.nodes.primary_nodes.experiment.Experiment.__init__","title":"__init__(name, process=None, computation=None, computation_process=None, data=None, funding=None, citation=None, notes='', **kwargs)","text":"

create an Experiment node

Parameters:

Name Type Description Default name str

name of Experiment

required process Optional[List[Any]]

list of Process nodes for this Experiment

None computation Optional[List[Any]]

list of computation nodes for this Experiment

None computation_process Optional[List[Any]]

list of computational_process nodes for this Experiment

None data Optional[List[Any]]

list of data nodes for this experiment

None funding Optional[List[str]]

list of the funders names for this Experiment

None citation Optional[List[Any]]

list of Citation nodes for this experiment

None notes str

notes for the experiment node

''

Examples:

# create an experiment node with all possible arguments\nmy_experiment = cript.Experiment(name=\"my experiment name\")\n

Returns:

Type Description None

Instantiate an Experiment node

Source code in src/cript/nodes/primary_nodes/experiment.py
@beartype\ndef __init__(\nself,\nname: str,\nprocess: Optional[List[Any]] = None,\ncomputation: Optional[List[Any]] = None,\ncomputation_process: Optional[List[Any]] = None,\ndata: Optional[List[Any]] = None,\nfunding: Optional[List[str]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n    create an Experiment node\n    Parameters\n    ----------\n    name: str\n        name of Experiment\n    process: List[Process]\n        list of Process nodes for this Experiment\n    computation: List[Computation]\n        list of computation nodes for this Experiment\n    computation_process: List[ComputationalProcess]\n        list of computational_process nodes for this Experiment\n    data: List[Data]\n        list of data nodes for this experiment\n    funding: List[str]\n        list of the funders names for this Experiment\n    citation: List[Citation]\n        list of Citation nodes for this experiment\n    notes: str default=\"\"\n        notes for the experiment node\n    Examples\n    --------\n    ```python\n    # create an experiment node with all possible arguments\n    my_experiment = cript.Experiment(name=\"my experiment name\")\n    ```\n    Returns\n    -------\n    None\n        Instantiate an Experiment node\n    \"\"\"\nif process is None:\nprocess = []\nif computation is None:\ncomputation = []\nif computation_process is None:\ncomputation_process = []\nif data is None:\ndata = []\nif funding is None:\nfunding = []\nif citation is None:\ncitation = []\nsuper().__init__(name=name, notes=notes, **kwargs)\nself._json_attrs = replace(\nself._json_attrs,\nname=name,\nprocess=process,\ncomputation=computation,\ncomputation_process=computation_process,\ndata=data,\nfunding=funding,\ncitation=citation,\nnotes=notes,\n)\n# check if the code is still valid\nself.validate()\n
"},{"location":"nodes/primary_nodes/inventory/","title":"Inventory","text":""},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory","title":"Inventory","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory--definition","title":"Definition","text":"

An Inventory Node is a list of material nodes. An example of an inventory can be a grouping of materials that were extracted from literature and curated into a group for machine learning, or it can be a subset of chemicals that are used for a certain type of synthesis.

"},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory--attributes","title":"Attributes","text":"Attribute Type Example Description material list[Material] material that you like to group together"},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my inventory name\",\n\"node\":[\"Inventory\"],\n\"uid\":\"_:90f45778-b7c9-4b77-8b83-a6ea9671a937\",\n\"uuid\":\"90f45778-b7c9-4b77-8b83-a6ea9671a937\",\n\"material\":[\n{\n\"node\":[\"Material\"],\n\"name\":\"my material 1\",\n\"uid\":\"_:9679ff12-f9b4-41f4-be95-080b78fa71fd\",\n\"uuid\":\"9679ff12-f9b4-41f4-be95-080b78fa71fd\"\n\"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n},\n{\n\"node\":[\"Material\"],\n\"name\":\"my material 2\",\n\"uid\":\"_:1ee41708-3531-43eb-8049-4bb91ad73df6\",\n\"uuid\":\"1ee41708-3531-43eb-8049-4bb91ad73df6\"\n\"bigsmiles\":\"654321\",\n}\n]\n}\n
Source code in src/cript/nodes/primary_nodes/inventory.py
class Inventory(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    An\n    [Inventory Node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)\n    is a list of material nodes.\n    An example of an inventory can be a grouping of materials that were extracted from literature\n    and curated into a group for machine learning, or it can be a subset of chemicals that are used for a\n    certain type of synthesis.\n    ## Attributes\n    | Attribute  | Type                            | Example             | Description                               |\n    |------------|---------------------------------|---------------------|-------------------------------------------|\n    | material  | list[[Material](./material.md)] |                     | material that you like to group together |\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my inventory name\",\n       \"node\":[\"Inventory\"],\n       \"uid\":\"_:90f45778-b7c9-4b77-8b83-a6ea9671a937\",\n       \"uuid\":\"90f45778-b7c9-4b77-8b83-a6ea9671a937\",\n       \"material\":[\n          {\n             \"node\":[\"Material\"],\n             \"name\":\"my material 1\",\n             \"uid\":\"_:9679ff12-f9b4-41f4-be95-080b78fa71fd\",\n             \"uuid\":\"9679ff12-f9b4-41f4-be95-080b78fa71fd\"\n             \"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n          },\n          {\n             \"node\":[\"Material\"],\n             \"name\":\"my material 2\",\n             \"uid\":\"_:1ee41708-3531-43eb-8049-4bb91ad73df6\",\n             \"uuid\":\"1ee41708-3531-43eb-8049-4bb91ad73df6\"\n             \"bigsmiles\":\"654321\",\n          }\n       ]\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Inventory attributes\n        \"\"\"\nmaterial: List[Material] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, name: str, material: List[Material], notes: str = \"\", **kwargs) -> None:\n\"\"\"\n        Instantiate an inventory node\n        Examples\n        --------\n        ```python\n        material_1 = cript.Material(\n            name=\"material 1\",\n            identifiers=[{\"alternative_names\": \"material 1 alternative name\"}],\n        )\n        material_2 = cript.Material(\n            name=\"material 2\",\n            identifiers=[{\"alternative_names\": \"material 2 alternative name\"}],\n        )\n        # instantiate inventory node\n        my_inventory = cript.Inventory(\n            name=\"my inventory name\", material=[material_1, material_2]\n        )\n        ```\n        Parameters\n        ----------\n        material: List[Material]\n            list of materials in this inventory\n        Returns\n        -------\n        None\n            instantiate an inventory node\n        \"\"\"\nif material is None:\nmaterial = []\nsuper().__init__(name=name, notes=notes, **kwargs)\nself._json_attrs = replace(self._json_attrs, material=material)\n@property\n@beartype\ndef material(self) -> List[Material]:\n\"\"\"\n        List of [material](../material) in this inventory\n        Examples\n        --------\n        ```python\n        material_3 = cript.Material(\n            name=\"new material 3\",\n            identifiers=[{\"alternative_names\": \"new material 3 alternative name\"}],\n        )\n        my_inventory.material = [my_material_3]\n        ```\n        Returns\n        -------\n        List[Material]\n            list of material representing the inventory within the collection\n        \"\"\"\nreturn self._json_attrs.material.copy()\n@material.setter\n@beartype\ndef material(self, new_material_list: List[Material]):\n\"\"\"\n        set the list of material for this inventory node\n        Parameters\n        ----------\n        new_material_list: List[Material]\n            new list of material to replace the current list of material nodes for this inventory node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, material=new_material_list)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory.material","title":"material: List[Material] property writable","text":"

List of material in this inventory

Examples:

material_3 = cript.Material(\nname=\"new material 3\",\nidentifiers=[{\"alternative_names\": \"new material 3 alternative name\"}],\n)\nmy_inventory.material = [my_material_3]\n

Returns:

Type Description List[Material]

list of material representing the inventory within the collection

"},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Inventory attributes

Source code in src/cript/nodes/primary_nodes/inventory.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Inventory attributes\n    \"\"\"\nmaterial: List[Material] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/inventory/#cript.nodes.primary_nodes.inventory.Inventory.__init__","title":"__init__(name, material, notes='', **kwargs)","text":"

Instantiate an inventory node

Examples:

material_1 = cript.Material(\nname=\"material 1\",\nidentifiers=[{\"alternative_names\": \"material 1 alternative name\"}],\n)\nmaterial_2 = cript.Material(\nname=\"material 2\",\nidentifiers=[{\"alternative_names\": \"material 2 alternative name\"}],\n)\n# instantiate inventory node\nmy_inventory = cript.Inventory(\nname=\"my inventory name\", material=[material_1, material_2]\n)\n

Parameters:

Name Type Description Default material List[Material]

list of materials in this inventory

required

Returns:

Type Description None

instantiate an inventory node

Source code in src/cript/nodes/primary_nodes/inventory.py
@beartype\ndef __init__(self, name: str, material: List[Material], notes: str = \"\", **kwargs) -> None:\n\"\"\"\n    Instantiate an inventory node\n    Examples\n    --------\n    ```python\n    material_1 = cript.Material(\n        name=\"material 1\",\n        identifiers=[{\"alternative_names\": \"material 1 alternative name\"}],\n    )\n    material_2 = cript.Material(\n        name=\"material 2\",\n        identifiers=[{\"alternative_names\": \"material 2 alternative name\"}],\n    )\n    # instantiate inventory node\n    my_inventory = cript.Inventory(\n        name=\"my inventory name\", material=[material_1, material_2]\n    )\n    ```\n    Parameters\n    ----------\n    material: List[Material]\n        list of materials in this inventory\n    Returns\n    -------\n    None\n        instantiate an inventory node\n    \"\"\"\nif material is None:\nmaterial = []\nsuper().__init__(name=name, notes=notes, **kwargs)\nself._json_attrs = replace(self._json_attrs, material=material)\n
"},{"location":"nodes/primary_nodes/material/","title":"Material","text":""},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material","title":"Material","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material--definition","title":"Definition","text":"

A Material node is nested inside a Project. A Material node is just the materials used within an project/experiment.

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material--attributes","title":"Attributes","text":"attribute type example description required vocab identifiers list[Identifier] material identifiers True component list[Material] list of component that make up the mixture property list[Property] material properties process Process process node that made this material parent_material Material material node that this node was copied from computational_ forcefield Computation Forcefield computation forcefield Conditional keyword list[str] [thermoplastic, homopolymer, linear, polyolefins] words that classify the material True"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material--navigating-to-material","title":"Navigating to Material","text":"

Materials can be easily found on the CRIPT home screen in the under the navigation within the Materials link

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material--available-sub-objects-for-material","title":"Available Sub-Objects for Material","text":"
  • Identifier
  • Property
  • Computational_forcefield
"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material--example","title":"Example","text":"

water, brine (water + NaCl), polystyrene, polyethylene glycol hydrogels, vulcanized polyisoprene, mcherry (protein), and mica

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material--warnings","title":"Warnings","text":"

Material names

Material names Must be unique within a Project

  {\n\"node\":[\"Material\"],\n\"name\":\"my unique material name\",\n\"uid\":\"_:9679ff12-f9b4-41f4-be95-080b78fa71fd\",\n\"uuid\":\"9679ff12-f9b4-41f4-be95-080b78fa71fd\"\n\"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n}\n
Source code in src/cript/nodes/primary_nodes/material.py
class Material(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    A [Material node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=10)\n    is nested inside a [Project](../project).\n    A [Material node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=10)\n    is just the materials used within an project/experiment.\n    ## Attributes\n    | attribute                 | type                                                                 | example                                           | description                                  | required    | vocab |\n    |---------------------------|----------------------------------------------------------------------|---------------------------------------------------|----------------------------------------------|-------------|-------|\n    | identifiers               | list[Identifier]                                                     |                                                   | material identifiers                         | True        |       |\n    | component                 | list[[Material](./)]                                                 |                                                   | list of component that make up the mixture   |             |       |\n    | property                  | list[[Property](../../subobjects/property)]                          |                                                   | material properties                          |             |       |\n    | process                   | [Process](../process)                                                |                                                   | process node that made this material         |             |       |\n    | parent_material           | [Material](./)                                                       |                                                   | material node that this node was copied from |             |       |\n    | computational_ forcefield | [Computation  Forcefield](../../subobjects/computational_forcefield) |                                                   | computation forcefield                       | Conditional |       |\n    | keyword                   | list[str]                                                            | [thermoplastic, homopolymer, linear, polyolefins] | words that classify the material             |             | True  |\n    ## Navigating to Material\n    Materials can be easily found on the [CRIPT](https://criptapp.org) home screen in the\n    under the navigation within the [Materials link](https://criptapp.org/material/)\n    ## Available Sub-Objects for Material\n    * [Identifier](../../subobjects/identifier)\n    * [Property](../../subobjects/property)\n    * [Computational_forcefield](../../subobjects/computational_forcefield)\n    Example\n    -------\n     water, brine (water + NaCl), polystyrene, polyethylene glycol hydrogels, vulcanized polyisoprene, mcherry (protein), and mica\n    Warnings\n    -------\n    !!! warning \"Material names\"\n        Material names Must be unique within a [Project](../project)\n    ```json\n      {\n         \"node\":[\"Material\"],\n         \"name\":\"my unique material name\",\n         \"uid\":\"_:9679ff12-f9b4-41f4-be95-080b78fa71fd\",\n         \"uuid\":\"9679ff12-f9b4-41f4-be95-080b78fa71fd\"\n         \"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n      }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Material attributes\n        \"\"\"\n# identifier sub-object for the material\nidentifiers: List[Dict[str, str]] = field(default_factory=dict)  # type: ignore\n# TODO add proper typing in future, using Any for now to avoid circular import error\ncomponent: List[\"Material\"] = field(default_factory=list)\nprocess: Optional[Process] = None\nproperty: List[Any] = field(default_factory=list)\nparent_material: Optional[\"Material\"] = None\ncomputational_forcefield: Optional[Any] = None\nkeyword: List[str] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nname: str,\nidentifiers: List[Dict[str, str]],\ncomponent: Optional[List[\"Material\"]] = None,\nprocess: Optional[Process] = None,\nproperty: Optional[List[Any]] = None,\nparent_material: Optional[\"Material\"] = None,\ncomputational_forcefield: Optional[Any] = None,\nkeyword: Optional[List[str]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n        create a material node\n        Parameters\n        ----------\n        name: str\n        identifiers: List[Dict[str, str]]\n        component: List[\"Material\"], default=None\n        property: Optional[Process], default=None\n        process: List[Process], default=None\n        parent_material: \"Material\", default=None\n        computational_forcefield: ComputationalForcefield, default=None\n        keyword: List[str], default=None\n        Returns\n        -------\n        None\n            Instantiate a material node\n        \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif component is None:\ncomponent = []\nif property is None:\nproperty = []\nif keyword is None:\nkeyword = []\nself._json_attrs = replace(\nself._json_attrs,\nname=name,\nidentifiers=identifiers,\ncomponent=component,\nprocess=process,\nproperty=property,\nparent_material=parent_material,\ncomputational_forcefield=computational_forcefield,\nkeyword=keyword,\n)\n@property\n@beartype\ndef name(self) -> str:\n\"\"\"\n        material name\n        Examples\n        ```python\n        my_material.name = \"my new material\"\n        ```\n        Returns\n        -------\n        str\n            material name\n        \"\"\"\nreturn self._json_attrs.name\n@name.setter\n@beartype\ndef name(self, new_name: str) -> None:\n\"\"\"\n        set the name of the material\n        Parameters\n        ----------\n        new_name: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, name=new_name)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef identifiers(self) -> List[Dict[str, str]]:\n\"\"\"\n        get the identifiers for this material\n        ```python\n        my_material.identifier = {\"alternative_names\": \"my material alternative name\"}\n        ```\n        Returns\n        -------\n        List[Dict[str, str]]\n            list of dictionary that has identifiers for this material\n        \"\"\"\nreturn self._json_attrs.identifiers.copy()\n@identifiers.setter\n@beartype\ndef identifiers(self, new_identifiers_list: List[Dict[str, str]]) -> None:\n\"\"\"\n        set the list of identifiers for this material\n        the identifier keys must come from the\n        material identifiers keyword within the CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_identifiers_list: List[Dict[str, str]]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, identifiers=new_identifiers_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef component(self) -> List[\"Material\"]:\n\"\"\"\n        list of component ([material nodes](./)) that make up this material\n        Examples\n        --------\n        ```python\n        # material component\n        my_component = [\n            cript.Material(\n                name=\"my component material 1\",\n                identifiers=[{\"alternative_names\": \"component 1 alternative name\"}],\n            ),\n            cript.Material(\n                name=\"my component material 2\",\n                identifiers=[{\"alternative_names\": \"component 2 alternative name\"}],\n            ),\n        ]\n        identifiers = [{\"alternative_names\": \"my material alternative name\"}]\n        my_material = cript.Material(name=\"my material\", component=my_component, identifiers=identifiers)\n        ```\n        Returns\n        -------\n        List[Material]\n            list of component that make up this material\n        \"\"\"\nreturn self._json_attrs.component\n@component.setter\n@beartype\ndef component(self, new_component_list: List[\"Material\"]) -> None:\n\"\"\"\n        set the list of component (material nodes) that make up this material\n        Parameters\n        ----------\n        new_component_list: List[\"Material\"]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, component=new_component_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef parent_material(self) -> Optional[\"Material\"]:\n\"\"\"\n        List of parent materials\n        Returns\n        -------\n        List[\"Material\"]\n            list of parent materials\n        \"\"\"\nreturn self._json_attrs.parent_material\n@parent_material.setter\n@beartype\ndef parent_material(self, new_parent_material: \"Material\") -> None:\n\"\"\"\n        set the [parent materials](./) for this material\n        Parameters\n        ----------\n        new_parent_material: \"Material\"\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, parent_material=new_parent_material)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef computational_forcefield(self) -> Any:\n\"\"\"\n        list of [computational_forcefield](../../subobjects/computational_forcefield) for this material node\n        Returns\n        -------\n        List[ComputationForcefield]\n            list of computational_forcefield that created this material\n        \"\"\"\nreturn self._json_attrs.computational_forcefield\n@computational_forcefield.setter\n@beartype\ndef computational_forcefield(self, new_computational_forcefield_list: Any) -> None:\n\"\"\"\n        sets the list of computational forcefields for this material\n        Parameters\n        ----------\n        new_computation_forcefield_list: List[ComputationalForcefield]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, computational_forcefield=new_computational_forcefield_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef keyword(self) -> List[str]:\n\"\"\"\n        List of keyword for this material\n        the material keyword must come from the\n        [CRIPT controlled vocabulary](https://criptapp.org/keys/material-keyword/)\n        ```python\n        identifiers = [{\"alternative_names\": \"my material alternative name\"}]\n        # keyword\n        material_keyword = [\"acetylene\", \"acrylate\", \"alternating\"]\n        my_material = cript.Material(\n            name=\"my material\", keyword=material_keyword, identifiers=identifiers\n        )\n        ```\n        Returns\n        -------\n        List[str]\n            list of material keyword\n        \"\"\"\nreturn self._json_attrs.keyword\n@keyword.setter\n@beartype\ndef keyword(self, new_keyword_list: List[str]) -> None:\n\"\"\"\n        set the keyword for this material\n        the material keyword must come from the CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_keyword_list\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, keyword=new_keyword_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef process(self) -> Optional[Process]:\nreturn self._json_attrs.process  # type: ignore\n@process.setter\ndef process(self, new_process: Process) -> None:\nnew_attrs = replace(self._json_attrs, process=new_process)\nself._update_json_attrs_if_valid(new_attrs)\n@property\ndef property(self) -> List[Any]:\n\"\"\"\n        list of material [property](../../subobjects/property)\n        ```python\n        # property subobject\n        my_property = cript.Property(key=\"modulus_shear\", type=\"min\", value=1.23, unit=\"gram\")\n        my_material.property = my_property\n        ```\n        Returns\n        -------\n        List[Property]\n            list of property that define this material\n        \"\"\"\nreturn self._json_attrs.property.copy()\n@property.setter\n@beartype\ndef property(self, new_property_list: List[Any]) -> None:\n\"\"\"\n        set the list of properties for this material\n        Parameters\n        ----------\n        new_property_list: List[Property]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, property=new_property_list)\nself._update_json_attrs_if_valid(new_attrs)\n@classmethod\n@beartype\ndef _from_json(cls, json_dict: Dict):\n\"\"\"\n        Create a new instance of a node from a JSON representation.\n        Parameters\n        ----------\n        json_dict : Dict\n            A JSON dictionary representing a node\n        Returns\n        -------\n        node\n            A new instance of a node.\n        Notes\n        -----\n        required fields in JSON:\n        * `name`: The name of the node\n        optional fields in JSON:\n        * `identifiers`: A list of material identifiers.\n            * If the `identifiers` property is not present in the JSON dictionary,\n            it will be set to an empty list.\n        \"\"\"\nfrom cript.nodes.util.material_deserialization import (\n_deserialize_flattened_material_identifiers,\n)\njson_dict = _deserialize_flattened_material_identifiers(json_dict)\nreturn super()._from_json(json_dict)\n
"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.component","title":"component: List[Material] property writable","text":"

list of component (material nodes) that make up this material

Examples:

# material component\nmy_component = [\ncript.Material(\nname=\"my component material 1\",\nidentifiers=[{\"alternative_names\": \"component 1 alternative name\"}],\n),\ncript.Material(\nname=\"my component material 2\",\nidentifiers=[{\"alternative_names\": \"component 2 alternative name\"}],\n),\n]\nidentifiers = [{\"alternative_names\": \"my material alternative name\"}]\nmy_material = cript.Material(name=\"my material\", component=my_component, identifiers=identifiers)\n

Returns:

Type Description List[Material]

list of component that make up this material

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.computational_forcefield","title":"computational_forcefield: Any property writable","text":"

list of computational_forcefield for this material node

Returns:

Type Description List[ComputationForcefield]

list of computational_forcefield that created this material

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.identifiers","title":"identifiers: List[Dict[str, str]] property writable","text":"

get the identifiers for this material

my_material.identifier = {\"alternative_names\": \"my material alternative name\"}\n

Returns:

Type Description List[Dict[str, str]]

list of dictionary that has identifiers for this material

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.keyword","title":"keyword: List[str] property writable","text":"

List of keyword for this material

the material keyword must come from the CRIPT controlled vocabulary

identifiers = [{\"alternative_names\": \"my material alternative name\"}]\n# keyword\nmaterial_keyword = [\"acetylene\", \"acrylate\", \"alternating\"]\nmy_material = cript.Material(\nname=\"my material\", keyword=material_keyword, identifiers=identifiers\n)\n

Returns:

Type Description List[str]

list of material keyword

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.name","title":"name: str property writable","text":"

material name

Examples

my_material.name = \"my new material\"\n

Returns:

Type Description str

material name

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.parent_material","title":"parent_material: Optional[Material] property writable","text":"

List of parent materials

Returns:

Type Description List[Material]

list of parent materials

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.property","title":"property: List[Any] property writable","text":"

list of material property

# property subobject\nmy_property = cript.Property(key=\"modulus_shear\", type=\"min\", value=1.23, unit=\"gram\")\nmy_material.property = my_property\n

Returns:

Type Description List[Property]

list of property that define this material

"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Material attributes

Source code in src/cript/nodes/primary_nodes/material.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Material attributes\n    \"\"\"\n# identifier sub-object for the material\nidentifiers: List[Dict[str, str]] = field(default_factory=dict)  # type: ignore\n# TODO add proper typing in future, using Any for now to avoid circular import error\ncomponent: List[\"Material\"] = field(default_factory=list)\nprocess: Optional[Process] = None\nproperty: List[Any] = field(default_factory=list)\nparent_material: Optional[\"Material\"] = None\ncomputational_forcefield: Optional[Any] = None\nkeyword: List[str] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/material/#cript.nodes.primary_nodes.material.Material.__init__","title":"__init__(name, identifiers, component=None, process=None, property=None, parent_material=None, computational_forcefield=None, keyword=None, notes='', **kwargs)","text":"

create a material node

Parameters:

Name Type Description Default name str required identifiers List[Dict[str, str]] required component Optional[List[Material]] None property Optional[List[Any]] None process Optional[Process] None parent_material Optional[Material] None computational_forcefield Optional[Any] None keyword Optional[List[str]] None

Returns:

Type Description None

Instantiate a material node

Source code in src/cript/nodes/primary_nodes/material.py
@beartype\ndef __init__(\nself,\nname: str,\nidentifiers: List[Dict[str, str]],\ncomponent: Optional[List[\"Material\"]] = None,\nprocess: Optional[Process] = None,\nproperty: Optional[List[Any]] = None,\nparent_material: Optional[\"Material\"] = None,\ncomputational_forcefield: Optional[Any] = None,\nkeyword: Optional[List[str]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n    create a material node\n    Parameters\n    ----------\n    name: str\n    identifiers: List[Dict[str, str]]\n    component: List[\"Material\"], default=None\n    property: Optional[Process], default=None\n    process: List[Process], default=None\n    parent_material: \"Material\", default=None\n    computational_forcefield: ComputationalForcefield, default=None\n    keyword: List[str], default=None\n    Returns\n    -------\n    None\n        Instantiate a material node\n    \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif component is None:\ncomponent = []\nif property is None:\nproperty = []\nif keyword is None:\nkeyword = []\nself._json_attrs = replace(\nself._json_attrs,\nname=name,\nidentifiers=identifiers,\ncomponent=component,\nprocess=process,\nproperty=property,\nparent_material=parent_material,\ncomputational_forcefield=computational_forcefield,\nkeyword=keyword,\n)\n
"},{"location":"nodes/primary_nodes/process/","title":"Process","text":""},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process","title":"Process","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process--definition","title":"Definition","text":"

The process node contains a list of ingredients, quantities, and procedure information for an experimental material transformation (chemical and physical).

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process--attributes","title":"Attributes","text":"attribute type example description required vocab type str mix type of process True True ingredient list[Ingredient] ingredients description str To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added. explanation of the process equipment list[Equipment] equipment used in the process product list[Material] desired material produced from the process waste list[Material] material sent to waste prerequisite_ processes list[Process] processes that must be completed prior to the start of this process condition list[Condition] global process condition property list[Property] process properties keyword list[str] words that classify the process True citation list[Citation] reference to a book, paper, or scholarly work"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process--available-subobjects","title":"Available Subobjects","text":"
  • Ingredient
  • equipment
  • Property
  • Condition
  • Citation
"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my minimal process name\",\n\"node\":[\"Process\"],\n\"type\":\"affinity_pure\",\n\"keyword\":[],\n\"uid\":\"_:f8ef33f3-677a-40f3-b24e-65ab2c99d796\",\n\"uuid\":\"f8ef33f3-677a-40f3-b24e-65ab2c99d796\"\n}\n
Source code in src/cript/nodes/primary_nodes/process.py
class Process(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    The process node contains a list of ingredients, quantities, and procedure information for an experimental material\n    transformation (chemical and physical).\n    ## Attributes\n    | attribute               | type             | example                                                                         | description                                                         | required | vocab |\n    |-------------------------|------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------|----------|-------|\n    | type                    | str              | mix                                                                             | type of process                                                     | True     | True  |\n    | ingredient              | list[Ingredient] |                                                                                 | ingredients                                                         |          |       |\n    | description             | str              | To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added. | explanation of the process                                          |          |       |\n    | equipment               | list[Equipment]  |                                                                                 | equipment used in the process                                       |          |       |\n    | product                 | list[Material]   |                                                                                 | desired material produced from the process                          |          |       |\n    | waste                   | list[Material]   |                                                                                 | material sent to waste                                              |          |       |\n    | prerequisite_ processes | list[Process]    |                                                                                 | processes that must be completed prior to the start of this process |          |       |\n    | condition               | list[Condition]  |                                                                                 | global process condition                                            |          |       |\n    | property                | list[Property]   |                                                                                 | process properties                                                  |          |       |\n    | keyword                 | list[str]        |                                                                                 | words that classify the process                                     |          | True  |\n    | citation                | list[Citation]   |                                                                                 | reference to a book, paper, or scholarly work                       |          |       |\n    ## Available Subobjects\n    * [Ingredient](../../subobjects/ingredient)\n    * [equipment](../../subobjects/equipment)\n    * [Property](../../subobjects/property)\n    * [Condition](../../subobjects/condition)\n    * [Citation](../../subobjects/citation)\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my minimal process name\",\n       \"node\":[\"Process\"],\n       \"type\":\"affinity_pure\",\n       \"keyword\":[],\n       \"uid\":\"_:f8ef33f3-677a-40f3-b24e-65ab2c99d796\",\n       \"uuid\":\"f8ef33f3-677a-40f3-b24e-65ab2c99d796\"\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Process attributes\n        \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\ningredient: List[Any] = field(default_factory=list)\ndescription: str = \"\"\nequipment: List[Any] = field(default_factory=list)\nproduct: List[Any] = field(default_factory=list)\nwaste: List[Any] = field(default_factory=list)\nprerequisite_process: List[\"Process\"] = field(default_factory=list)\ncondition: List[Any] = field(default_factory=list)\nproperty: List[Any] = field(default_factory=list)\nkeyword: Optional[List[str]] = None\ncitation: List[Any] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\ningredient: Optional[List[Any]] = None,\ndescription: str = \"\",\nequipment: Optional[List[Any]] = None,\nproduct: Optional[List[Any]] = None,\nwaste: Optional[List[Any]] = None,\nprerequisite_process: Optional[List[Any]] = None,\ncondition: Optional[List[Any]] = None,\nproperty: Optional[List[Any]] = None,\nkeyword: Optional[List[str]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n) -> None:\n\"\"\"\n        create a process node\n        ```python\n        my_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\n        ```\n        Parameters\n        ----------\n        ingredient: List[Ingredient]\n            [ingredient](../../subobjects/ingredient) used in this process\n        type: str = \"\"\n            Process type must come from\n            [CRIPT Controlled vocabulary process type](https://criptapp.org/keys/process-type/)\n        description: str = \"\"\n            description of this process\n        equipment: List[Equipment] = None\n            list of [equipment](../../subobjects/equipment) used in this process\n        product: List[Material] = None\n            product that this process created\n        waste: List[Material] = None\n            waste that this process created\n        condition: List[Condition] = None\n            list of [condition](../../subobjects/condition) that this process was created under\n        property: List[Property] = None\n            list of [properties](../../subobjects/property) for this process\n        keyword: List[str] = None\n            list of keywords for this process must come from\n            [CRIPT process keyword controlled keyword](https://criptapp.org/keys/process-keyword/)\n        citation: List[Citation] = None\n            list of [citation](../../subobjects/citation)\n        Returns\n        -------\n        None\n            instantiate a process node\n        \"\"\"\nif ingredient is None:\ningredient = []\nif equipment is None:\nequipment = []\nif product is None:\nproduct = []\nif waste is None:\nwaste = []\nif prerequisite_process is None:\nprerequisite_process = []\nif condition is None:\ncondition = []\nif property is None:\nproperty = []\nif keyword is None:\nkeyword = []\nif citation is None:\ncitation = []\nsuper().__init__(name=name, notes=notes, **kwargs)\nnew_attrs = replace(\nself._json_attrs,\ningredient=ingredient,\ntype=type,\ndescription=description,\nequipment=equipment,\nproduct=product,\nwaste=waste,\ncondition=condition,\nprerequisite_process=prerequisite_process,\nproperty=property,\nkeyword=keyword,\ncitation=citation,\n)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        Process type must come from the [CRIPT controlled vocabulary](https://criptapp.org/keys/process-type/)\n        Examples\n        --------\n        ```python\n        my_process.type = \"affinity_pure\"\n        ```\n        Returns\n        -------\n        str\n            Select a [Process type](https://criptapp.org/keys/process-type/) from CRIPT controlled vocabulary\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_process_type: str) -> None:\n\"\"\"\n        set process type from CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_process_type: str\n            new process type from CRIPT controlled vocabulary\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, type=new_process_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef ingredient(self) -> List[Any]:\n\"\"\"\n        List of [ingredient](../../subobjects/ingredient) for this process\n        Examples\n        ---------\n        ```python\n        my_ingredients = cript.Ingredient(\n            material=simple_material_node,\n            quantities=[simple_quantity_node],\n        )\n        my_process.ingredient = [my_ingredients]\n        ```\n        Returns\n        -------\n        List[Ingredient]\n            list of ingredients for this process\n        \"\"\"\nreturn self._json_attrs.ingredient.copy()\n@ingredient.setter\n@beartype\ndef ingredient(self, new_ingredient_list: List[Any]) -> None:\n\"\"\"\n        set the list of the ingredients for this process\n        Parameters\n        ----------\n        new_ingredient_list\n            list of ingredients to replace the current list\n        Returns\n        -------\n        None\n        \"\"\"\n# TODO need to validate with CRIPT controlled vocabulary\n#   and if invalid then raise an error immediately\nnew_attrs = replace(self._json_attrs, ingredient=new_ingredient_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef description(self) -> str:\n\"\"\"\n        description of this process\n        Examples\n        --------\n        ```python\n        my_process.description = \"To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added\"\n        ```\n        Returns\n        -------\n        str\n            description of this process\n        \"\"\"\nreturn self._json_attrs.description\n@description.setter\n@beartype\ndef description(self, new_description: str) -> None:\n\"\"\"\n        set the description of this process\n        Parameters\n        ----------\n        new_description: str\n            new process description to replace the current one\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, description=new_description)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef equipment(self) -> List[Any]:\n\"\"\"\n        List of [equipment](../../subobjects/equipment) used for this process\n        Returns\n        -------\n        List[Equipment]\n            list of equipment used for this process\n        \"\"\"\nreturn self._json_attrs.equipment.copy()\n@equipment.setter\n@beartype\ndef equipment(self, new_equipment_list: List[Any]) -> None:\n\"\"\"\n        set the list of equipment used for this process\n        Parameters\n        ----------\n        new_equipment_list\n            new equipment list to replace the current equipment list for this process\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, equipment=new_equipment_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef product(self) -> List[Any]:\n\"\"\"\n        List of product (material nodes) for this process\n        Returns\n        -------\n        List[Material]\n            List of process product (Material nodes)\n        \"\"\"\nreturn self._json_attrs.product.copy()\n@product.setter\n@beartype\ndef product(self, new_product_list: List[Any]) -> None:\n\"\"\"\n        set the product list for this process\n        Parameters\n        ----------\n        new_product_list: List[Material]\n            replace the current list of process product\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, product=new_product_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef waste(self) -> List[Any]:\n\"\"\"\n        List of waste that resulted from this process\n        Examples\n        --------\n        ```python\n        my_process.waste = my_waste_material\n        ```\n        Returns\n        -------\n        List[Material]\n            list of waste materials that resulted from this product\n        \"\"\"\nreturn self._json_attrs.waste.copy()\n@waste.setter\n@beartype\ndef waste(self, new_waste_list: List[Any]) -> None:\n\"\"\"\n        set the list of waste (Material node) for that resulted from this process\n        Parameters\n        ----------\n        new_waste_list: List[Material]\n            replace the list waste that resulted from this process\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, waste=new_waste_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef prerequisite_process(self) -> List[\"Process\"]:\n\"\"\"\n        list of prerequisite process nodes\n        Examples\n        --------\n        ```python\n        my_prerequisite_process = [\n            cript.Process(name=\"prerequisite processes 1\", type=\"blow_molding\"),\n            cript.Process(name=\"prerequisite processes 2\", type=\"centrifugation\"),\n        ]\n        my_process.prerequisite_process = my_prerequisite_process\n        ```\n        Returns\n        -------\n        List[Process]\n            list of process that had to happen before this process\n        \"\"\"\nreturn self._json_attrs.prerequisite_process.copy()\n@prerequisite_process.setter\n@beartype\ndef prerequisite_process(self, new_prerequisite_process_list: List[\"Process\"]) -> None:\n\"\"\"\n        set the prerequisite_process for the process node\n        Parameters\n        ----------\n        new_prerequisite_process_list: List[\"Process\"]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, prerequisite_process=new_prerequisite_process_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef condition(self) -> List[Any]:\n\"\"\"\n        List of condition present for this process\n        Examples\n        -------\n        ```python\n        # create condition node\n        my_condition = cript.Condition(key=\"atm\", type=\"min\", value=1)\n        my_process.condition = [my_condition]\n        ```\n        Returns\n        -------\n        List[Condition]\n            list of condition for this process node\n        \"\"\"\nreturn self._json_attrs.condition.copy()\n@condition.setter\n@beartype\ndef condition(self, new_condition_list: List[Any]) -> None:\n\"\"\"\n        set the list of condition for this process\n        Parameters\n        ----------\n        new_condition_list: List[Condition]\n            replace the condition list\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, condition=new_condition_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef keyword(self) -> List[str]:\n\"\"\"\n        List of keyword for this process\n        [Process keyword](https://criptapp.org/keys/process-keyword/) must come from CRIPT controlled vocabulary\n        Returns\n        -------\n        List[str]\n            list of keywords for this process nod\n        \"\"\"\nreturn self._json_attrs.keyword.copy()  # type: ignore\n@keyword.setter\n@beartype\ndef keyword(self, new_keyword_list: List[str]) -> None:\n\"\"\"\n        set the list of keyword for this process from CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_keyword_list: List[str]\n            replace the current list of keyword\n        Returns\n        -------\n        None\n        \"\"\"\n# TODO validate with CRIPT controlled vocabulary\nnew_attrs = replace(self._json_attrs, keyword=new_keyword_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Any]:\n\"\"\"\n        List of citation for this process\n        Examples\n        --------\n        ```python\n        # crate reference node for this citation\n        my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n        # create citation node\n        my_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\n        my_process.citation = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of citation for this process node\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation_list: List[Any]) -> None:\n\"\"\"\n        set the list of citation for this process\n        Parameters\n        ----------\n        new_citation_list: List[Citation]\n            replace the current list of citation\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef property(self) -> List[Any]:\n\"\"\"\n        List of [Property nodes](../../subobjects/property) for this process\n        Examples\n        --------\n        ```python\n        # create property node\n         my_property = cript.Property(key=\"modulus_shear\", type=\"min\", value=1.23, unit=\"gram\")\n         my_process.properties = [my_property]\n        ```\n        Returns\n        -------\n        List[Property]\n            list of properties for this process\n        \"\"\"\nreturn self._json_attrs.property.copy()\n@property.setter\n@beartype\ndef property(self, new_property_list: List[Any]) -> None:\n\"\"\"\n        set the list of Property nodes for this process\n        Parameters\n        ----------\n        new_property_list: List[Property]\n            replace the current list of properties\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, property=new_property_list)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.citation","title":"citation: List[Any] property writable","text":"

List of citation for this process

Examples:

# crate reference node for this citation\nmy_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n# create citation node\nmy_citation = cript.Citation(type=\"derived_from\", reference=my_reference)\nmy_process.citation = [my_citation]\n

Returns:

Type Description List[Citation]

list of citation for this process node

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.condition","title":"condition: List[Any] property writable","text":"

List of condition present for this process

Examples:

# create condition node\nmy_condition = cript.Condition(key=\"atm\", type=\"min\", value=1)\nmy_process.condition = [my_condition]\n

Returns:

Type Description List[Condition]

list of condition for this process node

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.description","title":"description: str property writable","text":"

description of this process

Examples:

my_process.description = \"To oven-dried 20 mL glass vial, 5 mL of styrene and 10 ml of toluene was added\"\n

Returns:

Type Description str

description of this process

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.equipment","title":"equipment: List[Any] property writable","text":"

List of equipment used for this process

Returns:

Type Description List[Equipment]

list of equipment used for this process

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.ingredient","title":"ingredient: List[Any] property writable","text":"

List of ingredient for this process

Examples:

my_ingredients = cript.Ingredient(\nmaterial=simple_material_node,\nquantities=[simple_quantity_node],\n)\nmy_process.ingredient = [my_ingredients]\n

Returns:

Type Description List[Ingredient]

list of ingredients for this process

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.keyword","title":"keyword: List[str] property writable","text":"

List of keyword for this process

Process keyword must come from CRIPT controlled vocabulary

Returns:

Type Description List[str]

list of keywords for this process nod

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.prerequisite_process","title":"prerequisite_process: List[Process] property writable","text":"

list of prerequisite process nodes

Examples:

my_prerequisite_process = [\ncript.Process(name=\"prerequisite processes 1\", type=\"blow_molding\"),\ncript.Process(name=\"prerequisite processes 2\", type=\"centrifugation\"),\n]\nmy_process.prerequisite_process = my_prerequisite_process\n

Returns:

Type Description List[Process]

list of process that had to happen before this process

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.product","title":"product: List[Any] property writable","text":"

List of product (material nodes) for this process

Returns:

Type Description List[Material]

List of process product (Material nodes)

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.property","title":"property: List[Any] property writable","text":"

List of Property nodes for this process

Examples:

# create property node\nmy_property = cript.Property(key=\"modulus_shear\", type=\"min\", value=1.23, unit=\"gram\")\nmy_process.properties = [my_property]\n

Returns:

Type Description List[Property]

list of properties for this process

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.type","title":"type: str property writable","text":"

Process type must come from the CRIPT controlled vocabulary

Examples:

my_process.type = \"affinity_pure\"\n

Returns:

Type Description str

Select a Process type from CRIPT controlled vocabulary

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.waste","title":"waste: List[Any] property writable","text":"

List of waste that resulted from this process

Examples:

my_process.waste = my_waste_material\n

Returns:

Type Description List[Material]

list of waste materials that resulted from this product

"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Process attributes

Source code in src/cript/nodes/primary_nodes/process.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Process attributes\n    \"\"\"\ntype: str = \"\"\n# TODO add proper typing in future, using Any for now to avoid circular import error\ningredient: List[Any] = field(default_factory=list)\ndescription: str = \"\"\nequipment: List[Any] = field(default_factory=list)\nproduct: List[Any] = field(default_factory=list)\nwaste: List[Any] = field(default_factory=list)\nprerequisite_process: List[\"Process\"] = field(default_factory=list)\ncondition: List[Any] = field(default_factory=list)\nproperty: List[Any] = field(default_factory=list)\nkeyword: Optional[List[str]] = None\ncitation: List[Any] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/process/#cript.nodes.primary_nodes.process.Process.__init__","title":"__init__(name, type, ingredient=None, description='', equipment=None, product=None, waste=None, prerequisite_process=None, condition=None, property=None, keyword=None, citation=None, notes='', **kwargs)","text":"

create a process node

my_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\n

Parameters:

Name Type Description Default ingredient Optional[List[Any]]

ingredient used in this process

None type str

Process type must come from CRIPT Controlled vocabulary process type

required description str

description of this process

'' equipment Optional[List[Any]]

list of equipment used in this process

None product Optional[List[Any]]

product that this process created

None waste Optional[List[Any]]

waste that this process created

None condition Optional[List[Any]]

list of condition that this process was created under

None property Optional[List[Any]]

list of properties for this process

None keyword Optional[List[str]]

list of keywords for this process must come from CRIPT process keyword controlled keyword

None citation Optional[List[Any]]

list of citation

None

Returns:

Type Description None

instantiate a process node

Source code in src/cript/nodes/primary_nodes/process.py
@beartype\ndef __init__(\nself,\nname: str,\ntype: str,\ningredient: Optional[List[Any]] = None,\ndescription: str = \"\",\nequipment: Optional[List[Any]] = None,\nproduct: Optional[List[Any]] = None,\nwaste: Optional[List[Any]] = None,\nprerequisite_process: Optional[List[Any]] = None,\ncondition: Optional[List[Any]] = None,\nproperty: Optional[List[Any]] = None,\nkeyword: Optional[List[str]] = None,\ncitation: Optional[List[Any]] = None,\nnotes: str = \"\",\n**kwargs\n) -> None:\n\"\"\"\n    create a process node\n    ```python\n    my_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\n    ```\n    Parameters\n    ----------\n    ingredient: List[Ingredient]\n        [ingredient](../../subobjects/ingredient) used in this process\n    type: str = \"\"\n        Process type must come from\n        [CRIPT Controlled vocabulary process type](https://criptapp.org/keys/process-type/)\n    description: str = \"\"\n        description of this process\n    equipment: List[Equipment] = None\n        list of [equipment](../../subobjects/equipment) used in this process\n    product: List[Material] = None\n        product that this process created\n    waste: List[Material] = None\n        waste that this process created\n    condition: List[Condition] = None\n        list of [condition](../../subobjects/condition) that this process was created under\n    property: List[Property] = None\n        list of [properties](../../subobjects/property) for this process\n    keyword: List[str] = None\n        list of keywords for this process must come from\n        [CRIPT process keyword controlled keyword](https://criptapp.org/keys/process-keyword/)\n    citation: List[Citation] = None\n        list of [citation](../../subobjects/citation)\n    Returns\n    -------\n    None\n        instantiate a process node\n    \"\"\"\nif ingredient is None:\ningredient = []\nif equipment is None:\nequipment = []\nif product is None:\nproduct = []\nif waste is None:\nwaste = []\nif prerequisite_process is None:\nprerequisite_process = []\nif condition is None:\ncondition = []\nif property is None:\nproperty = []\nif keyword is None:\nkeyword = []\nif citation is None:\ncitation = []\nsuper().__init__(name=name, notes=notes, **kwargs)\nnew_attrs = replace(\nself._json_attrs,\ningredient=ingredient,\ntype=type,\ndescription=description,\nequipment=equipment,\nproduct=product,\nwaste=waste,\ncondition=condition,\nprerequisite_process=prerequisite_process,\nproperty=property,\nkeyword=keyword,\ncitation=citation,\n)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/project/","title":"Project","text":""},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project","title":"Project","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project--definition","title":"Definition","text":"

A Project is the highest level node that is Not nested inside any other node. A Project can be thought of as a folder that can contain Collections and Materials.

attribute type description collection List[Collection] collections that relate to the project materials List[Materials] materials owned by the project"},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"my project name\",\n\"node\":[\"Project\"],\n\"uid\":\"_:270168b7-fc29-4c37-aa93-334212e1d962\",\n\"uuid\":\"270168b7-fc29-4c37-aa93-334212e1d962\",\n\"collection\":[\n{\n\"name\":\"my collection name\",\n\"node\":[\"Collection\"],\n\"uid\":\"_:c60955a5-4de0-4da5-b2c8-77952b1d9bfa\",\n\"uuid\":\"c60955a5-4de0-4da5-b2c8-77952b1d9bfa\",\n\"experiment\":[\n{\n\"name\":\"my experiment name\",\n\"node\":[\"Experiment\"],\n\"uid\":\"_:a8cbc083-506e-45ce-bb8f-5e50917ab361\",\n\"uuid\":\"a8cbc083-506e-45ce-bb8f-5e50917ab361\"\n}\n],\n\"inventory\":[],\n\"citation\":[]\n}\n]\n}\n
Source code in src/cript/nodes/primary_nodes/project.py
class Project(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    A [Project](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=7)\n    is the highest level node that is Not nested inside any other node.\n    A Project can be thought of as a folder that can contain [Collections](../collection) and\n    [Materials](../material).\n    | attribute   | type             | description                            |\n    |-------------|------------------|----------------------------------------|\n    | collection | List[Collection] | collections that relate to the project |\n    | materials   | List[Materials]  | materials owned by the project         |\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"my project name\",\n       \"node\":[\"Project\"],\n       \"uid\":\"_:270168b7-fc29-4c37-aa93-334212e1d962\",\n       \"uuid\":\"270168b7-fc29-4c37-aa93-334212e1d962\",\n       \"collection\":[\n          {\n            \"name\":\"my collection name\",\n             \"node\":[\"Collection\"],\n             \"uid\":\"_:c60955a5-4de0-4da5-b2c8-77952b1d9bfa\",\n             \"uuid\":\"c60955a5-4de0-4da5-b2c8-77952b1d9bfa\",\n             \"experiment\":[\n                {\n                   \"name\":\"my experiment name\",\n                   \"node\":[\"Experiment\"],\n                   \"uid\":\"_:a8cbc083-506e-45ce-bb8f-5e50917ab361\",\n                   \"uuid\":\"a8cbc083-506e-45ce-bb8f-5e50917ab361\"\n                }\n             ],\n             \"inventory\":[],\n             \"citation\":[]\n          }\n       ]\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all Project attributes\n        \"\"\"\nmember: List[User] = field(default_factory=list)\nadmin: List[User] = field(default_factory=list)\ncollection: List[Collection] = field(default_factory=list)\nmaterial: List[Material] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, name: str, collection: Optional[List[Collection]] = None, material: Optional[List[Material]] = None, notes: str = \"\", **kwargs):\n\"\"\"\n        Create a Project node with Project name and Group\n        Parameters\n        ----------\n        name: str\n            project name\n        collection: List[Collection]\n            list of Collections that belongs to this Project\n         material: List[Material]\n            list of materials that belongs to this project\n        notes: str\n            notes for this project\n        Returns\n        -------\n        None\n            instantiate a Project node\n        \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif collection is None:\ncollection = []\nif material is None:\nmaterial = []\nself._json_attrs = replace(self._json_attrs, name=name, collection=collection, material=material)\nself.validate()\ndef validate(self, api=None, is_patch=False):\nfrom cript.nodes.exceptions import (\nCRIPTOrphanedMaterialError,\nget_orphaned_experiment_exception,\n)\n# First validate like other nodes\nsuper().validate(api=api, is_patch=is_patch)\n# Check graph for orphaned nodes, that should be listed in project\n# Project.materials should contain all material nodes\nproject_graph_materials = self.find_children({\"node\": [\"Material\"]})\n# Combine all materials listed in the project inventories\nproject_inventory_materials = []\nfor inventory in self.find_children({\"node\": [\"Inventory\"]}):\nfor material in inventory.material:\nproject_inventory_materials.append(material)\nfor material in project_graph_materials:\nif material not in self.material and material not in project_inventory_materials:\nraise CRIPTOrphanedMaterialError(material)\n# Check graph for orphaned nodes, that should be listed in the experiments\nproject_experiments = self.find_children({\"node\": [\"Experiment\"]})\n# There are 4 different types of nodes Experiments are collecting.\nnode_types = (\"Process\", \"Computation\", \"ComputationProcess\", \"Data\")\n# We loop over them with the same logic\nfor node_type in node_types:\n# All in the graph has to be in at least one experiment\nproject_graph_nodes = self.find_children({\"node\": [node_type]})\nnode_type_attr = node_type.lower()\n# Non-consistent naming makes this necessary for Computation Process\nif node_type == \"ComputationProcess\":\nnode_type_attr = \"computation_process\"\n# Concatenation of all experiment attributes (process, computation, etc.)\n# Every node of the graph must be present somewhere in this concatenated list.\nexperiment_nodes = []\nfor experiment in project_experiments:\nfor ex_node in getattr(experiment, node_type_attr):\nexperiment_nodes.append(ex_node)\nfor node in project_graph_nodes:\nif node not in experiment_nodes:\nraise get_orphaned_experiment_exception(node)\n@property\n@beartype\ndef member(self) -> List[User]:\nreturn self._json_attrs.member.copy()\n@property\n@beartype\ndef admin(self) -> List[User]:\nreturn self._json_attrs.admin\n@property\n@beartype\ndef collection(self) -> List[Collection]:\n\"\"\"\n        Collection is a Project node's property that can be set during creation in the constructor\n        or later by setting the project's property\n        Examples\n        --------\n        ```python\n        my_new_collection = cript.Collection(\n            name=\"my collection name\", experiments=[my_experiment_node]\n        )\n        my_project.collection = my_new_collection\n        ```\n        Returns\n        -------\n        Collection: List[Collection]\n            the list of collections within this project\n        \"\"\"\nreturn self._json_attrs.collection\n@collection.setter\n@beartype\ndef collection(self, new_collection: List[Collection]) -> None:\n\"\"\"\n        set list of collections for the project node\n        Parameters\n        ----------\n        new_collection: List[Collection]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, collection=new_collection)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef material(self) -> List[Material]:\n\"\"\"\n        List of Materials that belong to this Project.\n        Examples\n        --------\n        ```python\n        identifiers = [{\"alternative_names\": \"my material alternative name\"}]\n        my_material = cript.Material(name=\"my material\", identifiers=identifiers)\n        my_project.material = [my_material]\n        ```\n        Returns\n        -------\n        Material: List[Material]\n            List of materials that belongs to this project\n        \"\"\"\nreturn self._json_attrs.material\n@material.setter\n@beartype\ndef material(self, new_materials: List[Material]) -> None:\n\"\"\"\n        set the list of materials for this project\n        Parameters\n        ----------\n        new_materials: List[Material]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, material=new_materials)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project.collection","title":"collection: List[Collection] property writable","text":"

Collection is a Project node's property that can be set during creation in the constructor or later by setting the project's property

Examples:

my_new_collection = cript.Collection(\nname=\"my collection name\", experiments=[my_experiment_node]\n)\nmy_project.collection = my_new_collection\n

Returns:

Name Type Description Collection List[Collection]

the list of collections within this project

"},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project.material","title":"material: List[Material] property writable","text":"

List of Materials that belong to this Project.

Examples:

identifiers = [{\"alternative_names\": \"my material alternative name\"}]\nmy_material = cript.Material(name=\"my material\", identifiers=identifiers)\nmy_project.material = [my_material]\n

Returns:

Name Type Description Material List[Material]

List of materials that belongs to this project

"},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all Project attributes

Source code in src/cript/nodes/primary_nodes/project.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all Project attributes\n    \"\"\"\nmember: List[User] = field(default_factory=list)\nadmin: List[User] = field(default_factory=list)\ncollection: List[Collection] = field(default_factory=list)\nmaterial: List[Material] = field(default_factory=list)\n
"},{"location":"nodes/primary_nodes/project/#cript.nodes.primary_nodes.project.Project.__init__","title":"__init__(name, collection=None, material=None, notes='', **kwargs)","text":"

Create a Project node with Project name and Group

Parameters:

Name Type Description Default name str

project name

required collection Optional[List[Collection]]

list of Collections that belongs to this Project material: List[Material] list of materials that belongs to this project

None notes str

notes for this project

''

Returns:

Type Description None

instantiate a Project node

Source code in src/cript/nodes/primary_nodes/project.py
@beartype\ndef __init__(self, name: str, collection: Optional[List[Collection]] = None, material: Optional[List[Material]] = None, notes: str = \"\", **kwargs):\n\"\"\"\n    Create a Project node with Project name and Group\n    Parameters\n    ----------\n    name: str\n        project name\n    collection: List[Collection]\n        list of Collections that belongs to this Project\n     material: List[Material]\n        list of materials that belongs to this project\n    notes: str\n        notes for this project\n    Returns\n    -------\n    None\n        instantiate a Project node\n    \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\nif collection is None:\ncollection = []\nif material is None:\nmaterial = []\nself._json_attrs = replace(self._json_attrs, name=name, collection=collection, material=material)\nself.validate()\n
"},{"location":"nodes/primary_nodes/reference/","title":"Reference","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.Reference--definition","title":"Definition","text":"

The Reference node

contains the metadata for a literature publication, book, or anything external to CRIPT. The reference node does NOT contain the base attributes.

The reference node is always used inside the citation sub-object to enable users to specify the context of the reference.

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.Reference--attributes","title":"Attributes","text":"attribute type example description required vocab type str journal_article type of literature True True title str 'Living' Polymers title of publication True author list[str] Michael Szwarc list of authors journal str Nature journal of the publication publisher str Springer publisher of publication year int 1956 year of publication volume int 178 volume of publication issue int 0 issue of publication pages list[int] [1168, 1169] page range of publication doi str 10.1038/1781168a0 DOI: digital object identifier Conditionally issn str 1476-4687 ISSN: international standard serial number Conditionally arxiv_id str 1501 arXiv identifier pmid int ######## PMID: PubMed ID website str https://www.nature.com/artic les/1781168a0 website where the publication can be accessed"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.Reference--available-subobjects","title":"Available Subobjects","text":"
  • None

Reference will always be public

Reference node is meant to always be public and static to allow globally link data to the reference

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.Reference--json-representation","title":"JSON Representation","text":"
{\n\"node\":[\"Reference\"],\n\"uid\":\"_:c681a947-0554-4acd-a01c-06ad76e34b87\",\n\"uuid\":\"c681a947-0554-4acd-a01c-06ad76e34b87\",\n\"author\":[\"Ludwig Schneider\",\"Marcus M\u00fcller\"],\n\"doi\":\"10.1016/j.cpc.2018.08.011\",\n\"issn\":\"0010-4655\",\n\"journal\":\"Computer Physics Communications\",\n\"pages\":[463,476],\n\"publisher\":\"Elsevier\",\n\"title\":\"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n\"type\":\"journal_article\",\n\"website\":\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n\"year\":2019\n}\n
Source code in src/cript/nodes/primary_nodes/reference.py
class Reference(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    The\n    [Reference node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=15)\n    contains the metadata for a literature publication, book, or anything external to CRIPT.\n    The reference node does NOT contain the base attributes.\n    The reference node is always used inside the citation\n    sub-object to enable users to specify the context of the reference.\n    ## Attributes\n    | attribute | type      | example                                    | description                                   | required      | vocab |\n    |-----------|-----------|--------------------------------------------|-----------------------------------------------|---------------|-------|\n    | type      | str       | journal_article                            | type of literature                            | True          | True  |\n    | title     | str       | 'Living' Polymers                          | title of publication                          | True          |       |\n    | author   | list[str] | Michael Szwarc                             | list of authors                               |               |       |\n    | journal   | str       | Nature                                     | journal of the publication                    |               |       |\n    | publisher | str       | Springer                                   | publisher of publication                      |               |       |\n    | year      | int       | 1956                                       | year of publication                           |               |       |\n    | volume    | int       | 178                                        | volume of publication                         |               |       |\n    | issue     | int       | 0                                          | issue of publication                          |               |       |\n    | pages     | list[int] | [1168, 1169]                               | page range of publication                     |               |       |\n    | doi       | str       | 10.1038/1781168a0                          | DOI: digital object identifier                | Conditionally |       |\n    | issn      | str       | 1476-4687                                  | ISSN: international standard serial number    | Conditionally |       |\n    | arxiv_id  | str       | 1501                                       | arXiv identifier                              |               |       |\n    | pmid      | int       | ########                                   | PMID: PubMed ID                               |               |       |\n    | website   | str       | https://www.nature.com/artic les/1781168a0 | website where the publication can be accessed |               |       |\n    ## Available Subobjects\n    * None\n    !!! warning \"Reference will always be public\"\n        Reference node is meant to always be public and static to allow globally link data to the reference\n    ## JSON Representation\n    ```json\n    {\n       \"node\":[\"Reference\"],\n       \"uid\":\"_:c681a947-0554-4acd-a01c-06ad76e34b87\",\n       \"uuid\":\"c681a947-0554-4acd-a01c-06ad76e34b87\",\n       \"author\":[\"Ludwig Schneider\",\"Marcus M\u00fcller\"],\n       \"doi\":\"10.1016/j.cpc.2018.08.011\",\n       \"issn\":\"0010-4655\",\n       \"journal\":\"Computer Physics Communications\",\n       \"pages\":[463,476],\n       \"publisher\":\"Elsevier\",\n       \"title\":\"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n       \"type\":\"journal_article\",\n       \"website\":\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n       \"year\":2019\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\n\"\"\"\n        all reference nodes attributes\n        all int types are also None type in case they are not present it should be properly shown as None\n        instead of a placeholder number such as 0 or -1\n        \"\"\"\ntype: str = \"\"\ntitle: str = \"\"\nauthor: List[str] = field(default_factory=list)\njournal: str = \"\"\npublisher: str = \"\"\nyear: Optional[int] = None\nvolume: Optional[int] = None\nissue: Optional[int] = None\npages: List[int] = field(default_factory=list)\ndoi: str = \"\"\nissn: str = \"\"\narxiv_id: str = \"\"\npmid: Optional[int] = None\nwebsite: str = \"\"\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\ntype: str,\ntitle: str,\nauthor: Optional[List[str]] = None,\njournal: str = \"\",\npublisher: str = \"\",\nyear: Optional[int] = None,\nvolume: Optional[int] = None,\nissue: Optional[int] = None,\npages: Optional[List[int]] = None,\ndoi: str = \"\",\nissn: str = \"\",\narxiv_id: str = \"\",\npmid: Optional[int] = None,\nwebsite: str = \"\",\n**kwargs,\n):\n\"\"\"\n        create a reference node\n        reference type must come from CRIPT controlled vocabulary\n        Parameters\n        ----------\n        type: str\n            type of literature.\n            The reference type must come from CRIPT controlled vocabulary\n        title: str\n            title of publication\n        author: List[str] default=\"\"\n            list of authors\n        journal: str default=\"\"\n            journal of publication\n        publisher: str default=\"\"\n            publisher of publication\n        year: int default=None\n            year of publication\n        volume: int default=None\n            volume of publication\n        issue: int default=None\n            issue of publication\n        pages: List[int] default=None\n            page range of publication\n        doi: str default=\"\"\n            DOI: digital object identifier\n        issn: str default=\"\"\n            ISSN: international standard serial number\n        arxiv_id: str default=\"\"\n            arXiv identifier\n        pmid: int default=None\n            PMID: PubMed ID\n        website: str default=\"\"\n            website where the publication can be accessed\n        Examples\n        --------\n        ```python\n        my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n        ```\n        Returns\n        -------\n        None\n            Instantiate a reference node\n        \"\"\"\nif author is None:\nauthor = []\nif pages is None:\npages = []\nsuper().__init__(**kwargs)\nnew_attrs = replace(self._json_attrs, type=type, title=title, author=author, journal=journal, publisher=publisher, year=year, volume=volume, issue=issue, pages=pages, doi=doi, issn=issn, arxiv_id=arxiv_id, pmid=pmid, website=website)\nself._update_json_attrs_if_valid(new_attrs)\nself.validate()\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        type of reference. The reference type must come from the CRIPT controlled vocabulary\n        Examples\n        --------\n        ```python\n        my_reference.type = \"journal_article\"\n        ```\n        Returns\n        -------\n        str\n            reference type\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_reference_type: str) -> None:\n\"\"\"\n        set the reference type attribute\n        reference type must come from the CRIPT controlled vocabulary\n        Parameters\n        ----------\n        new_reference_type: str\n        Returns\n        -------\n        None\n        \"\"\"\n# TODO validate the reference type with CRIPT controlled vocabulary\nnew_attrs = replace(self._json_attrs, type=new_reference_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef title(self) -> str:\n\"\"\"\n        title of publication\n        Examples\n        --------\n        ```python\n        my_reference.title = \"my new title\"\n        ```\n        Returns\n        -------\n        str\n            title of publication\n        \"\"\"\nreturn self._json_attrs.title\n@title.setter\n@beartype\ndef title(self, new_title: str) -> None:\n\"\"\"\n        set the title for the reference node\n        Parameters\n        ----------\n        new_title: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, title=new_title)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef author(self) -> List[str]:\n\"\"\"\n        List of authors for this reference node\n        Examples\n        --------\n        ```python\n        my_reference.author = [\"Bradley D. Olsen\", \"Dylan Walsh\"]\n        ```\n        Returns\n        -------\n        List[str]\n            list of authors\n        \"\"\"\nreturn self._json_attrs.author.copy()\n@author.setter\n@beartype\ndef author(self, new_author: List[str]) -> None:\n\"\"\"\n        set the list of authors for the reference node\n        Parameters\n        ----------\n        new_author: List[str]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, author=new_author)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef journal(self) -> str:\n\"\"\"\n        journal of publication\n        Examples\n        --------\n        ```python\n        my_reference.journal = \"my new journal\"\n        ```\n        Returns\n        -------\n        str\n            journal of publication\n        \"\"\"\nreturn self._json_attrs.journal\n@journal.setter\n@beartype\ndef journal(self, new_journal: str) -> None:\n\"\"\"\n        set the journal attribute for this reference node\n        Parameters\n        ----------\n        new_journal: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, journal=new_journal)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef publisher(self) -> str:\n\"\"\"\n        publisher for this reference node\n        Examples\n        --------\n        ```python\n        my_reference.publisher = \"my new publisher\"\n        ```\n        Returns\n        -------\n        str\n            publisher of this publication\n        \"\"\"\nreturn self._json_attrs.publisher\n@publisher.setter\n@beartype\ndef publisher(self, new_publisher: str) -> None:\n\"\"\"\n        set the publisher for this reference node\n        Parameters\n        ----------\n        new_publisher: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, publisher=new_publisher)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef year(self) -> Union[int, None]:\n\"\"\"\n        year for the scholarly work\n        Examples\n        --------\n        ```python\n        my_reference.year = 2023\n        ```\n        Returns\n        -------\n        int\n        \"\"\"\nreturn self._json_attrs.year\n@year.setter\n@beartype\ndef year(self, new_year: Union[int, None]) -> None:\n\"\"\"\n        set the year for the scholarly work within the reference node\n        Parameters\n        ----------\n        new_year: int\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, year=new_year)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef volume(self) -> Union[int, None]:\n\"\"\"\n        Volume of the scholarly work from the reference node\n        Examples\n        --------\n        ```python\n        my_reference.volume = 1\n        ```\n        Returns\n        -------\n        int\n            volume number of the publishing\n        \"\"\"\nreturn self._json_attrs.volume\n@volume.setter\n@beartype\ndef volume(self, new_volume: Union[int, None]) -> None:\n\"\"\"\n        set the volume of the scholarly work for this reference node\n        Parameters\n        ----------\n        new_volume: int\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, volume=new_volume)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef issue(self) -> Union[int, None]:\n\"\"\"\n        issue of the scholarly work for the reference node\n        Examples\n        --------\n        ```python\n        my_reference.issue = 2\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nreturn self._json_attrs.issue\n@issue.setter\n@beartype\ndef issue(self, new_issue: Union[int, None]) -> None:\n\"\"\"\n        set the issue of the scholarly work\n        Parameters\n        ----------\n        new_issue: int\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, issue=new_issue)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef pages(self) -> List[int]:\n\"\"\"\n        pages of the scholarly work used in the reference node\n        Examples\n        --------\n        ```python\n        my_reference.pages = [123, 456]\n        ```\n        Returns\n        -------\n        int\n        \"\"\"\nreturn self._json_attrs.pages.copy()\n@pages.setter\n@beartype\ndef pages(self, new_pages_list: List[int]) -> None:\n\"\"\"\n        set the list of pages of the scholarly work for this reference node\n        Parameters\n        ----------\n        new_pages_list: List[int]\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, pages=new_pages_list)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef doi(self) -> str:\n\"\"\"\n        get the digital object identifier (DOI) for this reference node\n        Examples\n        --------\n        ```python\n        my_reference.doi = \"100.1038/1781168a0\"\n        ```\n        Returns\n        -------\n        str\n            digital object identifier (DOI) for this reference node\n        \"\"\"\nreturn self._json_attrs.doi\n@doi.setter\n@beartype\ndef doi(self, new_doi: str) -> None:\n\"\"\"\n        set the digital object identifier (DOI) for the scholarly work for this reference node\n        Parameters\n        ----------\n        new_doi: str\n        Examples\n        --------\n        ```python\n        my_reference.doi = \"100.1038/1781168a0\"\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, doi=new_doi)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef issn(self) -> str:\n\"\"\"\n        The international standard serial number (ISSN) for this reference node\n        Examples\n        ```python\n        my_reference.issn = \"1456-4687\"\n        ```\n        Returns\n        -------\n        str\n            ISSN for this reference node\n        \"\"\"\nreturn self._json_attrs.issn\n@issn.setter\n@beartype\ndef issn(self, new_issn: str) -> None:\n\"\"\"\n        set the international standard serial number (ISSN) for the scholarly work for this reference node\n        Parameters\n        ----------\n        new_issn: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, issn=new_issn)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef arxiv_id(self) -> str:\n\"\"\"\n        The arXiv identifier for the scholarly work for this reference node\n        Examples\n        --------\n        ```python\n        my_reference.arxiv_id = \"1501\"\n        ```\n        Returns\n        -------\n        str\n            arXiv identifier for the scholarly work for this publishing\n        \"\"\"\nreturn self._json_attrs.arxiv_id\n@arxiv_id.setter\n@beartype\ndef arxiv_id(self, new_arxiv_id: str) -> None:\n\"\"\"\n        set the arXiv identifier for the scholarly work for this reference node\n        Parameters\n        ----------\n        new_arxiv_id: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, arxiv_id=new_arxiv_id)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef pmid(self) -> Union[int, None]:\n\"\"\"\n        The PubMed ID (PMID) for this reference node\n        Examples\n        --------\n        ```python\n        my_reference.pmid = 12345678\n        ```\n        Returns\n        -------\n        int\n            the PubMedID of this publishing\n        \"\"\"\nreturn self._json_attrs.pmid\n@pmid.setter\n@beartype\ndef pmid(self, new_pmid: Union[int, None]) -> None:\n\"\"\"\n        Parameters\n        ----------\n        new_pmid\n        Returns\n        -------\n        \"\"\"\n# TODO can possibly add validations, possibly in forms of length checking\n#  to be sure its the correct length\nnew_attrs = replace(self._json_attrs, pmid=new_pmid)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef website(self) -> str:\n\"\"\"\n        The website URL for the scholarly work\n        Examples\n        --------\n        ```python\n        my_reference.website = \"https://criptapp.org\"\n        ```\n        Returns\n        -------\n        str\n            the website URL of this publishing\n        \"\"\"\nreturn self._json_attrs.website\n@website.setter\n@beartype\ndef website(self, new_website: str) -> None:\n\"\"\"\n        set the website URL for the scholarly work\n        Parameters\n        ----------\n        new_website: str\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, website=new_website)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.arxiv_id","title":"arxiv_id: str property writable","text":"

The arXiv identifier for the scholarly work for this reference node

Examples:

my_reference.arxiv_id = \"1501\"\n

Returns:

Type Description str

arXiv identifier for the scholarly work for this publishing

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.author","title":"author: List[str] property writable","text":"

List of authors for this reference node

Examples:

my_reference.author = [\"Bradley D. Olsen\", \"Dylan Walsh\"]\n

Returns:

Type Description List[str]

list of authors

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.doi","title":"doi: str property writable","text":"

get the digital object identifier (DOI) for this reference node

Examples:

my_reference.doi = \"100.1038/1781168a0\"\n

Returns:

Type Description str

digital object identifier (DOI) for this reference node

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.issn","title":"issn: str property writable","text":"

The international standard serial number (ISSN) for this reference node

Examples

my_reference.issn = \"1456-4687\"\n

Returns:

Type Description str

ISSN for this reference node

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.issue","title":"issue: Union[int, None] property writable","text":"

issue of the scholarly work for the reference node

Examples:

my_reference.issue = 2\n

Returns:

Type Description None"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.journal","title":"journal: str property writable","text":"

journal of publication

Examples:

my_reference.journal = \"my new journal\"\n

Returns:

Type Description str

journal of publication

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.pages","title":"pages: List[int] property writable","text":"

pages of the scholarly work used in the reference node

Examples:

my_reference.pages = [123, 456]\n

Returns:

Type Description int"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.pmid","title":"pmid: Union[int, None] property writable","text":"

The PubMed ID (PMID) for this reference node

Examples:

my_reference.pmid = 12345678\n

Returns:

Type Description int

the PubMedID of this publishing

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.publisher","title":"publisher: str property writable","text":"

publisher for this reference node

Examples:

my_reference.publisher = \"my new publisher\"\n

Returns:

Type Description str

publisher of this publication

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.title","title":"title: str property writable","text":"

title of publication

Examples:

my_reference.title = \"my new title\"\n

Returns:

Type Description str

title of publication

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.type","title":"type: str property writable","text":"

type of reference. The reference type must come from the CRIPT controlled vocabulary

Examples:

my_reference.type = \"journal_article\"\n

Returns:

Type Description str

reference type

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.volume","title":"volume: Union[int, None] property writable","text":"

Volume of the scholarly work from the reference node

Examples:

my_reference.volume = 1\n

Returns:

Type Description int

volume number of the publishing

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.website","title":"website: str property writable","text":"

The website URL for the scholarly work

Examples:

my_reference.website = \"https://criptapp.org\"\n

Returns:

Type Description str

the website URL of this publishing

"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.year","title":"year: Union[int, None] property writable","text":"

year for the scholarly work

Examples:

my_reference.year = 2023\n

Returns:

Type Description int"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: UUIDBaseNode.JsonAttributes

all reference nodes attributes

all int types are also None type in case they are not present it should be properly shown as None instead of a placeholder number such as 0 or -1

Source code in src/cript/nodes/primary_nodes/reference.py
@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\n\"\"\"\n    all reference nodes attributes\n    all int types are also None type in case they are not present it should be properly shown as None\n    instead of a placeholder number such as 0 or -1\n    \"\"\"\ntype: str = \"\"\ntitle: str = \"\"\nauthor: List[str] = field(default_factory=list)\njournal: str = \"\"\npublisher: str = \"\"\nyear: Optional[int] = None\nvolume: Optional[int] = None\nissue: Optional[int] = None\npages: List[int] = field(default_factory=list)\ndoi: str = \"\"\nissn: str = \"\"\narxiv_id: str = \"\"\npmid: Optional[int] = None\nwebsite: str = \"\"\n
"},{"location":"nodes/primary_nodes/reference/#cript.nodes.primary_nodes.reference.Reference.__init__","title":"__init__(type, title, author=None, journal='', publisher='', year=None, volume=None, issue=None, pages=None, doi='', issn='', arxiv_id='', pmid=None, website='', **kwargs)","text":"

create a reference node

reference type must come from CRIPT controlled vocabulary

Parameters:

Name Type Description Default type str

type of literature. The reference type must come from CRIPT controlled vocabulary

required title str

title of publication

required author Optional[List[str]]

list of authors

None journal str

journal of publication

'' publisher str

publisher of publication

'' year Optional[int]

year of publication

None volume Optional[int]

volume of publication

None issue Optional[int]

issue of publication

None pages Optional[List[int]]

page range of publication

None doi str

DOI: digital object identifier

'' issn str

ISSN: international standard serial number

'' arxiv_id str

arXiv identifier

'' pmid Optional[int]

PMID: PubMed ID

None website str

website where the publication can be accessed

''

Examples:

my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n

Returns:

Type Description None

Instantiate a reference node

Source code in src/cript/nodes/primary_nodes/reference.py
@beartype\ndef __init__(\nself,\ntype: str,\ntitle: str,\nauthor: Optional[List[str]] = None,\njournal: str = \"\",\npublisher: str = \"\",\nyear: Optional[int] = None,\nvolume: Optional[int] = None,\nissue: Optional[int] = None,\npages: Optional[List[int]] = None,\ndoi: str = \"\",\nissn: str = \"\",\narxiv_id: str = \"\",\npmid: Optional[int] = None,\nwebsite: str = \"\",\n**kwargs,\n):\n\"\"\"\n    create a reference node\n    reference type must come from CRIPT controlled vocabulary\n    Parameters\n    ----------\n    type: str\n        type of literature.\n        The reference type must come from CRIPT controlled vocabulary\n    title: str\n        title of publication\n    author: List[str] default=\"\"\n        list of authors\n    journal: str default=\"\"\n        journal of publication\n    publisher: str default=\"\"\n        publisher of publication\n    year: int default=None\n        year of publication\n    volume: int default=None\n        volume of publication\n    issue: int default=None\n        issue of publication\n    pages: List[int] default=None\n        page range of publication\n    doi: str default=\"\"\n        DOI: digital object identifier\n    issn: str default=\"\"\n        ISSN: international standard serial number\n    arxiv_id: str default=\"\"\n        arXiv identifier\n    pmid: int default=None\n        PMID: PubMed ID\n    website: str default=\"\"\n        website where the publication can be accessed\n    Examples\n    --------\n    ```python\n    my_reference = cript.Reference(type=\"journal_article\", title=\"'Living' Polymers\")\n    ```\n    Returns\n    -------\n    None\n        Instantiate a reference node\n    \"\"\"\nif author is None:\nauthor = []\nif pages is None:\npages = []\nsuper().__init__(**kwargs)\nnew_attrs = replace(self._json_attrs, type=type, title=title, author=author, journal=journal, publisher=publisher, year=year, volume=volume, issue=issue, pages=pages, doi=doi, issn=issn, arxiv_id=arxiv_id, pmid=pmid, website=website)\nself._update_json_attrs_if_valid(new_attrs)\nself.validate()\n
"},{"location":"nodes/primary_nodes/software/","title":"Software","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/primary_nodes/software/#cript.Software--definition","title":"Definition","text":"

The Software node contains metadata for a computation tool, code, programming language, or software package.

Similar to the reference node, the software node does not contain the base attributes and is meant to always be public and static.

"},{"location":"nodes/primary_nodes/software/#cript.Software--can-be-added-to","title":"Can Be Added To:","text":"
  • Software_Configuration
"},{"location":"nodes/primary_nodes/software/#cript.Software--available-sub-objects","title":"Available sub-objects","text":"
  • None
"},{"location":"nodes/primary_nodes/software/#cript.Software--attributes","title":"Attributes","text":"attribute type example description required vocab name str LAMMPS type of literature True version str 23Jun22 software version True source str lammps.org source of software"},{"location":"nodes/primary_nodes/software/#cript.Software--json-representation","title":"JSON Representation","text":"
{\n\"name\":\"SOMA\",\n\"node\":[\"Software\"],\n\"version\":\"0.7.0\"\n\"source\":\"https://gitlab.com/InnocentBug/SOMA\",\n\"uid\":\"_:f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b\",\n\"uuid\":\"f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b\",\n}\n
Source code in src/cript/nodes/subobjects/software.py
class Software(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    The [Software](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=16)\n    node contains metadata for a computation tool, code, programming language, or software package.\n    Similar to the [reference](../../primary_nodes/reference) node, the software node does not contain the base\n    attributes and is meant to always be public and static.\n    ---\n    ## Can Be Added To:\n    * [Software_Configuration](../../subobjects/software_configuration)\n    ## Available sub-objects\n    * None\n    ---\n    ## Attributes\n    | attribute | type | example    | description                   | required | vocab |\n    |-----------|------|------------|-------------------------------|----------|-------|\n    | name      | str  | LAMMPS     | type of literature            | True     |       |\n    | version   | str  | 23Jun22    | software version              | True     |       |\n    | source    | str  | lammps.org | source of software            |          |       |\n    ## JSON Representation\n    ```json\n    {\n       \"name\":\"SOMA\",\n       \"node\":[\"Software\"],\n       \"version\":\"0.7.0\"\n       \"source\":\"https://gitlab.com/InnocentBug/SOMA\",\n       \"uid\":\"_:f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b\",\n       \"uuid\":\"f2ec4bf2-96aa-48a3-bfbc-d1d3f090583b\",\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nname: str = \"\"\nversion: str = \"\"\nsource: str = \"\"\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, name: str, version: str, source: str = \"\", **kwargs):\n\"\"\"\n        create Software node\n        Parameters\n        ----------\n        name : str\n            Software name\n        version : str\n            Software version\n        source : str, optional\n            Software source, by default \"\"\n        Examples\n        --------\n        ```python\n        my_software = cript.Software(\n            name=\"my software name\", version=\"v1.0.0\", source=\"https://myurl.com\"\n        )\n        ```\n        Returns\n        -------\n        None\n            create Software node\n        \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, name=name, version=version, source=source)\nself.validate()\n@property\n@beartype\ndef name(self) -> str:\n\"\"\"\n        Software name\n        Examples\n        --------\n        ```python\n        my_software.name = \"my software name\"\n        ```\n        Returns\n        -------\n        str\n            Software name\n        \"\"\"\nreturn self._json_attrs.name\n@name.setter\n@beartype\ndef name(self, new_name: str) -> None:\n\"\"\"\n        set the name of the Software node\n        Parameters\n        ----------\n        new_name : str\n            new Software name\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attr = replace(self._json_attrs, name=new_name)\nself._update_json_attrs_if_valid(new_attr)\n@property\n@beartype\ndef version(self) -> str:\n\"\"\"\n        Software version\n        my_software.version = \"1.2.3\"\n        Returns\n        -------\n        str\n            Software version\n        \"\"\"\nreturn self._json_attrs.version\n@version.setter\n@beartype\ndef version(self, new_version: str) -> None:\n\"\"\"\n        set the Software version\n        Parameters\n        ----------\n        new_version : str\n            new Software version\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attr = replace(self._json_attrs, version=new_version)\nself._update_json_attrs_if_valid(new_attr)\n@property\n@beartype\ndef source(self) -> str:\n\"\"\"\n        Software source\n        Examples\n        --------\n        ```python\n        my_software.source = \"https://mywebsite.com\"\n        ```\n        Returns\n        -------\n        str\n            Software source\n        \"\"\"\nreturn self._json_attrs.source\n@source.setter\n@beartype\ndef source(self, new_source: str) -> None:\n\"\"\"\n        set the Software source\n        Parameters\n        ----------\n        new_source : str\n            new Software source\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attr = replace(self._json_attrs, source=new_source)\nself._update_json_attrs_if_valid(new_attr)\n
"},{"location":"nodes/primary_nodes/software/#cript.nodes.subobjects.software.Software.name","title":"name: str property writable","text":"

Software name

Examples:

my_software.name = \"my software name\"\n

Returns:

Type Description str

Software name

"},{"location":"nodes/primary_nodes/software/#cript.nodes.subobjects.software.Software.source","title":"source: str property writable","text":"

Software source

Examples:

my_software.source = \"https://mywebsite.com\"\n

Returns:

Type Description str

Software source

"},{"location":"nodes/primary_nodes/software/#cript.nodes.subobjects.software.Software.version","title":"version: str property writable","text":"

Software version

my_software.version = \"1.2.3\"

Returns:

Type Description str

Software version

"},{"location":"nodes/primary_nodes/software/#cript.nodes.subobjects.software.Software.__init__","title":"__init__(name, version, source='', **kwargs)","text":"

create Software node

Parameters:

Name Type Description Default name str

Software name

required version str

Software version

required source str

Software source, by default \"\"

''

Examples:

my_software = cript.Software(\nname=\"my software name\", version=\"v1.0.0\", source=\"https://myurl.com\"\n)\n

Returns:

Type Description None

create Software node

Source code in src/cript/nodes/subobjects/software.py
@beartype\ndef __init__(self, name: str, version: str, source: str = \"\", **kwargs):\n\"\"\"\n    create Software node\n    Parameters\n    ----------\n    name : str\n        Software name\n    version : str\n        Software version\n    source : str, optional\n        Software source, by default \"\"\n    Examples\n    --------\n    ```python\n    my_software = cript.Software(\n        name=\"my software name\", version=\"v1.0.0\", source=\"https://myurl.com\"\n    )\n    ```\n    Returns\n    -------\n    None\n        create Software node\n    \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, name=name, version=version, source=source)\nself.validate()\n
"},{"location":"nodes/subobjects/algorithm/","title":"Algorithm","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.Algorithm--definition","title":"Definition","text":"

An algorithm sub-object is a set of instructions that define a computational process. An algorithm consists of parameters that are used in the computation and the computational process itself.

"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.Algorithm--attributes","title":"Attributes","text":"Keys Type Example Description Required Vocab key str ensemble, thermo-barostat system configuration, algorithms used in a computation True True type str NPT for ensemble, Nose-Hoover for thermostat specific type of configuration, algorithm True parameter list[Parameter] setup associated parameters citation Citation reference to a book, paper, or scholarly work"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.Algorithm--available-sub-objects","title":"Available sub-objects","text":"
  • Parameter
  • Citation
"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.Algorithm--json-representation","title":"JSON Representation","text":"
{\n\"node\": [\"Algorithm\"],\n\"key\": \"mc_barostat\",\n\"type\": \"barostat\",\n\"parameter\": {\n\"node\": [\"Parameter\"],\n\"key\": \"update_frequency\",\n\"value\": 1000.0,\n\"unit\": \"1/second\"\n},\n\"citation\": {\n\"node\": [\"Citation\"],\n\"type\": \"reference\"\n\"reference\": {\n\"node\": [\"Reference\"],\n\"type\": \"journal_article\",\n\"title\": \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n\"author\": [\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n\"journal\": \"Computer Physics Communications\",\n\"publisher\": \"Elsevier\",\n\"year\": 2019,\n\"pages\": [463, 476],\n\"doi\": \"10.1016/j.cpc.2018.08.011\",\n\"issn\": \"0010-4655\",\n\"website\": \"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n},\n},\n}\n
Source code in src/cript/nodes/subobjects/algorithm.py
class Algorithm(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    An [algorithm sub-object](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=25)\n    is a set of instructions that define a computational process.\n    An algorithm consists of parameters that are used in the computation and the computational process itself.\n    ## Attributes\n    | Keys      | Type            | Example                                      | Description                                            | Required | Vocab |\n    |-----------|-----------------|----------------------------------------------|--------------------------------------------------------|----------|-------|\n    | key       | str             | ensemble, thermo-barostat                    | system configuration, algorithms used in a computation | True     | True  |\n    | type      | str             | NPT for ensemble, Nose-Hoover for thermostat | specific type of configuration, algorithm              | True     |       |\n    | parameter | list[Parameter] |                                              | setup associated parameters                            |          |       |\n    | citation  | Citation        |                                              | reference to a book, paper, or scholarly work          |          |       |\n    ## Available sub-objects\n    * [Parameter](../parameter)\n    * [Citation](../citation)\n    ## JSON Representation\n    ```json\n    {\n        \"node\": [\"Algorithm\"],\n        \"key\": \"mc_barostat\",\n        \"type\": \"barostat\",\n        \"parameter\": {\n            \"node\": [\"Parameter\"],\n            \"key\": \"update_frequency\",\n            \"value\": 1000.0,\n            \"unit\": \"1/second\"\n        },\n        \"citation\": {\n            \"node\": [\"Citation\"],\n            \"type\": \"reference\"\n            \"reference\": {\n                    \"node\": [\"Reference\"],\n                    \"type\": \"journal_article\",\n                    \"title\": \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n                    \"author\": [\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n                    \"journal\": \"Computer Physics Communications\",\n                    \"publisher\": \"Elsevier\",\n                    \"year\": 2019,\n                    \"pages\": [463, 476],\n                    \"doi\": \"10.1016/j.cpc.2018.08.011\",\n                    \"issn\": \"0010-4655\",\n                    \"website\": \"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n            },\n        },\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\ntype: str = \"\"\nparameter: List[Parameter] = field(default_factory=list)\ncitation: List[Citation] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\ndef __init__(self, key: str, type: str, parameter: Optional[List[Parameter]] = None, citation: Optional[List[Citation]] = None, **kwargs):  # ignored\n\"\"\"\n        create algorithm sub-object\n        Parameters\n        ----------\n        key : str\n            algorithm key must come from [CRIPT controlled vocabulary]()\n        type : str\n            algorithm type must come from [CRIPT controlled vocabulary]()\n        parameter : List[Parameter], optional\n            parameter sub-object, by default None\n        citation : List[Citation], optional\n            citation sub-object, by default None\n        Examples\n        --------\n        ```python\n        # create algorithm sub-object\n        algorithm = cript.Algorithm(key=\"mc_barostat\", type=\"barostat\")\n        ```\n        Returns\n        -------\n        None\n            instantiate an algorithm node\n        \"\"\"\nif parameter is None:\nparameter = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, type=type, parameter=parameter)\nself.validate()\n@property\ndef key(self) -> str:\n\"\"\"\n        Algorithm key\n        > Algorithm key must come from [CRIPT controlled vocabulary]()\n        Examples\n        --------\n        ```python\n        algorithm.key = \"amorphous_cell_module\"\n        ```\n        Returns\n        -------\n        str\n            algorithm key\n        \"\"\"\nreturn self._json_attrs.key\n@key.setter\ndef key(self, new_key: str) -> None:\n\"\"\"\n        set the algorithm key\n        > Algorithm key must come from [CRIPT Controlled Vocabulary]()\n        Parameters\n        ----------\n        new_key : str\n            algorithm key\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n@property\ndef type(self) -> str:\n\"\"\"\n        Algorithm type\n        > Algorithm type must come from [CRIPT controlled vocabulary]()\n        Returns\n        -------\n        str\n            algorithm type\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\ndef type(self, new_type: str) -> None:\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\ndef parameter(self) -> List[Parameter]:\n\"\"\"\n        list of [Parameter](../parameter) sub-objects for the algorithm sub-object\n        Examples\n        --------\n        ```python\n        # create parameter sub-object\n        my_parameter = [\n            cript.Parameter(\"update_frequency\", 1000.0, \"1/second\")\n            cript.Parameter(\"damping_time\", 1.0, \"second\")\n        ]\n        # add parameter sub-object to algorithm sub-object\n        algorithm.parameter = my_parameter\n        ```\n        Returns\n        -------\n        List[Parameter]\n            list of parameters for the algorithm sub-object\n        \"\"\"\nreturn self._json_attrs.parameter.copy()\n@parameter.setter\ndef parameter(self, new_parameter: List[Parameter]) -> None:\n\"\"\"\n        set a list of cript.Parameter sub-objects\n        Parameters\n        ----------\n        new_parameter : List[Parameter]\n            list of Parameter sub-objects for the algorithm sub-object\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, parameter=new_parameter)\nself._update_json_attrs_if_valid(new_attrs)\n@property\ndef citation(self) -> Citation:\n\"\"\"\n        [citation](../citation) subobject for algorithm subobject\n        Examples\n        --------\n        ```python\n        title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n        title += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n        # create reference node\n        my_reference = cript.Reference(\n            type=\"journal_article\",\n            title=title,\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        # create citation sub-object and add reference to it\n        my_citation = cript.Citation(type=\"reference, reference==my_reference)\n        # add citation to algorithm node\n        algorithm.citation = my_citation\n        ```\n        Returns\n        -------\n        citation node: Citation\n            get the algorithm citation node\n        \"\"\"\nreturn self._json_attrs.citation.copy()  # type: ignore\n@citation.setter\ndef citation(self, new_citation: Citation) -> None:\n\"\"\"\n        set the algorithm citation subobject\n        Parameters\n        ----------\n        new_citation : Citation\n            new citation subobject to replace the current\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.algorithm.Algorithm.citation","title":"citation: Citation property writable","text":"

citation subobject for algorithm subobject

Examples:

title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\ntitle += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n# create reference node\nmy_reference = cript.Reference(\ntype=\"journal_article\",\ntitle=title,\nauthor=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\njournal=\"Computer Physics Communications\",\npublisher=\"Elsevier\",\nyear=2019,\npages=[463, 476],\ndoi=\"10.1016/j.cpc.2018.08.011\",\nissn=\"0010-4655\",\nwebsite=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n)\n# create citation sub-object and add reference to it\nmy_citation = cript.Citation(type=\"reference, reference==my_reference)\n# add citation to algorithm node\nalgorithm.citation = my_citation\n

Returns:

Type Description citation node: Citation

get the algorithm citation node

"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.algorithm.Algorithm.key","title":"key: str property writable","text":"

Algorithm key

Algorithm key must come from CRIPT controlled vocabulary

Examples:

algorithm.key = \"amorphous_cell_module\"\n

Returns:

Type Description str

algorithm key

"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.algorithm.Algorithm.parameter","title":"parameter: List[Parameter] property writable","text":"

list of Parameter sub-objects for the algorithm sub-object

Examples:

# create parameter sub-object\nmy_parameter = [\ncript.Parameter(\"update_frequency\", 1000.0, \"1/second\")\ncript.Parameter(\"damping_time\", 1.0, \"second\")\n]\n# add parameter sub-object to algorithm sub-object\nalgorithm.parameter = my_parameter\n

Returns:

Type Description List[Parameter]

list of parameters for the algorithm sub-object

"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.algorithm.Algorithm.type","title":"type: str property writable","text":"

Algorithm type

Algorithm type must come from CRIPT controlled vocabulary

Returns:

Type Description str

algorithm type

"},{"location":"nodes/subobjects/algorithm/#cript.nodes.subobjects.algorithm.Algorithm.__init__","title":"__init__(key, type, parameter=None, citation=None, **kwargs)","text":"

create algorithm sub-object

Parameters:

Name Type Description Default key str

algorithm key must come from CRIPT controlled vocabulary

required type str

algorithm type must come from CRIPT controlled vocabulary

required parameter List[Parameter]

parameter sub-object, by default None

None citation List[Citation]

citation sub-object, by default None

None

Examples:

# create algorithm sub-object\nalgorithm = cript.Algorithm(key=\"mc_barostat\", type=\"barostat\")\n

Returns:

Type Description None

instantiate an algorithm node

Source code in src/cript/nodes/subobjects/algorithm.py
def __init__(self, key: str, type: str, parameter: Optional[List[Parameter]] = None, citation: Optional[List[Citation]] = None, **kwargs):  # ignored\n\"\"\"\n    create algorithm sub-object\n    Parameters\n    ----------\n    key : str\n        algorithm key must come from [CRIPT controlled vocabulary]()\n    type : str\n        algorithm type must come from [CRIPT controlled vocabulary]()\n    parameter : List[Parameter], optional\n        parameter sub-object, by default None\n    citation : List[Citation], optional\n        citation sub-object, by default None\n    Examples\n    --------\n    ```python\n    # create algorithm sub-object\n    algorithm = cript.Algorithm(key=\"mc_barostat\", type=\"barostat\")\n    ```\n    Returns\n    -------\n    None\n        instantiate an algorithm node\n    \"\"\"\nif parameter is None:\nparameter = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, type=type, parameter=parameter)\nself.validate()\n
"},{"location":"nodes/subobjects/citation/","title":"Citation","text":""},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation","title":"Citation","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--definition","title":"Definition","text":"

The Citation sub-object essentially houses Reference nodes. The citation subobject can then be added to CRIPT Primary nodes.

"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--attributes","title":"Attributes","text":"attribute type example description required vocab type str derived_from key for identifier True True reference Reference reference to a book, paper, or scholarly work True"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--can-be-added-to","title":"Can Be Added To","text":""},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--primary-nodes","title":"Primary Nodes","text":"
  • Collection node
  • Computation node
  • Computation Process Node
  • Data node
"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--subobjects","title":"Subobjects","text":"
  • Computational Forcefield subobjects
  • Property subobject
  • Algorithm subobject
  • Equipment subobject
"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--available-subobjects","title":"Available Subobjects","text":"
  • None
"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation--json-representation","title":"JSON Representation","text":"
\"citation\": {\n\"node\": [\"Citation\"],\n\"type\": \"reference\",\n\"reference\": {\n\"node\": [\"Reference\"],\n\"type\": \"journal_article\",\n\"title\": \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n\"author\": [\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n\"journal\": \"Computer Physics Communications\",\n\"publisher\": \"Elsevier\",\n\"year\": 2019,\n\"pages\": [463, 476],\n\"doi\": \"10.1016/j.cpc.2018.08.011\",\n\"issn\": \"0010-4655\",\n\"website\": \"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n},\n}\n
Source code in src/cript/nodes/subobjects/citation.py
class Citation(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    The [Citation sub-object](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=26)\n    essentially houses [Reference nodes](../../primary_nodes/reference). The citation subobject can then be added to CRIPT Primary nodes.\n    ## Attributes\n    | attribute | type      | example      | description                                   | required | vocab |\n    |-----------|-----------|--------------|-----------------------------------------------|----------|-------|\n    | type      | str       | derived_from | key for identifier                            | True     | True  |\n    | reference | Reference |              | reference to a book, paper, or scholarly work | True     |       |\n    ## Can Be Added To\n    ### Primary Nodes\n    * [Collection node](../../primary_nodes/collection)\n    * [Computation node](../../primary_nodes/computation)\n    * [Computation Process Node](../../primary_nodes/computation_process)\n    * [Data node](../../primary_nodes/data)\n    ### Subobjects\n    * [Computational Forcefield subobjects](../computational_forcefield)\n    * [Property subobject](../property)\n    * [Algorithm subobject](../algorithm)\n    * [Equipment subobject](../equipment)\n    ---\n    ## Available Subobjects\n    * `None`\n    ## JSON Representation\n    ```json\n    \"citation\": {\n            \"node\": [\"Citation\"],\n            \"type\": \"reference\",\n            \"reference\": {\n                    \"node\": [\"Reference\"],\n                    \"type\": \"journal_article\",\n                    \"title\": \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n                    \"author\": [\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n                    \"journal\": \"Computer Physics Communications\",\n                    \"publisher\": \"Elsevier\",\n                    \"year\": 2019,\n                    \"pages\": [463, 476],\n                    \"doi\": \"10.1016/j.cpc.2018.08.011\",\n                    \"issn\": \"0010-4655\",\n                    \"website\": \"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n            },\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\ntype: str = \"\"\nreference: Optional[Reference] = None\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, type: str, reference: Reference, **kwargs):\n\"\"\"\n        create a Citation subobject\n        Parameters\n        ----------\n        type : citation type\n            citation type must come from [CRIPT Controlled Vocabulary]()\n        reference : Reference\n            Reference node\n        Examples\n        -------\n        ```python\n        title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n        title += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n        # create a Reference node for the Citation subobject\n        my_reference = Reference(\n            \"journal_article\",\n            title=title,\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        # create Citation subobject\n        my_citation = cript.Citation(\"reference\", my_reference)\n        ```\n        Returns\n        -------\n        None\n            Instantiate citation subobject\n        \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, type=type, reference=reference)\nself.validate()\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        Citation type subobject\n        > Note: Citation type must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_citation.type = \"extracted_by_algorithm\"\n        ```\n        Returns\n        -------\n        str\n            Citation type\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_type: str) -> None:\n\"\"\"\n        set the citation subobject type\n        > Note: citation subobject must come from [CRIPT Controlled Vocabulary]()\n        Parameters\n        ----------\n        new_type : str\n            citation type\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef reference(self) -> Union[Reference, None]:\n\"\"\"\n        citation reference node\n        Examples\n        --------\n        ```python\n        # create a Reference node for the Citation subobject\n        my_reference = Reference(\n            \"journal_article\",\n            title=\"my title\",\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        my_citation.reference = my_reference\n        ```\n        Returns\n        -------\n        Reference\n            Reference node\n        \"\"\"\nreturn self._json_attrs.reference\n@reference.setter\n@beartype\ndef reference(self, new_reference: Reference) -> None:\n\"\"\"\n        replace the current Reference node for the citation subobject\n        Parameters\n        ----------\n        new_reference : Reference\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, reference=new_reference)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation.reference","title":"reference: Union[Reference, None] property writable","text":"

citation reference node

Examples:

# create a Reference node for the Citation subobject\nmy_reference = Reference(\n\"journal_article\",\ntitle=\"my title\",\nauthor=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\njournal=\"Computer Physics Communications\",\npublisher=\"Elsevier\",\nyear=2019,\npages=[463, 476],\ndoi=\"10.1016/j.cpc.2018.08.011\",\nissn=\"0010-4655\",\nwebsite=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n)\nmy_citation.reference = my_reference\n

Returns:

Type Description Reference

Reference node

"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation.type","title":"type: str property writable","text":"

Citation type subobject

Note: Citation type must come from CRIPT Controlled Vocabulary

Examples:

my_citation.type = \"extracted_by_algorithm\"\n

Returns:

Type Description str

Citation type

"},{"location":"nodes/subobjects/citation/#cript.nodes.subobjects.citation.Citation.__init__","title":"__init__(type, reference, **kwargs)","text":"

create a Citation subobject

Parameters:

Name Type Description Default type citation type

citation type must come from CRIPT Controlled Vocabulary

required reference Reference

Reference node

required

Examples:

title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\ntitle += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n# create a Reference node for the Citation subobject\nmy_reference = Reference(\n\"journal_article\",\ntitle=title,\nauthor=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\njournal=\"Computer Physics Communications\",\npublisher=\"Elsevier\",\nyear=2019,\npages=[463, 476],\ndoi=\"10.1016/j.cpc.2018.08.011\",\nissn=\"0010-4655\",\nwebsite=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n)\n# create Citation subobject\nmy_citation = cript.Citation(\"reference\", my_reference)\n

Returns:

Type Description None

Instantiate citation subobject

Source code in src/cript/nodes/subobjects/citation.py
@beartype\ndef __init__(self, type: str, reference: Reference, **kwargs):\n\"\"\"\n    create a Citation subobject\n    Parameters\n    ----------\n    type : citation type\n        citation type must come from [CRIPT Controlled Vocabulary]()\n    reference : Reference\n        Reference node\n    Examples\n    -------\n    ```python\n    title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n    title += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n    # create a Reference node for the Citation subobject\n    my_reference = Reference(\n        \"journal_article\",\n        title=title,\n        author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n        journal=\"Computer Physics Communications\",\n        publisher=\"Elsevier\",\n        year=2019,\n        pages=[463, 476],\n        doi=\"10.1016/j.cpc.2018.08.011\",\n        issn=\"0010-4655\",\n        website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n    )\n    # create Citation subobject\n    my_citation = cript.Citation(\"reference\", my_reference)\n    ```\n    Returns\n    -------\n    None\n        Instantiate citation subobject\n    \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, type=type, reference=reference)\nself.validate()\n
"},{"location":"nodes/subobjects/computational_forcefield/","title":"Computational Forcefield","text":""},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield","title":"ComputationalForcefield","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield--definition","title":"Definition","text":"

A Computational Forcefield Subobject is a mathematical model that describes the forces between atoms and molecules. It is used in computational chemistry and molecular dynamics simulations to predict the behavior of materials. Forcefields are typically based on experimental data or quantum mechanical calculations, and they are often used to study the properties of materials such as their structure, dynamics, and reactivity.

"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield--attributes","title":"Attributes","text":"attribute type example description required vocab key str CHARMM27 type of forcefield True True building_block str atom type of building block True True coarse_grained_mapping str SC3 beads in MARTINI forcefield atom to beads mapping implicit_solvent str water Name of implicit solvent source str package in GROMACS source of forcefield description str OPLS forcefield with partial charges calculated via the LBCC algorithm description of the forcefield and any modifications that have been added data Data details of mapping schema and forcefield parameters citation list[Citation] reference to a book, paper, or scholarly work"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield--can-be-added-to-primary-node","title":"Can be Added To Primary Node:","text":"
  • Material node
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield--json-representation","title":"JSON Representation","text":"
{\n\"node\": [\"ComputationalForcefield\"],\n\"key\": \"opls_aa\",\n\"building_block\": \"atom\",\n\"coarse_grained_mapping\": \"atom -> atom\",\n\"implicit_solvent\": \"no implicit solvent\",\n\"source\": \"local LigParGen installation\",\n\"description\": \"this is a test forcefield\",\n\"data\": {\n\"node\":[\"Data\"],\n\"name\":\"my data name\",\n\"type\":\"afm_amp\",\n\"file\":[\n{\n\"node\":[\"File\"],\n\"type\":\"calibration\",\n\"source\":\"https://criptapp.org\",\n\"extension\":\".csv\",\n\"data_dictionary\":\"my file's data dictionary\"\n}\n]\n},\n\"citation\": {\n\"node\": [\"Citation\"],\n\"type\": \"reference\"\n\"reference\": {\n\"node\": [\"Reference\"],\n\"type\": \"journal_article\",\n\"title\": \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n\"author\": [\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n\"journal\": \"Computer Physics Communications\",\n\"publisher\": \"Elsevier\",\n\"year\": 2019,\n\"pages\": [463, 476],\n\"doi\": \"10.1016/j.cpc.2018.08.011\",\n\"issn\": \"0010-4655\",\n\"website\": \"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n}\n}\n
Source code in src/cript/nodes/subobjects/computational_forcefield.py
class ComputationalForcefield(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    A [Computational Forcefield Subobject](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=23)\n    is a mathematical model that describes the forces between atoms and molecules.\n    It is used in computational chemistry and molecular dynamics simulations to predict the behavior of materials.\n    Forcefields are typically based on experimental data or quantum mechanical calculations,\n    and they are often used to study the properties of materials such as their structure, dynamics, and reactivity.\n    ## Attributes\n    | attribute              | type           | example                                                                | description                                                              | required | vocab |\n    |------------------------|----------------|------------------------------------------------------------------------|--------------------------------------------------------------------------|----------|-------|\n    | key                    | str            | CHARMM27                                                               | type of forcefield                                                       | True     | True  |\n    | building_block         | str            | atom                                                                   | type of building block                                                   | True     | True  |\n    | coarse_grained_mapping | str            | SC3 beads in MARTINI forcefield                                        | atom to beads mapping                                                    |          |       |\n    | implicit_solvent       | str            | water                                                                  | Name of implicit solvent                                                 |          |       |\n    | source                 | str            | package in GROMACS                                                     | source of forcefield                                                     |          |       |\n    | description            | str            | OPLS forcefield with partial charges calculated via the LBCC algorithm | description of the forcefield and any modifications that have been added |          |       |\n    | data                   | Data           |                                                                        | details of mapping schema and forcefield parameters                      |          |       |\n    | citation               | list[Citation] |                                                                        | reference to a book, paper, or scholarly work                            |          |       |\n    ## Can be Added To Primary Node:\n    * Material node\n    ## JSON Representation\n    ```json\n    {\n        \"node\": [\"ComputationalForcefield\"],\n        \"key\": \"opls_aa\",\n        \"building_block\": \"atom\",\n        \"coarse_grained_mapping\": \"atom -> atom\",\n        \"implicit_solvent\": \"no implicit solvent\",\n        \"source\": \"local LigParGen installation\",\n        \"description\": \"this is a test forcefield\",\n        \"data\": {\n            \"node\":[\"Data\"],\n            \"name\":\"my data name\",\n            \"type\":\"afm_amp\",\n            \"file\":[\n                {\n                    \"node\":[\"File\"],\n                    \"type\":\"calibration\",\n                    \"source\":\"https://criptapp.org\",\n                    \"extension\":\".csv\",\n                    \"data_dictionary\":\"my file's data dictionary\"\n                }\n            ]\n        },\n        \"citation\": {\n            \"node\": [\"Citation\"],\n            \"type\": \"reference\"\n            \"reference\": {\n                \"node\": [\"Reference\"],\n                \"type\": \"journal_article\",\n                \"title\": \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)\",\n                \"author\": [\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n                \"journal\": \"Computer Physics Communications\",\n                \"publisher\": \"Elsevier\",\n                \"year\": 2019,\n                \"pages\": [463, 476],\n                \"doi\": \"10.1016/j.cpc.2018.08.011\",\n                \"issn\": \"0010-4655\",\n                \"website\": \"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n            }\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\nbuilding_block: str = \"\"\ncoarse_grained_mapping: str = \"\"\nimplicit_solvent: str = \"\"\nsource: str = \"\"\ndescription: str = \"\"\ndata: List[Data] = field(default_factory=list)\ncitation: List[Citation] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, key: str, building_block: str, coarse_grained_mapping: str = \"\", implicit_solvent: str = \"\", source: str = \"\", description: str = \"\", data: Optional[List[Data]] = None, citation: Optional[List[Citation]] = None, **kwargs):\n\"\"\"\n        instantiate a computational_forcefield subobject\n        Parameters\n        ----------\n        key : str\n            type of forcefield key must come from [CRIPT Controlled Vocabulary]()\n        building_block : str\n            type of computational_forcefield building_block must come from [CRIPT Controlled Vocabulary]()\n        coarse_grained_mapping : str, optional\n            atom to beads mapping, by default \"\"\n        implicit_solvent : str, optional\n            Name of implicit solvent, by default \"\"\n        source : str, optional\n            source of forcefield, by default \"\"\n        description : str, optional\n            description of the forcefield and any modifications that have been added, by default \"\"\n        data : List[Data], optional\n            details of mapping schema and forcefield parameters, by default None\n        citation : Union[List[Citation], None], optional\n            reference to a book, paper, or scholarly work, by default None\n        Examples\n        --------\n        ```python\n        my_computational_forcefield = cript.ComputationalForcefield(\n            key=\"opls_aa\",\n            building_block=\"atom\",\n        )\n        ```\n        Returns\n        -------\n        None\n            Instantiate a computational_forcefield subobject\n        \"\"\"\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nif data is None:\ndata = []\nself._json_attrs = replace(\nself._json_attrs,\nkey=key,\nbuilding_block=building_block,\ncoarse_grained_mapping=coarse_grained_mapping,\nimplicit_solvent=implicit_solvent,\nsource=source,\ndescription=description,\ndata=data,\ncitation=citation,\n)\nself.validate()\n@property\n@beartype\ndef key(self) -> str:\n\"\"\"\n        type of forcefield\n        > Computational_Forcefield key must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_computational_forcefield.key = \"amber\"\n        ```\n        Returns\n        -------\n        str\n            type of forcefield\n        \"\"\"\nreturn self._json_attrs.key\n@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n        set key for this computational_forcefield\n        Parameters\n        ----------\n        new_key : str\n            computational_forcefield key\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef building_block(self) -> str:\n\"\"\"\n        type of building block\n        > Computational_Forcefield building_block must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_computational_forcefield.building_block = \"atom\"\n        ```\n        Returns\n        -------\n        str\n            type of building block\n        \"\"\"\nreturn self._json_attrs.building_block\n@building_block.setter\n@beartype\ndef building_block(self, new_building_block: str) -> None:\n\"\"\"\n        type of building block\n        Parameters\n        ----------\n        new_building_block : str\n            new type of building block\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, building_block=new_building_block)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef coarse_grained_mapping(self) -> str:\n\"\"\"\n        atom to beads mapping\n        Examples\n        --------\n        ```python\n        my_computational_forcefield.coarse_grained_mapping = \"SC3 beads in MARTINI forcefield\"\n        ```\n        Returns\n        -------\n        str\n            coarse_grained_mapping\n        \"\"\"\nreturn self._json_attrs.coarse_grained_mapping\n@coarse_grained_mapping.setter\n@beartype\ndef coarse_grained_mapping(self, new_coarse_grained_mapping: str) -> None:\n\"\"\"\n        atom to beads mapping\n        Parameters\n        ----------\n        new_coarse_grained_mapping : str\n            new coarse_grained_mapping\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, coarse_grained_mapping=new_coarse_grained_mapping)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef implicit_solvent(self) -> str:\n\"\"\"\n        Name of implicit solvent\n        Examples\n        --------\n        ```python\n        my_computational_forcefield.implicit_solvent = \"water\"\n        ```\n        Returns\n        -------\n        str\n            _description_\n        \"\"\"\nreturn self._json_attrs.implicit_solvent\n@implicit_solvent.setter\n@beartype\ndef implicit_solvent(self, new_implicit_solvent: str) -> None:\n\"\"\"\n        set the implicit_solvent\n        Parameters\n        ----------\n        new_implicit_solvent : str\n            new implicit_solvent\n        \"\"\"\nnew_attrs = replace(self._json_attrs, implicit_solvent=new_implicit_solvent)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef source(self) -> str:\n\"\"\"\n        source of forcefield\n        Examples\n        --------\n        ```python\n        my_computational_forcefield.source = \"package in GROMACS\"\n        ```\n        Returns\n        -------\n        str\n            source of forcefield\n        \"\"\"\nreturn self._json_attrs.source\n@source.setter\n@beartype\ndef source(self, new_source: str) -> None:\n\"\"\"\n        set the computational_forcefield\n        Parameters\n        ----------\n        new_source : str\n            new source of forcefield\n        \"\"\"\nnew_attrs = replace(self._json_attrs, source=new_source)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef description(self) -> str:\n\"\"\"\n        description of the forcefield and any modifications that have been added\n        Examples\n        --------\n        ```python\n        my_computational_forcefield.description = \"OPLS forcefield with partial charges calculated via the LBCC algorithm\"\n        ```\n        Returns\n        -------\n        str\n            description of the forcefield and any modifications that have been added\n        \"\"\"\nreturn self._json_attrs.description\n@description.setter\n@beartype\ndef description(self, new_description: str) -> None:\n\"\"\"\n        set this computational_forcefields description\n        Parameters\n        ----------\n        new_description : str\n            new computational_forcefields description\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, description=new_description)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef data(self) -> List[Data]:\n\"\"\"\n        details of mapping schema and forcefield parameters\n        Examples\n        --------\n        ```python\n        # create file nodes for the data node\n        my_file = cript.File(\n            source=\"https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf\",\n            type=\"calibration\",\n            extension=\".pdf\",\n        )\n        # create data node and add the file node to it\n        my_data = cript.Data(\n            name=\"my data node name\",\n            type=\"afm_amp\",\n            file=my_file,\n        )\n        # add data node to computational_forcefield subobject\n        my_computational_forcefield.data = [my_data]\n        ```\n        Returns\n        -------\n        List[Data]\n            list of data nodes for this computational_forcefield subobject\n        \"\"\"\nreturn self._json_attrs.data.copy()\n@data.setter\n@beartype\ndef data(self, new_data: List[Data]) -> None:\n\"\"\"\n        set the data attribute of this computational_forcefield node\n        Parameters\n        ----------\n        new_data : List[Data]\n            new list of data nodes\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, data=new_data)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Citation]:\n\"\"\"\n        reference to a book, paper, or scholarly work\n        Examples\n        --------\n        ```python\n        # create reference node for the citation node\n        title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n        title += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n        my_reference = cript.Reference(\n            \"journal_article\",\n            title=title,\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        # create citation node and add reference node to it\n        my_citation = cript.Citation(type=\"reference\", reference=my_reference)\n        my_computational_forcefield.citation = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            computational_forcefield list of citations\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation: List[Citation]) -> None:\n\"\"\"\n        set the citation subobject of the computational_forcefield subobject\n        Parameters\n        ----------\n        new_citation : List[Citation]\n            new citation subobject\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.__init__","title":"__init__(key, building_block, coarse_grained_mapping='', implicit_solvent='', source='', description='', data=None, citation=None, **kwargs)","text":"

instantiate a computational_forcefield subobject

Parameters:

Name Type Description Default key str

type of forcefield key must come from CRIPT Controlled Vocabulary

required building_block str

type of computational_forcefield building_block must come from CRIPT Controlled Vocabulary

required coarse_grained_mapping str

atom to beads mapping, by default \"\"

'' implicit_solvent str

Name of implicit solvent, by default \"\"

'' source str

source of forcefield, by default \"\"

'' description str

description of the forcefield and any modifications that have been added, by default \"\"

'' data List[Data]

details of mapping schema and forcefield parameters, by default None

None citation Union[List[Citation], None]

reference to a book, paper, or scholarly work, by default None

None

Examples:

my_computational_forcefield = cript.ComputationalForcefield(\nkey=\"opls_aa\",\nbuilding_block=\"atom\",\n)\n

Returns:

Type Description None

Instantiate a computational_forcefield subobject

Source code in src/cript/nodes/subobjects/computational_forcefield.py
@beartype\ndef __init__(self, key: str, building_block: str, coarse_grained_mapping: str = \"\", implicit_solvent: str = \"\", source: str = \"\", description: str = \"\", data: Optional[List[Data]] = None, citation: Optional[List[Citation]] = None, **kwargs):\n\"\"\"\n    instantiate a computational_forcefield subobject\n    Parameters\n    ----------\n    key : str\n        type of forcefield key must come from [CRIPT Controlled Vocabulary]()\n    building_block : str\n        type of computational_forcefield building_block must come from [CRIPT Controlled Vocabulary]()\n    coarse_grained_mapping : str, optional\n        atom to beads mapping, by default \"\"\n    implicit_solvent : str, optional\n        Name of implicit solvent, by default \"\"\n    source : str, optional\n        source of forcefield, by default \"\"\n    description : str, optional\n        description of the forcefield and any modifications that have been added, by default \"\"\n    data : List[Data], optional\n        details of mapping schema and forcefield parameters, by default None\n    citation : Union[List[Citation], None], optional\n        reference to a book, paper, or scholarly work, by default None\n    Examples\n    --------\n    ```python\n    my_computational_forcefield = cript.ComputationalForcefield(\n        key=\"opls_aa\",\n        building_block=\"atom\",\n    )\n    ```\n    Returns\n    -------\n    None\n        Instantiate a computational_forcefield subobject\n    \"\"\"\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nif data is None:\ndata = []\nself._json_attrs = replace(\nself._json_attrs,\nkey=key,\nbuilding_block=building_block,\ncoarse_grained_mapping=coarse_grained_mapping,\nimplicit_solvent=implicit_solvent,\nsource=source,\ndescription=description,\ndata=data,\ncitation=citation,\n)\nself.validate()\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.building_block","title":"building_block(new_building_block)","text":"

type of building block

Parameters:

Name Type Description Default new_building_block str

new type of building block

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/computational_forcefield.py
@building_block.setter\n@beartype\ndef building_block(self, new_building_block: str) -> None:\n\"\"\"\n    type of building block\n    Parameters\n    ----------\n    new_building_block : str\n        new type of building block\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, building_block=new_building_block)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.citation","title":"citation(new_citation)","text":"

set the citation subobject of the computational_forcefield subobject

Parameters:

Name Type Description Default new_citation List[Citation]

new citation subobject

required Source code in src/cript/nodes/subobjects/computational_forcefield.py
@citation.setter\n@beartype\ndef citation(self, new_citation: List[Citation]) -> None:\n\"\"\"\n    set the citation subobject of the computational_forcefield subobject\n    Parameters\n    ----------\n    new_citation : List[Citation]\n        new citation subobject\n    \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.coarse_grained_mapping","title":"coarse_grained_mapping(new_coarse_grained_mapping)","text":"

atom to beads mapping

Parameters:

Name Type Description Default new_coarse_grained_mapping str

new coarse_grained_mapping

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/computational_forcefield.py
@coarse_grained_mapping.setter\n@beartype\ndef coarse_grained_mapping(self, new_coarse_grained_mapping: str) -> None:\n\"\"\"\n    atom to beads mapping\n    Parameters\n    ----------\n    new_coarse_grained_mapping : str\n        new coarse_grained_mapping\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, coarse_grained_mapping=new_coarse_grained_mapping)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.data","title":"data(new_data)","text":"

set the data attribute of this computational_forcefield node

Parameters:

Name Type Description Default new_data List[Data]

new list of data nodes

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/computational_forcefield.py
@data.setter\n@beartype\ndef data(self, new_data: List[Data]) -> None:\n\"\"\"\n    set the data attribute of this computational_forcefield node\n    Parameters\n    ----------\n    new_data : List[Data]\n        new list of data nodes\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, data=new_data)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.description","title":"description(new_description)","text":"

set this computational_forcefields description

Parameters:

Name Type Description Default new_description str

new computational_forcefields description

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/computational_forcefield.py
@description.setter\n@beartype\ndef description(self, new_description: str) -> None:\n\"\"\"\n    set this computational_forcefields description\n    Parameters\n    ----------\n    new_description : str\n        new computational_forcefields description\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, description=new_description)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.implicit_solvent","title":"implicit_solvent(new_implicit_solvent)","text":"

set the implicit_solvent

Parameters:

Name Type Description Default new_implicit_solvent str

new implicit_solvent

required Source code in src/cript/nodes/subobjects/computational_forcefield.py
@implicit_solvent.setter\n@beartype\ndef implicit_solvent(self, new_implicit_solvent: str) -> None:\n\"\"\"\n    set the implicit_solvent\n    Parameters\n    ----------\n    new_implicit_solvent : str\n        new implicit_solvent\n    \"\"\"\nnew_attrs = replace(self._json_attrs, implicit_solvent=new_implicit_solvent)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.key","title":"key(new_key)","text":"

set key for this computational_forcefield

Parameters:

Name Type Description Default new_key str

computational_forcefield key

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/computational_forcefield.py
@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n    set key for this computational_forcefield\n    Parameters\n    ----------\n    new_key : str\n        computational_forcefield key\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/computational_forcefield/#cript.nodes.subobjects.computational_forcefield.ComputationalForcefield.source","title":"source(new_source)","text":"

set the computational_forcefield

Parameters:

Name Type Description Default new_source str

new source of forcefield

required Source code in src/cript/nodes/subobjects/computational_forcefield.py
@source.setter\n@beartype\ndef source(self, new_source: str) -> None:\n\"\"\"\n    set the computational_forcefield\n    Parameters\n    ----------\n    new_source : str\n        new source of forcefield\n    \"\"\"\nnew_attrs = replace(self._json_attrs, source=new_source)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/","title":"Condition","text":""},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition","title":"Condition","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition--definition","title":"Definition","text":"

A Condition sub-object is the conditions under which the experiment was conducted. Some examples include temperature, mixing_rate, stirring, time_duration.

"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition--can-be-added-to","title":"Can Be Added To:","text":""},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition--primary-nodes","title":"Primary Nodes","text":"
  • Process
  • Computation_Process
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition--subobjects","title":"Subobjects","text":"
  • Property
  • Equipment
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition--attributes","title":"Attributes","text":"attribute type example description required vocab key str temp type of condition True True type str min type of value stored, 'value' is just the number, 'min', 'max', 'avg', etc. for series True True descriptor str upper temperature probe freeform description for condition value Number 1.23 value or quantity True unit str gram unit for value uncertainty Number 0.1 uncertainty of value uncertainty_type str std type of uncertainty True set_id int 0 ID of set (used to link measurements in as series) measurement _id int 0 ID for a single measurement (used to link multiple condition at a single instance) data List[Data] detailed data associated with the condition"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition--json-representation","title":"JSON Representation","text":"
{\n\"node\": [\"Condition\"],\n\"key\": \"temperature\",\n\"type\": \"value\",\n\"descriptor\": \"room temperature of lab\",\n\"value\": 22,\n\"unit\": \"C\",\n\"uncertainty\": 5,\n\"uncertainty_type\": \"stdev\",\n\"set_id\": 0,\n\"measurement_id\": 2,\n\"data\": [{\n\"node\":[\"Data\"],\n\"name\":\"my data name\",\n\"type\":\"afm_amp\",\n\"file\":[\n{\n\"node\":[\"File\"],\n\"type\":\"calibration\",\n\"source\":\"https://criptapp.org\",\n\"extension\":\".csv\",\n\"data_dictionary\":\"my file's data dictionary\"\n}\n]\n}],\n}\n
Source code in src/cript/nodes/subobjects/condition.py
class Condition(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    A [Condition](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=21) sub-object\n    is the conditions under which the experiment was conducted.\n    Some examples include temperature, mixing_rate, stirring, time_duration.\n    ----\n    ## Can Be Added To:\n    ### Primary Nodes\n    * [Process](../../primary_nodes/process)\n    * [Computation_Process](../../primary_nodes/computation_process)\n    ### Subobjects\n    * [Property](../property)\n    * [Equipment](../equipment)\n    ---\n    ## Attributes\n    | attribute        | type   | example                 | description                                                                            | required | vocab |\n    |------------------|--------|-------------------------|----------------------------------------------------------------------------------------|----------|-------|\n    | key              | str    | temp                    | type of condition                                                                      | True     | True  |\n    | type             | str    | min                     | type of value stored, 'value' is just the number, 'min', 'max', 'avg', etc. for series | True     | True  |\n    | descriptor       | str    | upper temperature probe | freeform description for condition                                                     |          |       |\n    | value            | Number | 1.23                    | value or quantity                                                                      | True     |       |\n    | unit             | str    | gram                    | unit for value                                                                         |          |       |\n    | uncertainty      | Number | 0.1                     | uncertainty of value                                                                   |          |       |\n    | uncertainty_type | str    | std                     | type of uncertainty                                                                    |          | True  |\n    | set_id           | int    | 0                       | ID of set (used to link measurements in as series)                                     |          |       |\n    | measurement _id  | int    | 0                       | ID for a single measurement (used to link multiple condition at a single instance)     |          |       |\n    | data             | List[Data] |                         | detailed data associated with the condition                                            |          |       |\n    ## JSON Representation\n    ```json\n    {\n        \"node\": [\"Condition\"],\n        \"key\": \"temperature\",\n        \"type\": \"value\",\n        \"descriptor\": \"room temperature of lab\",\n        \"value\": 22,\n        \"unit\": \"C\",\n        \"uncertainty\": 5,\n        \"uncertainty_type\": \"stdev\",\n        \"set_id\": 0,\n        \"measurement_id\": 2,\n        \"data\": [{\n            \"node\":[\"Data\"],\n            \"name\":\"my data name\",\n            \"type\":\"afm_amp\",\n            \"file\":[\n                {\n                    \"node\":[\"File\"],\n                    \"type\":\"calibration\",\n                    \"source\":\"https://criptapp.org\",\n                    \"extension\":\".csv\",\n                    \"data_dictionary\":\"my file's data dictionary\"\n                }\n            ]\n        }],\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\ntype: str = \"\"\ndescriptor: str = \"\"\nvalue: Optional[Union[Number, str]] = None\nunit: str = \"\"\nuncertainty: Optional[Union[Number, str]] = None\nuncertainty_type: str = \"\"\nset_id: Optional[int] = None\nmeasurement_id: Optional[int] = None\ndata: List[Data] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nkey: str,\ntype: str,\nvalue: Union[Number, str],\nunit: str = \"\",\ndescriptor: str = \"\",\nuncertainty: Optional[Union[Number, str]] = None,\nuncertainty_type: str = \"\",\nset_id: Optional[int] = None,\nmeasurement_id: Optional[int] = None,\ndata: Optional[List[Data]] = None,\n**kwargs\n):\n\"\"\"\n        create Condition sub-object\n        Parameters\n        ----------\n        key : str\n            type of condition\n        type : str\n            type of value stored\n        value : Number\n            value or quantity\n        unit : str, optional\n            unit for value, by default \"\"\n        descriptor : str, optional\n            freeform description for condition, by default \"\"\n        uncertainty : Union[Number, None], optional\n           uncertainty of value, by default None\n        uncertainty_type : str, optional\n            type of uncertainty, by default \"\"\n        set_id : Union[int, None], optional\n            ID of set (used to link measurements in as series), by default None\n        measurement_id : Union[int, None], optional\n            ID for a single measurement (used to link multiple condition at a single instance), by default None\n        data : List[Data], optional\n            detailed data associated with the condition, by default None\n        Examples\n        --------\n        ```python\n        # instantiate a Condition sub-object\n        my_condition = cript.Condition(\n            key=\"temperature\",\n            type=\"value\",\n            value=22,\n            unit=\"C\",\n        )\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nsuper().__init__(**kwargs)\nif data is None:\ndata = []\nself._json_attrs = replace(\nself._json_attrs,\nkey=key,\ntype=type,\nvalue=value,\ndescriptor=descriptor,\nunit=unit,\nuncertainty=uncertainty,\nuncertainty_type=uncertainty_type,\nset_id=set_id,\nmeasurement_id=measurement_id,\ndata=data,\n)\nself.validate()\n@property\n@beartype\ndef key(self) -> str:\n\"\"\"\n        type of condition\n        > Condition key must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_condition.key = \"energy_threshold\"\n        ```\n        Returns\n        -------\n        condition key: str\n            type of condition\n        \"\"\"\nreturn self._json_attrs.key\n@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n        set this Condition sub-object key\n        > Condition key must come from [CRIPT Controlled Vocabulary]()\n        Parameters\n        ----------\n        new_key : str\n            type of condition\n        Returns\n        --------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        description for the value stored for this Condition node\n        Examples\n        --------\n        ```python\n        my_condition.type = \"min\"\n        ```\n        Returns\n        -------\n        condition type: str\n            description for the value\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_type: str) -> None:\n\"\"\"\n        set the type attribute for this Condition node\n        Parameters\n        ----------\n        new_type : str\n            new description of the Condition value\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef descriptor(self) -> str:\n\"\"\"\n        freeform description for Condition\n        Examples\n        --------\n        ```python\n        my_condition.description = \"my condition description\"\n        ```\n        Returns\n        -------\n        description: str\n            description of this Condition sub-object\n        \"\"\"\nreturn self._json_attrs.descriptor\n@descriptor.setter\n@beartype\ndef descriptor(self, new_descriptor: str) -> None:\n\"\"\"\n        set the description of this Condition sub-object\n        Parameters\n        ----------\n        new_descriptor : str\n            new description describing the Condition subobject\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, descriptor=new_descriptor)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef value(self) -> Optional[Union[Number, str]]:\n\"\"\"\n        value or quantity\n        Examples\n        -------\n        ```python\n        my_condition.value = 10\n        ```\n        Returns\n        -------\n        Union[Number, None]\n            new value or quantity\n        \"\"\"\nreturn self._json_attrs.value\ndef set_value(self, new_value: Union[Number, str], new_unit: str) -> None:\n\"\"\"\n        set the value for this Condition subobject\n        Parameters\n        ----------\n        new_value : Number\n            new value\n        new_unit : str\n            units for the new value\n        Examples\n        --------\n        ```python\n        my_condition.set_value(new_value=1, new_unit=\"gram\")\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef unit(self) -> str:\n\"\"\"\n        set units for this Condition subobject\n        Examples\n        --------\n        ```python\n        my_condition.unit = \"gram\"\n        ```\n        Returns\n        -------\n        unit: str\n            units\n        \"\"\"\nreturn self._json_attrs.unit\n@property\n@beartype\ndef uncertainty(self) -> Optional[Union[Number, str]]:\n\"\"\"\n        set uncertainty value for this Condition subobject\n        Examples\n        --------\n        ```python\n        my_condition.uncertainty = \"0.1\"\n        ```\n        Returns\n        -------\n        uncertainty: Union[Number, None]\n            uncertainty\n        \"\"\"\nreturn self._json_attrs.uncertainty\n@beartype\ndef set_uncertainty(self, new_uncertainty: Union[Number, str], new_uncertainty_type: str) -> None:\n\"\"\"\n        set uncertainty and uncertainty type\n        Parameters\n        ----------\n        new_uncertainty : Number\n            new uncertainty value\n        new_uncertainty_type : str\n            new uncertainty type\n        Examples\n        --------\n        ```python\n        my_condition.set_uncertainty(new_uncertainty=\"0.2\", new_uncertainty_type=\"std\")\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef uncertainty_type(self) -> str:\n\"\"\"\n        Uncertainty type for the uncertainty value\n        Examples\n        --------\n        ```python\n        my_condition.uncertainty_type = \"std\"\n        ```\n        Returns\n        -------\n        uncertainty_type: str\n            uncertainty type\n        \"\"\"\nreturn self._json_attrs.uncertainty_type\n@property\n@beartype\ndef set_id(self) -> Union[int, None]:\n\"\"\"\n        ID of set (used to link measurements in as series)\n        Examples\n        --------\n        ```python\n        my_condition.set_id = 0\n        ```\n        Returns\n        -------\n        set_id: Union[int, None]\n            ID of set\n        \"\"\"\nreturn self._json_attrs.set_id\n@set_id.setter\n@beartype\ndef set_id(self, new_set_id: Union[int, None]) -> None:\n\"\"\"\n         set this Condition subobjects set_id\n        Parameters\n        ----------\n        new_set_id : Union[int, None]\n            ID of set\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, set_id=new_set_id)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef measurement_id(self) -> Union[int, None]:\n\"\"\"\n        ID for a single measurement (used to link multiple condition at a single instance)\n        Examples\n        --------\n        ```python\n        my_condition.measurement_id = 0\n        ```\n        Returns\n        -------\n        measurement_id: Union[int, None]\n            ID for a single measurement\n        \"\"\"\nreturn self._json_attrs.measurement_id\n@measurement_id.setter\n@beartype\ndef measurement_id(self, new_measurement_id: Union[int, None]) -> None:\n\"\"\"\n        set the set_id for this Condition subobject\n        Parameters\n        ----------\n        new_measurement_id : Union[int, None]\n            ID for a single measurement\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, measurement_id=new_measurement_id)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef data(self) -> List[Data]:\n\"\"\"\n        detailed data associated with the condition\n        Examples\n        --------\n        ```python\n        # create file nodes for the data node\n        my_file = cript.File(\n            source=\"https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf\",\n            type=\"calibration\",\n            extension=\".pdf\",\n        )\n        # create data node and add the file node to it\n        my_data = cript.Data(\n            name=\"my data node name\",\n            type=\"afm_amp\",\n            file=my_file,\n        )\n        # add data node to Condition subobject\n        my_condition.data = [my_data]\n        ```\n        Returns\n        -------\n        Condition: Union[Data, None]\n            detailed data associated with the condition\n        \"\"\"\nreturn self._json_attrs.data.copy()\n@data.setter\n@beartype\ndef data(self, new_data: List[Data]) -> None:\n\"\"\"\n        set the data node for this Condition Subobject\n        Parameters\n        ----------\n        new_data : List[Data]\n            new Data node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, data=new_data)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.__init__","title":"__init__(key, type, value, unit='', descriptor='', uncertainty=None, uncertainty_type='', set_id=None, measurement_id=None, data=None, **kwargs)","text":"

create Condition sub-object

Parameters:

Name Type Description Default key str

type of condition

required type str

type of value stored

required value Number

value or quantity

required unit str

unit for value, by default \"\"

'' descriptor str

freeform description for condition, by default \"\"

'' uncertainty Union[Number, None]

uncertainty of value, by default None

None uncertainty_type str

type of uncertainty, by default \"\"

'' set_id Union[int, None]

ID of set (used to link measurements in as series), by default None

None measurement_id Union[int, None]

ID for a single measurement (used to link multiple condition at a single instance), by default None

None data List[Data]

detailed data associated with the condition, by default None

None

Examples:

# instantiate a Condition sub-object\nmy_condition = cript.Condition(\nkey=\"temperature\",\ntype=\"value\",\nvalue=22,\nunit=\"C\",\n)\n

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@beartype\ndef __init__(\nself,\nkey: str,\ntype: str,\nvalue: Union[Number, str],\nunit: str = \"\",\ndescriptor: str = \"\",\nuncertainty: Optional[Union[Number, str]] = None,\nuncertainty_type: str = \"\",\nset_id: Optional[int] = None,\nmeasurement_id: Optional[int] = None,\ndata: Optional[List[Data]] = None,\n**kwargs\n):\n\"\"\"\n    create Condition sub-object\n    Parameters\n    ----------\n    key : str\n        type of condition\n    type : str\n        type of value stored\n    value : Number\n        value or quantity\n    unit : str, optional\n        unit for value, by default \"\"\n    descriptor : str, optional\n        freeform description for condition, by default \"\"\n    uncertainty : Union[Number, None], optional\n       uncertainty of value, by default None\n    uncertainty_type : str, optional\n        type of uncertainty, by default \"\"\n    set_id : Union[int, None], optional\n        ID of set (used to link measurements in as series), by default None\n    measurement_id : Union[int, None], optional\n        ID for a single measurement (used to link multiple condition at a single instance), by default None\n    data : List[Data], optional\n        detailed data associated with the condition, by default None\n    Examples\n    --------\n    ```python\n    # instantiate a Condition sub-object\n    my_condition = cript.Condition(\n        key=\"temperature\",\n        type=\"value\",\n        value=22,\n        unit=\"C\",\n    )\n    ```\n    Returns\n    -------\n    None\n    \"\"\"\nsuper().__init__(**kwargs)\nif data is None:\ndata = []\nself._json_attrs = replace(\nself._json_attrs,\nkey=key,\ntype=type,\nvalue=value,\ndescriptor=descriptor,\nunit=unit,\nuncertainty=uncertainty,\nuncertainty_type=uncertainty_type,\nset_id=set_id,\nmeasurement_id=measurement_id,\ndata=data,\n)\nself.validate()\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.data","title":"data(new_data)","text":"

set the data node for this Condition Subobject

Parameters:

Name Type Description Default new_data List[Data]

new Data node

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@data.setter\n@beartype\ndef data(self, new_data: List[Data]) -> None:\n\"\"\"\n    set the data node for this Condition Subobject\n    Parameters\n    ----------\n    new_data : List[Data]\n        new Data node\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, data=new_data)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.descriptor","title":"descriptor(new_descriptor)","text":"

set the description of this Condition sub-object

Parameters:

Name Type Description Default new_descriptor str

new description describing the Condition subobject

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@descriptor.setter\n@beartype\ndef descriptor(self, new_descriptor: str) -> None:\n\"\"\"\n    set the description of this Condition sub-object\n    Parameters\n    ----------\n    new_descriptor : str\n        new description describing the Condition subobject\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, descriptor=new_descriptor)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.key","title":"key(new_key)","text":"

set this Condition sub-object key

Condition key must come from CRIPT Controlled Vocabulary

Parameters:

Name Type Description Default new_key str

type of condition

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n    set this Condition sub-object key\n    > Condition key must come from [CRIPT Controlled Vocabulary]()\n    Parameters\n    ----------\n    new_key : str\n        type of condition\n    Returns\n    --------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.measurement_id","title":"measurement_id(new_measurement_id)","text":"

set the set_id for this Condition subobject

Parameters:

Name Type Description Default new_measurement_id Union[int, None]

ID for a single measurement

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@measurement_id.setter\n@beartype\ndef measurement_id(self, new_measurement_id: Union[int, None]) -> None:\n\"\"\"\n    set the set_id for this Condition subobject\n    Parameters\n    ----------\n    new_measurement_id : Union[int, None]\n        ID for a single measurement\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, measurement_id=new_measurement_id)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.set_id","title":"set_id(new_set_id)","text":"

set this Condition subobjects set_id

Parameters:

Name Type Description Default new_set_id Union[int, None]

ID of set

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@set_id.setter\n@beartype\ndef set_id(self, new_set_id: Union[int, None]) -> None:\n\"\"\"\n     set this Condition subobjects set_id\n    Parameters\n    ----------\n    new_set_id : Union[int, None]\n        ID of set\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, set_id=new_set_id)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.set_uncertainty","title":"set_uncertainty(new_uncertainty, new_uncertainty_type)","text":"

set uncertainty and uncertainty type

Parameters:

Name Type Description Default new_uncertainty Number

new uncertainty value

required new_uncertainty_type str

new uncertainty type

required

Examples:

my_condition.set_uncertainty(new_uncertainty=\"0.2\", new_uncertainty_type=\"std\")\n

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@beartype\ndef set_uncertainty(self, new_uncertainty: Union[Number, str], new_uncertainty_type: str) -> None:\n\"\"\"\n    set uncertainty and uncertainty type\n    Parameters\n    ----------\n    new_uncertainty : Number\n        new uncertainty value\n    new_uncertainty_type : str\n        new uncertainty type\n    Examples\n    --------\n    ```python\n    my_condition.set_uncertainty(new_uncertainty=\"0.2\", new_uncertainty_type=\"std\")\n    ```\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.set_value","title":"set_value(new_value, new_unit)","text":"

set the value for this Condition subobject

Parameters:

Name Type Description Default new_value Number

new value

required new_unit str

units for the new value

required

Examples:

my_condition.set_value(new_value=1, new_unit=\"gram\")\n

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:\n\"\"\"\n    set the value for this Condition subobject\n    Parameters\n    ----------\n    new_value : Number\n        new value\n    new_unit : str\n        units for the new value\n    Examples\n    --------\n    ```python\n    my_condition.set_value(new_value=1, new_unit=\"gram\")\n    ```\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.type","title":"type(new_type)","text":"

set the type attribute for this Condition node

Parameters:

Name Type Description Default new_type str

new description of the Condition value

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/condition.py
@type.setter\n@beartype\ndef type(self, new_type: str) -> None:\n\"\"\"\n    set the type attribute for this Condition node\n    Parameters\n    ----------\n    new_type : str\n        new description of the Condition value\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.uncertainty","title":"uncertainty()","text":"

set uncertainty value for this Condition subobject

Examples:

my_condition.uncertainty = \"0.1\"\n

Returns:

Name Type Description uncertainty Union[Number, None]

uncertainty

Source code in src/cript/nodes/subobjects/condition.py
@property\n@beartype\ndef uncertainty(self) -> Optional[Union[Number, str]]:\n\"\"\"\n    set uncertainty value for this Condition subobject\n    Examples\n    --------\n    ```python\n    my_condition.uncertainty = \"0.1\"\n    ```\n    Returns\n    -------\n    uncertainty: Union[Number, None]\n        uncertainty\n    \"\"\"\nreturn self._json_attrs.uncertainty\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.uncertainty_type","title":"uncertainty_type()","text":"

Uncertainty type for the uncertainty value

Examples:

my_condition.uncertainty_type = \"std\"\n

Returns:

Name Type Description uncertainty_type str

uncertainty type

Source code in src/cript/nodes/subobjects/condition.py
@property\n@beartype\ndef uncertainty_type(self) -> str:\n\"\"\"\n    Uncertainty type for the uncertainty value\n    Examples\n    --------\n    ```python\n    my_condition.uncertainty_type = \"std\"\n    ```\n    Returns\n    -------\n    uncertainty_type: str\n        uncertainty type\n    \"\"\"\nreturn self._json_attrs.uncertainty_type\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.unit","title":"unit()","text":"

set units for this Condition subobject

Examples:

my_condition.unit = \"gram\"\n

Returns:

Name Type Description unit str

units

Source code in src/cript/nodes/subobjects/condition.py
@property\n@beartype\ndef unit(self) -> str:\n\"\"\"\n    set units for this Condition subobject\n    Examples\n    --------\n    ```python\n    my_condition.unit = \"gram\"\n    ```\n    Returns\n    -------\n    unit: str\n        units\n    \"\"\"\nreturn self._json_attrs.unit\n
"},{"location":"nodes/subobjects/condition/#cript.nodes.subobjects.condition.Condition.value","title":"value()","text":"

value or quantity

Examples:

my_condition.value = 10\n

Returns:

Type Description Union[Number, None]

new value or quantity

Source code in src/cript/nodes/subobjects/condition.py
@property\n@beartype\ndef value(self) -> Optional[Union[Number, str]]:\n\"\"\"\n    value or quantity\n    Examples\n    -------\n    ```python\n    my_condition.value = 10\n    ```\n    Returns\n    -------\n    Union[Number, None]\n        new value or quantity\n    \"\"\"\nreturn self._json_attrs.value\n
"},{"location":"nodes/subobjects/equipment/","title":"Equipment","text":""},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment","title":"Equipment","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment--definition","title":"Definition","text":"

An Equipment sub-object specifies the physical instruments, tools, glassware, etc. used in a process.

"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment--can-be-added-to","title":"Can Be Added To:","text":"
  • Process node
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment--available-sub-objects","title":"Available sub-objects:","text":"
  • Condition
  • Citation
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment--attributes","title":"Attributes","text":"attribute type example description required vocab key str hot plate material True True description str Hot plate with silicon oil bath with stir bar additional details about the equipment condition list[Condition] conditions under which the property was measured files list[File] list of file nodes to link to calibration or equipment specification documents citation list[Citation] reference to a book, paper, or scholarly work"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment--json-representation","title":"JSON Representation","text":"
{\n\"node\":[\"Equipment\"],\n\"description\": \"my equipment description\",\n\"key\":\"burner\",\n\"uid\":\"_:19708284-1bd7-42e4-b8b2-da7ea0bc2ac9\",\n\"uuid\":\"19708284-1bd7-42e4-b8b2-da7ea0bc2ac9\"\n}\n
Source code in src/cript/nodes/subobjects/equipment.py
class Equipment(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    An [Equipment](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=23)\n    sub-object specifies the physical instruments, tools, glassware, etc. used in a process.\n    ---\n    ## Can Be Added To:\n    * [Process node](../../primary_nodes/process)\n    ## Available sub-objects:\n    * [Condition](../condition)\n    * [Citation](../citation)\n    ---\n    ## Attributes\n    | attribute   | type            | example                                       | description                                                                    | required | vocab |\n    |-------------|-----------------|-----------------------------------------------|--------------------------------------------------------------------------------|----------|-------|\n    | key         | str             | hot plate                                     | material                                                                       | True     | True  |\n    | description | str             | Hot plate with silicon oil bath with stir bar | additional details about the equipment                                         |          |       |\n    | condition  | list[Condition] |                                               | conditions under which the property was measured                               |          |       |\n    | files       | list[File]      |                                               | list of file nodes to link to calibration or equipment specification documents |          |       |\n    | citation   | list[Citation]  |                                               | reference to a book, paper, or scholarly work                                  |          |       |\n    ## JSON Representation\n    ```json\n    {\n       \"node\":[\"Equipment\"],\n       \"description\": \"my equipment description\",\n       \"key\":\"burner\",\n       \"uid\":\"_:19708284-1bd7-42e4-b8b2-da7ea0bc2ac9\",\n       \"uuid\":\"19708284-1bd7-42e4-b8b2-da7ea0bc2ac9\"\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\ndescription: str = \"\"\ncondition: List[Condition] = field(default_factory=list)\nfile: List[File] = field(default_factory=list)\ncitation: List[Citation] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, key: str, description: str = \"\", condition: Union[List[Condition], None] = None, file: Union[List[File], None] = None, citation: Union[List[Citation], None] = None, **kwargs) -> None:\n\"\"\"\n        create equipment sub-object\n        Parameters\n        ----------\n        key : str\n            Equipment key must come from [CRIPT Controlled Vocabulary]()\n        description : str, optional\n            additional details about the equipment, by default \"\"\n        condition : Union[List[Condition], None], optional\n            Conditions under which the property was measured, by default None\n        file : Union[List[File], None], optional\n            list of file nodes to link to calibration or equipment specification documents, by default None\n        citation : Union[List[Citation], None], optional\n            reference to a scholarly work, by default None\n        Example\n        -------\n        ```python\n        my_equipment = cript.Equipment(key=\"burner\")\n        ```\n        Returns\n        -------\n        None\n            instantiate equipment sub-object\n        \"\"\"\nif condition is None:\ncondition = []\nif file is None:\nfile = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, description=description, condition=condition, file=file, citation=citation)\nself.validate()\n@property\n@beartype\ndef key(self) -> str:\n\"\"\"\n        scientific instrument\n        > Equipment key must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_equipment = cript.Equipment(key=\"burner\")\n        ```\n        Returns\n        -------\n        Equipment: str\n        \"\"\"\nreturn self._json_attrs.key\n@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n        set the equipment key\n        > Equipment key must come from [CRIPT Controlled Vocabulary]()\n        Parameters\n        ----------\n        new_key : str\n            equipment sub-object key\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef description(self) -> str:\n\"\"\"\n        description of the equipment\n        Examples\n        --------\n        ```python\n        my_equipment.description = \"additional details about the equipment\"\n        ```\n        Returns\n        -------\n        str\n            additional description of the equipment\n        \"\"\"\nreturn self._json_attrs.description\n@description.setter\n@beartype\ndef description(self, new_description: str) -> None:\n\"\"\"\n        set this equipments description\n        Parameters\n        ----------\n        new_description : str\n            equipment description\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, description=new_description)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef condition(self) -> List[Condition]:\n\"\"\"\n        conditions under which the property was measured\n        Examples\n        --------\n        ```python\n        # create a Condition sub-object\n        my_condition = cript.Condition(\n            key=\"temperature\",\n            type=\"value\",\n            value=22,\n            unit=\"C\",\n        )\n        # add Condition sub-object to Equipment sub-object\n        my_equipment.condition = [my_condition]\n        ```\n        Returns\n        -------\n        List[Condition]\n            list of Condition sub-objects\n        \"\"\"\nreturn self._json_attrs.condition.copy()\n@condition.setter\n@beartype\ndef condition(self, new_condition: List[Condition]) -> None:\n\"\"\"\n        set a list of Conditions for the equipment sub-object\n        Parameters\n        ----------\n        new_condition : List[Condition]\n            list of Condition sub-objects\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, condition=new_condition)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef file(self) -> List[File]:\n\"\"\"\n        list of file nodes to link to calibration or equipment specification documents\n        Examples\n        --------\n        ```python\n        # create a file node to be added to the equipment sub-object\n        my_file = cript.File(\n            source=\"https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf\",\n            type=\"calibration\",\n            extension=\".pdf\",\n        )\n        # add file node to equipment sub-object\n        my_equipment.file = [my_file]\n        ```\n        Returns\n        -------\n        List[File]\n            list of file nodes\n        \"\"\"\nreturn self._json_attrs.file.copy()\n@file.setter\n@beartype\ndef file(self, new_file: List[File]) -> None:\n\"\"\"\n        set the file node for the equipment subobject\n        Parameters\n        ----------\n        new_file : List[File]\n            list of File nodes\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, file=new_file)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Citation]:\n\"\"\"\n        reference to a book, paper, or scholarly work\n        Examples\n        --------\n        ```python\n        # create reference node for the citation node\n        title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n        title += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n        my_reference = cript.Reference(\n            type=\"journal_article\",\n            title=title,\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        # create citation node and add reference node to it\n        my_citation = cript.Citation(type=\"reference\", reference=my_reference)\n        # add citation subobject to equipment\n        my_equipment.citation = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of Citation subobjects\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation: List[Citation]) -> None:\n\"\"\"\n        set the citation subobject for this equipment subobject\n        Parameters\n        ----------\n        new_citation : List[Citation]\n            list of Citation subobjects\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.__init__","title":"__init__(key, description='', condition=None, file=None, citation=None, **kwargs)","text":"

create equipment sub-object

Parameters:

Name Type Description Default key str

Equipment key must come from CRIPT Controlled Vocabulary

required description str

additional details about the equipment, by default \"\"

'' condition Union[List[Condition], None]

Conditions under which the property was measured, by default None

None file Union[List[File], None]

list of file nodes to link to calibration or equipment specification documents, by default None

None citation Union[List[Citation], None]

reference to a scholarly work, by default None

None"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.__init__--example","title":"Example","text":"
my_equipment = cript.Equipment(key=\"burner\")\n

Returns:

Type Description None

instantiate equipment sub-object

Source code in src/cript/nodes/subobjects/equipment.py
@beartype\ndef __init__(self, key: str, description: str = \"\", condition: Union[List[Condition], None] = None, file: Union[List[File], None] = None, citation: Union[List[Citation], None] = None, **kwargs) -> None:\n\"\"\"\n    create equipment sub-object\n    Parameters\n    ----------\n    key : str\n        Equipment key must come from [CRIPT Controlled Vocabulary]()\n    description : str, optional\n        additional details about the equipment, by default \"\"\n    condition : Union[List[Condition], None], optional\n        Conditions under which the property was measured, by default None\n    file : Union[List[File], None], optional\n        list of file nodes to link to calibration or equipment specification documents, by default None\n    citation : Union[List[Citation], None], optional\n        reference to a scholarly work, by default None\n    Example\n    -------\n    ```python\n    my_equipment = cript.Equipment(key=\"burner\")\n    ```\n    Returns\n    -------\n    None\n        instantiate equipment sub-object\n    \"\"\"\nif condition is None:\ncondition = []\nif file is None:\nfile = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, description=description, condition=condition, file=file, citation=citation)\nself.validate()\n
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.citation","title":"citation(new_citation)","text":"

set the citation subobject for this equipment subobject

Parameters:

Name Type Description Default new_citation List[Citation]

list of Citation subobjects

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/equipment.py
@citation.setter\n@beartype\ndef citation(self, new_citation: List[Citation]) -> None:\n\"\"\"\n    set the citation subobject for this equipment subobject\n    Parameters\n    ----------\n    new_citation : List[Citation]\n        list of Citation subobjects\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.condition","title":"condition(new_condition)","text":"

set a list of Conditions for the equipment sub-object

Parameters:

Name Type Description Default new_condition List[Condition]

list of Condition sub-objects

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/equipment.py
@condition.setter\n@beartype\ndef condition(self, new_condition: List[Condition]) -> None:\n\"\"\"\n    set a list of Conditions for the equipment sub-object\n    Parameters\n    ----------\n    new_condition : List[Condition]\n        list of Condition sub-objects\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, condition=new_condition)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.description","title":"description(new_description)","text":"

set this equipments description

Parameters:

Name Type Description Default new_description str

equipment description

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/equipment.py
@description.setter\n@beartype\ndef description(self, new_description: str) -> None:\n\"\"\"\n    set this equipments description\n    Parameters\n    ----------\n    new_description : str\n        equipment description\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, description=new_description)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.file","title":"file(new_file)","text":"

set the file node for the equipment subobject

Parameters:

Name Type Description Default new_file List[File]

list of File nodes

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/equipment.py
@file.setter\n@beartype\ndef file(self, new_file: List[File]) -> None:\n\"\"\"\n    set the file node for the equipment subobject\n    Parameters\n    ----------\n    new_file : List[File]\n        list of File nodes\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, file=new_file)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/equipment/#cript.nodes.subobjects.equipment.Equipment.key","title":"key(new_key)","text":"

set the equipment key

Equipment key must come from CRIPT Controlled Vocabulary

Parameters:

Name Type Description Default new_key str

equipment sub-object key

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/equipment.py
@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n    set the equipment key\n    > Equipment key must come from [CRIPT Controlled Vocabulary]()\n    Parameters\n    ----------\n    new_key : str\n        equipment sub-object key\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/identifier/","title":"Identifier Subobject","text":""},{"location":"nodes/subobjects/identifier/#identifier-subobject","title":"Identifier Subobject","text":""},{"location":"nodes/subobjects/ingredient/","title":"Ingredient","text":""},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient","title":"Ingredient","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient--definition","title":"Definition","text":"

An Ingredient sub-objects are links to material nodes with the associated quantities.

"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient--can-be-added-to","title":"Can Be Added To:","text":"
  • process
  • computation_process
"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient--available-sub-objects","title":"Available sub-objects:","text":"
  • Quantity
"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient--attributes","title":"Attributes","text":"attribute type example description required vocab material Material material True quantity list[Quantity] quantities True keyword list(str) catalyst keyword for ingredient True"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient--json-representation","title":"JSON Representation","text":"
{\n\"node\":[\"Ingredient\"],\n\"keyword\":[\"catalyst\"],\n\"uid\":\"_:32f173ab-a98a-449b-a528-1b656f652dd3\",\n\"uuid\":\"32f173ab-a98a-449b-a528-1b656f652dd3\"\n\"material\":{\n\"name\":\"my material 1\",\n\"node\":[\"Material\"],\n\"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n\"uid\":\"_:029367a8-aee7-493a-bc08-991e0f6939ae\",\n\"uuid\":\"029367a8-aee7-493a-bc08-991e0f6939ae\"\n},\n\"quantity\":[\n{\n\"node\":[\"Quantity\"],\n\"key\":\"mass\",\n\"value\":11.2\n\"uncertainty\":0.2,\n\"uncertainty_type\":\"stdev\",\n\"unit\":\"kg\",\n\"uid\":\"_:c95ee781-923b-4699-ba3b-923ce186ac5d\",\n\"uuid\":\"c95ee781-923b-4699-ba3b-923ce186ac5d\",\n}\n]\n}\n
Source code in src/cript/nodes/subobjects/ingredient.py
class Ingredient(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    An [Ingredient](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=22)\n    sub-objects are links to material nodes with the associated quantities.\n    ---\n    ## Can Be Added To:\n    * [process](../../primary_nodes/process)\n    * [computation_process](../../primary_nodes/computation_process)\n    ## Available sub-objects:\n    * [Quantity](../quantity)\n    ---\n    ## Attributes\n    | attribute  | type           | example  | description            | required | vocab |\n    |------------|----------------|----------|------------------------|----------|-------|\n    | material   | Material       |          | material               | True     |       |\n    | quantity   | list[Quantity] |          | quantities             | True     |       |\n    | keyword    | list(str)      | catalyst | keyword for ingredient |          | True  |\n    ## JSON Representation\n    ```json\n    {\n        \"node\":[\"Ingredient\"],\n        \"keyword\":[\"catalyst\"],\n        \"uid\":\"_:32f173ab-a98a-449b-a528-1b656f652dd3\",\n        \"uuid\":\"32f173ab-a98a-449b-a528-1b656f652dd3\"\n       \"material\":{\n          \"name\":\"my material 1\",\n          \"node\":[\"Material\"],\n          \"bigsmiles\":\"[H]{[>][<]C(C[>])c1ccccc1[]}\",\n          \"uid\":\"_:029367a8-aee7-493a-bc08-991e0f6939ae\",\n          \"uuid\":\"029367a8-aee7-493a-bc08-991e0f6939ae\"\n       },\n       \"quantity\":[\n          {\n             \"node\":[\"Quantity\"],\n             \"key\":\"mass\",\n             \"value\":11.2\n             \"uncertainty\":0.2,\n             \"uncertainty_type\":\"stdev\",\n             \"unit\":\"kg\",\n             \"uid\":\"_:c95ee781-923b-4699-ba3b-923ce186ac5d\",\n             \"uuid\":\"c95ee781-923b-4699-ba3b-923ce186ac5d\",\n          }\n       ]\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nmaterial: Optional[Material] = None\nquantity: List[Quantity] = field(default_factory=list)\nkeyword: List[str] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, material: Material, quantity: List[Quantity], keyword: Optional[List[str]] = None, **kwargs):\n\"\"\"\n        create an ingredient sub-object\n        Examples\n        --------\n        ```python\n        import cript\n        # create material and identifier for the ingredient sub-object\n        my_identifiers = [{\"bigsmiles\": \"123456\"}]\n        my_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n        # create quantity sub-object\n        my_quantity = cript.Quantity(key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\")\n        # create ingredient sub-object and add all appropriate nodes/sub-objects\n        my_ingredient = cript.Ingredient(material=my_material, quantity=my_quantity, keyword=\"catalyst\")\n        ```\n        Parameters\n        ----------\n        material : Material\n            material node\n        quantity : List[Quantity]\n            list of quantity sub-objects\n        keyword : List[str], optional\n            ingredient keyword must come from [CRIPT Controlled Vocabulary](), by default \"\"\n        Returns\n        -------\n        None\n            Create new Ingredient sub-object\n        \"\"\"\nsuper().__init__(**kwargs)\nif keyword is None:\nkeyword = []\nself._json_attrs = replace(self._json_attrs, material=material, quantity=quantity, keyword=keyword)\nself.validate()\n@classmethod\ndef _from_json(cls, json_dict: dict):\n# TODO: remove this temporary fix, once back end is working correctly\nif isinstance(json_dict[\"material\"], list):\nassert len(json_dict[\"material\"]) == 1\njson_dict[\"material\"] = json_dict[\"material\"][0]\nreturn super(Ingredient, cls)._from_json(json_dict)\n@property\n@beartype\ndef material(self) -> Union[Material, None]:\n\"\"\"\n        current material in this ingredient sub-object\n        Returns\n        -------\n        Material\n            Material node within the ingredient sub-object\n        \"\"\"\nreturn self._json_attrs.material\n@property\n@beartype\ndef quantity(self) -> List[Quantity]:\n\"\"\"\n        quantity for the ingredient sub-object\n        Returns\n        -------\n        List[Quantity]\n            list of quantities for the ingredient sub-object\n        \"\"\"\nreturn self._json_attrs.quantity.copy()\n@beartype\ndef set_material(self, new_material: Material, new_quantity: List[Quantity]) -> None:\n\"\"\"\n        update ingredient sub-object with new material and new list of quantities\n        Examples\n        --------\n        ```python\n        my_identifiers = [{\"bigsmiles\": \"123456\"}]\n        my_new_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n        my_new_quantity = cript.Quantity(\n            key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\"\n        )\n        # set new material and list of quantities\n        my_ingredient.set_material(new_material=my_new_material, new_quantity=[my_new_quantity])\n        ```\n        Parameters\n        ----------\n        new_material : Material\n            new material node to replace the current\n        new_quantity : List[Quantity]\n            new list of quantity sub-objects to replace the current quantity subobject on this node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, material=new_material, quantity=new_quantity)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef keyword(self) -> List[str]:\n\"\"\"\n        ingredient keyword must come from the [CRIPT controlled vocabulary]()\n        Examples\n        --------\n        ```python\n        # set new ingredient keyword\n        my_ingredient.keyword = \"computation\"\n        ```\n        Returns\n        -------\n        str\n            get the current ingredient keyword\n        \"\"\"\nreturn self._json_attrs.keyword.copy()\n@keyword.setter\n@beartype\ndef keyword(self, new_keyword: List[str]) -> None:\n\"\"\"\n        set new ingredient keyword to replace the current\n        ingredient keyword must come from the [CRIPT controlled vocabulary]()\n        Parameters\n        ----------\n        new_keyword : str\n            new ingredient keyword\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, keyword=new_keyword)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient.keyword","title":"keyword: List[str] property writable","text":"

ingredient keyword must come from the CRIPT controlled vocabulary

Examples:

# set new ingredient keyword\nmy_ingredient.keyword = \"computation\"\n

Returns:

Type Description str

get the current ingredient keyword

"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient.material","title":"material: Union[Material, None] property","text":"

current material in this ingredient sub-object

Returns:

Type Description Material

Material node within the ingredient sub-object

"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient.quantity","title":"quantity: List[Quantity] property","text":"

quantity for the ingredient sub-object

Returns:

Type Description List[Quantity]

list of quantities for the ingredient sub-object

"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient.__init__","title":"__init__(material, quantity, keyword=None, **kwargs)","text":"

create an ingredient sub-object

Examples:

import cript\n# create material and identifier for the ingredient sub-object\nmy_identifiers = [{\"bigsmiles\": \"123456\"}]\nmy_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n# create quantity sub-object\nmy_quantity = cript.Quantity(key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\")\n# create ingredient sub-object and add all appropriate nodes/sub-objects\nmy_ingredient = cript.Ingredient(material=my_material, quantity=my_quantity, keyword=\"catalyst\")\n

Parameters:

Name Type Description Default material Material

material node

required quantity List[Quantity]

list of quantity sub-objects

required keyword List[str]

ingredient keyword must come from CRIPT Controlled Vocabulary, by default \"\"

None

Returns:

Type Description None

Create new Ingredient sub-object

Source code in src/cript/nodes/subobjects/ingredient.py
@beartype\ndef __init__(self, material: Material, quantity: List[Quantity], keyword: Optional[List[str]] = None, **kwargs):\n\"\"\"\n    create an ingredient sub-object\n    Examples\n    --------\n    ```python\n    import cript\n    # create material and identifier for the ingredient sub-object\n    my_identifiers = [{\"bigsmiles\": \"123456\"}]\n    my_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n    # create quantity sub-object\n    my_quantity = cript.Quantity(key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\")\n    # create ingredient sub-object and add all appropriate nodes/sub-objects\n    my_ingredient = cript.Ingredient(material=my_material, quantity=my_quantity, keyword=\"catalyst\")\n    ```\n    Parameters\n    ----------\n    material : Material\n        material node\n    quantity : List[Quantity]\n        list of quantity sub-objects\n    keyword : List[str], optional\n        ingredient keyword must come from [CRIPT Controlled Vocabulary](), by default \"\"\n    Returns\n    -------\n    None\n        Create new Ingredient sub-object\n    \"\"\"\nsuper().__init__(**kwargs)\nif keyword is None:\nkeyword = []\nself._json_attrs = replace(self._json_attrs, material=material, quantity=quantity, keyword=keyword)\nself.validate()\n
"},{"location":"nodes/subobjects/ingredient/#cript.nodes.subobjects.ingredient.Ingredient.set_material","title":"set_material(new_material, new_quantity)","text":"

update ingredient sub-object with new material and new list of quantities

Examples:

my_identifiers = [{\"bigsmiles\": \"123456\"}]\nmy_new_material = cript.Material(name=\"my material\", identifier=my_identifiers)\nmy_new_quantity = cript.Quantity(\nkey=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\"\n)\n# set new material and list of quantities\nmy_ingredient.set_material(new_material=my_new_material, new_quantity=[my_new_quantity])\n

Parameters:

Name Type Description Default new_material Material

new material node to replace the current

required new_quantity List[Quantity]

new list of quantity sub-objects to replace the current quantity subobject on this node

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/ingredient.py
@beartype\ndef set_material(self, new_material: Material, new_quantity: List[Quantity]) -> None:\n\"\"\"\n    update ingredient sub-object with new material and new list of quantities\n    Examples\n    --------\n    ```python\n    my_identifiers = [{\"bigsmiles\": \"123456\"}]\n    my_new_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n    my_new_quantity = cript.Quantity(\n        key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\"\n    )\n    # set new material and list of quantities\n    my_ingredient.set_material(new_material=my_new_material, new_quantity=[my_new_quantity])\n    ```\n    Parameters\n    ----------\n    new_material : Material\n        new material node to replace the current\n    new_quantity : List[Quantity]\n        new list of quantity sub-objects to replace the current quantity subobject on this node\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, material=new_material, quantity=new_quantity)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/parameter/","title":"Parameter","text":""},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter","title":"Parameter","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter--definition","title":"Definition","text":"

A parameter is an input value to an algorithm.

Difference between Parameter and Condition

For typical computations, the difference between parameter and condition lies in whether it changes the thermodynamic state of the simulated system: Variables that are part of defining a thermodynamic state should be defined as a condition in a parent node.

Therefore, number and volume need to be listed as conditions while boundaries and origin are parameters of ensemble size

"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter--can-be-added-to","title":"Can Be Added To:","text":"
  • Algorithm sub-object
"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter--available-sub-objects","title":"Available sub-objects:","text":"
  • None
"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter--attributes","title":"Attributes","text":"attribute type example description required vocab key str key for identifier True True value Any value True unit str unit for parameter"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter--json-representation","title":"JSON Representation","text":"
{\n\"key\":\"update_frequency\",\n\"node\":[\"Parameter\"],\n\"unit\":\"1/second\",\n\"value\":1000.0\n\"uid\":\"_:6af3b3aa-1dbc-4ce7-be8b-1896b375001c\",\n\"uuid\":\"6af3b3aa-1dbc-4ce7-be8b-1896b375001c\",\n}\n
Source code in src/cript/nodes/subobjects/parameter.py
class Parameter(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    A [parameter](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=25)\n    is an input value to an algorithm.\n    ??? note \"Difference between `Parameter` and `Condition`\"\n        For typical computations, the difference between\n        parameter and condition lies in whether it changes the thermodynamic state of the simulated\n        system: Variables that are part of defining a thermodynamic state should be defined as a condition\n        in a parent node.\n        Therefore, `number` and `volume` need to be listed as conditions while\n        `boundaries` and `origin` are parameters of ensemble size\n    ---\n    ## Can Be Added To:\n    * [Algorithm sub-object](../algorithm)\n    ## Available sub-objects:\n    * None\n    ---\n    ## Attributes\n    | attribute | type | example | description        | required | vocab |\n    |-----------|------|---------|--------------------|----------|-------|\n    | key       | str  |         | key for identifier | True     | True  |\n    | value     | Any  |         | value              | True     |       |\n    | unit      | str  |         | unit for parameter |          |       |\n    ## JSON Representation\n    ```json\n    {\n       \"key\":\"update_frequency\",\n       \"node\":[\"Parameter\"],\n       \"unit\":\"1/second\",\n       \"value\":1000.0\n       \"uid\":\"_:6af3b3aa-1dbc-4ce7-be8b-1896b375001c\",\n       \"uuid\":\"6af3b3aa-1dbc-4ce7-be8b-1896b375001c\",\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\nvalue: Optional[Number] = None\n# We explicitly allow None for unit here (instead of empty str),\n# this presents number without physical unit, like counting\n# particles or dimensionless numbers.\nunit: Union[str, None] = None\n_json_attrs: JsonAttributes = JsonAttributes()\n# Note that the key word args are ignored.\n# They are just here, such that we can feed more kwargs in that we get from the back end.\n@beartype\ndef __init__(self, key: str, value: Number, unit: Optional[str] = None, **kwargs):\n\"\"\"\n        create new Parameter sub-object\n        Parameters\n        ----------\n        key : str\n            Parameter key must come from [CRIPT Controlled Vocabulary]()\n        value : Union[int, float]\n            Parameter value\n        unit : Union[str, None], optional\n            Parameter unit, by default None\n        Examples\n        --------\n        ```python\n        import cript\n        my_parameter = cript.Parameter(\"update_frequency\", 1000.0, \"1/second\")\n        ```\n        Returns\n        -------\n        None\n            create Parameter sub-object\n        \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit)\nself.validate()\n@classmethod\ndef _from_json(cls, json_dict: dict):\n# TODO: remove this temporary fix, once back end is working correctly\ntry:\njson_dict[\"value\"] = float(json_dict[\"value\"])\nexcept KeyError:\npass\nreturn super(Parameter, cls)._from_json(json_dict)\n@property\n@beartype\ndef key(self) -> str:\n\"\"\"\n        Parameter key must come from the [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_parameter.key = \"bond_type\"\n        ```\n        Returns\n        -------\n        str\n            parameter key\n        \"\"\"\nreturn self._json_attrs.key\n@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n        set new key for the Parameter sub-object\n        Parameter key must come from [CRIPT Controlled Vocabulary]()\n        Parameters\n        ----------\n        new_key : str\n            new Parameter key\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef value(self) -> Optional[Number]:\n\"\"\"\n        Parameter value\n        Examples\n        --------\n        ```python\n        my_parameter.value = 1\n        ```\n        Returns\n        -------\n        Union[int, float, str]\n            parameter value\n        \"\"\"\nreturn self._json_attrs.value\n@value.setter\n@beartype\ndef value(self, new_value: Number) -> None:\n\"\"\"\n        set the Parameter value\n        Parameters\n        ----------\n        new_value : Union[int, float, str]\n            new parameter value\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, value=new_value)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef unit(self) -> Union[str, None]:\n\"\"\"\n        Parameter unit\n        Examples\n        --------\n        ```python\n        my_parameter.unit = \"gram\"\n        ```\n        Returns\n        -------\n        str\n            parameter unit\n        \"\"\"\nreturn self._json_attrs.unit\n@unit.setter\n@beartype\ndef unit(self, new_unit: str) -> None:\n\"\"\"\n        set the unit attribute for the Parameter sub-object\n        Parameters\n        ----------\n        new_unit : str\n            new Parameter unit\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter.key","title":"key: str property writable","text":"

Parameter key must come from the CRIPT Controlled Vocabulary

Examples:

my_parameter.key = \"bond_type\"\n

Returns:

Type Description str

parameter key

"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter.unit","title":"unit: Union[str, None] property writable","text":"

Parameter unit

Examples:

my_parameter.unit = \"gram\"\n

Returns:

Type Description str

parameter unit

"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter.value","title":"value: Optional[Number] property writable","text":"

Parameter value

Examples:

my_parameter.value = 1\n

Returns:

Type Description Union[int, float, str]

parameter value

"},{"location":"nodes/subobjects/parameter/#cript.nodes.subobjects.parameter.Parameter.__init__","title":"__init__(key, value, unit=None, **kwargs)","text":"

create new Parameter sub-object

Parameters:

Name Type Description Default key str

Parameter key must come from CRIPT Controlled Vocabulary

required value Union[int, float]

Parameter value

required unit Union[str, None]

Parameter unit, by default None

None

Examples:

import cript\nmy_parameter = cript.Parameter(\"update_frequency\", 1000.0, \"1/second\")\n

Returns:

Type Description None

create Parameter sub-object

Source code in src/cript/nodes/subobjects/parameter.py
@beartype\ndef __init__(self, key: str, value: Number, unit: Optional[str] = None, **kwargs):\n\"\"\"\n    create new Parameter sub-object\n    Parameters\n    ----------\n    key : str\n        Parameter key must come from [CRIPT Controlled Vocabulary]()\n    value : Union[int, float]\n        Parameter value\n    unit : Union[str, None], optional\n        Parameter unit, by default None\n    Examples\n    --------\n    ```python\n    import cript\n    my_parameter = cript.Parameter(\"update_frequency\", 1000.0, \"1/second\")\n    ```\n    Returns\n    -------\n    None\n        create Parameter sub-object\n    \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit)\nself.validate()\n
"},{"location":"nodes/subobjects/property/","title":"Property","text":""},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property","title":"Property","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property--definition","title":"Definition","text":"

Property sub-objects are qualities/traits of a material or or Process

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property--can-be-added-to","title":"Can Be Added To:","text":"
  • Material
  • Process
  • Computation_Process
"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property--available-sub-objects","title":"Available sub-objects:","text":"
  • Condition
  • Citation
"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property--attributes","title":"Attributes","text":"attribute type example description required vocab key str modulus_shear type of property True True type str min type of value stored True True value Any 1.23 value or quantity True unit str gram unit for value True uncertainty Number 0.1 uncertainty of value uncertainty_type str standard_deviation type of uncertainty True component list[Material] material that the property relates to** structure str {[][$][C:1][C:1][$], [$][C:2][C:2]([C:2]) [$][]} specific chemical structure associate with the property with atom mappings** method str sec approach or source of property data True sample_preparation Process sample preparation condition list[Condition] conditions under which the property was measured data Data data node computation list[Computation] computation method that produced property citation list[Citation] reference to a book, paper, or scholarly work notes str miscellaneous information, or custom data structure (e.g.; JSON)"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property--json-representation","title":"JSON Representation","text":"
{\n\"key\":\"modulus_shear\",\n\"node\":[\"Property\"],\n\"type\":\"value\",\n\"unit\":\"GPa\",\n\"value\":5.0\n\"uid\":\"_:bc3abb68-25b5-4144-aa1b-85d82b7c77e1\",\n\"uuid\":\"bc3abb68-25b5-4144-aa1b-85d82b7c77e1\",\n}\n
Source code in src/cript/nodes/subobjects/property.py
class Property(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    [Property](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=18) sub-objects\n    are qualities/traits of a [material](../../primary_nodes/material) or or [Process](../../primary_nodes/process)\n    ---\n    ## Can Be Added To:\n    * [Material](../../primary_nodes/material)\n    * [Process](../../primary_nodes/process)\n    * [Computation_Process](../../primary_nodes/Computation_Process)\n    ## Available sub-objects:\n    * [Condition](../condition)\n    * [Citation](../citation)\n    ---\n    ## Attributes\n    | attribute          | type              | example                                                                | description                                                                  | required | vocab |\n    |--------------------|-------------------|------------------------------------------------------------------------|------------------------------------------------------------------------------|----------|-------|\n    | key                | str               | modulus_shear                                                          | type of property                                                             | True     | True  |\n    | type               | str               | min                                                                    | type of value stored                                                         | True     | True  |\n    | value              | Any               | 1.23                                                                   | value or quantity                                                            | True     |       |\n    | unit               | str               | gram                                                                   | unit for value                                                               | True     |       |\n    | uncertainty        | Number            | 0.1                                                                    | uncertainty of value                                                         |          |       |\n    | uncertainty_type   | str               | standard_deviation                                                     | type of uncertainty                                                          |          | True  |\n    | component          | list[Material]    |                                                                        | material that the property relates to**                                      |          |       |\n    | structure          | str               | {\\[\\]\\[$\\]\\[C:1\\]\\[C:1\\]\\[$\\], \\[$\\]\\[C:2\\]\\[C:2\\](\\[C:2\\]) \\[$\\]\\[\\]} | specific chemical structure associate with the property with atom mappings** |          |       |\n    | method             | str               | sec                                                                    | approach or source of property data                                          |          | True  |\n    | sample_preparation | Process           |                                                                        | sample preparation                                                           |          |       |\n    | condition          | list[Condition]   |                                                                        | conditions under which the property was measured                             |          |       |\n    | data               | Data              |                                                                        | data node                                                                    |          |       |\n    | computation        | list[Computation] |                                                                        | computation method that produced property                                    |          |       |\n    | citation           | list[Citation]    |                                                                        | reference to a book, paper, or scholarly work                                |          |       |\n    | notes              | str               |                                                                        | miscellaneous information, or custom data structure (e.g.; JSON)             |          |       |\n    ## JSON Representation\n    ```json\n    {\n       \"key\":\"modulus_shear\",\n       \"node\":[\"Property\"],\n       \"type\":\"value\",\n       \"unit\":\"GPa\",\n       \"value\":5.0\n       \"uid\":\"_:bc3abb68-25b5-4144-aa1b-85d82b7c77e1\",\n       \"uuid\":\"bc3abb68-25b5-4144-aa1b-85d82b7c77e1\",\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\ntype: str = \"\"\nvalue: Union[Number, str, None] = None\nunit: str = \"\"\nuncertainty: Optional[Number] = None\nuncertainty_type: str = \"\"\ncomponent: List[Material] = field(default_factory=list)\nstructure: str = \"\"\nmethod: str = \"\"\nsample_preparation: Optional[Process] = None\ncondition: List[Condition] = field(default_factory=list)\ndata: List[Data] = field(default_factory=list)\ncomputation: List[Computation] = field(default_factory=list)\ncitation: List[Citation] = field(default_factory=list)\nnotes: str = \"\"\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(\nself,\nkey: str,\ntype: str,\nvalue: Union[Number, str, None],\nunit: Union[str, None],\nuncertainty: Optional[Number] = None,\nuncertainty_type: str = \"\",\ncomponent: Optional[List[Material]] = None,\nstructure: str = \"\",\nmethod: str = \"\",\nsample_preparation: Optional[Process] = None,\ncondition: Optional[List[Condition]] = None,\ndata: Optional[List[Data]] = None,\ncomputation: Optional[List[Computation]] = None,\ncitation: Optional[List[Citation]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n        create a property sub-object\n        Parameters\n        ----------\n        key : str\n            type of property, Property key must come from the [CRIPT Controlled Vocabulary]()\n        type : str\n            type of value stored, Property type must come from the [CRIPT Controlled Vocabulary]()\n        value : Union[Number, None]\n            value or quantity\n        unit : str\n            unit for value\n        uncertainty : Union[Number, None], optional\n            uncertainty value of the value, by default None\n        uncertainty_type : str, optional\n            type of uncertainty, by default \"\"\n        component : Union[List[Material], None], optional\n            List of Material nodes, by default None\n        structure : str, optional\n            specific chemical structure associate with the property with atom mappings**, by default \"\"\n        method : str, optional\n            approach or source of property data, by default \"\"\n        sample_preparation : Union[Process, None], optional\n            sample preparation, by default None\n        condition : Union[List[Condition], None], optional\n            conditions under which the property was measured, by default None\n        data : Union[List[Data], None], optional\n            Data node, by default None\n        computation : Union[List[Computation], None], optional\n            computation method that produced property, by default None\n        citation : Union[List[Citation], None], optional\n            reference scholarly work, by default None\n        notes : str, optional\n            miscellaneous information, or custom data structure (e.g.; JSON), by default \"\"\n        Examples\n        --------\n        ```python\n        import cript\n        my_property = cript.Property(key=\"air_flow\", type=\"min\", value=1.00, unit=\"gram\")\n        ```\n        Returns\n        -------\n        None\n            create a Property sub-object\n        \"\"\"\nif component is None:\ncomponent = []\nif condition is None:\ncondition = []\nif computation is None:\ncomputation = []\nif data is None:\ndata = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(\nself._json_attrs,\nkey=key,\ntype=type,\nvalue=value,\nunit=unit,\nuncertainty=uncertainty,\nuncertainty_type=uncertainty_type,\ncomponent=component,\nstructure=structure,\nmethod=method,\nsample_preparation=sample_preparation,\ncondition=condition,\ndata=data,\ncomputation=computation,\ncitation=citation,\nnotes=notes,\n)\nself.validate()\n@property\n@beartype\ndef key(self) -> str:\n\"\"\"\n        Property key must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_parameter.key = \"angle_rdist\"\n        ```\n        Returns\n        -------\n        str\n            Property Key\n        \"\"\"\nreturn self._json_attrs.key\n@key.setter\n@beartype\ndef key(self, new_key: str) -> None:\n\"\"\"\n        set the key for this Property sub-object\n        Parameters\n        ----------\n        new_key : str\n            new Property key\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        type of value for this Property sub-object\n        Examples\n        ```python\n        my_property.type = \"max\"\n        ```\n        Returns\n        -------\n        str\n            type of value for this Property sub-object\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_type: str) -> None:\n\"\"\"\n        set the Property type for this subobject\n        Parameters\n        ----------\n        new_type : str\n            new Property type\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef value(self) -> Union[Number, str, None]:\n\"\"\"\n        get the Property value\n        Returns\n        -------\n        Union[Number, None]\n            Property value\n        \"\"\"\nreturn self._json_attrs.value\n@beartype\ndef set_value(self, new_value: Union[Number, str], new_unit: str) -> None:\n\"\"\"\n        set the value attribute of the Property subobject\n        Examples\n        ---------\n        ```python\n        my_property.set_value(new_value=1, new_unit=\"gram\")\n        ```\n        Parameters\n        ----------\n        new_value : Number\n            new value\n        new_unit : str\n            new unit for the value\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef unit(self) -> str:\n\"\"\"\n        get the Property unit for the value\n        Returns\n        -------\n        str\n            unit\n        \"\"\"\nreturn self._json_attrs.unit\n@property\n@beartype\ndef uncertainty(self) -> Union[Number, None]:\n\"\"\"\n        get the uncertainty value of the Property node\n        Returns\n        -------\n        Union[Number, None]\n            uncertainty value\n        \"\"\"\nreturn self._json_attrs.uncertainty\n@beartype\ndef set_uncertainty(self, new_uncertainty: Number, new_uncertainty_type: str) -> None:\n\"\"\"\n        set the uncertainty value and type\n        Uncertainty type must come from [CRIPT Controlled Vocabulary]\n        Parameters\n        ----------\n        new_uncertainty : Number\n            new uncertainty value\n        new_uncertainty_type : str\n            new uncertainty type\n        Examples\n        --------\n        ```python\n        my_property.set_uncertainty(new_uncertainty=2, new_uncertainty_type=\"fwhm\")\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef uncertainty_type(self) -> str:\n\"\"\"\n        get the uncertainty_type for this Property subobject\n        Uncertainty type must come from [CRIPT Controlled Vocabulary]()\n        Returns\n        -------\n        str\n            Uncertainty type\n        \"\"\"\nreturn self._json_attrs.uncertainty_type\n@property\n@beartype\ndef component(self) -> List[Material]:\n\"\"\"\n        list of Materials that the Property relates to\n        Examples\n        ---------\n        ```python\n        my_identifiers = [{\"bigsmiles\": \"123456\"}]\n        my_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n        # add material node as component to Property subobject\n        my_property.component = my_material\n        ```\n        Returns\n        -------\n        List[Material]\n            list of Materials that the Property relates to\n        \"\"\"\nreturn self._json_attrs.component.copy()\n@component.setter\n@beartype\ndef component(self, new_component: List[Material]) -> None:\n\"\"\"\n        set the list of Materials as components for the Property subobject\n        Parameters\n        ----------\n        new_component : List[Material]\n            new list of Materials to for the Property subobject\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, component=new_component)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef structure(self) -> str:\n\"\"\"\n        specific chemical structure associate with the property with atom mappings\n        Examples\n        --------\n        ```python\n        my_property.structure = \"{[][$][C:1][C:1][$],[$][C:2][C:2]([C:2])[$][]}\"\n        ```\n        Returns\n        -------\n        str\n            Property structure string\n        \"\"\"\nreturn self._json_attrs.structure\n@structure.setter\n@beartype\ndef structure(self, new_structure: str) -> None:\n\"\"\"\n        set the this Property's structure\n        Parameters\n        ----------\n        new_structure : str\n            new structure\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, structure=new_structure)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef method(self) -> str:\n\"\"\"\n        approach or source of property data True sample_preparation Process sample preparation\n        Property method must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_property.method = \"ASTM_D3574_Test_A\"\n        ```\n        Returns\n        -------\n        str\n            Property method\n        \"\"\"\nreturn self._json_attrs.method\n@method.setter\n@beartype\ndef method(self, new_method: str) -> None:\n\"\"\"\n        set the Property method\n        Property method must come from [CRIPT Controlled Vocabulary]()\n        Parameters\n        ----------\n        new_method : str\n            new Property method\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, method=new_method)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef sample_preparation(self) -> Union[Process, None]:\n\"\"\"\n        sample_preparation\n        Examples\n        --------\n        ```python\n        my_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\n        my_property.sample_preparation = my_process\n        ```\n        Returns\n        -------\n        Union[Process, None]\n            Property linking back to the Process that has it as subobject\n        \"\"\"\nreturn self._json_attrs.sample_preparation\n@sample_preparation.setter\n@beartype\ndef sample_preparation(self, new_sample_preparation: Union[Process, None]) -> None:\n\"\"\"\n        set the sample_preparation for the Property subobject\n        Parameters\n        ----------\n        new_sample_preparation : Union[Process, None]\n            back link to the Process that has this Property as its subobject\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, sample_preparation=new_sample_preparation)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef condition(self) -> List[Condition]:\n\"\"\"\n        list of Conditions under which the property was measured\n        Examples\n        --------\n        ```python\n        my_condition = cript.Condition(key=\"atm\", type=\"max\", value=1)\n        my_property.condition = [my_condition]\n        ```\n        Returns\n        -------\n        List[Condition]\n            list of Conditions\n        \"\"\"\nreturn self._json_attrs.condition.copy()\n@condition.setter\n@beartype\ndef condition(self, new_condition: List[Condition]) -> None:\n\"\"\"\n        set the list of Conditions for this property subobject\n        Parameters\n        ----------\n        new_condition : List[Condition]\n            new list of Condition Subobjects\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, condition=new_condition)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef data(self) -> List[Data]:\n\"\"\"\n        List of Data nodes for this Property subobjects\n        Examples\n        --------\n        ```python\n        # create file node for the Data node\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\",\n        )\n        # create data node for the property subobject\n        my_data = cript.Data(name=\"my data name\", type=\"afm_amp\", file=[my_file])\n        # add data node to Property subobject\n        my_property.data = my_data\n        ```\n        Returns\n        -------\n        List[Data]\n            list of Data nodes\n        \"\"\"\nreturn self._json_attrs.data.copy()\n@data.setter\n@beartype\ndef data(self, new_data: List[Data]) -> None:\n\"\"\"\n        set the Data node for the Property subobject\n        Parameters\n        ----------\n        new_data : List[Data]\n            new list of Data nodes\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, data=new_data)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef computation(self) -> List[Computation]:\n\"\"\"\n        list of Computation nodes that produced this property\n        Examples\n        --------\n        ```python\n        my_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\n        my_property.computation = [my_computation]\n        ```\n        Returns\n        -------\n        List[Computation]\n            list of Computation nodes\n        \"\"\"\nreturn self._json_attrs.computation.copy()\n@computation.setter\n@beartype\ndef computation(self, new_computation: List[Computation]) -> None:\n\"\"\"\n        set the list of Computation nodes that produced this property\n        Parameters\n        ----------\n        new_computation : List[Computation]\n            new list of Computation nodes\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, computation=new_computation)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Citation]:\n\"\"\"\n        list of Citation subobjects for this Property subobject\n        Examples\n        --------\n        ```python\n        # create reference node for the citation node\n        title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n        title += \"Soft coarse grained Monte-Carlo Acceleration (SOMA)\"\n        my_reference = cript.Reference(\n            type=\"journal_article\",\n            title=title,\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        # create citation node and add reference node to it\n        my_citation = cript.Citation(type=\"reference\", reference=my_reference)\n        # add citation to Property subobject\n        my_property.citation = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of Citation subobjects for this Property subobject\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation: List[Citation]) -> None:\n\"\"\"\n        set the list of Citation subobjects for the Property subobject\n        Parameters\n        ----------\n        new_citation : List[Citation]\n            new list of Citation subobjects\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef notes(self) -> str:\n\"\"\"\n        notes for this Property subobject\n        Examples\n        --------\n        ```python\n        my_property.notes = \"these are my notes\"\n        ```\n        Returns\n        -------\n        str\n            notes for this property subobject\n        \"\"\"\nreturn self._json_attrs.notes\n@notes.setter\n@beartype\ndef notes(self, new_notes: str) -> None:\n\"\"\"\n        set the notes for this Property subobject\n        Parameters\n        ----------\n        new_notes : str\n            new notes\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, notes=new_notes)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.citation","title":"citation: List[Citation] property writable","text":"

list of Citation subobjects for this Property subobject

Examples:

# create reference node for the citation node\ntitle = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\ntitle += \"Soft coarse grained Monte-Carlo Acceleration (SOMA)\"\nmy_reference = cript.Reference(\ntype=\"journal_article\",\ntitle=title,\nauthor=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\njournal=\"Computer Physics Communications\",\npublisher=\"Elsevier\",\nyear=2019,\npages=[463, 476],\ndoi=\"10.1016/j.cpc.2018.08.011\",\nissn=\"0010-4655\",\nwebsite=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n)\n# create citation node and add reference node to it\nmy_citation = cript.Citation(type=\"reference\", reference=my_reference)\n# add citation to Property subobject\nmy_property.citation = [my_citation]\n

Returns:

Type Description List[Citation]

list of Citation subobjects for this Property subobject

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.component","title":"component: List[Material] property writable","text":"

list of Materials that the Property relates to

Examples:

my_identifiers = [{\"bigsmiles\": \"123456\"}]\nmy_material = cript.Material(name=\"my material\", identifier=my_identifiers)\n# add material node as component to Property subobject\nmy_property.component = my_material\n

Returns:

Type Description List[Material]

list of Materials that the Property relates to

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.computation","title":"computation: List[Computation] property writable","text":"

list of Computation nodes that produced this property

Examples:

my_computation = cript.Computation(name=\"my computation name\", type=\"analysis\")\nmy_property.computation = [my_computation]\n

Returns:

Type Description List[Computation]

list of Computation nodes

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.condition","title":"condition: List[Condition] property writable","text":"

list of Conditions under which the property was measured

Examples:

my_condition = cript.Condition(key=\"atm\", type=\"max\", value=1)\nmy_property.condition = [my_condition]\n

Returns:

Type Description List[Condition]

list of Conditions

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.data","title":"data: List[Data] property writable","text":"

List of Data nodes for this Property subobjects

Examples:

# create file node for the Data node\nmy_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\",\n)\n# create data node for the property subobject\nmy_data = cript.Data(name=\"my data name\", type=\"afm_amp\", file=[my_file])\n# add data node to Property subobject\nmy_property.data = my_data\n

Returns:

Type Description List[Data]

list of Data nodes

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.key","title":"key: str property writable","text":"

Property key must come from CRIPT Controlled Vocabulary

Examples:

my_parameter.key = \"angle_rdist\"\n

Returns:

Type Description str

Property Key

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.method","title":"method: str property writable","text":"

approach or source of property data True sample_preparation Process sample preparation

Property method must come from CRIPT Controlled Vocabulary

Examples:

my_property.method = \"ASTM_D3574_Test_A\"\n

Returns:

Type Description str

Property method

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.notes","title":"notes: str property writable","text":"

notes for this Property subobject

Examples:

my_property.notes = \"these are my notes\"\n

Returns:

Type Description str

notes for this property subobject

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.sample_preparation","title":"sample_preparation: Union[Process, None] property writable","text":"

sample_preparation

Examples:

my_process = cript.Process(name=\"my process name\", type=\"affinity_pure\")\nmy_property.sample_preparation = my_process\n

Returns:

Type Description Union[Process, None]

Property linking back to the Process that has it as subobject

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.structure","title":"structure: str property writable","text":"

specific chemical structure associate with the property with atom mappings

Examples:

my_property.structure = \"{[][$][C:1][C:1][$],[$][C:2][C:2]([C:2])[$][]}\"\n

Returns:

Type Description str

Property structure string

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.type","title":"type: str property writable","text":"

type of value for this Property sub-object

Examples

my_property.type = \"max\"\n

Returns:

Type Description str

type of value for this Property sub-object

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.uncertainty","title":"uncertainty: Union[Number, None] property","text":"

get the uncertainty value of the Property node

Returns:

Type Description Union[Number, None]

uncertainty value

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.uncertainty_type","title":"uncertainty_type: str property","text":"

get the uncertainty_type for this Property subobject

Uncertainty type must come from CRIPT Controlled Vocabulary

Returns:

Type Description str

Uncertainty type

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.unit","title":"unit: str property","text":"

get the Property unit for the value

Returns:

Type Description str

unit

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.value","title":"value: Union[Number, str, None] property","text":"

get the Property value

Returns:

Type Description Union[Number, None]

Property value

"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.__init__","title":"__init__(key, type, value, unit, uncertainty=None, uncertainty_type='', component=None, structure='', method='', sample_preparation=None, condition=None, data=None, computation=None, citation=None, notes='', **kwargs)","text":"

create a property sub-object

Parameters:

Name Type Description Default key str

type of property, Property key must come from the CRIPT Controlled Vocabulary

required type str

type of value stored, Property type must come from the CRIPT Controlled Vocabulary

required value Union[Number, None]

value or quantity

required unit str

unit for value

required uncertainty Union[Number, None]

uncertainty value of the value, by default None

None uncertainty_type str

type of uncertainty, by default \"\"

'' component Union[List[Material], None]

List of Material nodes, by default None

None structure str

specific chemical structure associate with the property with atom mappings**, by default \"\"

'' method str

approach or source of property data, by default \"\"

'' sample_preparation Union[Process, None]

sample preparation, by default None

None condition Union[List[Condition], None]

conditions under which the property was measured, by default None

None data Union[List[Data], None]

Data node, by default None

None computation Union[List[Computation], None]

computation method that produced property, by default None

None citation Union[List[Citation], None]

reference scholarly work, by default None

None notes str

miscellaneous information, or custom data structure (e.g.; JSON), by default \"\"

''

Examples:

import cript\nmy_property = cript.Property(key=\"air_flow\", type=\"min\", value=1.00, unit=\"gram\")\n

Returns:

Type Description None

create a Property sub-object

Source code in src/cript/nodes/subobjects/property.py
@beartype\ndef __init__(\nself,\nkey: str,\ntype: str,\nvalue: Union[Number, str, None],\nunit: Union[str, None],\nuncertainty: Optional[Number] = None,\nuncertainty_type: str = \"\",\ncomponent: Optional[List[Material]] = None,\nstructure: str = \"\",\nmethod: str = \"\",\nsample_preparation: Optional[Process] = None,\ncondition: Optional[List[Condition]] = None,\ndata: Optional[List[Data]] = None,\ncomputation: Optional[List[Computation]] = None,\ncitation: Optional[List[Citation]] = None,\nnotes: str = \"\",\n**kwargs\n):\n\"\"\"\n    create a property sub-object\n    Parameters\n    ----------\n    key : str\n        type of property, Property key must come from the [CRIPT Controlled Vocabulary]()\n    type : str\n        type of value stored, Property type must come from the [CRIPT Controlled Vocabulary]()\n    value : Union[Number, None]\n        value or quantity\n    unit : str\n        unit for value\n    uncertainty : Union[Number, None], optional\n        uncertainty value of the value, by default None\n    uncertainty_type : str, optional\n        type of uncertainty, by default \"\"\n    component : Union[List[Material], None], optional\n        List of Material nodes, by default None\n    structure : str, optional\n        specific chemical structure associate with the property with atom mappings**, by default \"\"\n    method : str, optional\n        approach or source of property data, by default \"\"\n    sample_preparation : Union[Process, None], optional\n        sample preparation, by default None\n    condition : Union[List[Condition], None], optional\n        conditions under which the property was measured, by default None\n    data : Union[List[Data], None], optional\n        Data node, by default None\n    computation : Union[List[Computation], None], optional\n        computation method that produced property, by default None\n    citation : Union[List[Citation], None], optional\n        reference scholarly work, by default None\n    notes : str, optional\n        miscellaneous information, or custom data structure (e.g.; JSON), by default \"\"\n    Examples\n    --------\n    ```python\n    import cript\n    my_property = cript.Property(key=\"air_flow\", type=\"min\", value=1.00, unit=\"gram\")\n    ```\n    Returns\n    -------\n    None\n        create a Property sub-object\n    \"\"\"\nif component is None:\ncomponent = []\nif condition is None:\ncondition = []\nif computation is None:\ncomputation = []\nif data is None:\ndata = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(\nself._json_attrs,\nkey=key,\ntype=type,\nvalue=value,\nunit=unit,\nuncertainty=uncertainty,\nuncertainty_type=uncertainty_type,\ncomponent=component,\nstructure=structure,\nmethod=method,\nsample_preparation=sample_preparation,\ncondition=condition,\ndata=data,\ncomputation=computation,\ncitation=citation,\nnotes=notes,\n)\nself.validate()\n
"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.set_uncertainty","title":"set_uncertainty(new_uncertainty, new_uncertainty_type)","text":"

set the uncertainty value and type

Uncertainty type must come from [CRIPT Controlled Vocabulary]

Parameters:

Name Type Description Default new_uncertainty Number

new uncertainty value

required new_uncertainty_type str

new uncertainty type

required

Examples:

my_property.set_uncertainty(new_uncertainty=2, new_uncertainty_type=\"fwhm\")\n

Returns:

Type Description None Source code in src/cript/nodes/subobjects/property.py
@beartype\ndef set_uncertainty(self, new_uncertainty: Number, new_uncertainty_type: str) -> None:\n\"\"\"\n    set the uncertainty value and type\n    Uncertainty type must come from [CRIPT Controlled Vocabulary]\n    Parameters\n    ----------\n    new_uncertainty : Number\n        new uncertainty value\n    new_uncertainty_type : str\n        new uncertainty type\n    Examples\n    --------\n    ```python\n    my_property.set_uncertainty(new_uncertainty=2, new_uncertainty_type=\"fwhm\")\n    ```\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/property/#cript.nodes.subobjects.property.Property.set_value","title":"set_value(new_value, new_unit)","text":"

set the value attribute of the Property subobject

Examples:

my_property.set_value(new_value=1, new_unit=\"gram\")\n

Parameters:

Name Type Description Default new_value Number

new value

required new_unit str

new unit for the value

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/property.py
@beartype\ndef set_value(self, new_value: Union[Number, str], new_unit: str) -> None:\n\"\"\"\n    set the value attribute of the Property subobject\n    Examples\n    ---------\n    ```python\n    my_property.set_value(new_value=1, new_unit=\"gram\")\n    ```\n    Parameters\n    ----------\n    new_value : Number\n        new value\n    new_unit : str\n        new unit for the value\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/quantity/","title":"Quantity","text":""},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity","title":"Quantity","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity--definition","title":"Definition","text":"

The Quantity sub-objects are the amount of material involved in a process

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity--can-be-added-to","title":"Can Be Added To:","text":"
  • Ingredient
"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity--available-sub-objects","title":"Available sub-objects","text":"
  • None
"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity--attributes","title":"Attributes","text":"attribute type example description required vocab key str mass type of quantity True True value Any 1.23 amount of material True unit str gram unit for quantity True uncertainty Number 0.1 uncertainty of value uncertainty_type str std type of uncertainty True"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity--json-representation","title":"JSON Representation","text":"
{\n\"node\":[\"Quantity\"],\n\"key\":\"mass\",\n\"value\":11.2\n\"uncertainty\":0.2,\n\"uncertainty_type\":\"stdev\",\n\"unit\":\"kg\",\n\"uid\":\"_:c95ee781-923b-4699-ba3b-923ce186ac5d\",\n\"uuid\":\"c95ee781-923b-4699-ba3b-923ce186ac5d\",\n}\n
Source code in src/cript/nodes/subobjects/quantity.py
class Quantity(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    The [Quantity](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=22)\n    sub-objects are the amount of material involved in a process\n    ---\n    ## Can Be Added To:\n    * [Ingredient](../ingredient)\n    ## Available sub-objects\n    * None\n    ----\n    ## Attributes\n    | attribute        | type    | example | description          | required | vocab |\n    |------------------|---------|---------|----------------------|----------|-------|\n    | key              | str     | mass    | type of quantity     | True     | True  |\n    | value            | Any     | 1.23    | amount of material   | True     |       |\n    | unit             | str     | gram    | unit for quantity    | True     |       |\n    | uncertainty      | Number  | 0.1     | uncertainty of value |          |       |\n    | uncertainty_type | str     | std     | type of uncertainty  |          | True  |\n    ## JSON Representation\n    ```json\n    {\n     \"node\":[\"Quantity\"],\n     \"key\":\"mass\",\n     \"value\":11.2\n     \"uncertainty\":0.2,\n     \"uncertainty_type\":\"stdev\",\n     \"unit\":\"kg\",\n     \"uid\":\"_:c95ee781-923b-4699-ba3b-923ce186ac5d\",\n     \"uuid\":\"c95ee781-923b-4699-ba3b-923ce186ac5d\",\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nkey: str = \"\"\nvalue: Optional[Number] = None\nunit: str = \"\"\nuncertainty: Optional[Number] = None\nuncertainty_type: str = \"\"\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, key: str, value: Number, unit: str, uncertainty: Optional[Number] = None, uncertainty_type: str = \"\", **kwargs):\n\"\"\"\n        create Quantity sub-object\n        Parameters\n        ----------\n        key : str\n            type of quantity. Quantity key must come from [CRIPT Controlled Vocabulary]()\n        value : Number\n            amount of material\n        unit : str\n            unit for quantity\n        uncertainty : Union[Number, None], optional\n            uncertainty of value, by default None\n        uncertainty_type : str, optional\n            type of uncertainty. Quantity uncertainty type must come from [CRIPT Controlled Vocabulary](), by default \"\"\n        Examples\n        --------\n        ```python\n        import cript\n        my_quantity = cript.Quantity(\n            key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\"\n        )\n        ```\n        Returns\n        -------\n        None\n            create Quantity sub-object\n        \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit, uncertainty=uncertainty, uncertainty_type=uncertainty_type)\nself.validate()\n@classmethod\ndef _from_json(cls, json_dict: dict):\n# TODO: remove this temporary fix, once back end is working correctly\nfor key in [\"value\", \"uncertainty\"]:\ntry:\njson_dict[key] = float(json_dict[key])\nexcept KeyError:\npass\nreturn super(Quantity, cls)._from_json(json_dict)\n@beartype\ndef set_key_unit(self, new_key: str, new_unit: str) -> None:\n\"\"\"\n        set the Quantity key and unit attributes\n        Quantity key must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_quantity.set_key_unit(new_key=\"mass\", new_unit=\"gram\")\n        ```\n        Parameters\n        ----------\n        new_key : str\n            new Quantity key. Quantity key must come from [CRIPT Controlled Vocabulary]()\n        new_unit : str\n            new unit\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef key(self) -> str:\n\"\"\"\n        get the Quantity sub-object key attribute\n        Returns\n        -------\n        str\n            this Quantity key attribute\n        \"\"\"\nreturn self._json_attrs.key\n@property\n@beartype\ndef value(self) -> Union[int, float, str]:\n\"\"\"\n        amount of Material\n        Examples\n        --------\n        ```python\n        my_quantity.value = 1\n        ```\n        Returns\n        -------\n        Union[int, float, str]\n            amount of Material\n        \"\"\"\nreturn self._json_attrs.value  # type: ignore\n@value.setter\n@beartype\ndef value(self, new_value: Union[int, float, str]) -> None:\n\"\"\"\n        set the amount of Material\n        Parameters\n        ----------\n        new_value : Union[int, float, str]\n            amount of Material\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, value=new_value)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef unit(self) -> str:\n\"\"\"\n        get the Quantity unit attribute\n        Returns\n        -------\n        str\n            unit for the Quantity value attribute\n        \"\"\"\nreturn self._json_attrs.unit\n@property\n@beartype\ndef uncertainty(self) -> Number:\n\"\"\"\n        get the uncertainty value\n        Returns\n        -------\n        Number\n            uncertainty value\n        \"\"\"\nreturn self._json_attrs.uncertainty  # type: ignore\n@property\n@beartype\ndef uncertainty_type(self) -> str:\n\"\"\"\n        get the uncertainty type attribute for the Quantity sub-object\n        `uncertainty_type` must come from [CRIPT Controlled Vocabulary]()\n        Returns\n        -------\n        str\n            uncertainty type\n        \"\"\"\nreturn self._json_attrs.uncertainty_type\n@beartype\ndef set_uncertainty(self, uncertainty: Number, type: str) -> None:\n\"\"\"\n        set the `uncertainty value` and `uncertainty_type`\n        Uncertainty and uncertainty type are set at the same time to keep the value and type in sync\n        `uncertainty_type` must come from [CRIPT Controlled Vocabulary]()\n        Examples\n        --------\n        ```python\n        my_property.set_uncertainty(uncertainty=1, type=\"stderr\")\n        ```\n        Parameters\n        ----------\n        uncertainty : Number\n            uncertainty value\n        type : str\n            type of uncertainty, uncertainty_type must come from [CRIPT Controlled Vocabulary]()\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, uncertainty=uncertainty, uncertainty_type=type)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.key","title":"key: str property","text":"

get the Quantity sub-object key attribute

Returns:

Type Description str

this Quantity key attribute

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.uncertainty","title":"uncertainty: Number property","text":"

get the uncertainty value

Returns:

Type Description Number

uncertainty value

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.uncertainty_type","title":"uncertainty_type: str property","text":"

get the uncertainty type attribute for the Quantity sub-object

uncertainty_type must come from CRIPT Controlled Vocabulary

Returns:

Type Description str

uncertainty type

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.unit","title":"unit: str property","text":"

get the Quantity unit attribute

Returns:

Type Description str

unit for the Quantity value attribute

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.value","title":"value: Union[int, float, str] property writable","text":"

amount of Material

Examples:

my_quantity.value = 1\n

Returns:

Type Description Union[int, float, str]

amount of Material

"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.__init__","title":"__init__(key, value, unit, uncertainty=None, uncertainty_type='', **kwargs)","text":"

create Quantity sub-object

Parameters:

Name Type Description Default key str

type of quantity. Quantity key must come from CRIPT Controlled Vocabulary

required value Number

amount of material

required unit str

unit for quantity

required uncertainty Union[Number, None]

uncertainty of value, by default None

None uncertainty_type str

type of uncertainty. Quantity uncertainty type must come from CRIPT Controlled Vocabulary, by default \"\"

''

Examples:

import cript\nmy_quantity = cript.Quantity(\nkey=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\"\n)\n

Returns:

Type Description None

create Quantity sub-object

Source code in src/cript/nodes/subobjects/quantity.py
@beartype\ndef __init__(self, key: str, value: Number, unit: str, uncertainty: Optional[Number] = None, uncertainty_type: str = \"\", **kwargs):\n\"\"\"\n    create Quantity sub-object\n    Parameters\n    ----------\n    key : str\n        type of quantity. Quantity key must come from [CRIPT Controlled Vocabulary]()\n    value : Number\n        amount of material\n    unit : str\n        unit for quantity\n    uncertainty : Union[Number, None], optional\n        uncertainty of value, by default None\n    uncertainty_type : str, optional\n        type of uncertainty. Quantity uncertainty type must come from [CRIPT Controlled Vocabulary](), by default \"\"\n    Examples\n    --------\n    ```python\n    import cript\n    my_quantity = cript.Quantity(\n        key=\"mass\", value=11.2, unit=\"kg\", uncertainty=0.2, uncertainty_type=\"stdev\"\n    )\n    ```\n    Returns\n    -------\n    None\n        create Quantity sub-object\n    \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, key=key, value=value, unit=unit, uncertainty=uncertainty, uncertainty_type=uncertainty_type)\nself.validate()\n
"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.set_key_unit","title":"set_key_unit(new_key, new_unit)","text":"

set the Quantity key and unit attributes

Quantity key must come from CRIPT Controlled Vocabulary

Examples:

my_quantity.set_key_unit(new_key=\"mass\", new_unit=\"gram\")\n

Parameters:

Name Type Description Default new_key str

new Quantity key. Quantity key must come from CRIPT Controlled Vocabulary

required new_unit str

new unit

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/quantity.py
@beartype\ndef set_key_unit(self, new_key: str, new_unit: str) -> None:\n\"\"\"\n    set the Quantity key and unit attributes\n    Quantity key must come from [CRIPT Controlled Vocabulary]()\n    Examples\n    --------\n    ```python\n    my_quantity.set_key_unit(new_key=\"mass\", new_unit=\"gram\")\n    ```\n    Parameters\n    ----------\n    new_key : str\n        new Quantity key. Quantity key must come from [CRIPT Controlled Vocabulary]()\n    new_unit : str\n        new unit\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, key=new_key, unit=new_unit)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/quantity/#cript.nodes.subobjects.quantity.Quantity.set_uncertainty","title":"set_uncertainty(uncertainty, type)","text":"

set the uncertainty value and uncertainty_type

Uncertainty and uncertainty type are set at the same time to keep the value and type in sync

uncertainty_type must come from CRIPT Controlled Vocabulary

Examples:

my_property.set_uncertainty(uncertainty=1, type=\"stderr\")\n

Parameters:

Name Type Description Default uncertainty Number

uncertainty value

required type str

type of uncertainty, uncertainty_type must come from CRIPT Controlled Vocabulary

required

Returns:

Type Description None Source code in src/cript/nodes/subobjects/quantity.py
@beartype\ndef set_uncertainty(self, uncertainty: Number, type: str) -> None:\n\"\"\"\n    set the `uncertainty value` and `uncertainty_type`\n    Uncertainty and uncertainty type are set at the same time to keep the value and type in sync\n    `uncertainty_type` must come from [CRIPT Controlled Vocabulary]()\n    Examples\n    --------\n    ```python\n    my_property.set_uncertainty(uncertainty=1, type=\"stderr\")\n    ```\n    Parameters\n    ----------\n    uncertainty : Number\n        uncertainty value\n    type : str\n        type of uncertainty, uncertainty_type must come from [CRIPT Controlled Vocabulary]()\n    Returns\n    -------\n    None\n    \"\"\"\nnew_attrs = replace(self._json_attrs, uncertainty=uncertainty, uncertainty_type=type)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/software_configuration/","title":"Software Configuration","text":""},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration","title":"SoftwareConfiguration","text":"

Bases: UUIDBaseNode

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration--definition","title":"Definition","text":"

The software_configuration sub-object includes software and the set of algorithms to execute computation or computational_process.

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration--can-be-added-to","title":"Can Be Added To:","text":"
  • Computation
  • Computation_Process
"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration--available-sub-objects","title":"Available sub-objects:","text":"
  • Algorithm
  • Citation
"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration--attributes","title":"Attributes","text":"keys type example description required vocab software Software software used True algorithms list[Algorithm] algorithms used notes str miscellaneous information, or custom data structure (e.g.; JSON) citation list[Citation] reference to a book, paper, or scholarly work"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration--json-representation","title":"JSON Representation","text":"
{\n\"node\":[\"SoftwareConfiguration\"],\n\"uid\":\"_:f0dc3415-635d-4590-8b1f-cd65ad8ab3fe\"\n\"software\":{\n\"name\":\"SOMA\",\n\"node\":[\"Software\"],\n\"source\":\"https://gitlab.com/InnocentBug/SOMA\",\n\"uid\":\"_:5bf9cb33-f029-4d1b-ba53-3602036e4f75\",\n\"uuid\":\"5bf9cb33-f029-4d1b-ba53-3602036e4f75\",\n\"version\":\"0.7.0\"\n}\n}\n
Source code in src/cript/nodes/subobjects/software_configuration.py
class SoftwareConfiguration(UUIDBaseNode):\n\"\"\"\n    ## Definition\n    The [software_configuration](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=24)\n    sub-object includes software and the set of algorithms to execute computation or computational_process.\n    ---\n    ## Can Be Added To:\n    * [Computation](../../primary_nodes/computation)\n    * [Computation_Process](../../primary_nodes/computation_process)\n    ## Available sub-objects:\n    * [Algorithm](../algorithm)\n    * [Citation](../citation)\n    ---\n    ## Attributes\n    | keys                                             | type            | example | description                                                      | required | vocab |\n    |--------------------------------------------------|-----------------|---------|------------------------------------------------------------------|----------|-------|\n    | software                                         | Software        |         | software used                                                    | True     |       |\n    | algorithms                                       | list[Algorithm] |         | algorithms used                                                  |          |       |\n    | notes                                            | str             |         | miscellaneous information, or custom data structure (e.g.; JSON) |          |       |\n    | citation                                         | list[Citation]  |         | reference to a book, paper, or scholarly work                    |          |       |\n    ## JSON Representation\n    ```json\n    {\n       \"node\":[\"SoftwareConfiguration\"],\n       \"uid\":\"_:f0dc3415-635d-4590-8b1f-cd65ad8ab3fe\"\n       \"software\":{\n          \"name\":\"SOMA\",\n          \"node\":[\"Software\"],\n          \"source\":\"https://gitlab.com/InnocentBug/SOMA\",\n          \"uid\":\"_:5bf9cb33-f029-4d1b-ba53-3602036e4f75\",\n          \"uuid\":\"5bf9cb33-f029-4d1b-ba53-3602036e4f75\",\n          \"version\":\"0.7.0\"\n       }\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\nsoftware: Union[Software, None] = None\nalgorithm: List[Algorithm] = field(default_factory=list)\nnotes: str = \"\"\ncitation: List[Citation] = field(default_factory=list)\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, software: Software, algorithm: Optional[List[Algorithm]] = None, notes: str = \"\", citation: Union[List[Citation], None] = None, **kwargs):\n\"\"\"\n        Create Software_Configuration sub-object\n        Parameters\n        ----------\n        software : Software\n            Software node used for the Software_Configuration\n        algorithm : Union[List[Algorithm], None], optional\n            algorithm used for the Software_Configuration, by default None\n        notes : str, optional\n            plain text notes, by default \"\"\n        citation : Union[List[Citation], None], optional\n            list of Citation sub-object, by default None\n        Examples\n        ---------\n        ```python\n        import cript\n        my_software = cript.Software(name=\"LAMMPS\", version=\"23Jun22\", source=\"lammps.org\")\n        my_software_configuration = cript.SoftwareConfiguration(software=my_software)\n        ```\n        Returns\n        -------\n        None\n            Create Software_Configuration sub-object\n        \"\"\"\nif algorithm is None:\nalgorithm = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, software=software, algorithm=algorithm, notes=notes, citation=citation)\nself.validate()\n@property\n@beartype\ndef software(self) -> Union[Software, None]:\n\"\"\"\n        Software used\n        Examples\n        --------\n        ```python\n        my_software = cript.Software(\n            name=\"my software name\", version=\"v1.0.0\", source=\"https://myurl.com\"\n        )\n        my_software_configuration.software = my_software\n        ```\n        Returns\n        -------\n        Union[Software, None]\n            Software node used\n        \"\"\"\nreturn self._json_attrs.software\n@software.setter\n@beartype\ndef software(self, new_software: Union[Software, None]) -> None:\n\"\"\"\n        set the Software used\n        Parameters\n        ----------\n        new_software : Union[Software, None]\n            new Software node\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, software=new_software)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef algorithm(self) -> List[Algorithm]:\n\"\"\"\n        list of Algorithms used\n        Examples\n        --------\n        ```python\n        my_algorithm = cript.Algorithm(key=\"mc_barostat\", type=\"barostat\")\n        my_software_configuration.algorithm = [my_algorithm]\n        ```\n        Returns\n        -------\n        List[Algorithm]\n            list of algorithms used\n        \"\"\"\nreturn self._json_attrs.algorithm.copy()\n@algorithm.setter\n@beartype\ndef algorithm(self, new_algorithm: List[Algorithm]) -> None:\n\"\"\"\n        set the list of Algorithms\n        Parameters\n        ----------\n        new_algorithm : List[Algorithm]\n            list of algorithms\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, algorithm=new_algorithm)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef notes(self) -> str:\n\"\"\"\n        miscellaneous information, or custom data structure (e.g.; JSON). Notes can be written in plain text or JSON\n        Examples\n        --------\n        ### Plain Text\n        ```json\n        my_software_configuration.notes = \"these are my awesome notes!\"\n        ```\n        ### JSON Notes\n        ```python\n        my_software_configuration.notes = \"{'notes subject': 'notes contents'}\"\n        ```\n        Returns\n        -------\n        str\n            notes\n        \"\"\"\nreturn self._json_attrs.notes\n@notes.setter\n@beartype\ndef notes(self, new_notes: str) -> None:\n\"\"\"\n        set notes for Software_configuration\n        Parameters\n        ----------\n        new_notes : str\n            new notes in plain text or JSON\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, notes=new_notes)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef citation(self) -> List[Citation]:\n\"\"\"\n        list of Citation sub-objects for the Software_Configuration\n        Examples\n        --------\n        ```python\n        title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\n        title += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n        # create reference node\n        my_reference = cript.Reference(\n            type\"journal_article\",\n            title=title,\n            author=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\n            journal=\"Computer Physics Communications\",\n            publisher=\"Elsevier\",\n            year=2019,\n            pages=[463, 476],\n            doi=\"10.1016/j.cpc.2018.08.011\",\n            issn=\"0010-4655\",\n            website=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n        )\n        # create citation sub-object and add reference to it\n        my_citation = Citation(\"reference\", my_reference)\n        # add citation to algorithm node\n        my_software_configuration.citation = [my_citation]\n        ```\n        Returns\n        -------\n        List[Citation]\n            list of Citations\n        \"\"\"\nreturn self._json_attrs.citation.copy()\n@citation.setter\n@beartype\ndef citation(self, new_citation: List[Citation]) -> None:\n\"\"\"\n        set the Citation sub-object\n        Parameters\n        ----------\n        new_citation : List[Citation]\n            new list of Citation sub-objects\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, citation=new_citation)\nself._update_json_attrs_if_valid(new_attrs)\n
"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.algorithm","title":"algorithm: List[Algorithm] property writable","text":"

list of Algorithms used

Examples:

my_algorithm = cript.Algorithm(key=\"mc_barostat\", type=\"barostat\")\nmy_software_configuration.algorithm = [my_algorithm]\n

Returns:

Type Description List[Algorithm]

list of algorithms used

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.citation","title":"citation: List[Citation] property writable","text":"

list of Citation sub-objects for the Software_Configuration

Examples:

title = \"Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: \"\ntitle += \"SOft coarse grained Monte-Carlo Acceleration (SOMA)\"\n# create reference node\nmy_reference = cript.Reference(\ntype\"journal_article\",\ntitle=title,\nauthor=[\"Ludwig Schneider\", \"Marcus M\u00fcller\"],\njournal=\"Computer Physics Communications\",\npublisher=\"Elsevier\",\nyear=2019,\npages=[463, 476],\ndoi=\"10.1016/j.cpc.2018.08.011\",\nissn=\"0010-4655\",\nwebsite=\"https://www.sciencedirect.com/science/article/pii/S0010465518303072\",\n)\n# create citation sub-object and add reference to it\nmy_citation = Citation(\"reference\", my_reference)\n# add citation to algorithm node\nmy_software_configuration.citation = [my_citation]\n

Returns:

Type Description List[Citation]

list of Citations

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.notes","title":"notes: str property writable","text":"

miscellaneous information, or custom data structure (e.g.; JSON). Notes can be written in plain text or JSON

Examples:

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.notes--plain-text","title":"Plain Text","text":"
my_software_configuration.notes = \"these are my awesome notes!\"\n
"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.notes--json-notes","title":"JSON Notes","text":"
my_software_configuration.notes = \"{'notes subject': 'notes contents'}\"\n

Returns:

Type Description str

notes

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.software","title":"software: Union[Software, None] property writable","text":"

Software used

Examples:

my_software = cript.Software(\nname=\"my software name\", version=\"v1.0.0\", source=\"https://myurl.com\"\n)\nmy_software_configuration.software = my_software\n

Returns:

Type Description Union[Software, None]

Software node used

"},{"location":"nodes/subobjects/software_configuration/#cript.nodes.subobjects.software_configuration.SoftwareConfiguration.__init__","title":"__init__(software, algorithm=None, notes='', citation=None, **kwargs)","text":"

Create Software_Configuration sub-object

Parameters:

Name Type Description Default software Software

Software node used for the Software_Configuration

required algorithm Union[List[Algorithm], None]

algorithm used for the Software_Configuration, by default None

None notes str

plain text notes, by default \"\"

'' citation Union[List[Citation], None]

list of Citation sub-object, by default None

None

Examples:

import cript\nmy_software = cript.Software(name=\"LAMMPS\", version=\"23Jun22\", source=\"lammps.org\")\nmy_software_configuration = cript.SoftwareConfiguration(software=my_software)\n

Returns:

Type Description None

Create Software_Configuration sub-object

Source code in src/cript/nodes/subobjects/software_configuration.py
@beartype\ndef __init__(self, software: Software, algorithm: Optional[List[Algorithm]] = None, notes: str = \"\", citation: Union[List[Citation], None] = None, **kwargs):\n\"\"\"\n    Create Software_Configuration sub-object\n    Parameters\n    ----------\n    software : Software\n        Software node used for the Software_Configuration\n    algorithm : Union[List[Algorithm], None], optional\n        algorithm used for the Software_Configuration, by default None\n    notes : str, optional\n        plain text notes, by default \"\"\n    citation : Union[List[Citation], None], optional\n        list of Citation sub-object, by default None\n    Examples\n    ---------\n    ```python\n    import cript\n    my_software = cript.Software(name=\"LAMMPS\", version=\"23Jun22\", source=\"lammps.org\")\n    my_software_configuration = cript.SoftwareConfiguration(software=my_software)\n    ```\n    Returns\n    -------\n    None\n        Create Software_Configuration sub-object\n    \"\"\"\nif algorithm is None:\nalgorithm = []\nif citation is None:\ncitation = []\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, software=software, algorithm=algorithm, notes=notes, citation=citation)\nself.validate()\n
"},{"location":"nodes/supporting_nodes/file/","title":"File","text":""},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File","title":"File","text":"

Bases: PrimaryBaseNode

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File--definition","title":"Definition","text":"

The File node provides a link to scholarly work and allows users to specify in what way the work relates to that data. More specifically, users can specify that the data was directly extracted from, inspired by, derived from, etc.

The file node is held in the Data node.

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File--attributes","title":"Attributes","text":"Attribute Type Example Description Required source str \"path/to/my/file\" or \"https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system\" source to the file can be URL or local path True type str \"logs\" Pick from CRIPT File Types True extension str \".csv\" file extension False data_dictionary str \"my extra info in my data dictionary\" set of information describing the contents, format, and structure of a file False"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File--json","title":"JSON","text":"
{\n\"node\": \"File\",\n\"source\": \"https://criptapp.org\",\n\"type\": \"calibration\",\n\"extension\": \".csv\",\n\"data_dictionary\": \"my file's data dictionary\",\n}\n
Source code in src/cript/nodes/supporting_nodes/file.py
class File(PrimaryBaseNode):\n\"\"\"\n    ## Definition\n    The [File node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001\n    .pdf#page=28) provides a link to  scholarly work and allows users to specify in what way the work relates to that\n    data. More specifically, users can specify that the data was directly extracted from, inspired by, derived from,\n    etc.\n    The file node is held in the [Data node](../../primary_nodes/data).\n    ## Attributes\n    | Attribute       | Type | Example                                                                                               | Description                                                                 | Required |\n    |-----------------|------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|----------|\n    | source          | str  | `\"path/to/my/file\"` or `\"https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system\"` | source to the file can be URL or local path                                 | True     |\n    | type            | str  | `\"logs\"`                                                                                              | Pick from [CRIPT File Types](https://criptapp.org/keys/file-type/)          | True     |\n    | extension       | str  | `\".csv\"`                                                                                              | file extension                                                              | False    |\n    | data_dictionary | str  | `\"my extra info in my data dictionary\"`                                                               | set of information describing the contents, format, and structure of a file | False    |\n    ## JSON\n    ``` json\n    {\n        \"node\": \"File\",\n        \"source\": \"https://criptapp.org\",\n        \"type\": \"calibration\",\n        \"extension\": \".csv\",\n        \"data_dictionary\": \"my file's data dictionary\",\n    }\n    ```\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n        all file attributes\n        \"\"\"\nsource: str = \"\"\ntype: str = \"\"\nextension: str = \"\"\ndata_dictionary: str = \"\"\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, name: str, source: str, type: str, extension: str = \"\", data_dictionary: str = \"\", notes: str = \"\", **kwargs):\n\"\"\"\n        create a File node\n        Parameters\n        ----------\n        name: str\n            File node name\n        source: str\n            link or path to local file\n        type: str\n            Pick a file type from CRIPT controlled vocabulary [File types]()\n        extension:str\n            file extension\n        data_dictionary:str\n            extra information describing the file\n        notes: str\n            notes for the file node\n        **kwargs:dict\n            for internal use. Any extra data needed to create this file node\n            when deserializing the JSON response from the API\n        Examples\n        --------\n        ??? Example \"Minimal File Node\"\n            ```python\n            my_file = cript.File(\n                source=\"https://criptapp.org\",\n                type=\"calibration\",\n            )\n            ```\n        ??? Example \"Maximal File Node\"\n            ```python\n            my_file = cript.File(\n                source=\"https://criptapp.org\",\n                type=\"calibration\",\n                extension=\".csv\",\n                data_dictionary=\"my file's data dictionary\"\n                notes=\"my notes for this file\"\n            )\n            ```\n        \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\n# TODO check if vocabulary is valid or not\n# is_vocab_valid(\"file type\", type)\n# setting every attribute except for source, which will be handled via setter\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\n# always giving the function the required str regardless if the input `Path` or `str`\nsource=str(source),\nextension=extension,\ndata_dictionary=data_dictionary,\n)\nself.validate()\ndef ensure_uploaded(self, api=None):\n\"\"\"\n        Ensure that a local file is being uploaded into CRIPT accessible cloud storage.\n        After this call, non-local files (file names that do not start with `http`) are uploaded.\n        It is not necessary to call this function manually.\n        A saved project automatically ensures uploaded files, it is recommend to rely on the automatic upload.\n        Parameters:\n        -----------\n        api: cript.API, optional\n           API object that performs the upload.\n           If None, the globally cached object is being used.\n        Examples\n        --------\n        ??? Example \"Minimal File Node\"\n            ```python\n            my_file = cript.File(source=\"/local/path/to/file\", type=\"calibration\")\n            my_file.ensure_uploaded()\n            my_file.source # Starts with http now\n            ```\n        \"\"\"\nif _is_local_file(file_source=self.source):\n# upload file source if local file\nself.source = _upload_file_and_get_object_name(source=self.source)\n# TODO can be made into a function\n# --------------- Properties ---------------\n@property\n@beartype\ndef source(self) -> str:\n\"\"\"\n        The File node source can be set to be either a path to a local file on disk\n        or a URL path to a file on the web.\n        Example\n        --------\n        URL File Source\n        ```python\n        url_source = \"https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf\"\n        my_file.source = url_source\n        ```\n        Local File Path\n        ```python\n        my_file.source = \"/home/user/project/my_file.csv\"\n        ```\n        Returns\n        -------\n        source: str\n            A string representing the file source.\n        \"\"\"\nreturn self._json_attrs.source\n@source.setter\n@beartype\ndef source(self, new_source: str) -> None:\n\"\"\"\n        sets the source of the file node\n        the source can either be a path to a file on local storage or a link to a file\n        1. checks if the file source is a link or a local file path\n        2. if the source is a link such as `https://wikipedia.com` then it sets the URL as the file source\n        3. if the file source is a local file path such as\n                `C:\\\\Users\\\\my_username\\\\Desktop\\\\cript\\\\file.txt`\n            1. then it opens the file and reads it\n            2. uploads it to the cloud storage\n            3. gets back a URL from where in the cloud the file is found\n            4. sets that as the source\n        Parameters\n        ----------\n        new_source: str\n        Example\n        -------\n        ```python\n        my_file.source = \"https://pubs.acs.org/doi/10.1021/acscentsci.3c00011\"\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, source=new_source)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef type(self) -> str:\n\"\"\"\n        The [File type]() must come from [CRIPT controlled vocabulary]()\n        Example\n        -------\n        ```python\n        my_file.type = \"calibration\"\n        ```\n        Returns\n        -------\n        file type: str\n            file type must come from [CRIPT controlled vocabulary]()\n        \"\"\"\nreturn self._json_attrs.type\n@type.setter\n@beartype\ndef type(self, new_type: str) -> None:\n\"\"\"\n        set the file type\n        file type must come from CRIPT controlled vocabulary\n        Parameters\n        -----------\n        new_type: str\n        Example\n        -------\n        ```python\n        my_file.type = \"computation_config\"\n        ```\n        Returns\n        -------\n        None\n        \"\"\"\n# TODO check vocabulary is valid\n# is_vocab_valid(\"file type\", self._json_attrs.type)\nnew_attrs = replace(self._json_attrs, type=new_type)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef extension(self) -> str:\n\"\"\"\n        The file extension property explicitly states what is the file extension of the file node.\n        Example\n        -------\n        ```python\n        my_file_node.extension = \".csv\"`\n        ```\n        Returns\n        -------\n        extension: str\n            file extension\n        \"\"\"\nreturn self._json_attrs.extension\n@extension.setter\n@beartype\ndef extension(self, new_extension) -> None:\n\"\"\"\n        sets the new file extension\n        Parameters\n        ----------\n        new_extension: str\n            new file extension to overwrite the current file extension\n        Example\n        -------\n        ```python\n        my_file.extension = \".pdf\"\n        ```\n        Returns\n        -------\n            None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, extension=new_extension)\nself._update_json_attrs_if_valid(new_attrs)\n@property\n@beartype\ndef data_dictionary(self) -> str:\n# TODO data dictionary needs documentation describing it and how to use it\n\"\"\"\n        The data dictionary contains additional information\n        that the scientist needs to describe their file.\n        Notes\n        ------\n        It is advised for this field to be written in JSON format\n        Examples\n        -------\n        ```python\n        my_file.data_dictionary = \"{'notes': 'This is something that describes my file node.'}\"\n        ```\n        Returns\n        -------\n        data_dictionary: str\n            the file data dictionary attribute\n        \"\"\"\nreturn self._json_attrs.data_dictionary\n@data_dictionary.setter\n@beartype\ndef data_dictionary(self, new_data_dictionary: str) -> None:\n\"\"\"\n        Sets the data dictionary for the file node.\n        Parameters\n        ----------\n        new_data_dictionary: str\n            The new data dictionary to be set.\n        Returns\n        -------\n        None\n        \"\"\"\nnew_attrs = replace(self._json_attrs, data_dictionary=new_data_dictionary)\nself._update_json_attrs_if_valid(new_attrs)\n@beartype\ndef download(\nself,\ndestination_directory_path: Union[str, Path] = \".\",\n) -> None:\n\"\"\"\n        download this file to current working directory or a specific destination.\n        The file name will come from the file_node.name and the extension will come from file_node.extension\n        Notes\n        -----\n        Whether the file extension is written like `.csv` or `csv` the program will work correctly\n        Parameters\n        ----------\n        destination_directory_path: Union[str, Path]\n            where you want the file to be stored and what you want the name to be\n            by default it is the current working directory\n        Returns\n        -------\n        None\n        \"\"\"\nfrom cript.api.api import _get_global_cached_api\napi = _get_global_cached_api()\n# convert the path from str to Path in case it was given as a str and resolve it to get the absolute path\nexisting_folder_path = Path(destination_directory_path).resolve()\n# stripping dot from extension to make all extensions uniform, in case a user puts `.csv` or `csv` it will work\nfile_name = f\"{self.name}.{self.extension.lstrip('.')}\"\nabsolute_file_path = str((existing_folder_path / file_name).resolve())\napi.download_file(file_source=self.source, destination_path=absolute_file_path)\n
"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.data_dictionary","title":"data_dictionary: str property writable","text":"

The data dictionary contains additional information that the scientist needs to describe their file.

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.data_dictionary--notes","title":"Notes","text":"

It is advised for this field to be written in JSON format

Examples:

my_file.data_dictionary = \"{'notes': 'This is something that describes my file node.'}\"\n

Returns:

Name Type Description data_dictionary str

the file data dictionary attribute

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.extension","title":"extension: str property writable","text":"

The file extension property explicitly states what is the file extension of the file node.

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.extension--example","title":"Example","text":"
my_file_node.extension = \".csv\"`\n

Returns:

Name Type Description extension str

file extension

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.source","title":"source: str property writable","text":"

The File node source can be set to be either a path to a local file on disk or a URL path to a file on the web.

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.source--example","title":"Example","text":"

URL File Source

url_source = \"https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf\"\nmy_file.source = url_source\n
Local File Path
my_file.source = \"/home/user/project/my_file.csv\"\n

Returns:

Name Type Description source str

A string representing the file source.

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.type","title":"type: str property writable","text":"

The File type must come from CRIPT controlled vocabulary

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.type--example","title":"Example","text":"
my_file.type = \"calibration\"\n

Returns:

Type Description file type: str

file type must come from CRIPT controlled vocabulary

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: PrimaryBaseNode.JsonAttributes

all file attributes

Source code in src/cript/nodes/supporting_nodes/file.py
@dataclass(frozen=True)\nclass JsonAttributes(PrimaryBaseNode.JsonAttributes):\n\"\"\"\n    all file attributes\n    \"\"\"\nsource: str = \"\"\ntype: str = \"\"\nextension: str = \"\"\ndata_dictionary: str = \"\"\n
"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.__init__","title":"__init__(name, source, type, extension='', data_dictionary='', notes='', **kwargs)","text":"

create a File node

Parameters:

Name Type Description Default name str

File node name

required source str

link or path to local file

required type str

Pick a file type from CRIPT controlled vocabulary File types

required extension str

file extension

'' data_dictionary str

extra information describing the file

'' notes str

notes for the file node

'' **kwargs

for internal use. Any extra data needed to create this file node when deserializing the JSON response from the API

{}

Examples:

Minimal File Node
my_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\n)\n
Maximal File Node
my_file = cript.File(\nsource=\"https://criptapp.org\",\ntype=\"calibration\",\nextension=\".csv\",\ndata_dictionary=\"my file's data dictionary\"\nnotes=\"my notes for this file\"\n)\n
Source code in src/cript/nodes/supporting_nodes/file.py
@beartype\ndef __init__(self, name: str, source: str, type: str, extension: str = \"\", data_dictionary: str = \"\", notes: str = \"\", **kwargs):\n\"\"\"\n    create a File node\n    Parameters\n    ----------\n    name: str\n        File node name\n    source: str\n        link or path to local file\n    type: str\n        Pick a file type from CRIPT controlled vocabulary [File types]()\n    extension:str\n        file extension\n    data_dictionary:str\n        extra information describing the file\n    notes: str\n        notes for the file node\n    **kwargs:dict\n        for internal use. Any extra data needed to create this file node\n        when deserializing the JSON response from the API\n    Examples\n    --------\n    ??? Example \"Minimal File Node\"\n        ```python\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n        )\n        ```\n    ??? Example \"Maximal File Node\"\n        ```python\n        my_file = cript.File(\n            source=\"https://criptapp.org\",\n            type=\"calibration\",\n            extension=\".csv\",\n            data_dictionary=\"my file's data dictionary\"\n            notes=\"my notes for this file\"\n        )\n        ```\n    \"\"\"\nsuper().__init__(name=name, notes=notes, **kwargs)\n# TODO check if vocabulary is valid or not\n# is_vocab_valid(\"file type\", type)\n# setting every attribute except for source, which will be handled via setter\nself._json_attrs = replace(\nself._json_attrs,\ntype=type,\n# always giving the function the required str regardless if the input `Path` or `str`\nsource=str(source),\nextension=extension,\ndata_dictionary=data_dictionary,\n)\nself.validate()\n
"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.download","title":"download(destination_directory_path='.')","text":"

download this file to current working directory or a specific destination. The file name will come from the file_node.name and the extension will come from file_node.extension

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.download--notes","title":"Notes","text":"

Whether the file extension is written like .csv or csv the program will work correctly

Parameters:

Name Type Description Default destination_directory_path Union[str, Path]

where you want the file to be stored and what you want the name to be by default it is the current working directory

'.'

Returns:

Type Description None Source code in src/cript/nodes/supporting_nodes/file.py
@beartype\ndef download(\nself,\ndestination_directory_path: Union[str, Path] = \".\",\n) -> None:\n\"\"\"\n    download this file to current working directory or a specific destination.\n    The file name will come from the file_node.name and the extension will come from file_node.extension\n    Notes\n    -----\n    Whether the file extension is written like `.csv` or `csv` the program will work correctly\n    Parameters\n    ----------\n    destination_directory_path: Union[str, Path]\n        where you want the file to be stored and what you want the name to be\n        by default it is the current working directory\n    Returns\n    -------\n    None\n    \"\"\"\nfrom cript.api.api import _get_global_cached_api\napi = _get_global_cached_api()\n# convert the path from str to Path in case it was given as a str and resolve it to get the absolute path\nexisting_folder_path = Path(destination_directory_path).resolve()\n# stripping dot from extension to make all extensions uniform, in case a user puts `.csv` or `csv` it will work\nfile_name = f\"{self.name}.{self.extension.lstrip('.')}\"\nabsolute_file_path = str((existing_folder_path / file_name).resolve())\napi.download_file(file_source=self.source, destination_path=absolute_file_path)\n
"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.ensure_uploaded","title":"ensure_uploaded(api=None)","text":"

Ensure that a local file is being uploaded into CRIPT accessible cloud storage. After this call, non-local files (file names that do not start with http) are uploaded. It is not necessary to call this function manually. A saved project automatically ensures uploaded files, it is recommend to rely on the automatic upload.

"},{"location":"nodes/supporting_nodes/file/#cript.nodes.supporting_nodes.file.File.ensure_uploaded--parameters","title":"Parameters:","text":"

api: cript.API, optional API object that performs the upload. If None, the globally cached object is being used.

Examples:

Minimal File Node
my_file = cript.File(source=\"/local/path/to/file\", type=\"calibration\")\nmy_file.ensure_uploaded()\nmy_file.source # Starts with http now\n
Source code in src/cript/nodes/supporting_nodes/file.py
def ensure_uploaded(self, api=None):\n\"\"\"\n    Ensure that a local file is being uploaded into CRIPT accessible cloud storage.\n    After this call, non-local files (file names that do not start with `http`) are uploaded.\n    It is not necessary to call this function manually.\n    A saved project automatically ensures uploaded files, it is recommend to rely on the automatic upload.\n    Parameters:\n    -----------\n    api: cript.API, optional\n       API object that performs the upload.\n       If None, the globally cached object is being used.\n    Examples\n    --------\n    ??? Example \"Minimal File Node\"\n        ```python\n        my_file = cript.File(source=\"/local/path/to/file\", type=\"calibration\")\n        my_file.ensure_uploaded()\n        my_file.source # Starts with http now\n        ```\n    \"\"\"\nif _is_local_file(file_source=self.source):\n# upload file source if local file\nself.source = _upload_file_and_get_object_name(source=self.source)\n
"},{"location":"nodes/supporting_nodes/group/","title":"Group Node","text":""},{"location":"nodes/supporting_nodes/group/#group-node","title":"Group Node","text":""},{"location":"nodes/supporting_nodes/user/","title":"User","text":""},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User","title":"User","text":"

Bases: UUIDBaseNode

The User node represents any researcher or individual who interacts with the CRIPT platform. It serves two main purposes: 1. It plays a core role in permissions (access control) 1. It provides a traceable link to the individual who has contributed or edited data within the database

attribute type example description required vocab url str unique ID of the node True username str \"john_doe\" User\u2019s name True email str \"user@cript.com\" email of the user True orcid str \"0000-0000-0000-0000\" ORCID ID of the user True updated_at datetime* 2023-03-06 18:45:23.450248 last date the node was modified (UTC time) True created_at datetime* 2023-03-06 18:45:23.450248 date it was created (UTC time) True"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User--json","title":"JSON","text":"
{\n\"node\": \"User\",\n\"username\": \"my username\",\n\"email\": \"user@email.com\",\n\"orcid\": \"0000-0000-0000-0001\",\n}\n
"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User--warnings","title":"Warnings","text":"
  • A User cannot be created or modified using the Python SDK.
  • A User node is a read-only node that can only be deserialized from API JSON response to Python node.
  • The User node cannot be instantiated and within the Python SDK.
  • Attempting to edit the user node will result in an Attribute Error
Source code in src/cript/nodes/supporting_nodes/user.py
class User(UUIDBaseNode):\n\"\"\"\n    The [User node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=27)\n    represents any researcher or individual who interacts with the CRIPT platform.\n    It serves two main purposes:\n    1. It plays a core role in permissions (access control)\n    1. It provides a traceable link to the individual who has contributed or edited data within the database\n    | attribute  | type        | example                    | description                                | required | vocab |\n    |------------|-------------|----------------------------|--------------------------------------------|----------|-------|\n    | url        | str         |                            | unique ID of the node                      | True     |       |\n    | username   | str         | \"john_doe\"                 | User\u2019s name                                | True     |       |\n    | email      | str         | \"user@cript.com\"           | email of the user                          | True     |       |\n    | orcid      | str         | \"0000-0000-0000-0000\"      | ORCID ID of the user                       | True     |       |\n    | updated_at | datetime*   | 2023-03-06 18:45:23.450248 | last date the node was modified (UTC time) | True     |       |\n    | created_at | datetime*   | 2023-03-06 18:45:23.450248 | date it was created (UTC time)             | True     |       |\n    ## JSON\n    ```json\n    {\n        \"node\": \"User\",\n        \"username\": \"my username\",\n        \"email\": \"user@email.com\",\n        \"orcid\": \"0000-0000-0000-0001\",\n    }\n    ```\n    Warnings\n    -------\n    * A User cannot be created or modified using the Python SDK.\n    * A User node is a **read-only** node that can only be deserialized from API JSON response to Python node.\n    * The User node cannot be instantiated and within the Python SDK.\n    * Attempting to edit the user node will result in an `Attribute Error`\n    \"\"\"\n@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\n\"\"\"\n        all User attributes\n        \"\"\"\nemail: Optional[str] = \"\"\nmodel_version: str = \"\"\norcid: Optional[str] = \"\"\npicture: str = \"\"\nusername: str = \"\"\n_json_attrs: JsonAttributes = JsonAttributes()\n@beartype\ndef __init__(self, username: str, email: Optional[str] = \"\", orcid: Optional[str] = \"\", **kwargs):\n\"\"\"\n        Json from CRIPT API to be converted to a node\n        optionally the group can be None if the user doesn't have a group\n        Parameters\n        ----------\n        username: str\n            user username\n        email: str\n            user email\n        orcid: str\n            user ORCID\n        \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, username=username, email=email, orcid=orcid)\nself.validate()\n@property\n@beartype\ndef created_at(self) -> str:\nreturn self._json_attrs.created_at\n@property\n@beartype\ndef email(self) -> Union[str, None]:\n\"\"\"\n        user's email\n        Raises\n        ------\n        AttributeError\n        Returns\n        -------\n        user email: str\n            User node email\n        \"\"\"\nreturn self._json_attrs.email\n@property\n@beartype\ndef model_version(self) -> str:\nreturn self._json_attrs.model_version\n@property\n@beartype\ndef orcid(self) -> Union[str, None]:\n\"\"\"\n        users [ORCID](https://orcid.org/)\n        Raises\n        ------\n        AttributeError\n        Returns\n        -------\n        ORCID: str\n            user's ORCID\n        \"\"\"\nreturn self._json_attrs.orcid\n@property\n@beartype\ndef picture(self) -> str:\nreturn self._json_attrs.picture\n@property\n@beartype\ndef updated_at(self) -> str:\nreturn self._json_attrs.updated_at\n@property\n@beartype\ndef username(self) -> str:\n\"\"\"\n        username of the User node\n        Raises\n        ------\n        AttributeError\n        Returns\n        -------\n        username: str\n            username of the User node\n        \"\"\"\nreturn self._json_attrs.username\n
"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User.email","title":"email: Union[str, None] property","text":"

user's email

Raises:

Type Description AttributeError

Returns:

Type Description user email: str

User node email

"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User.orcid","title":"orcid: Union[str, None] property","text":"

users ORCID

Raises:

Type Description AttributeError

Returns:

Name Type Description ORCID str

user's ORCID

"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User.username","title":"username: str property","text":"

username of the User node

Raises:

Type Description AttributeError

Returns:

Name Type Description username str

username of the User node

"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User.JsonAttributes","title":"JsonAttributes dataclass","text":"

Bases: UUIDBaseNode.JsonAttributes

all User attributes

Source code in src/cript/nodes/supporting_nodes/user.py
@dataclass(frozen=True)\nclass JsonAttributes(UUIDBaseNode.JsonAttributes):\n\"\"\"\n    all User attributes\n    \"\"\"\nemail: Optional[str] = \"\"\nmodel_version: str = \"\"\norcid: Optional[str] = \"\"\npicture: str = \"\"\nusername: str = \"\"\n
"},{"location":"nodes/supporting_nodes/user/#cript.nodes.supporting_nodes.user.User.__init__","title":"__init__(username, email='', orcid='', **kwargs)","text":"

Json from CRIPT API to be converted to a node optionally the group can be None if the user doesn't have a group

Parameters:

Name Type Description Default username str

user username

required email Optional[str]

user email

'' orcid Optional[str]

user ORCID

'' Source code in src/cript/nodes/supporting_nodes/user.py
@beartype\ndef __init__(self, username: str, email: Optional[str] = \"\", orcid: Optional[str] = \"\", **kwargs):\n\"\"\"\n    Json from CRIPT API to be converted to a node\n    optionally the group can be None if the user doesn't have a group\n    Parameters\n    ----------\n    username: str\n        user username\n    email: str\n        user email\n    orcid: str\n        user ORCID\n    \"\"\"\nsuper().__init__(**kwargs)\nself._json_attrs = replace(self._json_attrs, username=username, email=email, orcid=orcid)\nself.validate()\n
"},{"location":"tutorial/cript_installation_guide/","title":"CRIPT Installation Guide","text":""},{"location":"tutorial/cript_installation_guide/#how-to-install-cript","title":"How to Install CRIPT","text":"

Abstract

This page will give you a through guide on how to install the CRIPT Python SDK on your system.

"},{"location":"tutorial/cript_installation_guide/#steps","title":"Steps","text":"
  1. Install Python 3.7+
  2. Create a virtual environment

    It is best practice to create a dedicated python virtual environment for each python project

    Windows: Mac & Linux:
    python -m venv .\\venv\n
    python3 -m venv ./venv\n
  3. Activate your virtual environment

    Windows: Mac & Linux:
    .\\venv\\Scripts\\activate\n
    source venv/bin/activate\n
  4. Install CRIPT from Python Package Index (PyPI)

     pip install cript\n

  5. Create your CRIPT Script!
"},{"location":"tutorial/how_to_get_api_token/","title":"CRIPT API Token","text":"

Abstract

This page shows the steps to acquiring an API Token to connect to the CRIPT platform

The token is needed because we need to authenticate the user before saving any of their data

Token Security

It is highly recommended that you store your API tokens in a safe location and read it into your code Hard-coding API tokens directly into the code can pose security risks, as the token might be exposed if the code is shared or stored in a version control system.

Anyone that has access to your tokens can impersonate you on the CRIPT platform

Security Settings under the profile icon dropdown

To get your token:

  1. please visit your Security Settings under the profile icon dropdown on the top right
  2. Click on the copy button next to the API Token to copy it to clipboard
  3. Now you can paste it into the API Token field

Example:

API Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\nStorage Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gU21pdGgiLCJpYXQiOjE1MTYyMzkwMjJ9.Q_w2AVguPRU2KskCXwR7ZHl09TQXEntfEA8Jj2_Jyew\n
"}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 000000000..0f8724efd --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz new file mode 100644 index 000000000..819cc6457 Binary files /dev/null and b/sitemap.xml.gz differ diff --git a/tutorial/cript_installation_guide/index.html b/tutorial/cript_installation_guide/index.html new file mode 100644 index 000000000..59f5506eb --- /dev/null +++ b/tutorial/cript_installation_guide/index.html @@ -0,0 +1,1250 @@ + + + + + + + + + + + + + + + + + + + + + + CRIPT Installation Guide - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

CRIPT Installation Guide

+ +

How to Install CRIPT

+
+

Abstract

+

This page will give you a through guide on how to install the +CRIPT Python SDK on your system.

+
+

Steps

+
    +
  1. Install Python 3.7+
  2. +
  3. +

    Create a virtual environment

    +
    +

    It is best practice to create a dedicated python virtual environment for each python project

    +
    +
    +
    +
    +
    python -m venv .\venv
    +
    +
    +
    +
    python3 -m venv ./venv
    +
    +
    +
    +
    +
  4. +
  5. +

    Activate your virtual environment

    +
    +
    +
    +
    .\venv\Scripts\activate
    +
    +
    +
    +
    source venv/bin/activate
    +
    +
    +
    +
    +
  6. +
  7. +

    Install CRIPT from Python Package Index (PyPI) +

     pip install cript
    +

    +
  8. +
  9. Create your CRIPT Script!
  10. +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/tutorial/how_to_get_api_token/index.html b/tutorial/how_to_get_api_token/index.html new file mode 100644 index 000000000..27ca3bd59 --- /dev/null +++ b/tutorial/how_to_get_api_token/index.html @@ -0,0 +1,1161 @@ + + + + + + + + + + + + + + + + + + + + + + CRIPT API Token - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

CRIPT API Token

+ +
+

Abstract

+

This page shows the steps to acquiring an API Token to connect to the CRIPT platform

+
+


+

The token is needed because we need to authenticate the user before saving any of their data

+
+

Token Security

+

It is highly recommended that you store your API tokens in a safe location and read it into your code + Hard-coding API tokens directly into the code can pose security risks, + as the token might be exposed if the code is shared or stored in a version control system.

+

Anyone that has access to your tokens can impersonate you on the CRIPT platform

+
+

Screenshot of CRIPT security page where API token is found

+

+ Security Settings + under the profile icon dropdown +

+

To get your token:

+
    +
  1. please visit your Security Settings under the profile + icon dropdown on the top right
  2. +
  3. Click on the copy button next to the API Token to copy it to clipboard
  4. +
  5. Now you can paste it into the API Token field
  6. +
+

Example:

+ + + +
API Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
+
+Storage Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gU21pdGgiLCJpYXQiOjE1MTYyMzkwMjJ9.Q_w2AVguPRU2KskCXwR7ZHl09TQXEntfEA8Jj2_Jyew
+
+ + + + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/utility_functions/index.html b/utility_functions/index.html new file mode 100644 index 000000000..f9feb7ecd --- /dev/null +++ b/utility_functions/index.html @@ -0,0 +1,1691 @@ + + + + + + + + + + + + + + + + + + + + + + Utility Functions - CRIPT Python SDK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Utility Functions

+ +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ NodeEncoder + + +

+ + +
+

+ Bases: json.JSONEncoder

+ + +
+ Source code in src/cript/nodes/util/__init__.py +
class NodeEncoder(json.JSONEncoder):
+    handled_ids: Set[str] = set()
+    known_uuid: Set[str] = set()
+    condense_to_uuid: Set[str] = set()
+    suppress_attributes: Optional[Dict[str, Set[str]]] = None
+
+    def default(self, obj):
+        if isinstance(obj, uuid.UUID):
+            return str(obj)
+        if isinstance(obj, BaseNode):
+            try:
+                uid = obj.uid
+            except AttributeError:
+                pass
+            else:
+                if uid in NodeEncoder.handled_ids:
+                    return {"node": obj._json_attrs.node, "uid": uid}
+
+            # When saving graphs, some nodes can be pre-saved.
+            # If that happens, we want to represent them as a UUID edge only
+            try:
+                uuid_str = str(obj.uuid)
+            except AttributeError:
+                pass
+            else:
+                if uuid_str in NodeEncoder.known_uuid:
+                    return {"uuid": uuid_str}
+
+            default_values = asdict(obj.JsonAttributes())
+            serialize_dict = {}
+            # Remove default values from serialization
+            for key in default_values:
+                if key in obj._json_attrs.__dataclass_fields__:
+                    if getattr(obj._json_attrs, key) != default_values[key]:
+                        serialize_dict[key] = copy.copy(getattr(obj._json_attrs, key))
+            serialize_dict["node"] = obj._json_attrs.node
+
+            # check if further modifications to the dict is needed before considering it done
+            serialize_dict, condensed_uid = self._apply_modifications(serialize_dict)
+            if uid not in condensed_uid:  # We can uid (node) as handled if we don't condense it to uuid
+                NodeEncoder.handled_ids.add(uid)
+
+            # Remove suppressed attributes
+            if NodeEncoder.suppress_attributes is not None and str(obj.uuid) in NodeEncoder.suppress_attributes:
+                for attr in NodeEncoder.suppress_attributes[str(obj.uuid)]:
+                    del serialize_dict[attr]
+
+            return serialize_dict
+        return json.JSONEncoder.default(self, obj)
+
+    def _apply_modifications(self, serialize_dict):
+        """
+        Checks the serialize_dict to see if any other operations are required before it
+        can be considered done. If other operations are required, then it passes it to the other operations
+        and at the end returns the fully finished dict.
+
+        This function is essentially a big switch case that checks the node type
+        and determines what other operations are required for it.
+
+        Parameters
+        ----------
+        serialize_dict: dict
+
+        Returns
+        -------
+        serialize_dict: dict
+        """
+
+        def process_attribute(attribute):
+            def strip_to_edge_uuid(element):
+                # Extracts UUID and UID information from the element
+                try:
+                    uuid = getattr(element, "uuid")
+                except AttributeError:
+                    uuid = element["uuid"]
+                    if len(element) == 1:  # Already a condensed element
+                        return element, None
+                try:
+                    uid = getattr(element, "uid")
+                except AttributeError:
+                    uid = element["uid"]
+
+                element = {"uuid": str(uuid)}
+                return element, uid
+
+            # Processes an attribute based on its type (list or single element)
+            if isinstance(attribute, list):
+                processed_elements = []
+                for element in attribute:
+                    processed_element, uid = strip_to_edge_uuid(element)
+                    if uid is not None:
+                        uid_of_condensed.append(uid)
+                    processed_elements.append(processed_element)
+                return processed_elements
+            else:
+                processed_attribute, uid = strip_to_edge_uuid(attribute)
+                if uid is not None:
+                    uid_of_condensed.append(uid)
+                return processed_attribute
+
+        uid_of_condensed = []
+
+        nodes_to_condense = serialize_dict["node"]
+        for node_type in nodes_to_condense:
+            if node_type in self.condense_to_uuid:
+                attributes_to_process = self.condense_to_uuid[node_type]
+                for attribute in attributes_to_process:
+                    if attribute in serialize_dict:
+                        attribute_to_condense = serialize_dict[attribute]
+                        processed_attribute = process_attribute(attribute_to_condense)
+                        serialize_dict[attribute] = processed_attribute
+
+        # Check if the node is "Material" and convert the identifiers list to JSON fields
+        if serialize_dict["node"] == ["Material"]:
+            serialize_dict = _material_identifiers_list_to_json_fields(serialize_dict)
+
+        return serialize_dict, uid_of_condensed
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+add_orphaned_nodes_to_project(project, active_experiment, max_iteration=-1) + +

+ + +
+ +

Helper function that adds all orphaned material nodes of the project graph to the +project.materials attribute. +Material additions only is permissible with active_experiment is None. +This function also adds all orphaned data, process, computation and computational process nodes +of the project graph to the active_experiment. +This functions call project.validate and might raise Exceptions from there.

+ +
+ Source code in src/cript/nodes/util/__init__.py +
def add_orphaned_nodes_to_project(project: Project, active_experiment: Experiment, max_iteration: int = -1):
+    """
+    Helper function that adds all orphaned material nodes of the project graph to the
+    `project.materials` attribute.
+    Material additions only is permissible with `active_experiment is None`.
+    This function also adds all orphaned data, process, computation and computational process nodes
+    of the project graph to the `active_experiment`.
+    This functions call `project.validate` and might raise Exceptions from there.
+    """
+    if active_experiment is not None and active_experiment not in project.find_children({"node": ["Experiment"]}):
+        raise RuntimeError(f"The provided active experiment {active_experiment} is not part of the project graph. Choose an active experiment that is part of a collection of this project.")
+
+    counter = 0
+    while True:
+        if counter > max_iteration >= 0:
+            break  # Emergency stop
+        try:
+            project.validate()
+        except CRIPTOrphanedMaterialError as exc:
+            # because calling the setter calls `validate` we have to force add the material.
+            project._json_attrs.material.append(exc.orphaned_node)
+        except CRIPTOrphanedDataError as exc:
+            active_experiment.data += [exc.orphaned_node]
+        except CRIPTOrphanedProcessError as exc:
+            active_experiment.process += [exc.orphaned_node]
+        except CRIPTOrphanedComputationError as exc:
+            active_experiment.computation += [exc.orphaned_node]
+        except CRIPTOrphanedComputationalProcessError as exc:
+            active_experiment.computation_process += [exc.orphaned_node]
+        else:
+            break
+        counter += 1
+
+
+
+ +
+ + +
+ + + +

+load_nodes_from_json(nodes_json) + +

+ + +
+ +

User facing function, that return a node and all its children from a json input.

+ +
+ Source code in src/cript/nodes/util/__init__.py +
def load_nodes_from_json(nodes_json: str):
+    """
+    User facing function, that return a node and all its children from a json input.
+    """
+    node_json_hook = _NodeDecoderHook()
+    json_nodes = json.loads(nodes_json, object_hook=node_json_hook)
+
+    # TODO: enable this logic to replace proxies, once beartype is OK with that.
+    # def recursive_proxy_replacement(node, handled_nodes):
+    #     if isinstance(node, _UIDProxy):
+    #         try:
+    #             node = node_json_hook._uid_cache[node.uid]
+    #         except KeyError as exc:
+    #             raise CRIPTDeserializationUIDError(node.node_type, node.uid)
+    #         return node
+    #     handled_nodes.add(node.uid)
+    #     for field in node._json_attrs.__dict__:
+    #         child_node = getattr(node._json_attrs, field)
+    #         if not isinstance(child_node, list):
+    #             if hasattr(cn, "__bases__") and BaseNode in child_node.__bases__:
+    #                 child_node = recursive_proxy_replacement(child_node, handled_nodes)
+    #                 node._json_attrs = replace(node._json_attrs, field=child_node)
+    #         else:
+    #             for i, cn in enumerate(child_node):
+    #                 if hasattr(cn, "__bases__") and BaseNode in cn.__bases__:
+    #                     if cn.uid not in handled_nodes:
+    #                         child_node[i] = recursive_proxy_replacement(cn, handled_nodes)
+
+    #     return node
+    # handled_nodes = set()
+    # recursive_proxy_replacement(json_nodes, handled_nodes)
+    return json_nodes
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file