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.
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/PKG-INFO +1 -1
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/pyproject.toml +3 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/__init__.py +5 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/kpi.py +39 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/PKG-INFO +1 -1
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/SOURCES.txt +2 -0
- perfact_api_pd_fastapi-1.0/src/perfact_api_pd_fastapi.egg-info/entry_points.txt +5 -0
- perfact_api_pd_fastapi-1.0/src/perfact_api_pd_fastapi.egg-info/scm_file_list.json +21 -0
- perfact_api_pd_fastapi-1.0/src/perfact_api_pd_fastapi.egg-info/scm_version.json +8 -0
- perfact_api_pd_fastapi-0.6/src/perfact_api_pd_fastapi.egg-info/entry_points.txt +0 -2
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/README.md +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/setup.cfg +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/pdunit.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/pdunitlch.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/performancedata.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/py.typed +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/dependency_links.txt +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/requires.txt +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact_api_pd_fastapi.egg-info/top_level.txt +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/__init__.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/conftest.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/helpers.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/locustfile.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_init.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_kpi.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_pdunit.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tests/test_performance.py +0 -0
- {perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/tox.ini +0 -0
{perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/__init__.py
RENAMED
|
@@ -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)
|
|
@@ -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,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
|
+
}
|
|
File without changes
|
|
File without changes
|
{perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/pdunit.py
RENAMED
|
File without changes
|
{perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/pdunitlch.py
RENAMED
|
File without changes
|
|
File without changes
|
{perfact_api_pd_fastapi-0.6 → perfact_api_pd_fastapi-1.0}/src/perfact/api/pd_fastapi/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|