Update process_data.py
Browse files- process_data.py +13 -11
process_data.py
CHANGED
|
@@ -197,7 +197,7 @@ def generate_json_pieces(input_data, parameters):
|
|
| 197 |
|
| 198 |
print("FIELD JSON: ")
|
| 199 |
print(field_generated_json) # debugging
|
| 200 |
-
|
| 201 |
|
| 202 |
|
| 203 |
plant_response = client.beta.chat.completions.parse(
|
|
@@ -264,19 +264,21 @@ def generate_json_pieces(input_data, parameters):
|
|
| 264 |
print(yield_generated_json) # debugging
|
| 265 |
yield_pretty_json = yield_generated_json.json()
|
| 266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
#combined_json["plantings"]["yield"] = yield_response.choices[0].message.parsed
|
| 273 |
-
|
| 274 |
-
#print(combined_json) # debugging
|
| 275 |
|
| 276 |
-
|
| 277 |
|
| 278 |
-
|
| 279 |
-
return pretty_json, pretty_json, pretty_json
|
| 280 |
except Exception as e:
|
| 281 |
return {"error": "Failed to generate valid JSON. " + str(e)}
|
| 282 |
|
|
|
|
| 197 |
|
| 198 |
print("FIELD JSON: ")
|
| 199 |
print(field_generated_json) # debugging
|
| 200 |
+
field_pretty_json = field_generated_json.json()
|
| 201 |
|
| 202 |
|
| 203 |
plant_response = client.beta.chat.completions.parse(
|
|
|
|
| 264 |
print(yield_generated_json) # debugging
|
| 265 |
yield_pretty_json = yield_generated_json.json()
|
| 266 |
|
| 267 |
+
plantings = {
|
| 268 |
+
**plant_pretty_json,
|
| 269 |
+
"logs": log_pretty_json,
|
| 270 |
+
"soil": soil_pretty_json,
|
| 271 |
+
"yield_": yield_pretty_json
|
| 272 |
+
}
|
| 273 |
|
| 274 |
+
farm_activities = {
|
| 275 |
+
**field_pretty_json,
|
| 276 |
+
"plantings": plantings
|
| 277 |
+
}
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
+
final_pretty_json = farm_activities.json()
|
| 280 |
|
| 281 |
+
return final_pretty_json, final_pretty_json, final_pretty_json
|
|
|
|
| 282 |
except Exception as e:
|
| 283 |
return {"error": "Failed to generate valid JSON. " + str(e)}
|
| 284 |
|