Skip to content

Commit

Permalink
simo data
Browse files Browse the repository at this point in the history
  • Loading branch information
matteotolloso committed Jan 14, 2024
1 parent 65f3d85 commit f8952fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions kb_daily.json
Original file line number Diff line number Diff line change
@@ -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]
}

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions smartreport_app/sync_db_kb.py
Original file line number Diff line number Diff line change
@@ -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():

Expand Down Expand Up @@ -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]
}
}

Expand Down

0 comments on commit f8952fe

Please sign in to comment.