diff --git a/kb_daily.json b/kb_daily.json new file mode 100644 index 0000000..d41706b --- /dev/null +++ b/kb_daily.json @@ -0,0 +1,8 @@ +{ + "date": ["2024-01-09", "2024-01-10", "2024-01-11", "2024-01-12", "2024-01-13", "2024-01-14", "2024-01-15"], + "all_machines_availability": [0.7093253968253967, 0.6359126984126984, 0.6374007936507936, 0.7324735449735449, 0.5219907407407407, 0.6121031746031745, 0.5714285714285714], + "all_machines_performance": [0.9592240686301553, 0.9717855976569765, 0.9830589750706683, 0.9740554062976611, 0.9911840078009655, 0.9892214809701199, 0.9833326159377656], + "all_machines_quality": [0.9068031656200728, 0.9238238465119826, 0.8923965444411264, 0.9520257594506903, 0.8646438066039629, 0.7768992808312886, 0.7696293751514001], + "all_machines_oee": [0.5885732338353517, 0.5384252039315043, 0.5248256921527835, 0.6622691770019036, 0.39944311659722864, 0.38456645072490664, 0.3342573982228372] +} + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 68ff5c5..d8559f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,7 +31,6 @@ idna==2.10 iniconfig==2.0.0 kombu==5.3.4 packaging==23.2 -pandas==2.1.2 Pillow==10.1.0 pipenv==2023.10.24 platformdirs==3.11.0 diff --git a/smartreport_app/sync_db_kb.py b/smartreport_app/sync_db_kb.py index b8e4d2f..051b611 100644 --- a/smartreport_app/sync_db_kb.py +++ b/smartreport_app/sync_db_kb.py @@ -1,12 +1,19 @@ import requests from .models import Kpi import random -import pandas as pd BASE_URL = 'https://industrial-smartapp-api.onrender.com' USERNAME = 'smartapp' PASSWORD = 'api' +simo_kpi = { + "date": ["2024-01-09", "2024-01-10", "2024-01-11", "2024-01-12", "2024-01-13", "2024-01-14", "2024-01-15"], + "all_machines_availability": [0.7093253968253967, 0.6359126984126984, 0.6374007936507936, 0.7324735449735449, 0.5219907407407407, 0.6121031746031745, 0.5714285714285714], + "all_machines_performance": [0.9592240686301553, 0.9717855976569765, 0.9830589750706683, 0.9740554062976611, 0.9911840078009655, 0.9892214809701199, 0.9833326159377656], + "all_machines_quality": [0.9068031656200728, 0.9238238465119826, 0.8923965444411264, 0.9520257594506903, 0.8646438066039629, 0.7768992808312886, 0.7696293751514001], + "all_machines_oee": [0.5885732338353517, 0.5384252039315043, 0.5248256921527835, 0.6622691770019036, 0.39944311659722864, 0.38456645072490664, 0.3342573982228372] +} + def sync_kpi_lits(): @@ -62,11 +69,10 @@ def get_kpi_value(kpi_uid, start_time=0, end_time=0): name = Kpi.objects.get(kb_uid=kpi_uid).kb_name if kpi_uid.startswith('all'): # kpi di simone - df = pd.read_csv('./kb_daily.csv') kpi_value = { 'data' : { 'name' : name, - 'value' : df[kpi_uid].tolist() + 'value' : simo_kpi[kpi_uid] } }