destiny_sdk 0.7.3__py3-none-any.whl → 0.7.4__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.
@@ -8,6 +8,7 @@ from typing import Annotated, Any, Literal, Self
8
8
  from pydantic import UUID4, BaseModel, Field, HttpUrl, model_validator
9
9
 
10
10
  from destiny_sdk.core import _JsonlFileInputMixIn
11
+ from destiny_sdk.identifiers import Identifier
11
12
  from destiny_sdk.visibility import Visibility
12
13
 
13
14
 
@@ -26,6 +27,8 @@ class EnhancementType(StrEnum):
26
27
  """A free-form enhancement for tagging with labels."""
27
28
  LOCATION = auto()
28
29
  """Locations where the reference can be found."""
30
+ REFERENCE_ASSOCIATION = auto()
31
+ """Associations to other references."""
29
32
  RAW = auto()
30
33
  """A free form enhancement for arbitrary/unstructured data."""
31
34
  FULL_TEXT = auto()
@@ -56,7 +59,11 @@ class Authorship(BaseModel):
56
59
  for our purposes.
57
60
  """
58
61
 
59
- display_name: str = Field(description="The display name of the author.")
62
+ display_name: str = Field(
63
+ description="The display name of the author. "
64
+ "Expected format FIRSTNAME <MIDDLENAME> LASTNAME. "
65
+ "Providing display_name in an unexpected format will affect search performance."
66
+ )
60
67
  orcid: str | None = Field(default=None, description="The ORCid of the author.")
61
68
  position: AuthorPosition = Field(
62
69
  description="The position of the author within the list of authors."
@@ -320,6 +327,43 @@ class LocationEnhancement(BaseModel):
320
327
  )
321
328
 
322
329
 
330
+ class ReferenceAssociationType(StrEnum):
331
+ """
332
+ The type of association between references.
333
+
334
+ Direction is important: "this reference <association_type> associated reference".
335
+ """
336
+
337
+ CITES = auto()
338
+ """This reference cites the related reference."""
339
+ IS_CITED_BY = auto()
340
+ """This reference is cited by the related reference."""
341
+ IS_SIMILAR_TO = auto()
342
+ """This reference is similar to the related reference."""
343
+
344
+
345
+ class ReferenceAssociationEnhancement(BaseModel):
346
+ """An enhancement for storing associations between references."""
347
+
348
+ enhancement_type: Literal[EnhancementType.REFERENCE_ASSOCIATION] = (
349
+ EnhancementType.REFERENCE_ASSOCIATION
350
+ )
351
+ associated_reference_ids: list[Identifier] = Field(
352
+ min_length=1,
353
+ description=(
354
+ "A list of Identifiers which are associated to this reference. "
355
+ "These can either be ExternalIdentifiers or resolved repository UUID4s."
356
+ ),
357
+ )
358
+ association_type: ReferenceAssociationType = Field(
359
+ description=(
360
+ "The type of association between this reference and the associated ones. "
361
+ "Direction is important: "
362
+ '"this reference <association_type> associated reference".'
363
+ )
364
+ )
365
+
366
+
323
367
  class RawEnhancement(BaseModel):
324
368
  """
325
369
  An enhancement for storing raw/arbitrary/unstructured data.
@@ -377,6 +421,7 @@ EnhancementContent = Annotated[
377
421
  | AbstractContentEnhancement
378
422
  | AnnotationEnhancement
379
423
  | LocationEnhancement
424
+ | ReferenceAssociationEnhancement
380
425
  | RawEnhancement,
381
426
  Field(discriminator="enhancement_type"),
382
427
  ]
@@ -165,6 +165,9 @@ ExternalIdentifier = Annotated[
165
165
  Field(discriminator="identifier_type"),
166
166
  ]
167
167
 
168
+ #: Any identifier including external identifiers and repository UUID4s.
169
+ Identifier = Annotated[ExternalIdentifier | UUID4, Field()]
170
+
168
171
  ExternalIdentifierAdapter: TypeAdapter[ExternalIdentifier] = TypeAdapter(
169
172
  ExternalIdentifier
170
173
  )
@@ -245,7 +248,7 @@ class IdentifierLookup(BaseModel):
245
248
  )
246
249
 
247
250
  @classmethod
248
- def from_identifier(cls, identifier: ExternalIdentifier | UUID4) -> Self:
251
+ def from_identifier(cls, identifier: Identifier) -> Self:
249
252
  """Create an IdentifierLookup from an ExternalIdentifier or UUID4."""
250
253
  if isinstance(identifier, uuid.UUID):
251
254
  return cls(identifier=str(identifier), identifier_type=None)
@@ -255,7 +258,7 @@ class IdentifierLookup(BaseModel):
255
258
  other_identifier_name=getattr(identifier, "other_identifier_name", None),
256
259
  )
257
260
 
258
- def to_identifier(self) -> ExternalIdentifier | UUID4:
261
+ def to_identifier(self) -> Identifier:
259
262
  """Convert into an ExternalIdentifier or UUID4 if it has no identifier_type."""
260
263
  if self.identifier_type is None:
261
264
  return UUID4(self.identifier)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: destiny_sdk
3
- Version: 0.7.3
3
+ Version: 0.7.4
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>, Tim Repke <tim.repke@pik-potsdam.de>
6
6
  License-Expression: Apache-2.0
@@ -2,8 +2,8 @@ destiny_sdk/__init__.py,sha256=NdSlsPQyDF3TW30_JzbvYMRBRA9iT677iTRWWCMdYOA,382
2
2
  destiny_sdk/auth.py,sha256=bY72ywZEcG_67YBd9PrwgWTXkCf58rhLvVEXrtXbWtA,6247
3
3
  destiny_sdk/client.py,sha256=nKvS5rRkIpBqv8dVIB57Xsop0UvVz3i875RQxfVSMao,21306
4
4
  destiny_sdk/core.py,sha256=E0Wotu9psggK1JRJxbvx3Jc7WEGE6zaz2R2awvRrLz8,2023
5
- destiny_sdk/enhancements.py,sha256=P_kH59WoWuYq444xjV05HNXlTGfB-lE0ffKYwpAY7z8,14118
6
- destiny_sdk/identifiers.py,sha256=I9Q2I35Lg8oyl3uytq1gCGOUu92F9sZSSwzLoCXBJi4,9727
5
+ destiny_sdk/enhancements.py,sha256=79-lXOowRPC3EdM3PZPkcbnVIj5Bnbp_GIlVuEYhLkM,15707
6
+ destiny_sdk/identifiers.py,sha256=JoJvRBzK4pGTRB03mCaGPyjd32tqZLT5hnRgc9Yi95Q,9828
7
7
  destiny_sdk/imports.py,sha256=b-rh-dt3NsyLGxqmVzIzKaHiXhbw-3wtAaBN-ZW-i1E,5940
8
8
  destiny_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  destiny_sdk/references.py,sha256=3Y8gBMTSyZY35S3pB1bnVHMai9RRiGeoGZysNvSo7kk,2553
@@ -15,7 +15,7 @@ destiny_sdk/labs/references.py,sha256=iZisRgGZ5c7X7uTFoe6Q0AwwFMa4yJbIoPUVv_hvOi
15
15
  destiny_sdk/parsers/__init__.py,sha256=d5gS--bXla_0I7e_9wTBnGWMXt2U8b-_ndeprTPe1hk,149
16
16
  destiny_sdk/parsers/eppi_parser.py,sha256=_1xnAT0F0o1HKpMWOGQbVS3VPOrhPqyzHDWR3CosWwk,9484
17
17
  destiny_sdk/parsers/exceptions.py,sha256=0Sc_M4j560Nqh4SjeP_YrgOUVagdIwWwRz24E6YlZ1k,573
18
- destiny_sdk-0.7.3.dist-info/METADATA,sha256=2z_JjoZa-UMvOaPefJoYAc1ILx39gT0IWIqfYljbS1g,2685
19
- destiny_sdk-0.7.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
- destiny_sdk-0.7.3.dist-info/licenses/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
21
- destiny_sdk-0.7.3.dist-info/RECORD,,
18
+ destiny_sdk-0.7.4.dist-info/METADATA,sha256=Qb7_sEE2hy49aCE929t1SiSlHGZQXxeMLHPL_GCJp1k,2685
19
+ destiny_sdk-0.7.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
+ destiny_sdk-0.7.4.dist-info/licenses/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
21
+ destiny_sdk-0.7.4.dist-info/RECORD,,