fable-model 0.2.0__tar.gz → 0.2.1__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fable-model
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Data models utilized in the FABLE ecosystem's HTTP-based PPRL service.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -24,13 +24,17 @@ Description-Content-Type: text/markdown
24
24
  [![Python Versions](https://img.shields.io/pypi/pyversions/fable-model?cacheSeconds=0)](https://pypi.org/project/fable-model/)
25
25
  ![Code Coverage](https://img.shields.io/badge/Coverage-98%25-brightgreen.svg)
26
26
  [![License](https://img.shields.io/pypi/l/fable-model?cacheSeconds=0)](https://pypi.org/project/fable-model/)
27
+ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
27
28
 
28
29
  # FABLE Model
29
30
 
30
31
  This package contains model classes that are used in the FABLE (**F**ederated
31
- **A**nonymized **B**loom filter **L**inkage **E**ngine) ecosystem's PPRL service for validation purposes.
32
- They were developed with the intention of creating an HTTP-based service for Bloom filter-based record linkage.
33
- It includes models for the service's data transformation, masking and bit vector matching routines.
32
+ **A**nonymized **B**loom filter **L**inkage **E**ngine) ecosystem's services for validation purposes.
33
+ They were developed with the intention of creating HTTP-based services to perform Bloom filter-based record linkage in
34
+ a federated setting.
35
+ It includes models for data transformation, masking and bit vector matching routines that are used by the
36
+ [FABLE PPRL service](https://github.com/ul-mds/fable-pprl-service) as well as models used by the
37
+ [FABLE Broker service](https://github.com/ul-mds/fable-broker).
34
38
  Validation, serialization and deserialization are done using [Pydantic](https://docs.pydantic.dev/latest/).
35
39
  It is rare to use this package directly.
36
40
  Rather, it powers the functionalities of other packages.
@@ -41,11 +45,11 @@ Rather, it powers the functionalities of other packages.
41
45
  pip install fable-model
42
46
  ```
43
47
 
44
- ## Data models
48
+ ## PPRL service
45
49
 
46
50
  Models for entity pre-processing, masking and bit vector matching are exposed through this package.
47
51
  The following examples are taken from the test suites of the
48
- [FABLE PPRL service package](https://github.com/ul-mds/fable-pprl-service) and show additional
52
+ [PPRL service package](https://github.com/ul-mds/fable-pprl-service) and show additional
49
53
  validation steps in addition to the ones native to Pydantic.
50
54
 
51
55
  ### Entity transformation
@@ -330,6 +334,12 @@ _ = VectorMatchRequest(
330
334
  )
331
335
  ```
332
336
 
337
+ ## Broker service
338
+
339
+ The `broker` module contains models used by the [Broker service](https://github.com/ul-mds/fable-broker) to validate
340
+ requests and responses to create, manage and delete matching sessions.
341
+ Follow the link to the repository of that service for further information.
342
+
333
343
  ## License
334
344
 
335
345
  MIT.
@@ -2,13 +2,17 @@
2
2
  [![Python Versions](https://img.shields.io/pypi/pyversions/fable-model?cacheSeconds=0)](https://pypi.org/project/fable-model/)
3
3
  ![Code Coverage](https://img.shields.io/badge/Coverage-98%25-brightgreen.svg)
4
4
  [![License](https://img.shields.io/pypi/l/fable-model?cacheSeconds=0)](https://pypi.org/project/fable-model/)
5
+ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
5
6
 
6
7
  # FABLE Model
7
8
 
8
9
  This package contains model classes that are used in the FABLE (**F**ederated
9
- **A**nonymized **B**loom filter **L**inkage **E**ngine) ecosystem's PPRL service for validation purposes.
10
- They were developed with the intention of creating an HTTP-based service for Bloom filter-based record linkage.
11
- It includes models for the service's data transformation, masking and bit vector matching routines.
10
+ **A**nonymized **B**loom filter **L**inkage **E**ngine) ecosystem's services for validation purposes.
11
+ They were developed with the intention of creating HTTP-based services to perform Bloom filter-based record linkage in
12
+ a federated setting.
13
+ It includes models for data transformation, masking and bit vector matching routines that are used by the
14
+ [FABLE PPRL service](https://github.com/ul-mds/fable-pprl-service) as well as models used by the
15
+ [FABLE Broker service](https://github.com/ul-mds/fable-broker).
12
16
  Validation, serialization and deserialization are done using [Pydantic](https://docs.pydantic.dev/latest/).
13
17
  It is rare to use this package directly.
14
18
  Rather, it powers the functionalities of other packages.
@@ -19,11 +23,11 @@ Rather, it powers the functionalities of other packages.
19
23
  pip install fable-model
20
24
  ```
21
25
 
22
- ## Data models
26
+ ## PPRL service
23
27
 
24
28
  Models for entity pre-processing, masking and bit vector matching are exposed through this package.
25
29
  The following examples are taken from the test suites of the
26
- [FABLE PPRL service package](https://github.com/ul-mds/fable-pprl-service) and show additional
30
+ [PPRL service package](https://github.com/ul-mds/fable-pprl-service) and show additional
27
31
  validation steps in addition to the ones native to Pydantic.
28
32
 
29
33
  ### Entity transformation
@@ -308,6 +312,12 @@ _ = VectorMatchRequest(
308
312
  )
309
313
  ```
310
314
 
315
+ ## Broker service
316
+
317
+ The `broker` module contains models used by the [Broker service](https://github.com/ul-mds/fable-broker) to validate
318
+ requests and responses to create, manage and delete matching sessions.
319
+ Follow the link to the repository of that service for further information.
320
+
311
321
  ## License
312
322
 
313
323
  MIT.
@@ -0,0 +1,76 @@
1
+ from typing import Annotated
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from fable_model.common import BitVectorEntity
6
+ from fable_model.match import MatchConfig
7
+
8
+
9
+ class BaseSessionModel(BaseModel):
10
+ session: str
11
+
12
+
13
+ class BaseAuthenticatedSessionModel(BaseSessionModel):
14
+ token: str
15
+
16
+
17
+ class SessionCreationRequest(BaseSessionModel):
18
+ match_config: MatchConfig
19
+ expires_in: int = 3600
20
+
21
+
22
+ class SessionUpdateResponse(BaseSessionModel):
23
+ expires_at: int
24
+
25
+
26
+ class SessionCreationResponse(SessionUpdateResponse):
27
+ token: str
28
+
29
+
30
+ SessionDeletionRequest = BaseAuthenticatedSessionModel
31
+ SessionUpdateRequest = BaseAuthenticatedSessionModel
32
+
33
+
34
+ class BitVectorMetadata(BaseModel):
35
+ name: str
36
+ value: str
37
+
38
+
39
+ class MetaBitVectorEntity(BitVectorEntity):
40
+ metadata: list[BitVectorMetadata] = Field(default_factory=list)
41
+
42
+
43
+ class BaseClientModel(BaseSessionModel):
44
+ client: str
45
+
46
+
47
+ class ClientSubmissionRequest(BaseClientModel):
48
+ vectors: list[MetaBitVectorEntity] = Field(min_length=1)
49
+
50
+
51
+ class ClientVectorBatch(BaseModel):
52
+ client: str
53
+ ids: list[int]
54
+
55
+
56
+ class VectorMatchBatch(BaseModel):
57
+ domain: ClientVectorBatch
58
+ range: list[ClientVectorBatch]
59
+ session: str
60
+ config: MatchConfig
61
+
62
+
63
+ class ClientResultRequest(BaseClientModel):
64
+ show_unfinished_results: bool = False
65
+
66
+
67
+ class MatchedClientVector(BaseModel):
68
+ vector: MetaBitVectorEntity
69
+ similarities: Annotated[list[Annotated[float, Field(ge=0, le=1)]], Field(min_length=1)]
70
+ aggregated_similarity: Annotated[float, Field(ge=0, le=1)] | None
71
+ reference_metadata: list[BitVectorMetadata]
72
+
73
+
74
+ class ClientResultResponse(BaseModel):
75
+ finished: bool
76
+ matches: list[MatchedClientVector]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fable-model"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Data models utilized in the FABLE ecosystem's HTTP-based PPRL service."
5
5
  authors = [
6
6
  {name = "Maximilian Jugl"},
@@ -39,6 +39,11 @@ markers = [
39
39
  "integration: mark a test as an integration test."
40
40
  ]
41
41
 
42
+ [tool.coverage.run]
43
+ omit = [
44
+ "fable_model/broker.py",
45
+ ]
46
+
42
47
  [build-system]
43
48
  requires = ["poetry-core>=2.0.0,<3.0.0"]
44
49
  build-backend = "poetry.core.masonry.api"
File without changes