cineon-api-format 3.6.0__tar.gz → 3.9.0__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.
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/PKG-INFO +3 -3
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/pyproject.toml +3 -2
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/src/cineon_api_format/__init__.py +10 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/src/cineon_api_format/definitions.py +10 -1
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/src/cineon_api_format/requests.py +14 -1
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/src/cineon_api_format/responses.py +20 -7
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/tests/test_all.py +38 -0
- cineon_api_format-3.9.0/uv.lock +3152 -0
- cineon_api_format-3.6.0/uv.lock +0 -2870
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/.env.example +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/.githooks/pre-push +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/.github/workflows/main.yml +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/.github/workflows/publish.yml +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/.gitignore +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/.python-version +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/README.md +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/badges/complexity.svg +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/badges/coverage.svg +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/badges/version.svg +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/scripts/badges/complexity.py +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/scripts/badges/version.py +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/scripts/badges.sh +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/scripts/format.sh +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/scripts/publish.sh +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/scripts/test.sh +0 -0
- {cineon_api_format-3.6.0 → cineon_api_format-3.9.0}/src/cineon_api_format/version.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: cineon-api-format
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.9.0
|
|
4
4
|
Summary: Types used by the ELE API, and other Cineon APIs.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
|
-
Requires-Dist: cineon-format[cineon-model]<4,>=3.
|
|
6
|
+
Requires-Dist: cineon-format[cineon-model]<4,>=3.9.0
|
|
7
7
|
Requires-Dist: pydantic>=2.12.5
|
|
8
8
|
Requires-Dist: typeguard>=4.4.4
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cineon-api-format"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.9.0"
|
|
4
4
|
description = "Types used by the ELE API, and other Cineon APIs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"pydantic>=2.12.5",
|
|
9
9
|
"typeguard>=4.4.4",
|
|
10
|
-
"cineon-format[cineon-model] (>=3.
|
|
10
|
+
"cineon-format[cineon-model] (>=3.9.0,<4)",
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
[dependency-groups]
|
|
@@ -17,6 +17,7 @@ dev = [
|
|
|
17
17
|
"isort>=6.0.1",
|
|
18
18
|
"mypy>=1.17.1",
|
|
19
19
|
"pytest>=8.4.1",
|
|
20
|
+
"pytz>=2026.3.post1",
|
|
20
21
|
"radon>=6.0.1",
|
|
21
22
|
"ruff>=0.12.11",
|
|
22
23
|
]
|
|
@@ -2,11 +2,16 @@ from .definitions import Construct, Metric
|
|
|
2
2
|
from .requests import (
|
|
3
3
|
CineonInferenceRequest,
|
|
4
4
|
ClientInfo,
|
|
5
|
+
CreateEventRequest,
|
|
6
|
+
DeleteEventRequest,
|
|
5
7
|
InferenceRequest,
|
|
6
8
|
ModelRecalculateRequest,
|
|
9
|
+
UpdateEventRequest,
|
|
7
10
|
UserReceiveMarketingRequest,
|
|
8
11
|
)
|
|
9
12
|
from .responses import (
|
|
13
|
+
CreateEventResponse,
|
|
14
|
+
GetEventResponse,
|
|
10
15
|
InferenceOutput,
|
|
11
16
|
InferenceResponse,
|
|
12
17
|
PingResponse,
|
|
@@ -19,6 +24,10 @@ __all__ = [
|
|
|
19
24
|
"CineonInferenceRequest",
|
|
20
25
|
"ClientInfo",
|
|
21
26
|
"Construct",
|
|
27
|
+
"CreateEventRequest",
|
|
28
|
+
"CreateEventResponse",
|
|
29
|
+
"DeleteEventRequest",
|
|
30
|
+
"GetEventResponse",
|
|
22
31
|
"InferenceOutput",
|
|
23
32
|
"InferenceRequest",
|
|
24
33
|
"InferenceResponse",
|
|
@@ -26,6 +35,7 @@ __all__ = [
|
|
|
26
35
|
"ModelRecalculateRequest",
|
|
27
36
|
"PingResponse",
|
|
28
37
|
"RootResponse",
|
|
38
|
+
"UpdateEventRequest",
|
|
29
39
|
"UserReceiveMarketingRequest",
|
|
30
40
|
"VersionResponse",
|
|
31
41
|
"__version__",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import datetime
|
|
1
2
|
from enum import Enum
|
|
2
3
|
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
# This is part of the public API, so do not change existing names!
|
|
5
8
|
class Construct(Enum):
|
|
@@ -24,7 +27,6 @@ class GazetoolsInput(Enum):
|
|
|
24
27
|
|
|
25
28
|
# This is part of the public API, so do not change existing names!
|
|
26
29
|
class Metric(Enum):
|
|
27
|
-
|
|
28
30
|
# Fixations
|
|
29
31
|
fixation_duration_mean = "fixation_duration_mean"
|
|
30
32
|
fixation_dispersion_median = "fixation_dispersion_median"
|
|
@@ -187,3 +189,10 @@ gazetools_metric_names: dict[Metric, str] = {
|
|
|
187
189
|
Metric.blink_duration_std: "blinks.duration.std",
|
|
188
190
|
Metric.pupil_diameter_std: "pupillometry.diameter.std",
|
|
189
191
|
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# Note that `Event` doesn't contain an `EventId`, instead `EventId`
|
|
195
|
+
# is used as a key in a mapping from `EventId` to `Event` by the backend
|
|
196
|
+
class Event(BaseModel, extra="forbid"):
|
|
197
|
+
event: str
|
|
198
|
+
timestamp: datetime.datetime
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from typing import Self
|
|
2
|
+
from uuid import UUID
|
|
2
3
|
|
|
3
4
|
from cineon_format.cineon_data import RawData
|
|
4
5
|
from pydantic import BaseModel, field_validator, model_validator
|
|
5
6
|
|
|
6
|
-
from cineon_api_format.definitions import Construct, Metric
|
|
7
|
+
from cineon_api_format.definitions import Construct, Event, Metric
|
|
7
8
|
|
|
8
9
|
DEFAULT_CONSTRUCRTS = [Construct.stress, Construct.workload, Construct.fatigue]
|
|
9
10
|
DEFAULT_METRICS = [
|
|
@@ -97,3 +98,15 @@ class ModelRecalculateRequest(BaseModel, extra="forbid"):
|
|
|
97
98
|
|
|
98
99
|
class UserReceiveMarketingRequest(BaseModel, extra="forbid"):
|
|
99
100
|
receive_marketing_emails: bool
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class CreateEventRequest(Event):
|
|
104
|
+
pass
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class UpdateEventRequest(Event):
|
|
108
|
+
id: UUID
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class DeleteEventRequest(BaseModel, extra="forbid"):
|
|
112
|
+
id: UUID
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from uuid import UUID
|
|
3
|
+
|
|
1
4
|
from cineon_format import CineonPrediction
|
|
2
|
-
from deprecated import deprecated
|
|
3
5
|
from pydantic import BaseModel
|
|
4
6
|
|
|
7
|
+
from cineon_api_format.definitions import Event
|
|
8
|
+
|
|
5
9
|
|
|
6
10
|
class RootResponse(BaseModel, extra="forbid"):
|
|
7
11
|
name: str
|
|
@@ -19,13 +23,22 @@ class VersionResponse(BaseModel, extra="forbid"):
|
|
|
19
23
|
gazetools: str
|
|
20
24
|
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
class MetadataResponse(BaseModel, extra="forbid"):
|
|
27
|
+
start_timestamp: datetime.datetime
|
|
28
|
+
end_timestamp: datetime.datetime
|
|
29
|
+
|
|
30
|
+
|
|
26
31
|
class InferenceOutput(CineonPrediction):
|
|
27
|
-
|
|
32
|
+
model_used: str | None = None
|
|
28
33
|
|
|
29
34
|
|
|
30
35
|
class InferenceResponse(BaseModel, extra="forbid"):
|
|
31
|
-
data: list[
|
|
36
|
+
data: list[InferenceOutput]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class GetEventResponse(Event):
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class CreateEventResponse(BaseModel, extra="forbid"):
|
|
44
|
+
id: UUID
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
from datetime import datetime, timedelta
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
4
|
+
import pytz
|
|
2
5
|
from cineon_format import RawInferenceData
|
|
3
6
|
from pydantic import ValidationError
|
|
4
7
|
from typeguard import typechecked
|
|
@@ -14,6 +17,8 @@ from cineon_api_format import (
|
|
|
14
17
|
UserReceiveMarketingRequest,
|
|
15
18
|
)
|
|
16
19
|
|
|
20
|
+
DEFAULT_TZ = pytz.timezone("Europe/London")
|
|
21
|
+
|
|
17
22
|
|
|
18
23
|
@typechecked
|
|
19
24
|
def test_cineon_request_to_ele_request():
|
|
@@ -93,6 +98,39 @@ def test_inference_response_construct_target():
|
|
|
93
98
|
assert InferenceResponse.model_validate(response)
|
|
94
99
|
|
|
95
100
|
|
|
101
|
+
@typechecked
|
|
102
|
+
def test_inference_response_datetime_object():
|
|
103
|
+
response = {
|
|
104
|
+
"data": [
|
|
105
|
+
{
|
|
106
|
+
"prediction": 0.8,
|
|
107
|
+
"target": Construct.stress,
|
|
108
|
+
"start_timestamp": datetime.now(DEFAULT_TZ),
|
|
109
|
+
"end_timestamp": datetime.now(DEFAULT_TZ) + timedelta(seconds=10),
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
assert InferenceResponse.model_validate(response)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@typechecked
|
|
117
|
+
def test_inference_response_model_used():
|
|
118
|
+
response = {
|
|
119
|
+
"data": [
|
|
120
|
+
{
|
|
121
|
+
"prediction": "1.6",
|
|
122
|
+
"target": "fatigue",
|
|
123
|
+
"model_used": "cheese-burger",
|
|
124
|
+
"start_timestamp": datetime.now(DEFAULT_TZ),
|
|
125
|
+
"end_timestamp": datetime.now(DEFAULT_TZ) + timedelta(seconds=10),
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
assert InferenceResponse.model_validate(response)
|
|
130
|
+
response = InferenceResponse.model_validate(response)
|
|
131
|
+
assert response.data[0].model_used == "cheese-burger"
|
|
132
|
+
|
|
133
|
+
|
|
96
134
|
def test_marketing_request():
|
|
97
135
|
request = {"receive_marketing_emails": True}
|
|
98
136
|
assert UserReceiveMarketingRequest.model_validate(request)
|