destiny_sdk 0.1.0__py3-none-any.whl → 0.1.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.
@@ -1,10 +1,11 @@
1
1
  """Enhancement classes for the Destiny Repository."""
2
2
 
3
+ import datetime
3
4
  import uuid
4
5
  from enum import StrEnum, auto
5
6
  from typing import Annotated, Literal
6
7
 
7
- from pydantic import BaseModel, Field, HttpUrl, PastDate
8
+ from pydantic import BaseModel, Field, HttpUrl
8
9
 
9
10
  from destiny_sdk.core import _JsonlFileInputMixIn
10
11
  from destiny_sdk.visibility import Visibility
@@ -86,10 +87,10 @@ class BibliographicMetadataEnhancement(BaseModel):
86
87
  other works have cited this work
87
88
  """,
88
89
  )
89
- created_date: PastDate | None = Field(
90
+ created_date: datetime.date | None = Field(
90
91
  default=None, description="The ISO8601 date this metadata record was created"
91
92
  )
92
- publication_date: PastDate | None = Field(
93
+ publication_date: datetime.date | None = Field(
93
94
  default=None, description="The date which the version of record was published."
94
95
  )
95
96
  publication_year: int | None = Field(
@@ -172,10 +173,11 @@ class ScoreAnnotation(BaseModel):
172
173
  )
173
174
  score: float = Field(description="""Score for this annotation""")
174
175
  data: dict = Field(
176
+ default_factory=dict,
175
177
  description=(
176
178
  "An object representation of the annotation including any confidence scores"
177
179
  " or descriptions."
178
- )
180
+ ),
179
181
  )
180
182
 
181
183
 
@@ -200,6 +202,7 @@ class BooleanAnnotation(BaseModel):
200
202
  None, description="A confidence score for this annotation"
201
203
  )
202
204
  data: dict = Field(
205
+ default_factory=dict,
203
206
  description="""
204
207
  An object representation of the annotation including any confidence scores or
205
208
  descriptions.
destiny_sdk/imports.py CHANGED
@@ -34,13 +34,20 @@ class ImportBatchStatus(StrEnum):
34
34
 
35
35
  - `created`: Created, but no processing has started.
36
36
  - `started`: Processing has started on the batch.
37
+ - `failed`: Processing has failed.
38
+ - `retrying`: Processing has failed, but is being retried.
39
+ - `indexing`: The imports have been saved and are being indexed.
40
+ - `indexing_failed`: The imports have been saved but were not indexed.
37
41
  - `completed`: Processing has been completed.
38
42
  - `cancelled`: Processing was cancelled by calling the API.
39
43
  """
40
44
 
41
45
  CREATED = auto()
42
46
  STARTED = auto()
47
+ RETRYING = auto()
43
48
  FAILED = auto()
49
+ INDEXING = auto()
50
+ INDEXING_FAILED = auto()
44
51
  COMPLETED = auto()
45
52
  CANCELLED = auto()
46
53
 
destiny_sdk/robots.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Schemas that define inputs/outputs for robots."""
2
2
 
3
3
  from enum import StrEnum, auto
4
- from typing import Annotated, Self
4
+ from typing import Annotated, Any, Self
5
5
 
6
6
  from pydantic import UUID4, BaseModel, ConfigDict, Field, HttpUrl, model_validator
7
7
 
@@ -174,6 +174,10 @@ class _EnhancementRequestBase(BaseModel):
174
174
  robot_id: UUID4 = Field(
175
175
  description="The robot to be used to create the enhancement."
176
176
  )
177
+ source: str | None = Field(
178
+ default=None,
179
+ description="The source of the batch enhancement request.",
180
+ )
177
181
 
178
182
  enhancement_parameters: dict | None = Field(
179
183
  default=None, description="Information needed to create the enhancement. TBC."
@@ -233,6 +237,10 @@ class _BatchEnhancementRequestBase(BaseModel):
233
237
  reference_ids: list[UUID4] = Field(
234
238
  description="The IDs of the references to be enhanced."
235
239
  )
240
+ source: str | None = Field(
241
+ default=None,
242
+ description="The source of the batch enhancement request.",
243
+ )
236
244
 
237
245
 
238
246
  class BatchEnhancementRequestIn(_BatchEnhancementRequestBase):
@@ -335,3 +343,39 @@ class ProvisionedRobot(Robot):
335
343
  description="The client secret of the robot, used as the secret key "
336
344
  "when sending HMAC authenticated requests."
337
345
  )
346
+
347
+
348
+ class _RobotAutomationBase(BaseModel):
349
+ """Base Robot Automation class."""
350
+
351
+ query: dict[str, Any] = Field(
352
+ description="The percolator query that will be used to match references "
353
+ " or enhancements against."
354
+ )
355
+
356
+
357
+ class RobotAutomationIn(_RobotAutomationBase):
358
+ """
359
+ Automation model for a robot.
360
+
361
+ This is used as a source of truth for an Elasticsearch index that percolates
362
+ references or enhancements against the queries. If a query matches, a request
363
+ is sent to the specified robot to perform the enhancement.
364
+ """
365
+
366
+
367
+ class RobotAutomation(_RobotAutomationBase):
368
+ """
369
+ Core Robot Automation class.
370
+
371
+ This is used as a source of truth for an Elasticsearch index that percolates
372
+ references or enhancements against the queries. If a query matches, a request
373
+ is sent to the specified robot to perform the enhancement.
374
+ """
375
+
376
+ id: UUID4 = Field(
377
+ description="The ID of the robot automation.",
378
+ )
379
+ robot_id: UUID4 = Field(
380
+ description="The ID of the robot that will be used to enhance the reference."
381
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: destiny_sdk
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A software development kit (sdk) to support interaction with the DESTINY repository
5
5
  License: Apache 2.0
6
6
  Author: Adam Hamilton
@@ -90,3 +90,13 @@ poetry config pypi-token.pypi [YOUR_PYPI_TOKEN]
90
90
  poetry publish
91
91
  ```
92
92
 
93
+ ### Versioning
94
+
95
+ Follow the [semver](https://semver.org/) guidelines for versioning, tldr;
96
+
97
+ Given a version number `MAJOR.MINOR.PATCH`, increment the:
98
+
99
+ - `MAJOR` version when you make incompatible API change
100
+ - `MINOR` version when you add functionality in a backward compatible manner
101
+ - `PATCH` version when you make backward compatible bug fixes
102
+
@@ -2,14 +2,14 @@ destiny_sdk/__init__.py,sha256=gmmrceJX84T4msk_GSm_OjTQvCpHFZRjnlUK5_7IODE,356
2
2
  destiny_sdk/auth.py,sha256=bY72ywZEcG_67YBd9PrwgWTXkCf58rhLvVEXrtXbWtA,6247
3
3
  destiny_sdk/client.py,sha256=gUZJ8Mnmm1mUH7zd8fJbTksgPzBQQoYOFcuzJGiO2Dk,3642
4
4
  destiny_sdk/core.py,sha256=GgNc7EncHKyZ5ppIG2CATWN2JFPjtA7IYhF0FutqwGE,945
5
- destiny_sdk/enhancements.py,sha256=fV3ybz9SLxOn9S0FRXjYeDySq0zNux-ipla8NwhGb8Y,11452
5
+ destiny_sdk/enhancements.py,sha256=wFaphXYEHEU6yRijsP4tBY7BC6V9O2MPnOisfvE5EfE,11529
6
6
  destiny_sdk/identifiers.py,sha256=JHxu-wM3T8kKtAYuk5dMec35Ay73KxYP7gthbSvOhuI,3480
7
- destiny_sdk/imports.py,sha256=WdgGvl74BjwDNQ7LCqSEs7ZRMUtDNu0hkohGROVZHR0,7924
7
+ destiny_sdk/imports.py,sha256=mfC1QXbAU27iD3hO9OFTRQes352F6DS1U4fSMw26-8w,8243
8
8
  destiny_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  destiny_sdk/references.py,sha256=Tt9sVgw6WIXIhXGrlgGdRgIrIgQL0yr3Aqb0nr0WfK0,1493
10
- destiny_sdk/robots.py,sha256=1xZajI5wm3xnIK5emH74KFUCCRqgnXAvFlA4tAlVmUg,11134
10
+ destiny_sdk/robots.py,sha256=B38KYXz_YJkZZ5RKBt17sh8yPD88dNCJvISw7V4km5k,12490
11
11
  destiny_sdk/visibility.py,sha256=nDLqnWuSZSk0vG3ynzDpHAvaALsbk8cuEZujTsqf6no,684
12
- destiny_sdk-0.1.0.dist-info/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
13
- destiny_sdk-0.1.0.dist-info/METADATA,sha256=wiWa8b0VXOPXplK_VZdIxAUWWcyBAyHk5Owp3qFj-3c,2196
14
- destiny_sdk-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
15
- destiny_sdk-0.1.0.dist-info/RECORD,,
12
+ destiny_sdk-0.1.1.dist-info/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
13
+ destiny_sdk-0.1.1.dist-info/METADATA,sha256=A4yKwHYOWseLSeHCVT8VoJ45ZC9w9EyX3R_WtU9M9Bo,2543
14
+ destiny_sdk-0.1.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
15
+ destiny_sdk-0.1.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.3
2
+ Generator: poetry-core 2.1.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any