destiny_sdk 0.4.1__py3-none-any.whl → 0.5.0__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.
destiny_sdk/client.py CHANGED
@@ -114,7 +114,7 @@ class Client:
114
114
  return RobotEnhancementBatchRead.model_validate(response.json())
115
115
 
116
116
  def poll_robot_enhancement_batch(
117
- self, robot_id: UUID4, limit: int = 10
117
+ self, robot_id: UUID4, limit: int = 10, timeout: int = 60
118
118
  ) -> RobotEnhancementBatch | None:
119
119
  """
120
120
  Poll for a robot enhancement batch.
@@ -127,11 +127,12 @@ class Client:
127
127
  :type limit: int
128
128
  :return: The RobotEnhancementBatch object from the response, or None if no
129
129
  batches available
130
- :rtype: RobotEnhancementBatch | None
130
+ :rtype: destiny_sdk.robots.RobotEnhancementBatch | None
131
131
  """
132
132
  response = self.session.post(
133
133
  "/robot-enhancement-batches/",
134
134
  params={"robot_id": str(robot_id), "limit": limit},
135
+ timeout=timeout,
135
136
  )
136
137
  # HTTP 204 No Content indicates no batches available
137
138
  if response.status_code == httpx.codes.NO_CONTENT:
@@ -15,20 +15,18 @@ class EnhancementType(StrEnum):
15
15
  The type of enhancement.
16
16
 
17
17
  This is used to identify the type of enhancement in the `Enhancement` class.
18
-
19
- **Allowed values**:
20
- - `bibliographic`: Bibliographic metadata.
21
- - `abstract`: The abstract of a reference.
22
- - `annotation`: A free-form enhancement for tagging with labels.
23
- - `locations`: Locations where the reference can be found.
24
- - `full_text`: The full text of the reference. (To be implemeted)
25
18
  """
26
19
 
27
20
  BIBLIOGRAPHIC = auto()
21
+ """Bibliographic metadata."""
28
22
  ABSTRACT = auto()
23
+ """The abstract of a reference."""
29
24
  ANNOTATION = auto()
25
+ """A free-form enhancement for tagging with labels."""
30
26
  LOCATION = auto()
27
+ """Locations where the reference can be found."""
31
28
  FULL_TEXT = auto()
29
+ """The full text of the reference. (To be implemented)"""
32
30
 
33
31
 
34
32
  class AuthorPosition(StrEnum):
@@ -36,16 +34,14 @@ class AuthorPosition(StrEnum):
36
34
  The position of an author in a list of authorships.
37
35
 
38
36
  Maps to the data from OpenAlex.
39
-
40
- **Allowed values**:
41
- - `first`: The first author.
42
- - `middle`: Any middle author
43
- - `last`: The last author
44
37
  """
45
38
 
46
39
  FIRST = auto()
40
+ """The first author."""
47
41
  MIDDLE = auto()
42
+ """Any middle author."""
48
43
  LAST = auto()
44
+ """The last author."""
49
45
 
50
46
 
51
47
  class Authorship(BaseModel):
@@ -104,18 +100,14 @@ other works have cited this work
104
100
 
105
101
 
106
102
  class AbstractProcessType(StrEnum):
107
- """
108
- The process used to acquire the abstract.
109
-
110
- **Allowed values**:
111
- - `uninverted`
112
- - `closed_api`
113
- - `other`
114
- """
103
+ """The process used to acquire the abstract."""
115
104
 
116
105
  UNINVERTED = auto()
106
+ """uninverted"""
117
107
  CLOSED_API = auto()
108
+ """closed_api"""
118
109
  OTHER = auto()
110
+ """other"""
119
111
 
120
112
 
121
113
  class AbstractContentEnhancement(BaseModel):
@@ -142,16 +134,15 @@ class AnnotationType(StrEnum):
142
134
  The type of annotation.
143
135
 
144
136
  This is used to identify the type of annotation in the `Annotation` class.
145
-
146
- **Allowed values**:
147
- - `boolean`: An annotation which is the boolean application of a label across a
148
- reference.
149
- - `score`: An annotation which is a score for a label across a reference,
150
- without a boolean value.
151
137
  """
152
138
 
153
139
  BOOLEAN = auto()
140
+ """An annotation which is the boolean application of a label across a reference."""
154
141
  SCORE = auto()
142
+ """
143
+ An annotation which is a score for a label across a reference, without a boolean
144
+ value.
145
+ """
155
146
 
156
147
 
157
148
  class ScoreAnnotation(BaseModel):
@@ -227,22 +218,22 @@ class DriverVersion(StrEnum):
227
218
  The version based on the DRIVER guidelines versioning scheme.
228
219
 
229
220
  (Borrowed from OpenAlex)
230
-
231
- Allowed values:
232
- - `publishedVersion`: The document's version of record. This is the most
233
- authoritative version.
234
- - `acceptedVersion`: The document after having completed peer review and being
235
- officially accepted for publication. It will lack publisher formatting, but the
236
- content should be interchangeable with the that of the publishedVersion.
237
- - `submittedVersion`: the document as submitted to the publisher by the authors, but
238
- before peer-review. Its content may differ significantly from that of the accepted
239
- article.
240
221
  """
241
222
 
242
223
  PUBLISHED_VERSION = "publishedVersion"
224
+ """The document's version of record. This is the most authoritative version."""
243
225
  ACCEPTED_VERSION = "acceptedVersion"
226
+ """
227
+ The document after having completed peer review and being officially accepted for
228
+ publication. It will lack publisher formatting, but the content should be
229
+ interchangeable with that of the publishedVersion.
230
+ """
244
231
  SUBMITTED_VERSION = "submittedVersion"
232
+ """
233
+ The document as submitted to the publisher by the authors, but before peer-review.
234
+ Its content may differ significantly from that of the accepted article."""
245
235
  OTHER = "other"
236
+ """Other version."""
246
237
 
247
238
 
248
239
  class Location(BaseModel):
@@ -360,7 +351,6 @@ class EnhancementFileInput(BaseModel):
360
351
  visibility: Visibility = Field(
361
352
  description="The level of visibility of the enhancement"
362
353
  )
363
- enhancement_type: EnhancementType = Field(description="The type of enhancement.")
364
354
  robot_version: str | None = Field(
365
355
  default=None,
366
356
  description="The version of the robot that generated the content.",
@@ -12,19 +12,16 @@ class ExternalIdentifierType(StrEnum):
12
12
 
13
13
  This is used to identify the type of identifier used in the `ExternalIdentifier`
14
14
  class.
15
- **Allowed values**:
16
- - `doi`: A DOI (Digital Object Identifier) which is a unique identifier for a
17
- document.
18
- - `pmid`: A PubMed ID which is a unique identifier for a document in PubMed.
19
- - `openalex`: An OpenAlex ID which is a unique identifier for a document in
20
- OpenAlex.
21
- - `other`: Any other identifier not defined. This should be used sparingly.
22
15
  """
23
16
 
24
17
  DOI = auto()
18
+ """A DOI (Digital Object Identifier) which is a unique identifier for a document."""
25
19
  PM_ID = auto()
20
+ """A PubMed ID which is a unique identifier for a document in PubMed."""
26
21
  OPEN_ALEX = auto()
22
+ """An OpenAlex ID which is a unique identifier for a document in OpenAlex."""
27
23
  OTHER = auto()
24
+ """Any other identifier not defined. This should be used sparingly."""
28
25
 
29
26
 
30
27
  class DOIIdentifier(BaseModel):
destiny_sdk/imports.py CHANGED
@@ -13,90 +13,52 @@ from pydantic import (
13
13
 
14
14
 
15
15
  class ImportRecordStatus(StrEnum):
16
- """
17
- Describes the status of an import record.
18
-
19
- - `created`: Created, but no processing has started.
20
- - `started`: Processing has started on the batch.
21
- - `completed`: Processing has been completed.
22
- """
16
+ """Describes the status of an import record."""
23
17
 
24
18
  CREATED = auto()
19
+ """Created, but no processing has started."""
25
20
  STARTED = auto()
21
+ """Processing has started on the batch."""
26
22
  COMPLETED = auto()
23
+ """Processing has been completed."""
27
24
 
28
25
 
29
26
  class ImportBatchStatus(StrEnum):
30
- """
31
- Describes the status of an import batch.
32
-
33
- - `created`: Created, but no processing has started.
34
- - `started`: Processing has started on the batch.
35
- - `failed`: Processing has failed.
36
- - `partially_failed`: Some references succeeded while others failed.
37
- - `completed`: Processing has been completed.
38
- """
27
+ """Describes the status of an import batch."""
39
28
 
40
29
  CREATED = auto()
30
+ """Created, but no processing has started."""
41
31
  STARTED = auto()
32
+ """Processing has started on the batch."""
42
33
  FAILED = auto()
34
+ """Processing has failed."""
43
35
  PARTIALLY_FAILED = auto()
36
+ """Some references succeeded while others failed."""
44
37
  COMPLETED = auto()
45
-
46
-
47
- class CollisionStrategy(StrEnum):
48
- """
49
- The strategy to use when an identifier collision is detected.
50
-
51
- Identifier collisions are detected on ``identifier_type`` and ``identifier``
52
- (and ``other_identifier_name`` where relevant) already present in the database.
53
-
54
- Enhancement collisions are detected on an entry with matching ``enhancement_type``
55
- and ``source`` already being present on the collided reference.
56
-
57
- - `discard`: Do nothing with the incoming reference.
58
- - `fail`: Do nothing with the incoming reference and mark it as failed. This
59
- allows the importing process to "follow up" on the failure.
60
- - `merge_aggressive`: Prioritize the incoming reference's identifiers and
61
- enhancements in the merge.
62
- - `merge_defensive`: Prioritize the existing reference's identifiers and
63
- enhancements in the merge.
64
- - `append`: Performs an aggressive merge of identifiers, and an append of
65
- enhancements.
66
- - `overwrite`: Performs an aggressive merge of identifiers, and an overwrite of
67
- enhancements (deleting existing and recreating what is imported). This should
68
- be used sparingly and carefully.
69
- """
70
-
71
- DISCARD = auto()
72
- FAIL = auto()
73
- MERGE_AGGRESSIVE = auto()
74
- MERGE_DEFENSIVE = auto()
75
- APPEND = auto()
76
- OVERWRITE = auto()
38
+ """Processing has been completed."""
77
39
 
78
40
 
79
41
  class ImportResultStatus(StrEnum):
80
- """
81
- Describes the status of an import result.
82
-
83
- - `created`: Created, but no processing has started.
84
- - `started`: The reference is currently being processed.
85
- - `completed`: The reference has been created.
86
- - `partially_failed`: The reference was created but one or more enhancements or
87
- identifiers failed to be added. See the result's `failure_details` field for
88
- more information.
89
- - `failed`: The reference failed to be created. See the result's `failure_details`
90
- field for more information.
91
- - `retrying`: Processing has failed, but is being retried.
92
- """
42
+ """Describes the status of an import result."""
93
43
 
94
44
  CREATED = auto()
45
+ """Created, but no processing has started."""
95
46
  STARTED = auto()
47
+ """The reference is currently being processed."""
96
48
  COMPLETED = auto()
49
+ """The reference has been created."""
97
50
  PARTIALLY_FAILED = auto()
51
+ """
52
+ The reference was created but one or more enhancements or identifiers failed to
53
+ be added. See the result's `failure_details` field for more information.
54
+ """
98
55
  FAILED = auto()
56
+ """
57
+ The reference failed to be created. See the result's `failure_details` field for
58
+ more information.
59
+ """
99
60
  RETRYING = auto()
61
+ """Processing has failed, but is being retried."""
100
62
 
101
63
 
102
64
  class _ImportRecordBase(BaseModel):
@@ -162,13 +124,6 @@ class ImportRecordRead(_ImportRecordBase):
162
124
  class _ImportBatchBase(BaseModel):
163
125
  """The base class for import batches."""
164
126
 
165
- collision_strategy: CollisionStrategy = Field(
166
- default=CollisionStrategy.FAIL,
167
- description="""
168
- The strategy to use for each reference when an identifier collision occurs.
169
- Default is `fail`, which allows the importing process to "follow up" on the collision.
170
- """,
171
- )
172
127
  storage_url: HttpUrl = Field(
173
128
  description="""
174
129
  The URL at which the set of references for this batch are stored. The file is a jsonl
@@ -176,11 +131,6 @@ with each line formatted according to
176
131
  :class:`ReferenceFileInput <libs.sdk.src.destiny_sdk.references.ReferenceFileInput>`.
177
132
  """,
178
133
  )
179
- callback_url: HttpUrl | None = Field(
180
- default=None,
181
- deprecated=True,
182
- description="This field is currently a no-op.",
183
- )
184
134
 
185
135
 
186
136
  class ImportBatchIn(_ImportBatchBase):
@@ -157,7 +157,6 @@ class EPPIParser:
157
157
  source=parser_source,
158
158
  visibility=Visibility.PUBLIC,
159
159
  content=content,
160
- enhancement_type=content.enhancement_type,
161
160
  robot_version=robot_version,
162
161
  )
163
162
  for content in enhancement_contents
destiny_sdk/robots.py CHANGED
@@ -159,32 +159,28 @@ If the URL expires, a new one can be generated using
159
159
 
160
160
 
161
161
  class EnhancementRequestStatus(StrEnum):
162
- """
163
- The status of an enhancement request.
164
-
165
- **Allowed values**:
166
- - `received`: Enhancement request has been received by the repo.
167
- - `accepted`: Enhancement request has been accepted by the robot.
168
- - `processing`: Enhancement request is being processed by the robot.
169
- - `rejected`: Enhancement request has been rejected by the robot.
170
- - `partial_failed`: Some enhancements failed to create.
171
- - `failed`: All enhancements failed to create.
172
- - `importing`: Enhancements have been received by the repo and are being imported.
173
- - `indexing`: Enhancements have been imported and are being indexed.
174
- - `indexing_failed`: Enhancements have been imported but indexing failed.
175
- - `completed`: All enhancements have been created.
176
- """
162
+ """The status of an enhancement request."""
177
163
 
178
164
  RECEIVED = auto()
165
+ """Enhancement request has been received by the repo."""
179
166
  ACCEPTED = auto()
167
+ """Enhancement request has been accepted by the robot."""
180
168
  PROCESSING = auto()
169
+ """Enhancement request is being processed by the robot."""
181
170
  REJECTED = auto()
171
+ """Enhancement request has been rejected by the robot."""
182
172
  PARTIAL_FAILED = auto()
173
+ """Some enhancements failed to create."""
183
174
  FAILED = auto()
175
+ """All enhancements failed to create."""
184
176
  IMPORTING = auto()
177
+ """Enhancements have been received by the repo and are being imported."""
185
178
  INDEXING = auto()
179
+ """Enhancements have been imported and are being indexed."""
186
180
  INDEXING_FAILED = auto()
181
+ """Enhancements have been imported but indexing failed."""
187
182
  COMPLETED = auto()
183
+ """All enhancements have been created."""
188
184
 
189
185
 
190
186
  class _EnhancementRequestBase(BaseModel):
@@ -334,10 +330,6 @@ class _RobotBase(BaseModel):
334
330
  model_config = ConfigDict(extra="forbid") # Forbid extra fields on robot models
335
331
 
336
332
  name: str = Field(description="The name of the robot, must be unique.")
337
- base_url: HttpUrl = Field(
338
- description="The base url of the robot. The robot must implement endpoint"
339
- "base_url/batch for batch enhancements of references.",
340
- )
341
333
  description: str = Field(
342
334
  description="Description of the enhancement the robot provides."
343
335
  )
destiny_sdk/visibility.py CHANGED
@@ -9,16 +9,11 @@ class Visibility(StrEnum):
9
9
 
10
10
  This is used to manage whether information should be publicly available or
11
11
  restricted (generally due to copyright constraints from publishers).
12
-
13
- TODO: Implement data governance layer to manage this.
14
-
15
- **Allowed values**:
16
-
17
- - `public`: Visible to the general public without authentication.
18
- - `restricted`: Requires authentication to be visible.
19
- - `hidden`: Is not visible, but may be passed to data mining processes.
20
12
  """
21
13
 
22
14
  PUBLIC = auto()
15
+ """Visible to the general public without authentication."""
23
16
  RESTRICTED = auto()
17
+ """Requires authentication to be visible."""
24
18
  HIDDEN = auto()
19
+ """Is not visible, but may be passed to data mining processes."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: destiny_sdk
3
- Version: 0.4.1
3
+ Version: 0.5.0
4
4
  Summary: A software development kit (sdk) to support interaction with the DESTINY repository
5
5
  Author-email: Adam Hamilton <adam@futureevidence.org>, Andrew Harvey <andrew@futureevidence.org>, Daniel Breves <daniel@futureevidence.org>, Jack Walmisley <jack@futureevidence.org>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1,17 @@
1
+ destiny_sdk/__init__.py,sha256=gmmrceJX84T4msk_GSm_OjTQvCpHFZRjnlUK5_7IODE,356
2
+ destiny_sdk/auth.py,sha256=bY72ywZEcG_67YBd9PrwgWTXkCf58rhLvVEXrtXbWtA,6247
3
+ destiny_sdk/client.py,sha256=fTBtuq5emT8ieNtCuCY8Y6xAKZJDLq8sG1WOvmjLz-I,4971
4
+ destiny_sdk/core.py,sha256=_FwDaczKTSaUSV_qfcnLhkBbZagh4ayFpN0qUwJ03-o,1448
5
+ destiny_sdk/enhancements.py,sha256=SkIlIlWKBN7Z-aXpQiy22SXrU7zVnKxaRb4F5yaFsO8,11503
6
+ destiny_sdk/identifiers.py,sha256=HjY3EVrbM2NP06TNo-VkXxH97zqTzoPFn974_iSXoKw,3554
7
+ destiny_sdk/imports.py,sha256=b-rh-dt3NsyLGxqmVzIzKaHiXhbw-3wtAaBN-ZW-i1E,5940
8
+ destiny_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ destiny_sdk/references.py,sha256=Dx-WKcv9gNJkKU9n52AYoEey7siTHR5_wBVBKSHND6Q,2321
10
+ destiny_sdk/robots.py,sha256=I_ZvMxwST52e8ovhv0-gPbOB3P9tptbRG0LrkNNOqKo,13463
11
+ destiny_sdk/visibility.py,sha256=8D44Q868YdScAt6eAFgXXrhonozXnv_Qa5w5yEGMPX8,577
12
+ destiny_sdk/parsers/__init__.py,sha256=d5gS--bXla_0I7e_9wTBnGWMXt2U8b-_ndeprTPe1hk,149
13
+ destiny_sdk/parsers/eppi_parser.py,sha256=rEOtt_5Kp3oktFlzRTLZ2x4_7aQ9-ba3FYpkaEnpnvs,5521
14
+ destiny_sdk-0.5.0.dist-info/METADATA,sha256=por5YQKyr40k3V95DJN_g8295pxlXbqG2nWdVf3h15w,2440
15
+ destiny_sdk-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ destiny_sdk-0.5.0.dist-info/licenses/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
17
+ destiny_sdk-0.5.0.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- destiny_sdk/__init__.py,sha256=gmmrceJX84T4msk_GSm_OjTQvCpHFZRjnlUK5_7IODE,356
2
- destiny_sdk/auth.py,sha256=bY72ywZEcG_67YBd9PrwgWTXkCf58rhLvVEXrtXbWtA,6247
3
- destiny_sdk/client.py,sha256=8l-UdKKdKgSSFZKg2AMhmyegIRD_wLjp8AtxtSuUMf0,4904
4
- destiny_sdk/core.py,sha256=_FwDaczKTSaUSV_qfcnLhkBbZagh4ayFpN0qUwJ03-o,1448
5
- destiny_sdk/enhancements.py,sha256=_S_anq194qdaEGklgycSG1qLEJeWzKe1u3oyXNxAg54,11800
6
- destiny_sdk/identifiers.py,sha256=9CFEaPhZr2IHfL4RSAzOvidXhhzKLDPXiSKddBMWzwM,3606
7
- destiny_sdk/imports.py,sha256=PG1rNNPdOxTeVI3-8sXFfRYi9BkCVZmr_jqr0Q9mxiU,7845
8
- destiny_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- destiny_sdk/references.py,sha256=Dx-WKcv9gNJkKU9n52AYoEey7siTHR5_wBVBKSHND6Q,2321
10
- destiny_sdk/robots.py,sha256=Okkveik2tFG4JtchnUMbrHcKGglBrR30fiNdtLP00IA,13777
11
- destiny_sdk/visibility.py,sha256=nDLqnWuSZSk0vG3ynzDpHAvaALsbk8cuEZujTsqf6no,684
12
- destiny_sdk/parsers/__init__.py,sha256=d5gS--bXla_0I7e_9wTBnGWMXt2U8b-_ndeprTPe1hk,149
13
- destiny_sdk/parsers/eppi_parser.py,sha256=aSTqmm8N2WK1gnkj38XvfWaEXsaf0y6je6h9qN0xvFA,5584
14
- destiny_sdk-0.4.1.dist-info/METADATA,sha256=6gCDo23pk4zxjAyADhY6gs3E3l8TWW0zJkpLbbrpTgI,2440
15
- destiny_sdk-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- destiny_sdk-0.4.1.dist-info/licenses/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
17
- destiny_sdk-0.4.1.dist-info/RECORD,,