perfact-api-pd-fastapi 0.6__tar.gz → 1.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.
Files changed (28) hide show
  1. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/PKG-INFO +1 -1
  2. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/pyproject.toml +3 -0
  3. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/__init__.py +5 -0
  4. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/kpi.py +39 -0
  5. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/PKG-INFO +1 -1
  6. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/SOURCES.txt +2 -0
  7. perfact_api_pd_fastapi-1.0/src/perfact_api_pd_fastapi.egg-info/entry_points.txt +5 -0
  8. perfact_api_pd_fastapi-1.0/src/perfact_api_pd_fastapi.egg-info/scm_file_list.json +21 -0
  9. perfact_api_pd_fastapi-1.0/src/perfact_api_pd_fastapi.egg-info/scm_version.json +8 -0
  10. perfact_api_pd_fastapi-0.6/src/perfact_api_pd_fastapi.egg-info/entry_points.txt +0 -2
  11. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/README.md +0 -0
  12. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/setup.cfg +0 -0
  13. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/pdunit.py +0 -0
  14. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/pdunitlch.py +0 -0
  15. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/performancedata.py +0 -0
  16. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/py.typed +0 -0
  17. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/dependency_links.txt +0 -0
  18. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/requires.txt +0 -0
  19. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/top_level.txt +0 -0
  20. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/__init__.py +0 -0
  21. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/conftest.py +0 -0
  22. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/helpers.py +0 -0
  23. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/locustfile.py +0 -0
  24. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_init.py +0 -0
  25. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_kpi.py +0 -0
  26. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_pdunit.py +0 -0
  27. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_performance.py +0 -0
  28. {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: perfact-api-pd-fastapi
3
- Version: 0.6
3
+ Version: 1.0
4
4
  Summary: PerFact API - SQLAlchemy+FastAPI pd apis package
5
5
  Author-email: Viktor Dick <viktor.dick@perfact.de>
6
6
  License-Expression: GPL-2.0-or-later
@@ -44,3 +44,6 @@ plugins = ["sqlalchemy.ext.mypy.plugin"]
44
44
 
45
45
  [project.entry-points.'perfact.api']
46
46
  pd = 'perfact.api.pd_fastapi:mount'
47
+
48
+ [project.entry-points.'perfact.assignapi']
49
+ pd_assignd = 'perfact.api.pd_fastapi:mount_assignd'
@@ -2,6 +2,7 @@ from fastapi import FastAPI
2
2
  from perfact.api.main.dbsession import APIRouter
3
3
 
4
4
  from .kpi import mount as kpi_mount
5
+ from .kpi import routes_assignd as kpi_routes_assignd
5
6
  from .pdunit import mount as pdunitmount
6
7
  from .pdunitlch import mount as pdunitlch_mount
7
8
  from .performancedata import mount as performancemount
@@ -17,3 +18,7 @@ def mount(app: FastAPI):
17
18
  performancemount(routes_pdord)
18
19
  app.include_router(routes, prefix="/pd")
19
20
  app.include_router(routes_pdord, prefix="/pd/pdord")
21
+
22
+
23
+ def mount_assignd(app: FastAPI):
24
+ app.include_router(kpi_routes_assignd, prefix="/pd")
@@ -15,10 +15,16 @@ from perfact.api.pd.services.oee.prod_metrics import (
15
15
  from perfact.api.pd.services.oee.prod_records import get_prod_records
16
16
  from perfact.api.pd.services.oee.state_spans import get_state_spans
17
17
  from perfact.api.pd.services.oee.summary import oee_workcenter_time_computation
18
+ from perfact.api.pd.services.oee.trend import (
19
+ compute_trend_for_candidates,
20
+ compute_trend_for_collections,
21
+ get_oee_trend_candidate_days,
22
+ )
18
23
  from pydantic import BaseModel, BeforeValidator
19
24
  from sqlalchemy import select
20
25
 
21
26
  routes = APIRouter()
27
+ routes_assignd = APIRouter()
22
28
 
23
29
 
24
30
  def _require_visible_unit(
@@ -217,5 +223,38 @@ def oee_breakdown(
217
223
  return [OEEBreakdownResponse(**row.__dict__) for row in rows]
218
224
 
219
225
 
226
+ @routes_assignd.get(
227
+ "/kpi/oee/aggregation", tags=["pd_assignd"], summary="OEE trend aggregation"
228
+ )
229
+ def oee_trend_aggregation(
230
+ session: DBSession,
231
+ lookback_months: int = 6,
232
+ ) -> dict:
233
+ """
234
+ Calculate and persist daily OEE values into dgval for eligible pdunit/day pairs.
235
+ """
236
+
237
+ candidates = get_oee_trend_candidate_days(session, lookback_months)
238
+
239
+ # compute trend for candidate days
240
+ c, u, s, impacted_days = compute_trend_for_candidates(session, candidates)
241
+
242
+ # create or update pdunitgroups and pdplants
243
+ # if possible for each of the impacted days
244
+ pdgrp_c, pdgrp_u, pdplt_c, pdplt_u = compute_trend_for_collections(
245
+ session, impacted_days
246
+ )
247
+
248
+ return {
249
+ "created": c,
250
+ "updated": u,
251
+ "skipped": s,
252
+ "pdunitgroup_created": pdgrp_c,
253
+ "pdunitgroup_updated": pdgrp_u,
254
+ "pdplant_created": pdplt_c,
255
+ "pdplant_updated": pdplt_u,
256
+ }
257
+
258
+
220
259
  def mount(app: APIRouter):
221
260
  app.include_router(routes)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: perfact-api-pd-fastapi
3
- Version: 0.6
3
+ Version: 1.0
4
4
  Summary: PerFact API - SQLAlchemy+FastAPI pd apis package
5
5
  Author-email: Viktor Dick <viktor.dick@perfact.de>
6
6
  License-Expression: GPL-2.0-or-later
@@ -12,6 +12,8 @@ src/perfact_api_pd_fastapi.egg-info/SOURCES.txt
12
12
  src/perfact_api_pd_fastapi.egg-info/dependency_links.txt
13
13
  src/perfact_api_pd_fastapi.egg-info/entry_points.txt
14
14
  src/perfact_api_pd_fastapi.egg-info/requires.txt
15
+ src/perfact_api_pd_fastapi.egg-info/scm_file_list.json
16
+ src/perfact_api_pd_fastapi.egg-info/scm_version.json
15
17
  src/perfact_api_pd_fastapi.egg-info/top_level.txt
16
18
  tests/__init__.py
17
19
  tests/conftest.py
@@ -0,0 +1,5 @@
1
+ [perfact.api]
2
+ pd = perfact.api.pd_fastapi:mount
3
+
4
+ [perfact.assignapi]
5
+ pd_assignd = perfact.api.pd_fastapi:mount_assignd
@@ -0,0 +1,21 @@
1
+ {
2
+ "files": [
3
+ "README.md",
4
+ "pyproject.toml",
5
+ "tox.ini",
6
+ "src/perfact/api/pd_fastapi/__init__.py",
7
+ "src/perfact/api/pd_fastapi/kpi.py",
8
+ "src/perfact/api/pd_fastapi/performancedata.py",
9
+ "src/perfact/api/pd_fastapi/pdunit.py",
10
+ "src/perfact/api/pd_fastapi/py.typed",
11
+ "src/perfact/api/pd_fastapi/pdunitlch.py",
12
+ "tests/__init__.py",
13
+ "tests/conftest.py",
14
+ "tests/test_kpi.py",
15
+ "tests/test_init.py",
16
+ "tests/helpers.py",
17
+ "tests/locustfile.py",
18
+ "tests/test_pdunit.py",
19
+ "tests/test_performance.py"
20
+ ]
21
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.0",
3
+ "distance": 0,
4
+ "node": "gfb2c87d0ac4741b17796b2fd015fa54fc09cd710",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-06-24"
8
+ }
@@ -1,2 +0,0 @@
1
- [perfact.api]
2
- pd = perfact.api.pd_fastapi:mount