Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -18,7 +18,7 @@ async def your_continuous_function():
|
|
18 |
combined_df = pd.DataFrame()
|
19 |
|
20 |
# Loop through pages 1 to 4
|
21 |
-
for page in range(1,
|
22 |
try:
|
23 |
# Update the payload for each page
|
24 |
url = "https://dev3.api.curfox.parallaxtec.com/api/admin/test-dataset?sort=id&paginate=2000&page="+str(page)
|
@@ -69,24 +69,27 @@ def read_root():
|
|
69 |
status_counts_30_to_49 = data[(data['delivery_possibility'] >= 30) & (data['delivery_possibility'] <= 49)]['status.name'].value_counts()
|
70 |
|
71 |
status_counts_below_30 = data[data['delivery_possibility'] < 30]['status.name'].value_counts()
|
|
|
|
|
72 |
kpi_result = {
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
89 |
}
|
90 |
}
|
91 |
-
|
92 |
-
return
|
|
|
18 |
combined_df = pd.DataFrame()
|
19 |
|
20 |
# Loop through pages 1 to 4
|
21 |
+
for page in range(1,5):
|
22 |
try:
|
23 |
# Update the payload for each page
|
24 |
url = "https://dev3.api.curfox.parallaxtec.com/api/admin/test-dataset?sort=id&paginate=2000&page="+str(page)
|
|
|
69 |
status_counts_30_to_49 = data[(data['delivery_possibility'] >= 30) & (data['delivery_possibility'] <= 49)]['status.name'].value_counts()
|
70 |
|
71 |
status_counts_below_30 = data[data['delivery_possibility'] < 30]['status.name'].value_counts()
|
72 |
+
|
73 |
+
|
74 |
kpi_result = {
|
75 |
+
"kpi_result": {
|
76 |
+
"status_counts_more_than_80": {
|
77 |
+
"correct_values": str(status_counts_more_than_80[0]),
|
78 |
+
"incorrect_values": str(status_counts_more_than_80[1])
|
79 |
+
},
|
80 |
+
"status_counts_50_to_80": {
|
81 |
+
"correct_values": str(status_counts_50_to_80[0]),
|
82 |
+
"incorrect_values": str(status_counts_50_to_80[1])
|
83 |
+
},
|
84 |
+
"status_counts_30_to_49": {
|
85 |
+
"correct_values": str(status_counts_30_to_49[0]),
|
86 |
+
"incorrect_values": str(status_counts_30_to_49[1])
|
87 |
+
},
|
88 |
+
"status_counts_below_30": {
|
89 |
+
"correct_values": str(status_counts_below_30[0]),
|
90 |
+
"incorrect_values": str(status_counts_below_30[1])
|
91 |
+
}
|
92 |
}
|
93 |
}
|
94 |
+
json_data = json.dumps(kpi_result, indent=2)
|
95 |
+
return json_data
|