ocelescope-module-filter 0.1.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.
File without changes
@@ -0,0 +1,58 @@
1
+ from typing import Annotated, Literal
2
+
3
+ from ocelescope_backend.app.modules import ModuleFilter
4
+ from pydantic import Field
5
+
6
+ from ocelescope import (
7
+ E2OCountFilter,
8
+ EventAttributeFilter,
9
+ EventTypeFilter,
10
+ O2OCountFilter,
11
+ ObjectAttributeFilter,
12
+ ObjectTypeFilter,
13
+ TimeFrameFilter,
14
+ )
15
+
16
+
17
+ class NativeFilterBase(ModuleFilter):
18
+ OcelescopeModuleSource = "FilterV1"
19
+
20
+
21
+ class NativeE2OCountFilter(NativeFilterBase, E2OCountFilter):
22
+ type: Literal["e2o_count"]
23
+
24
+
25
+ class NativeO2OCountFilter(NativeFilterBase, O2OCountFilter):
26
+ type: Literal["o2o_count"]
27
+
28
+
29
+ class NativeActivityFilter(NativeFilterBase, EventTypeFilter):
30
+ type: Literal["activity"]
31
+
32
+
33
+ class NativeObjectTypeFilter(NativeFilterBase, ObjectTypeFilter):
34
+ type: Literal["object_type"]
35
+
36
+
37
+ class NativeEventAttributeFilter(NativeFilterBase, EventAttributeFilter):
38
+ type: Literal["event_attribute"]
39
+
40
+
41
+ class NativeObjectAttributeFilter(NativeFilterBase, ObjectAttributeFilter):
42
+ type: Literal["object_attribute"]
43
+
44
+
45
+ class NativeTimeFrameFilter(NativeFilterBase, TimeFrameFilter):
46
+ type: Literal["time_frame"]
47
+
48
+
49
+ NativeFilter = Annotated[
50
+ NativeActivityFilter
51
+ | NativeObjectTypeFilter
52
+ | NativeTimeFrameFilter
53
+ | NativeEventAttributeFilter
54
+ | NativeObjectAttributeFilter
55
+ | NativeE2OCountFilter
56
+ | NativeO2OCountFilter,
57
+ Field(discriminator="type"),
58
+ ]
@@ -0,0 +1,19 @@
1
+ from fastapi import FastAPI
2
+ from ocelescope_backend.app.modules import Module, ModuleMeta
3
+ from packaging.version import Version
4
+
5
+ from ocelescope_module_filter.routes import router
6
+
7
+
8
+ class Filter(Module):
9
+ meta = ModuleMeta(key="filter", version=Version("1.0"))
10
+
11
+ @classmethod
12
+ def create_app(cls) -> FastAPI:
13
+ app = FastAPI(
14
+ title="Filter", version=str(cls.meta.version), docs_url=None, redoc_url=None
15
+ )
16
+
17
+ app.include_router(router)
18
+
19
+ return app
@@ -0,0 +1,33 @@
1
+ from typing import cast
2
+
3
+ from fastapi import APIRouter
4
+ from ocelescope_backend.app.dependencies import ApiSession
5
+
6
+ from ocelescope_module_filter.models import (
7
+ NativeFilter,
8
+ NativeFilterBase,
9
+ )
10
+
11
+ router = APIRouter()
12
+
13
+
14
+ @router.get("/{ocel_id}/filter", operation_id="getFilter")
15
+ def getFilter(
16
+ ocel_id: str,
17
+ session: ApiSession,
18
+ ) -> list[NativeFilter]:
19
+
20
+ native_filter_list = cast(
21
+ list[NativeFilter],
22
+ session.get_filter(ocel_id, NativeFilterBase.OcelescopeModuleSource),
23
+ )
24
+
25
+ return native_filter_list
26
+
27
+
28
+ @router.post("/{ocel_id}/filter", operation_id="setFilter")
29
+ def setFilter(ocel_id: str, body: list[NativeFilter], session: ApiSession):
30
+ return cast(
31
+ list[NativeFilter],
32
+ session.set_filter(ocel_id, NativeFilterBase.OcelescopeModuleSource, body),
33
+ )
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.3
2
+ Name: ocelescope-module-filter
3
+ Version: 0.1.0
4
+ Summary: Ocelescope backend module providing basic filtering of OCELs
5
+ Requires-Dist: fastapi
6
+ Requires-Dist: ocelescope-backend
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+
10
+ # ocelescope-module-filter
11
+
12
+ The backend module providing basic filtering functionality for object-centric
13
+ event logs in Ocelescope.
14
+
15
+ This package provides the FastAPI routes consumed by the
16
+ [`@ocelescope/filter`](https://www.npmjs.com/package/@ocelescope/filter)
17
+ frontend module.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install ocelescope-module-filter
23
+ ```
24
+
25
+ The module registers itself with the host through the
26
+ `ocelescope_backend.modules` entry point and is discovered automatically once
27
+ [`ocelescope-backend`](../../ocelescope-backend) is running.
28
+
29
+ ## About
30
+
31
+ Part of [Ocelescope](https://github.com/promi4s/ocelescope), a framework for
32
+ working with Object-Centric Event Logs developed at the Chair of Process and
33
+ Data Science (PADS), RWTH Aachen University.
34
+
35
+ 📖 Documentation: <https://www.ocelescope.org>
@@ -0,0 +1,8 @@
1
+ ocelescope_module_filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ ocelescope_module_filter/models.py,sha256=_0Ey20hLXRVdA9UshMfhFtm1NGPzBxFvhKeIhW3OIBM,1367
3
+ ocelescope_module_filter/module.py,sha256=4FSopW98qtzPGZio36bnL1k_uwTBztktl_rjKiS9hB4,496
4
+ ocelescope_module_filter/routes.py,sha256=ya3yozHgWVirl4QoFMborPBu1kGvQIIEYjbQ7SbqLnA,817
5
+ ocelescope_module_filter-0.1.0.dist-info/WHEEL,sha256=jK0lbM7sVtq70msNoYotEXYS3OJMDdns2CRgyjhimnE,81
6
+ ocelescope_module_filter-0.1.0.dist-info/entry_points.txt,sha256=TkZRT9M5ZXcavAK0Wui0VL4YV2ThRbgFDTQqDERncHM,80
7
+ ocelescope_module_filter-0.1.0.dist-info/METADATA,sha256=KnSj4VQrTnZJyRN-z3U64Hnn9tUJHba6q5-Mr4v3xM0,1061
8
+ ocelescope_module_filter-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.11.25
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [ocelescope_backend.modules]
2
+ filterV1 = ocelescope_module_filter.module:Filter
3
+