logs-py 1.13__py3-none-any.whl → 2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of logs-py might be problematic. Click here for more details.

Files changed (90) hide show
  1. LOGS/Auxiliary/Constants.py +2 -2
  2. LOGS/Auxiliary/DateTimeConverter.py +1 -1
  3. LOGS/Auxiliary/Exceptions.py +1 -1
  4. LOGS/Auxiliary/MinimalModelGenerator.py +28 -6
  5. LOGS/Auxiliary/Tools.py +4 -0
  6. LOGS/Entities/AutoloadClientInfo.py +6 -8
  7. LOGS/Entities/AutoloadStatus.py +3 -3
  8. LOGS/Entities/{AutoloadSource.py → Bridge.py} +11 -10
  9. LOGS/Entities/BridgeMinimal.py +8 -0
  10. LOGS/Entities/BridgeRelations.py +23 -0
  11. LOGS/Entities/BridgeRequestParameter.py +19 -0
  12. LOGS/Entities/{AutoloadSourceType.py → BridgeType.py} +1 -1
  13. LOGS/Entities/Bridges.py +12 -0
  14. LOGS/Entities/{AutoloadConfiguration.py → DataSource.py} +97 -23
  15. LOGS/Entities/DataSourceMinimal.py +8 -0
  16. LOGS/Entities/DataSourceRelations.py +23 -0
  17. LOGS/Entities/DataSourceRequestParameter.py +44 -0
  18. LOGS/Entities/{AutoloadConfigurationStatus.py → DataSourceStatus.py} +1 -1
  19. LOGS/Entities/DataSources.py +12 -0
  20. LOGS/Entities/Dataset.py +83 -71
  21. LOGS/Entities/DatasetCreator.py +38 -18
  22. LOGS/Entities/DatasetMatchTypes.py +38 -6
  23. LOGS/Entities/DatasetRelations.py +13 -2
  24. LOGS/Entities/DatasetRequestParameter.py +19 -7
  25. LOGS/Entities/Datasets.py +1 -1
  26. LOGS/Entities/Document.py +2 -2
  27. LOGS/Entities/Experiment.py +9 -24
  28. LOGS/Entities/ExperimentRelations.py +23 -0
  29. LOGS/Entities/ExperimentRequestParameter.py +27 -2
  30. LOGS/Entities/Format.py +27 -61
  31. LOGS/Entities/FormatFormat.py +8 -6
  32. LOGS/Entities/FormatInstrument.py +2 -2
  33. LOGS/Entities/FormatMetaData.py +13 -5
  34. LOGS/Entities/FormatMethod.py +34 -3
  35. LOGS/Entities/FormatMinimal.py +11 -1
  36. LOGS/Entities/FormatRequestParameter.py +8 -3
  37. LOGS/Entities/FormatVendor.py +14 -1
  38. LOGS/Entities/FormatVendorRequestParameter.py +1 -0
  39. LOGS/Entities/ICustomSchemaRequest.py +7 -0
  40. LOGS/Entities/IRelatedEntityRequest.py +9 -0
  41. LOGS/Entities/Instrument.py +16 -2
  42. LOGS/Entities/InstrumentRelations.py +23 -0
  43. LOGS/Entities/InstrumentRequestParameter.py +34 -2
  44. LOGS/Entities/LabNotebookEntry.py +67 -7
  45. LOGS/Entities/LabNotebookEntryRelations.py +81 -0
  46. LOGS/Entities/LabNotebookEntryRequestParameter.py +57 -2
  47. LOGS/Entities/Method.py +24 -2
  48. LOGS/Entities/MethodRelations.py +35 -0
  49. LOGS/Entities/MethodRequestParameter.py +35 -1
  50. LOGS/Entities/Origin.py +2 -2
  51. LOGS/Entities/OriginRequestParameter.py +3 -3
  52. LOGS/Entities/Person.py +34 -3
  53. LOGS/Entities/PersonRelations.py +36 -3
  54. LOGS/Entities/PersonRequestParameter.py +50 -10
  55. LOGS/Entities/Project.py +15 -2
  56. LOGS/Entities/ProjectRelations.py +11 -0
  57. LOGS/Entities/ProjectRequestParameter.py +44 -3
  58. LOGS/Entities/Role.py +45 -16
  59. LOGS/Entities/RoleRelations.py +23 -0
  60. LOGS/Entities/RoleRequestParameter.py +28 -1
  61. LOGS/Entities/Sample.py +26 -32
  62. LOGS/Entities/SampleRelations.py +4 -2
  63. LOGS/Entities/SampleRequestParameter.py +5 -10
  64. LOGS/Entities/__init__.py +8 -7
  65. LOGS/Entity/Entity.py +30 -6
  66. LOGS/Entity/EntityRelations.py +3 -2
  67. LOGS/Entity/EntityRequestParameter.py +10 -5
  68. LOGS/Entity/EntityWithIntId.py +1 -1
  69. LOGS/Entity/SerializeableContent.py +10 -4
  70. LOGS/Interfaces/ICreationRecord.py +12 -3
  71. LOGS/Interfaces/IModificationRecord.py +10 -1
  72. LOGS/Interfaces/IProjectBased.py +30 -0
  73. LOGS/Interfaces/IRelatedEntity.py +34 -0
  74. LOGS/Interfaces/IRelationModel.py +6 -0
  75. LOGS/Interfaces/IRelationRequest.py +12 -0
  76. LOGS/Interfaces/ITypedEntity.py +28 -0
  77. LOGS/Interfaces/IUniqueEntity.py +2 -3
  78. LOGS/LOGS.py +135 -41
  79. LOGS/LOGSConnection.py +2 -1
  80. {logs_py-1.13.dist-info → logs_py-2.1.dist-info}/METADATA +1 -1
  81. {logs_py-1.13.dist-info → logs_py-2.1.dist-info}/RECORD +84 -70
  82. LOGS/Entities/AutoloadConfigurationMinimal.py +0 -8
  83. LOGS/Entities/AutoloadConfigurationRequestParameter.py +0 -17
  84. LOGS/Entities/AutoloadConfigurations.py +0 -16
  85. LOGS/Entities/AutoloadSourceMinimal.py +0 -8
  86. LOGS/Entities/AutoloadSourceRequestParameter.py +0 -13
  87. LOGS/Entities/AutoloadSources.py +0 -12
  88. /LOGS/Interfaces/{ICustomFields.py → ICustomField.py} +0 -0
  89. {logs_py-1.13.dist-info → logs_py-2.1.dist-info}/WHEEL +0 -0
  90. {logs_py-1.13.dist-info → logs_py-2.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,23 @@
1
+ from typing import TYPE_CHECKING, Optional
2
+
3
+ from LOGS.Entity.EntityRelation import EntityRelation
4
+ from LOGS.Entity.EntityRelations import EntityRelations
5
+
6
+ if TYPE_CHECKING:
7
+ from LOGS.Entities.Dataset import Dataset
8
+
9
+
10
+ class ExperimentRelations(EntityRelations):
11
+ """Relations of a Experiment with other entities"""
12
+
13
+ _datasets: Optional[EntityRelation["Dataset"]] = None
14
+
15
+ @property
16
+ def datasets(self) -> Optional[EntityRelation["Dataset"]]:
17
+ return self._datasets
18
+
19
+ @datasets.setter
20
+ def datasets(self, value):
21
+ from LOGS.Entities.Datasets import Datasets
22
+
23
+ self._datasets = self._entityConverter(value, Datasets)
@@ -1,11 +1,36 @@
1
1
  from dataclasses import dataclass
2
+ from enum import Enum
2
3
  from typing import List, Optional
3
4
 
5
+ from LOGS.Entities.IRelatedEntityRequest import IRelatedEntityRequest
4
6
  from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
5
- from LOGS.Interfaces.IOwnedEntity import IOwnedEntityRequest
7
+ from LOGS.Interfaces.ICreationRecord import ICreationRecordRequest
8
+ from LOGS.Interfaces.IModificationRecord import IModificationRecordRequest
9
+
10
+
11
+ class ExperimentOrder(Enum):
12
+ ID_ASC = "ID_ASC"
13
+ ID_DESC = "ID_DESC"
14
+ NAME_ASC = "NAME_ASC"
15
+ NAME_DESC = "NAME_DESC"
16
+ METHOD_ASC = "METHOD_ASC"
17
+ METHOD_DESC = "METHOD_DESC"
18
+ CREATED_ON_ASC = "CREATED_ON_ASC"
19
+ CREATED_ON_DESC = "CREATED_ON_DESC"
20
+ CREATED_BY_ASC = "CREATED_BY_ASC"
21
+ CREATED_BY_DESC = "CREATED_BY_DESC"
22
+ MODIFIED_ON_ASC = "MODIFIED_ON_ASC"
23
+ MODIFIED_ON_DESC = "MODIFIED_ON_DESC"
24
+ MODIFIED_BY_ASC = "MODIFIED_BY_ASC"
25
+ MODIFIED_BY_DESC = "MODIFIED_BY_DESC"
6
26
 
7
27
 
8
28
  @dataclass
9
- class ExperimentRequestParameter(EntityRequestParameter, IOwnedEntityRequest):
29
+ class ExperimentRequestParameter(
30
+ EntityRequestParameter[ExperimentOrder],
31
+ IRelatedEntityRequest,
32
+ ICreationRecordRequest,
33
+ IModificationRecordRequest,
34
+ ):
10
35
  name: Optional[str] = None
11
36
  methodIds: Optional[List[int]] = None
LOGS/Entities/Format.py CHANGED
@@ -9,10 +9,10 @@ from LOGS.LOGSConnection import LOGSConnection
9
9
 
10
10
  @Endpoint("parsers")
11
11
  class Format(INamedEntity, EntityWithStrId):
12
- _version: str
12
+ _formatVersion: str
13
13
  _vendors: List[str]
14
- _methods: List[str]
15
- _formats: List[str]
14
+ _method: List[str]
15
+ _format: List[str]
16
16
  _instruments: List[str]
17
17
  _metaData: List[FormatMetaData]
18
18
 
@@ -24,80 +24,46 @@ class Format(INamedEntity, EntityWithStrId):
24
24
  ):
25
25
  """Represents a connected LOGS entity type"""
26
26
 
27
- self._version = "0.0"
28
- self._vendors = []
29
- self._methods = []
30
- self._formats = []
27
+ self._formatVersion = "0.0"
28
+ self._vendor = []
29
+ self._method = []
30
+ self._format = []
31
31
  self._instruments = []
32
32
  self._metaData = []
33
33
 
34
34
  super().__init__(ref=ref, id=id, connection=connection)
35
35
 
36
- def fromDict(self, ref, formatDict=None) -> None:
37
- if isinstance(ref, dict):
38
- if "metaData" in ref and isinstance(ref["metaData"], list):
39
- ref["vendors"] = []
40
- ref["methods"] = []
41
- ref["instruments"] = []
42
- ref["formats"] = []
43
- for metaData in ref["metaData"]:
44
- if metaData["vendor"]:
45
- ref["vendors"].extend(v["name"] for v in metaData["vendor"])
46
- if metaData["method"]:
47
- ref["methods"].extend(v["name"] for v in metaData["method"])
48
- if metaData["instrument"]:
49
- ref["instruments"].extend(
50
- v["name"] for v in metaData["instrument"]
51
- )
52
- if metaData["format"]:
53
- ref["formats"].extend(v["name"] for v in metaData["format"])
54
-
55
- if "majorVersion" in ref and "minorVersion" in ref:
56
- ref["version"] = "%s.%s" % (ref["majorVersion"], ref["minorVersion"])
57
- super().fromDict(ref=ref, formatDict=formatDict)
58
-
59
- def toDict(self):
60
- d = super().toDict()
61
-
62
- if self.version:
63
- d["majorVersion"], d["minorVersion"] = [
64
- int(v) for v in self.version.split(".")
65
- ]
66
- del d["version"]
67
-
68
- return d
69
-
70
36
  @property
71
- def version(self) -> Optional[str]:
72
- return self._version
37
+ def formatVersion(self) -> Optional[str]:
38
+ return self._formatVersion
73
39
 
74
- @version.setter
75
- def version(self, value):
76
- self._version = self.checkAndConvert(value, str, "version")
40
+ @formatVersion.setter
41
+ def formatVersion(self, value):
42
+ self._formatVersion = self.checkAndConvert(value, str, "formatVersion")
77
43
 
78
44
  @property
79
- def vendors(self) -> List[str]:
80
- return self._vendors
45
+ def vendor(self) -> List[str]:
46
+ return self._vendor
81
47
 
82
- @vendors.setter
83
- def vendors(self, value):
84
- self._vendors = self.checkListAndConvert(value, str, "vendors")
48
+ @vendor.setter
49
+ def vendor(self, value):
50
+ self._vendor = self.checkListAndConvert(value, str, "vendor")
85
51
 
86
52
  @property
87
- def methods(self) -> List[str]:
88
- return self._methods
53
+ def method(self) -> List[str]:
54
+ return self._method
89
55
 
90
- @methods.setter
91
- def methods(self, value):
92
- self._methods = self.checkListAndConvert(value, str, "methods")
56
+ @method.setter
57
+ def method(self, value):
58
+ self._method = self.checkListAndConvert(value, str, "method")
93
59
 
94
60
  @property
95
- def formats(self) -> List[str]:
96
- return self._formats
61
+ def format(self) -> List[str]:
62
+ return self._format
97
63
 
98
- @formats.setter
99
- def formats(self, value):
100
- self._formats = self.checkListAndConvert(value, str, "formats")
64
+ @format.setter
65
+ def format(self, value):
66
+ self._format = self.checkListAndConvert(value, str, "format")
101
67
 
102
68
  @property
103
69
  def instruments(self) -> List[str]:
@@ -8,7 +8,7 @@ from LOGS.Interfaces.INamedEntity import INamedEntity
8
8
  @Endpoint("formats")
9
9
  class FormatFormat(INamedEntity, EntityWithStrId):
10
10
  _description: Optional[str]
11
- _version: Optional[List[str]]
11
+ _formatVersion: Optional[List[str]]
12
12
 
13
13
  @property
14
14
  def description(self) -> Optional[str]:
@@ -19,9 +19,11 @@ class FormatFormat(INamedEntity, EntityWithStrId):
19
19
  self._description = self.checkAndConvertNullable(value, str, "description")
20
20
 
21
21
  @property
22
- def version(self) -> Optional[List[str]]:
23
- return self._version
22
+ def formatVersion(self) -> Optional[List[str]]:
23
+ return self._formatVersion
24
24
 
25
- @version.setter
26
- def version(self, value):
27
- self._version = self.checkListAndConvertNullable(value, str, "version")
25
+ @formatVersion.setter
26
+ def formatVersion(self, value):
27
+ self._formatVersion = self.checkListAndConvertNullable(
28
+ value, str, "formatVersion"
29
+ )
@@ -6,8 +6,8 @@ from LOGS.Interfaces.INamedEntity import INamedEntity
6
6
 
7
7
 
8
8
  @Endpoint("parser_instruments")
9
- class FormatInstrument(INamedEntity, EntityWithStrId):
10
- _description: Optional[str]
9
+ class FormatInstrument(EntityWithStrId, INamedEntity):
10
+ _description: Optional[str] = None
11
11
 
12
12
  @property
13
13
  def description(self) -> Optional[str]:
@@ -1,7 +1,8 @@
1
- from typing import TYPE_CHECKING, List
1
+ from typing import TYPE_CHECKING, List, Optional
2
2
 
3
3
  from LOGS.Auxiliary.MinimalModelGenerator import MinimalFromList
4
4
  from LOGS.Entity.ConnectedEntity import ConnectedEntity
5
+ from LOGS.LOGSConnection import LOGSConnection
5
6
 
6
7
  if TYPE_CHECKING:
7
8
  from LOGS.Entities.FormatFormatMinimal import FormatFormatMinimal
@@ -11,10 +12,17 @@ if TYPE_CHECKING:
11
12
 
12
13
 
13
14
  class FormatMetaData(ConnectedEntity):
14
- _vendor: List["FormatVendorMinimal"] = []
15
- _method: List["FormatMethodMinimal"] = []
16
- _format: List["FormatFormatMinimal"] = []
17
- _instrument: List["FormatInstrumentMinimal"] = []
15
+ _vendor: List["FormatVendorMinimal"]
16
+ _method: List["FormatMethodMinimal"]
17
+ _format: List["FormatFormatMinimal"]
18
+ _instrument: List["FormatInstrumentMinimal"]
19
+
20
+ def __init__(self, ref=None, connection: Optional[LOGSConnection] = None):
21
+ self._vendor = []
22
+ self._method = []
23
+ self._format = []
24
+ self._instrument = []
25
+ super().__init__(ref=ref, connection=connection)
18
26
 
19
27
  @property
20
28
  def vendor(self) -> List["FormatVendorMinimal"]:
@@ -1,17 +1,38 @@
1
- from typing import TYPE_CHECKING, Optional
1
+ from typing import TYPE_CHECKING, List, Optional
2
2
 
3
3
  from LOGS.Auxiliary.Decorators import Endpoint
4
+ from LOGS.Auxiliary.MinimalModelGenerator import MinimalFromList
4
5
  from LOGS.Entity.EntityWithStrId import EntityWithStrId
5
6
  from LOGS.Interfaces.INamedEntity import INamedEntity
7
+ from LOGS.LOGSConnection import LOGSConnection
6
8
 
7
9
  if TYPE_CHECKING:
8
- pass
10
+ from LOGS.Entities.FormatMethodMinimal import FormatMethodMinimal
9
11
 
10
12
 
11
13
  @Endpoint("parser_methods")
12
- class FormatMethod(INamedEntity, EntityWithStrId):
14
+ class FormatMethod(EntityWithStrId, INamedEntity):
13
15
  _fullName: Optional[str]
14
16
  _description: Optional[str]
17
+ _parent: Optional[List["FormatMethodMinimal"]]
18
+
19
+ def __init__(
20
+ self,
21
+ ref=None,
22
+ id: Optional[str] = None,
23
+ connection: Optional[LOGSConnection] = None,
24
+ ):
25
+ self._fullName = None
26
+ self._description = None
27
+ self._parent = None
28
+
29
+ super().__init__(ref=ref, id=id, connection=connection)
30
+
31
+ def fromDict(self, ref, formatDict=None) -> None:
32
+ if isinstance(ref, dict) and "from" in ref:
33
+ ref["parent"] = ref["from"]
34
+
35
+ super().fromDict(ref=ref, formatDict=formatDict)
15
36
 
16
37
  @property
17
38
  def fullName(self) -> Optional[str]:
@@ -28,3 +49,13 @@ class FormatMethod(INamedEntity, EntityWithStrId):
28
49
  @description.setter
29
50
  def description(self, value):
30
51
  self._description = self.checkAndConvertNullable(value, str, "description")
52
+
53
+ @property
54
+ def parent(self) -> Optional[List["FormatMethodMinimal"]]:
55
+ return self._parent
56
+
57
+ @parent.setter
58
+ def parent(self, value):
59
+ self._parent = MinimalFromList(
60
+ value, "FormatMethodMinimal", "parent", connection=self.connection
61
+ )
@@ -1,3 +1,5 @@
1
+ from typing import List, Optional
2
+
1
3
  from LOGS.Auxiliary.Decorators import FullModel
2
4
  from LOGS.Entities.Format import Format
3
5
  from LOGS.Entity.EntityMinimalWithStrId import EntityMinimalWithStrId
@@ -5,4 +7,12 @@ from LOGS.Entity.EntityMinimalWithStrId import EntityMinimalWithStrId
5
7
 
6
8
  @FullModel(Format)
7
9
  class FormatMinimal(EntityMinimalWithStrId[Format]):
8
- pass
10
+ _version: Optional[List[str]] = None
11
+
12
+ @property
13
+ def version(self) -> Optional[List[str]]:
14
+ return self._version
15
+
16
+ @version.setter
17
+ def version(self, value):
18
+ self._version = self.checkListAndConvertNullable(value, str, "version")
@@ -1,9 +1,14 @@
1
1
  from dataclasses import dataclass
2
- from typing import Optional
2
+ from typing import List, Optional
3
3
 
4
- from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
4
+ from LOGS.Entity.EntityRequestParameter import DefaultOrder, EntityRequestParameter
5
5
 
6
6
 
7
7
  @dataclass
8
- class FormatRequestParameter(EntityRequestParameter):
8
+ class FormatRequestParameter(EntityRequestParameter[DefaultOrder]):
9
9
  name: Optional[str] = None
10
+ vendors: Optional[List[str]] = None
11
+ vendors: Optional[List[str]] = None
12
+ methods: Optional[List[str]] = None
13
+ formats: Optional[List[str]] = None
14
+ instruments: Optional[List[str]] = None
@@ -3,13 +3,26 @@ from typing import Optional
3
3
  from LOGS.Auxiliary.Decorators import Endpoint
4
4
  from LOGS.Entity.EntityWithStrId import EntityWithStrId
5
5
  from LOGS.Interfaces.INamedEntity import INamedEntity
6
+ from LOGS.LOGSConnection import LOGSConnection
6
7
 
7
8
 
8
9
  @Endpoint("vendors")
9
- class FormatVendor(INamedEntity, EntityWithStrId):
10
+ class FormatVendor(EntityWithStrId, INamedEntity):
10
11
  _description: Optional[str]
11
12
  _icon: Optional[str]
12
13
 
14
+ def __init__(
15
+ self,
16
+ ref=None,
17
+ id: Optional[str] = None,
18
+ connection: Optional[LOGSConnection] = None,
19
+ ):
20
+ """Represents a connected LOGS entity type"""
21
+
22
+ self._description = None
23
+ self._icon = None
24
+ super().__init__(ref=ref, id=id, connection=connection)
25
+
13
26
  @property
14
27
  def description(self) -> Optional[str]:
15
28
  return self._description
@@ -6,4 +6,5 @@ from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
6
6
 
7
7
  @dataclass
8
8
  class FormatVendorRequestParameter(EntityRequestParameter):
9
+ name: Optional[str] = None
9
10
  includeIcon: Optional[bool] = None
@@ -0,0 +1,7 @@
1
+ from dataclasses import dataclass
2
+ from typing import List, Optional
3
+
4
+
5
+ @dataclass
6
+ class ICustomSchemaRequest:
7
+ typeIds: Optional[List[str]] = None
@@ -0,0 +1,9 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+
4
+
5
+ @dataclass
6
+ class IRelatedEntityRequest:
7
+ includeRelations: Optional[bool] = None
8
+ includeRelationLink: Optional[bool] = None
9
+ includeRelationCount: Optional[bool] = None
@@ -2,16 +2,30 @@ from typing import Optional
2
2
 
3
3
  from LOGS.Auxiliary.Decorators import Endpoint
4
4
  from LOGS.Auxiliary.MinimalModelGenerator import MethodMinimalFromDict
5
+ from LOGS.Entities.InstrumentRelations import InstrumentRelations
5
6
  from LOGS.Entities.MethodMinimal import MethodMinimal
6
- from LOGS.Entity.EntityWithIntId import EntityWithIntId
7
+ from LOGS.Entity.EntityWithIntId import IEntityWithIntId
8
+ from LOGS.Interfaces.ICreationRecord import ICreatedOn
9
+ from LOGS.Interfaces.IModificationRecord import IModifiedOn
7
10
  from LOGS.Interfaces.INamedEntity import INamedEntity
8
11
  from LOGS.Interfaces.IOwnedEntity import IOwnedEntity
12
+ from LOGS.Interfaces.IRelatedEntity import IRelatedEntity
9
13
  from LOGS.Interfaces.IUniqueEntity import IUniqueEntity
10
14
  from LOGS.LOGSConnection import LOGSConnection
11
15
 
12
16
 
13
17
  @Endpoint("instruments")
14
- class Instrument(INamedEntity, EntityWithIntId, IUniqueEntity, IOwnedEntity):
18
+ class Instrument(
19
+ IEntityWithIntId,
20
+ IRelatedEntity[InstrumentRelations],
21
+ INamedEntity,
22
+ IOwnedEntity,
23
+ IUniqueEntity,
24
+ ICreatedOn,
25
+ IModifiedOn,
26
+ ):
27
+ _relationType = type(InstrumentRelations)
28
+
15
29
  _serialnumber: Optional[str]
16
30
  _room: Optional[str]
17
31
  _notes: Optional[str]
@@ -0,0 +1,23 @@
1
+ from typing import TYPE_CHECKING, Optional
2
+
3
+ from LOGS.Entity.EntityRelation import EntityRelation
4
+ from LOGS.Entity.EntityRelations import EntityRelations
5
+
6
+ if TYPE_CHECKING:
7
+ from LOGS.Entities.Dataset import Dataset
8
+
9
+
10
+ class InstrumentRelations(EntityRelations):
11
+ """Relations of a Instrument with other entities"""
12
+
13
+ _datasets: Optional[EntityRelation["Dataset"]] = None
14
+
15
+ @property
16
+ def datasets(self) -> Optional[EntityRelation["Dataset"]]:
17
+ return self._datasets
18
+
19
+ @datasets.setter
20
+ def datasets(self, value):
21
+ from LOGS.Entities.Datasets import Datasets
22
+
23
+ self._datasets = self._entityConverter(value, Datasets)
@@ -1,9 +1,41 @@
1
1
  from dataclasses import dataclass
2
- from typing import Optional
2
+ from enum import Enum
3
+ from typing import List, Optional
3
4
 
5
+ from LOGS.Entities.IRelatedEntityRequest import IRelatedEntityRequest
4
6
  from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
7
+ from LOGS.Interfaces.ICreationRecord import ICreatedOnRequest
8
+ from LOGS.Interfaces.IModificationRecord import IModifiedOnRequest
9
+ from LOGS.Interfaces.IOwnedEntity import IOwnedEntityRequest
10
+
11
+
12
+ class InstrumentOrder(Enum):
13
+ ID_ASC = "ID_ASC"
14
+ ID_DESC = "ID_DESC"
15
+ NAME_ASC = "NAME_ASC"
16
+ NAME_DESC = "NAME_DESC"
17
+ METHOD_ASC = "METHOD_ASC"
18
+ METHOD_DESC = "METHOD_DESC"
19
+ CREATED_ON_ASC = "CREATED_ON_ASC"
20
+ CREATED_ON_DESC = "CREATED_ON_DESC"
21
+ CREATED_BY_ASC = "CREATED_BY_ASC"
22
+ CREATED_BY_DESC = "CREATED_BY_DESC"
23
+ MODIFIED_ON_ASC = "MODIFIED_ON_ASC"
24
+ MODIFIED_ON_DESC = "MODIFIED_ON_DESC"
25
+ MODIFIED_BY_ASC = "MODIFIED_BY_ASC"
26
+ MODIFIED_BY_DESC = "MODIFIED_BY_DESC"
27
+ IS_OBSOLETE_ASC = "IS_OBSOLETE_ASC"
28
+ IS_OBSOLETE_DESC = "IS_OBSOLETE_DESC"
5
29
 
6
30
 
7
31
  @dataclass
8
- class InstrumentRequestParameter(EntityRequestParameter):
32
+ class InstrumentRequestParameter(
33
+ EntityRequestParameter[InstrumentOrder],
34
+ IRelatedEntityRequest,
35
+ ICreatedOnRequest,
36
+ IModifiedOnRequest,
37
+ IOwnedEntityRequest,
38
+ ):
9
39
  name: Optional[str] = None
40
+ methodIds: Optional[List[int]] = None
41
+ datasetIds: Optional[List[int]] = None
@@ -2,22 +2,46 @@ from datetime import datetime
2
2
  from typing import Optional
3
3
 
4
4
  from LOGS.Auxiliary.Decorators import Endpoint
5
+ from LOGS.Entities.LabNotebookEntryRelations import LabNotebookEntryRelations
5
6
  from LOGS.Entity.EntityMinimalWithIntId import EntityMinimalWithIntId
6
- from LOGS.Entity.EntityWithIntId import EntityWithIntId
7
+ from LOGS.Entity.EntityWithIntId import IEntityWithIntId
7
8
  from LOGS.Interfaces.ICreationRecord import ICreationRecord
8
9
  from LOGS.Interfaces.IModificationRecord import IModificationRecord
9
10
  from LOGS.Interfaces.INamedEntity import INamedEntity
11
+ from LOGS.Interfaces.IRelatedEntity import IRelatedEntity
12
+ from LOGS.Interfaces.ISoftDeletable import ISoftDeletable
13
+ from LOGS.LOGSConnection import LOGSConnection
10
14
 
11
15
 
12
16
  @Endpoint("lab_notebook_entries")
13
17
  class LabNotebookEntry(
14
- INamedEntity, EntityWithIntId, ICreationRecord, IModificationRecord
18
+ IEntityWithIntId,
19
+ IRelatedEntity[LabNotebookEntryRelations],
20
+ INamedEntity,
21
+ ICreationRecord,
22
+ IModificationRecord,
23
+ ISoftDeletable,
15
24
  ):
16
- _version: Optional[int] = None
17
- _labNotebook: Optional[EntityMinimalWithIntId] = None
18
- _labNotebookExperiment: Optional[EntityMinimalWithIntId] = None
19
- _entryDate: Optional[datetime] = None
20
- _isDeleted: Optional[bool] = None
25
+ _relationType = type(LabNotebookEntryRelations)
26
+
27
+ _version: Optional[int]
28
+ _labNotebook: Optional[EntityMinimalWithIntId]
29
+ _labNotebookExperiment: Optional[EntityMinimalWithIntId]
30
+ _entryDate: Optional[datetime]
31
+
32
+ def __init__(
33
+ self,
34
+ ref=None,
35
+ id: Optional[int] = None,
36
+ connection: Optional[LOGSConnection] = None,
37
+ ):
38
+ """Represents a connected LOGS entity type"""
39
+ self._version = None
40
+ self._labNotebook = None
41
+ self._labNotebookExperiment = None
42
+ self._entryDate = None
43
+
44
+ super().__init__(ref=ref, id=id, connection=connection)
21
45
 
22
46
  def fromDict(self, ref, formatDict=None) -> None:
23
47
  if isinstance(ref, dict):
@@ -25,3 +49,39 @@ class LabNotebookEntry(
25
49
  ref["name"] = ref["name"].replace(" > ", "_")
26
50
 
27
51
  super().fromDict(ref, formatDict)
52
+
53
+ @property
54
+ def version(self) -> Optional[int]:
55
+ return self._version
56
+
57
+ @version.setter
58
+ def version(self, value):
59
+ self._version = self.checkAndConvertNullable(value, int, "version")
60
+
61
+ @property
62
+ def labNotebook(self) -> Optional[EntityMinimalWithIntId]:
63
+ return self._labNotebook
64
+
65
+ @labNotebook.setter
66
+ def labNotebook(self, value):
67
+ self._labNotebook = self.checkAndConvertNullable(
68
+ value, EntityMinimalWithIntId, "labNotebook"
69
+ )
70
+
71
+ @property
72
+ def labNotebookExperiment(self) -> Optional[EntityMinimalWithIntId]:
73
+ return self._labNotebookExperiment
74
+
75
+ @labNotebookExperiment.setter
76
+ def labNotebookExperiment(self, value):
77
+ self._labNotebookExperiment = self.checkAndConvertNullable(
78
+ value, EntityMinimalWithIntId, "labNotebookExperiment"
79
+ )
80
+
81
+ @property
82
+ def entryDate(self) -> Optional[datetime]:
83
+ return self._entryDate
84
+
85
+ @entryDate.setter
86
+ def entryDate(self, value):
87
+ self._entryDate = self.checkAndConvertNullable(value, datetime, "entryDate")